made the "photo not available" image configurable in render-config.xml

This commit is contained in:
Eric J. Bowersox
2001-11-11 02:20:34 +00:00
parent 070fd2c9e2
commit f9cb84d465
7 changed files with 47 additions and 4 deletions

View File

@@ -56,7 +56,7 @@ public class EditProfileDialog extends ContentDialog
out.write("<A HREF=\"" + rdat.getEncodedServletPath(linkURL) + "\">");
String photo = getValue();
if (StringUtil.isStringEmpty(photo))
photo = rdat.getFullImagePath("photo_not_avail.gif");
photo = rdat.getPhotoNotAvailURL();
out.write("<IMG SRC=\"" + photo + "\" ALT=\"\" BORDER=0 WIDTH=100 HEIGHT=100></A>");
if (isEnabled())
out.write("</A>");

View File

@@ -76,6 +76,8 @@ public class RenderConfig implements ColorSelectors
private String[] colors_array;
private int footer_logo_scale;
private Map sidebox_factories;
private String photo_not_avail;
private boolean photo_not_avail_fixup;
/*--------------------------------------------------------------------------------
* Constructor
@@ -363,6 +365,21 @@ public class RenderConfig implements ColorSelectors
sidebox_factories = Collections.unmodifiableMap(tmp_factories);
Element pna = paths_sect_h.getSubElement("photo-not-avail");
if (pna!=null)
{ // copy element text and fixup information
DOMElementHelper pna_h = new DOMElementHelper(pna);
photo_not_avail = pna_h.getElementText();
photo_not_avail_fixup = pna_h.hasAttribute("fixup");
} // end if
else
{ // just load the defaults
photo_not_avail = "photo_not_avail.gif";
photo_not_avail_fixup = true;
} // end else
Element msg_sect = root_h.getSubElement("messages");
if (msg_sect==null)
{ // no <messages/> section - bail out now!
@@ -711,6 +728,18 @@ public class RenderConfig implements ColorSelectors
} // end createSideBox
String getPhotoNotAvail()
{
return photo_not_avail;
} // end getPhotoNotAvail
boolean getPhotoNotAvailFixup()
{
return photo_not_avail_fixup;
} // end getPhotoNotAvailFixup
/*--------------------------------------------------------------------------------
* Static operations for use by VeniceServlet
*--------------------------------------------------------------------------------

View File

@@ -325,6 +325,15 @@ public class RenderData implements ColorSelectors
} // end useStyleSheet
public String getPhotoNotAvailURL()
{
if (rconf.getPhotoNotAvailFixup())
return rconf.getFullImagePath(rconf.getPhotoNotAvail());
else
return rconf.getPhotoNotAvail();
} // end getPhotoNotAvailURL
public String formatDateForDisplay(Date date)
{
if (display_date==null)

View File

@@ -502,7 +502,7 @@ public class TopicPosts implements JSPRender
StringBuffer buf = new StringBuffer("<IMG SRC=\"");
String url = (String)(uid_photos.get(new Integer(uid)));
if (url==null)
url = rdat.getFullImagePath("photo_not_avail.gif");
url = rdat.getPhotoNotAvailURL();
buf.append(url).append("\" ALT=\"\" WIDTH=").append(photo_size.width).append(" HEIGHT=");
buf.append(photo_size.height).append(" ALIGN=LEFT BORDER=0 HSPACE=2 VSPACE=2>");
return buf.toString();

View File

@@ -53,7 +53,7 @@ public class UserPhotoData implements JSPRender
photo_dims = engine.getUserPhotoSize();
photo_url = user.getContactInfo().getPhotoURL();
if (StringUtil.isStringEmpty(photo_url))
photo_url = rdat.getFullImagePath("photo_not_avail.gif");
photo_url = rdat.getPhotoNotAvailURL();
this.target = target;
} // end constructor

View File

@@ -153,7 +153,7 @@ public class UserProfileData implements JSPRender
StringBuffer buf = new StringBuffer("<IMG SRC=\"");
String tmp = prof.getPhotoURL();
if (StringUtil.isStringEmpty(tmp))
tmp = rdat.getFullImagePath("photo_not_avail.gif");
tmp = rdat.getPhotoNotAvailURL();
buf.append(tmp).append("\" ALT=\"\" ALIGN=LEFT WIDTH=").append(dim.width).append(" HEIGHT=");
buf.append(dim.height).append(" BORDER=0>");
return buf.toString();