roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r426339 - in /incubator/roller/branches/roller_3.0: src/org/apache/roller/ui/rendering/model/ConfigModel.java web/WEB-INF/velocity/deprecated/comments.vm web/WEB-INF/velocity/feeds.vm web/WEB-INF/velocity/weblog.vm
Date Fri, 28 Jul 2006 00:26:58 GMT
Author: agilliland
Date: Thu Jul 27 17:26:58 2006
New Revision: 426339

URL: http://svn.apache.org/viewvc?rev=426339&view=rev
Log:
remove getXXXProperty() methods from config model and replace them with individual methods.


Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/ConfigModel.java
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/deprecated/comments.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/feeds.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/ConfigModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/ConfigModel.java?rev=426339&r1=426338&r2=426339&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/ConfigModel.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/model/ConfigModel.java
Thu Jul 27 17:26:58 2006
@@ -47,20 +47,11 @@
     /** Hand-picked list of runtime properties to be made available */
     private static List allowedProperties =
             Arrays.asList(new String[] {
-        "site.name",
-        "site.shortName",
-        "site.description",
-        "site.adminemail",
         "users.registration.enabled",
         "users.registration.url",
         "users.comments.enabled",
         "users.trackbacks.enabled",
-        "users.comments.autoformat",
-        "users.comments.escapehtml",
-        "users.comments.emailnotify",
         "site.linkbacks.enabled",
-        "site.newsfeeds.defaultEntries",
-        "site.newsfeeds.maxEntries",
         "site.frontpage.weblog.handle",
         "site.frontpage.weblog.aggregated"
     });
@@ -78,42 +69,40 @@
     }
     
     
