Author: agilliland
Date: Fri May 18 16:40:26 2007
New Revision: 539635

URL: http://svn.apache.org/viewvc?view=rev&rev=539635
Log:
support for 'icon' and 'about' attributes of a weblog.


Modified:
    roller/trunk/src/org/apache/roller/pojos/WebsiteData.java
    roller/trunk/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java
    roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfig.java
    
roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfigBean.java
    roller/trunk/web/WEB-INF/jsps/authoring/struts2/WeblogConfig.jsp

Modified: roller/trunk/src/org/apache/roller/pojos/WebsiteData.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java?view=diff&rev=539635&r1=539634&r2=539635
==============================================================================
--- roller/trunk/src/org/apache/roller/pojos/WebsiteData.java (original)
+++ roller/trunk/src/org/apache/roller/pojos/WebsiteData.java Fri May 18 
16:40:26 2007
@@ -92,6 +92,8 @@
     private boolean enableMultiLang = false;
     private boolean showAllLangs = true;
     private String customStylesheetPath = null;
+    private String iconPath = null;
+    private String about = null;
     
     
     // Associated objects
@@ -184,11 +186,17 @@
     /**
      * Get the Theme object in use by this weblog, or null if no theme 
selected.
      */
-    public WeblogTheme getTheme() throws RollerException {
+    public WeblogTheme getTheme() {
+        try {
+            // let the ThemeManager handle it
+            ThemeManager themeMgr = 
RollerFactory.getRoller().getThemeManager();
+            return themeMgr.getTheme(this);
+        } catch (RollerException ex) {
+            log.error("Error getting theme for weblog - "+getHandle(), ex);
+        }
         
-        // let the ThemeManager handle it
-        ThemeManager themeMgr = RollerFactory.getRoller().getThemeManager();
-        return themeMgr.getTheme(this);
+        // TODO: maybe we should return a default theme in this case?
+        return null;
     }
     
     
@@ -965,22 +973,37 @@
     }
     
     
