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

@ -92,6 +92,11 @@
<!-- The location of the sidebox configuration file, relative to the application root. --> <!-- The location of the sidebox configuration file, relative to the application root. -->
<sidebox-config>WEB-INF/sidebox-config.xml</sidebox-config> <sidebox-config>WEB-INF/sidebox-config.xml</sidebox-config>
<!-- The location of the "photo not available" image, relative to either the main
images directory (if the "fixup" attribute is present) or the site (if it is not).
Image should be 100x100 pixels. -->
<photo-not-avail fixup="true">photo_not_avail.gif</photo-not-avail>
</paths> </paths>
<!-- Contains standard messages displayed by front end --> <!-- Contains standard messages displayed by front end -->

View File

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

View File

@ -76,6 +76,8 @@ public class RenderConfig implements ColorSelectors
private String[] colors_array; private String[] colors_array;
private int footer_logo_scale; private int footer_logo_scale;
private Map sidebox_factories; private Map sidebox_factories;
private String photo_not_avail;
private boolean photo_not_avail_fixup;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -363,6 +365,21 @@ public class RenderConfig implements ColorSelectors
sidebox_factories = Collections.unmodifiableMap(tmp_factories); 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"); Element msg_sect = root_h.getSubElement("messages");
if (msg_sect==null) if (msg_sect==null)
{ // no <messages/> section - bail out now! { // no <messages/> section - bail out now!
@ -711,6 +728,18 @@ public class RenderConfig implements ColorSelectors
} // end createSideBox } // 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 * Static operations for use by VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

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