-    /**
-     * Get Roller string runtime configuration property.
-     * @return Property value or null if not found
-     */
-    public String getProperty(String name) {
-        String ret = null;
-        if (allowedProperties.contains(name)) {
-            ret = RollerRuntimeConfig.getProperty(name);
-        }
-        return ret;
+    public String getSiteName() {
+        return getProperty("site.name");
     }
     
+    public String getSiteShortName() {
+        return getProperty("site.shortName");
+    }
+    
+    public String getSiteDescription() {
+        return getProperty("site.description");
+    }
+    
+    public String getSiteEmail() {
+        return getProperty("site.adminemail");
+    }
     
-    /**
-     * Get Roller integer runtime configuration property
-     * @return Property value or -999 if not found
-     */
-    public int getIntProperty(String name) {
-        int ret = -999;
-        if (allowedProperties.contains(name)) {
-            ret = RollerRuntimeConfig.getIntProperty(name);
-        }
-        return ret;
+    public int getFeedSize() {
+        return getIntProperty("site.newsfeeds.defaultEntries");
     }
     
+    public int getFeedMaxSize() {
+        return getIntProperty("site.newsfeeds.maxEntries");
+    }
+    
+    public boolean getCommentAutoFormat() {
+        return getBooleanProperty("users.comments.autoformat");
+    }
+    
+    public boolean getCommentEscapeHtml() {
+        return getBooleanProperty("users.comments.escapehtml");
+    }
     
-    /**
-     * Get Roller boolean runtime configuration property.
-     * @return Property value or false if not found
-     */
-    public boolean getBooleanProperty(String name) {
-        boolean ret = false;
-        if (allowedProperties.contains(name)) {
-            return RollerRuntimeConfig.getBooleanProperty(name);
-        }
-        return ret;
+    public boolean getCommentEmailNotify() {
+        return getBooleanProperty("users.comments.emailnotify");
     }
     
     
@@ -132,6 +121,21 @@
     /** Get username who created Roller build */
     public String getRollerBuildUser() {
         return RollerContext.getRollerContext().getRollerBuildUser();
+    }
+    
+    
+    private String getProperty(String name) {
+        return RollerRuntimeConfig.getProperty(name);
+    }
+    
+    
+    private int getIntProperty(String name) {
+        return RollerRuntimeConfig.getIntProperty(name);
+    }
+    
+    
+    private boolean getBooleanProperty(String name) {
+        return RollerRuntimeConfig.getBooleanProperty(name);
     }
     
 }

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/deprecated/comments.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/deprecated/comments.vm?rev=426339&r1=426338&r2=426339&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/deprecated/comments.vm (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/deprecated/comments.vm Thu Jul
27 17:26:58 2006
@@ -191,7 +191,7 @@
             <td><input type="text" name="url" value="$cform.url" size="50" maxlength="255"
/></td>
         </tr>
 
-        #if ($config.getBooleanProperty("users.comments.emailnotify"))
+        #if ($config.commentEmailNotify)
         <tr>
             <td></td>
             <td>
@@ -218,7 +218,7 @@
             <textarea name="content" cols="50" rows="10">$cform.content</textarea><br
/>
             <span class="comments-syntax-indicator">
             $text.get( "macro.weblog.htmlsyntax" )
-            #if($config.getBooleanProperty("users.comments.escapehtml"))
+            #if($config.commentEscapeHtml)
                 <span class="disabled">$text.get( "macro.weblog.htmldisabled" )</span>
             #else
                 <span class="enabled">$text.get( "macro.weblog.htmlenabled" )</span>

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/feeds.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/feeds.vm?rev=426339&r1=426338&r2=426339&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/feeds.vm (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/feeds.vm Thu Jul 27 17:26:58
2006
@@ -86,12 +86,12 @@
         <link rel="alternate" type="text/html" href="$url.comment($comment.weblogEntry.anchor,
$comment.timestamp)"/>
         <published>$utils.formatIso8601Date($comment.postTime)</published>
         <updated>$utils.formatIso8601Date($comment.postTime)</updated> 
-        #if($config.getBooleanProperty("users.comments.escapehtml"))
+        #if($config.commentEscapeHtml)
             #set($content = $utils.escapeHTML($utils.removeHTML($comment.content)))
         #else 
             #set($content = $utils.escapeHTML($utils.transformToHTMLSubset($utils.escapeHTML($comment.content))))
         #end
-        #if($config.getBooleanProperty("users.comments.autoformat"))
+        #if($config.commentAutoFormat)
             #set($content = $utils.autoformat($content))
         #end
         #set($content = $utils.addNofollow($content))
@@ -107,12 +107,12 @@
         <title>Re: $utils.escapeHTML($comment.weblogEntry.title)</title>
         <dc:creator>$utils.escapeHTML($utils.removeHTML($comment.name))</dc:creator>
         <pubDate>$utils.formatRfc822Date($comment.postTime)</pubDate>
-        #if($config.getBooleanProperty("users.comments.escapehtml"))
+        #if($config.commentEscapeHtml)
             #set($content = $utils.escapeHTML($utils.removeHTML($comment.content)))
         #else 
             #set($content = $utils.escapeHTML($utils.transformToHTMLSubset($utils.escapeHTML($comment.content))))
         #end
-        #if($config.getBooleanProperty("users.comments.autoformat"))
+        #if($config.commentAutoFormat)
             #set($content = $utils.autoformat($content))
         #end
         #set($content = $utils.addNofollow($content))

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm?rev=426339&r1=426338&r2=426339&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm Thu Jul 27 17:26:58
2006
@@ -164,12 +164,12 @@
     #foreach( $comment in $comments )
         #if($comment.approved || $model.commentForm.preview)
             #set($content = $utils.encodeEmail($comment.content))
-            #if($config.getBooleanProperty("users.comments.escapehtml"))
+            #if($config.commentEscapeHtml)
                 #set($content = $utils.escapeHTML($content))
             #else 
                 #set($content = $utils.transformToHTMLSubset($utils.escapeHTML($content)))
             #end
-            #if($config.getBooleanProperty("users.comments.autoformat"))
+            #if($config.commentAutoFormat)
                 #set($content = $utils.autoformat($content))
             #end
             #set($content = $utils.addNofollow($content))
@@ -213,7 +213,13 @@
     <div class="comments-form">
     <div class="comments-head">$text.get("macro.weblog.postcommentHeader")</div>
 
-    #if( $entry.commentsStillAllowed )
+#if( $entry.commentsStillAllowed )
+
+    #if( $cform.error )
+        <span class="error">$cform.message</span>
+    #elsif( !$cform.error && !$utils.isEmpty($cform.message) )
+        <span class="status">$cform.message</span>
+    #end
 
     <form method="post" action="$url.entry($entry.anchor)" focus="name" 
         name="form" onsubmit="fixURL(this); return validateComments(this)">    
@@ -234,7 +240,7 @@
                 <input type="text" name="url" class="text large" value="$cform.url" size="50"
maxlength="255" />
             </li>
 
-        #if ($config.getBooleanProperty("users.comments.emailnotify"))
+        #if ($config.commentEmailNotify)
             <li><input type="checkbox" class="checkbox" id="notify" name="notify"
#if($cform.notify)CHECKED #end/>
                 <label for="notify" class="choice">$text.get( "macro.weblog.notifyMeOfComments"
)</label>
             </li>
@@ -250,7 +256,7 @@
             <li class="info">
                 <span class="comments-syntax-indicator">
                 $text.get( "macro.weblog.htmlsyntax" )
-                #if($config.getBooleanProperty("users.comments.escapehtml"))
+                #if($config.commentEscapeHtml)
                     <span class="disabled">$text.get( "macro.weblog.htmldisabled" )</span>
                 #else
                     <span class="enabled">$text.get( "macro.weblog.htmlenabled" )</span>
@@ -488,7 +494,7 @@
 #macro(showPageMenu $weblog)
     <ul class="rNavigationBar">
         <li class="rNavItem">
-            <a href="$url.site">$config.getProperty("site.shortName")</a>
+            <a href="$url.site">$config.siteName</a>
         </li>
         #foreach($iPage in $weblog.pages)
             #set($invisible = $iPage.Name.startsWith("_"))



Mime
View raw message