From f9cb84d46567880b401415c8e6fa88edcfe470c1 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Sun, 11 Nov 2001 02:20:34 +0000 Subject: [PATCH] made the "photo not available" image configurable in render-config.xml --- etc/render-config.xml | 5 ++++ .../servlets/format/EditProfileDialog.java | 2 +- .../venice/servlets/format/RenderConfig.java | 29 +++++++++++++++++++ .../venice/servlets/format/RenderData.java | 9 ++++++ .../venice/servlets/format/TopicPosts.java | 2 +- .../venice/servlets/format/UserPhotoData.java | 2 +- .../servlets/format/UserProfileData.java | 2 +- 7 files changed, 47 insertions(+), 4 deletions(-) diff --git a/etc/render-config.xml b/etc/render-config.xml index e60f6af..344f4c1 100644 --- a/etc/render-config.xml +++ b/etc/render-config.xml @@ -92,6 +92,11 @@ WEB-INF/sidebox-config.xml + + photo_not_avail.gif + diff --git a/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java b/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java index ed18ec9..f6c0b7a 100644 --- a/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java +++ b/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java @@ -56,7 +56,7 @@ public class EditProfileDialog extends ContentDialog out.write(""); String photo = getValue(); if (StringUtil.isStringEmpty(photo)) - photo = rdat.getFullImagePath("photo_not_avail.gif"); + photo = rdat.getPhotoNotAvailURL(); out.write("\"\""); if (isEnabled()) out.write(""); diff --git a/src/com/silverwrist/venice/servlets/format/RenderConfig.java b/src/com/silverwrist/venice/servlets/format/RenderConfig.java index 8c99e97..587dfab 100644 --- a/src/com/silverwrist/venice/servlets/format/RenderConfig.java +++ b/src/com/silverwrist/venice/servlets/format/RenderConfig.java @@ -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 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 *-------------------------------------------------------------------------------- diff --git a/src/com/silverwrist/venice/servlets/format/RenderData.java b/src/com/silverwrist/venice/servlets/format/RenderData.java index 0c287ef..482b0c0 100644 --- a/src/com/silverwrist/venice/servlets/format/RenderData.java +++ b/src/com/silverwrist/venice/servlets/format/RenderData.java @@ -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) diff --git a/src/com/silverwrist/venice/servlets/format/TopicPosts.java b/src/com/silverwrist/venice/servlets/format/TopicPosts.java index 5d2f9c6..4b1b6b6 100644 --- a/src/com/silverwrist/venice/servlets/format/TopicPosts.java +++ b/src/com/silverwrist/venice/servlets/format/TopicPosts.java @@ -502,7 +502,7 @@ public class TopicPosts implements JSPRender StringBuffer buf = new StringBuffer("\"\""); return buf.toString(); diff --git a/src/com/silverwrist/venice/servlets/format/UserPhotoData.java b/src/com/silverwrist/venice/servlets/format/UserPhotoData.java index 6582530..423581a 100644 --- a/src/com/silverwrist/venice/servlets/format/UserPhotoData.java +++ b/src/com/silverwrist/venice/servlets/format/UserPhotoData.java @@ -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 diff --git a/src/com/silverwrist/venice/servlets/format/UserProfileData.java b/src/com/silverwrist/venice/servlets/format/UserProfileData.java index 944054c..eeb072b 100644 --- a/src/com/silverwrist/venice/servlets/format/UserProfileData.java +++ b/src/com/silverwrist/venice/servlets/format/UserProfileData.java @@ -153,7 +153,7 @@ public class UserProfileData implements JSPRender StringBuffer buf = new StringBuffer("\"\""); return buf.toString();