-    public String getCustomStylesheet() {
-        try {
-            Theme weblogTheme = getTheme();
-            if(weblogTheme != null) {
-                return weblogTheme.getCustomStylesheet();
-            } else {
-                return getCustomStylesheetPath();
-            }
-        } catch(RollerException re) {
-            // hmmm, some exception getting theme
-            return null;
-        }
+    /**
+     * The path under the weblog's resources to an icon image.
+     *
+     * @hibernate.property column="icon" not-null="false"
+     */
+    public String getIconPath() {
+        return iconPath;
+    }
+
+    public void setIconPath(String iconPath) {
+        this.iconPath = iconPath;
+    }
+
+    
+    /**
+     * A short description about the weblog.
+     *
+     * This field difers from the 'description' attribute in the sense that the
+     * description is meant to hold more of a tagline, while this attribute is
+     * more of a full paragraph (or two) about section.
+     *
+     * @hibernate.property column="about" not-null="false"
+     */
+    public String getAbout() {
+        return about;
+    }
+
+    public void setAbout(String about) {
+        this.about = about;
     }
     
-    // no-op to please xdoclet
-    public void setCustomStylesheet(String noop) {}
     
     /**
      * Get initialized plugins for use during rendering process.

Modified: 
roller/trunk/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java?view=diff&rev=539635&r1=539634&r2=539635
==============================================================================
--- roller/trunk/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java 
(original)
+++ roller/trunk/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java 
Fri May 18 16:40:26 2007
@@ -19,6 +19,7 @@
 package org.apache.roller.pojos.wrapper;
 
 import org.apache.roller.pojos.WebsiteData;
+import org.apache.roller.util.URLUtilities;
 
 
 /**
@@ -419,10 +420,34 @@
     {   
         return this.pojo.isShowAllLangs();
     }
-
+    
     
     public String getCustomStylesheet() {
-        return this.pojo.getCustomStylesheet();
+        // custom stylesheet comes from the weblog theme
+        return this.pojo.getTheme().getCustomStylesheet();
+    }
+    
+    
+    public String getIcon() {
+        
+        String iconPath = this.pojo.getIconPath();
+        if(iconPath == null) {
+            return null;
+        }
+        
+        if(iconPath.startsWith("http") || iconPath.startsWith("/")) {
+            // if icon path is a relative path then assume it's a weblog 
resource
+            return iconPath;
+        } else {
+            // otherwise it's just a plain old url
+            return URLUtilities.getWeblogResourceURL(this.pojo, iconPath, 
true);
+        }
+        
+    }
+    
+    
+    public String getAbout() {
+        return this.pojo.getAbout();
     }
     
     

Modified: 
roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfig.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfig.java?view=diff&rev=539635&r1=539634&r2=539635
==============================================================================
--- roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfig.java 
(original)
+++ roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfig.java 
Fri May 18 16:40:26 2007
@@ -194,27 +194,6 @@
         }
     }
     
-
-    public List getCommentDaysOptions() {
-        
-        List opts = new ArrayList();
-        
-        opts.add(new KeyValueObject("0", 
getText("weblogEdit.unlimitedCommentDays")));
-        opts.add(new KeyValueObject("1", getText("weblogEdit.days1")));
-        opts.add(new KeyValueObject("2", getText("weblogEdit.days2")));
-        opts.add(new KeyValueObject("3", getText("weblogEdit.days3")));
-        opts.add(new KeyValueObject("4", getText("weblogEdit.days4")));
-        opts.add(new KeyValueObject("5", getText("weblogEdit.days5")));
-        opts.add(new KeyValueObject("7", getText("weblogEdit.days7")));
-        opts.add(new KeyValueObject("10", getText("weblogEdit.days10")));
-        opts.add(new KeyValueObject("20", getText("weblogEdit.days20")));
-        opts.add(new KeyValueObject("30", getText("weblogEdit.days30")));
-        opts.add(new KeyValueObject("60", getText("weblogEdit.days60")));
-        opts.add(new KeyValueObject("90", getText("weblogEdit.days90")));
-        
-        return opts;
-    }
-    
     
     public WeblogConfigBean getBean() {
         return bean;

Modified: 
roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfigBean.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfigBean.java?view=diff&rev=539635&r1=539634&r2=539635
==============================================================================
--- 
roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfigBean.java 
(original)
+++ 
roller/trunk/src/org/apache/roller/ui/authoring/struts2/WeblogConfigBean.java 
Fri May 18 16:40:26 2007
@@ -58,6 +58,9 @@
     private boolean showAllLangs = true;
     private String pageModels = null;
     private String customStylesheetPath = null;
+    private String icon = null;
+    private String about = null;
+    
     private String bloggerCategoryId = null;
     private String defaultCategoryId = null;
     private String[] defaultPluginsArray = null;
@@ -236,6 +239,22 @@
         this.customStylesheetPath = customStylesheetPath;
     }
     
+    public String getIcon() {
+        return icon;
+    }
+
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    public String getAbout() {
+        return about;
+    }
+
+    public void setAbout(String about) {
+        this.about = about;
+    }
+    
     public String getBloggerCategoryId() {
         return bloggerCategoryId;
     }
@@ -297,12 +316,14 @@
         this.timeZone = dataHolder.getTimeZone();
         this.defaultPlugins = dataHolder.getDefaultPlugins();
         this.entryDisplayCount = dataHolder.getEntryDisplayCount();
-        this.setActive(dataHolder.getActive());
+        setActive(dataHolder.getActive());
         this.commentModerationRequired = 
dataHolder.getCommentModerationRequired();
         this.enableMultiLang = dataHolder.isEnableMultiLang();
         this.showAllLangs = dataHolder.isShowAllLangs();
         this.pageModels = dataHolder.getPageModels();
         this.customStylesheetPath = dataHolder.getCustomStylesheetPath();
+        setIcon(dataHolder.getIconPath());
+        setAbout(dataHolder.getAbout());
         
         if (dataHolder.getDefaultCategory() != null) {
             defaultCategoryId = dataHolder.getDefaultCategory().getId();
@@ -339,6 +360,9 @@
         dataHolder.setShowAllLangs(this.showAllLangs);
         dataHolder.setPageModels(this.pageModels);
         dataHolder.setCustomStylesheetPath(this.customStylesheetPath);
+        dataHolder.setIconPath(getIcon());
+        dataHolder.setAbout(getAbout());
+        
         dataHolder.setDefaultPlugins( 
StringUtils.join(this.defaultPluginsArray,",") );
         
         
dataHolder.setDefaultCommentDays(Integer.parseInt(this.defaultCommentDays));

Modified: roller/trunk/web/WEB-INF/jsps/authoring/struts2/WeblogConfig.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/jsps/authoring/struts2/WeblogConfig.jsp?view=diff&rev=539635&r1=539634&r2=539635
==============================================================================
--- roller/trunk/web/WEB-INF/jsps/authoring/struts2/WeblogConfig.jsp (original)
+++ roller/trunk/web/WEB-INF/jsps/authoring/struts2/WeblogConfig.jsp Fri May 18 
16:40:26 2007
@@ -44,10 +44,22 @@
 
     <tr>
         <td class="label"><s:text name="websiteSettings.websiteDescription" 
/></td>
-        <td class="field"><s:textarea name="bean.description" rows="3" 
cols="40"/></td>
+        <td class="field"><s:textfield name="bean.description" /></td>
         <td class="description"><%-- <s:text name="websiteSettings.tip." /> 
--%></td>
     </tr>
-
+    
+    <tr>
+        <td class="label"><s:text name="websiteSettings.icon" /></td>
+        <td class="field"><s:textfield name="bean.icon" /></td>
+        <td class="description"><%-- <s:text name="websiteSettings.tip." /> 
--%></td>
+    </tr>
+    
+    <tr>
+        <td class="label"><s:text name="websiteSettings.about" /></td>
+        <td class="field"><s:textarea name="bean.about" rows="3" 
cols="40"/></td>
+        <td class="description"><%-- <s:text name="websiteSettings.tip." /> 
--%></td>
+    </tr>
+    
     <tr>
         <td class="label"><s:text name="websiteSettings.emailAddress" />
         <td class="field"><s:textfield name="bean.emailAddress" 
size="40"/></td>
@@ -161,7 +173,7 @@
      <tr>
         <td class="label"><s:text name="websiteSettings.defaultCommentDays" 
/></td>
         <td class="field">
-            <s:select name="bean.defaultCommentDays" list="commentDaysOptions" 
size="1" listKey="key" listValue="value" />
+            <s:select name="bean.defaultCommentDays" list="commentDaysList" 
size="1" listKey="key" listValue="value" />
         <td class="description"><%-- <s:text name="websiteSettings.tip." /> 
--%></td>
     </tr>
     


Reply via email to