roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r555776 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/business/plugins/ src/java/org/apache/roller/weblogger/business/plugins/comment/ src/java/org/apache/roller/weblogger/business/startup/ src/java/org/apache/roll...
Date Thu, 12 Jul 2007 21:33:49 GMT
Author: agilliland
Date: Thu Jul 12 14:33:47 2007
New Revision: 555776

URL: http://svn.apache.org/viewvc?view=rev&rev=555776
Log:
more work on fixing up handling of submitted comments and their formatting.

1. Introduced a new 'contentType' attribute to the comment pojo for tracking the content type
of a comment.  Current valid options are 'text/plain' and 'text/html'.  Also added new db
column roller_comment.contenttype defaulting to 'text/plain' and corresponding hbm and orm
mapping file edits.

2. Updated comment pojo wrapper so that if the content type of a comment is 'text/plain' then
it's content gets html escaped before plugins are rendered.

3. Added new runtime config property 'users.comments.htmlenabled' which defines the content
type to be set for incoming comments.  if html is enabled then the content type is set to
'text/html' otherwise it is set to 'text/plain'.

4. Updated comment servlet so that an appropriate content type is set for incoming comments
based on the 'users.comments.htmlenabled' setting.

5. Updated the database upgrade process to set a content type for all existing comments and
to initialize the value of the 'users.comments.htmlenabled' property based on the values of
old properties.

6. EOLed the old 'users.comments.escapehtml' and 'users.comments.autoformat' properties.

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManager.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManagerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.hbm.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogEntryCommentWrapper.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/ConfigModel.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/ContextLoader.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java
    roller/trunk/apps/weblogger/src/sql/310-to-400-migration.vm
    roller/trunk/apps/weblogger/src/sql/createdb.vm
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/plugins/CommentPluginsTest.java
    roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManager.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManager.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManager.java
Thu Jul 12 14:33:47 2007
@@ -74,9 +74,10 @@
      * Apply comment plugins.
      *
      * @param comment The comment to apply plugins for.
+     * @param text The text to apply the plugins to.
      * @return String The transformed comment text.
      */
-    public String applyCommentPlugins(WeblogEntryComment comment);
+    public String applyCommentPlugins(WeblogEntryComment comment, String text);
     
     
     /**

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManagerImpl.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManagerImpl.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/PluginManagerImpl.java
Thu Jul 12 14:33:47 2007
@@ -117,13 +117,13 @@
     /**
      * @inheritDoc
      */
-    public String applyCommentPlugins(WeblogEntryComment comment) {
+    public String applyCommentPlugins(WeblogEntryComment comment, String text) {
         
-        if(comment == null) {
+        if(comment == null || text == null) {
             throw new IllegalArgumentException("comment cannot be null");
         }
         
-        String content = comment.getContent();
+        String content = text;
         
         if (commentPlugins.size() > 0) {
             for( WeblogEntryCommentPlugin plugin : commentPlugins ) {

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin.java
Thu Jul 12 14:33:47 2007
@@ -51,8 +51,13 @@
         
         log.debug("starting value:\n"+text);
         
+        String output = text;
+        
+        // escape html
+        output = Utilities.escapeHTML(output);
+        
         // just use old utilities method
-        String output = Utilities.transformToHTMLSubset(text);
+        output = Utilities.transformToHTMLSubset(output);
         
         log.debug("ending value:\n"+output);
         

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
Thu Jul 12 14:33:47 2007
@@ -92,7 +92,7 @@
     /** 
      * Determine if database schema needs to be upgraded.
      */
-    public boolean isUpgradeRequired() {        
+    public boolean isUpgradeRequired() {
         int desiredVersion = parseVersionString(version);
         int databaseVersion;
         try {
@@ -103,6 +103,22 @@
         
         // if dbversion is unset then assume a new install, otherwise compare
         if (databaseVersion < 0) {
+            // if this is a fresh db then we need to set the database version
+            Connection con = null;
+            try {
+                con = db.getConnection();
+                setDatabaseVersion(con, version);
+            } catch (Exception ioe) {
+                errorMessage("ERROR setting database version");
+            } finally {
+                try {
+                    if (con != null) {
+                        con.close();
+                    }
+                } catch (Exception ignored) {
+                }
+            }
+
             return false;
         } else {
             return databaseVersion < desiredVersion;
@@ -138,7 +154,7 @@
      */
     public void createDatabase() throws StartupException {
         
-        log.debug("Attempting to create database");
+        log.info("Creating Roller Weblogger database tables.");
         
         Connection con = null;
         SQLScriptRunner create = null;
@@ -918,10 +934,7 @@
         
         // upgrade comments to use new plugin mechanism
         try {
-            successMessage("Upgrading existing comments to use new comment plugins");
-            
-            // we are just going to set the 'plugins' value for comments to
-            // include 'AutoFormat' if it was configured previously
+            successMessage("Upgrading existing comments with content-type & plugins");
             
             // look in db and see if comment autoformatting is enabled
             boolean autoformatEnabled = false;
@@ -937,83 +950,67 @@
             }
             
             // look in db and see if comment html escaping is enabled
-            boolean htmlsubsetEnabled = false;
+            boolean htmlEnabled = false;
             String escapehtml = null;
             PreparedStatement selectIsEscapehtmlEnabled = con.prepareStatement(
                 "select value from roller_properties where name = 'users.comments.escapehtml'");
             ResultSet rs1 = selectIsEscapehtmlEnabled.executeQuery();
             if (rs1.next()) {
                 escapehtml = rs1.getString(1);
-                // NOTE: we enforce an html subset only when html escaping is OFF
+                // NOTE: we allow html only when html escaping is OFF
                 if(escapehtml != null && !"true".equals(escapehtml)) {
-                    htmlsubsetEnabled = true;
+                    htmlEnabled = true;
                 }
             }
             
-            // now update existing comments with necessary plugins
-            if(htmlsubsetEnabled && autoformatEnabled) {
-                
-                // set new global config property for enabled coment plugins
-                PreparedStatement addCommentPluginsProp = con.prepareStatement(
-                        "insert into roller_properties(name,value) values(?,?)");
-                addCommentPluginsProp.clearParameters();
-                addCommentPluginsProp.setString( 1, "users.comments.plugins");
-                addCommentPluginsProp.setString( 2, "HTMLSubset, AutoFormat");
-                addCommentPluginsProp.executeUpdate();
-                
-                // update existing comments
-                PreparedStatement updateComments = con.prepareStatement(
-                        "update roller_comment set plugins = ?");
-                updateComments.clearParameters();
-                updateComments.setString( 1, "HTMLSubset, AutoFormat");
-                updateComments.executeUpdate();
-                
-            } else if(autoformatEnabled) {
-                
-                // set new global config property for enabled coment plugins
-                PreparedStatement addCommentPluginsProp = con.prepareStatement(
-                        "insert into roller_properties(name,value) values(?,?)");
-                addCommentPluginsProp.clearParameters();
-                addCommentPluginsProp.setString( 1, "users.comments.plugins");
-                addCommentPluginsProp.setString( 2, "AutoFormat");
-                addCommentPluginsProp.executeUpdate();
-                
-                // update existing comments
-                PreparedStatement updateComments = con.prepareStatement(
-                        "update roller_comment set plugins = ?");
-                updateComments.clearParameters();
-                updateComments.setString( 1, "AutoFormat");
-                updateComments.executeUpdate();
-                
-            } else if(htmlsubsetEnabled) {
-                
-                // set new global config property for enabled coment plugins
-                PreparedStatement addCommentPluginsProp = con.prepareStatement(
-                        "insert into roller_properties(name,value) values(?,?)");
-                addCommentPluginsProp.clearParameters();
-                addCommentPluginsProp.setString( 1, "users.comments.plugins");
-                addCommentPluginsProp.setString( 2, "HTMLSubset");
-                addCommentPluginsProp.executeUpdate();
-                
-                // update existing comments
-                PreparedStatement updateComments = con.prepareStatement(
-                        "update roller_comment set plugins = ?");
-                updateComments.clearParameters();
-                updateComments.setString( 1, "HTMLSubset");
-                updateComments.executeUpdate();
-                
+            // first lets set the new 'users.comments.htmlenabled' property
+            PreparedStatement addCommentHtmlProp = con.prepareStatement("insert into roller_properties(name,value)
values(?,?)");
+            addCommentHtmlProp.clearParameters();
+            addCommentHtmlProp.setString(1, "users.comments.htmlenabled");
+            if(htmlEnabled) {
+                addCommentHtmlProp.setString(2, "true");
             } else {
-                
-                // set new global config property for enabled coment plugins
-                PreparedStatement addCommentPluginsProp = con.prepareStatement(
-                        "insert into roller_properties(name,value) values(?,?)");
-                addCommentPluginsProp.clearParameters();
-                addCommentPluginsProp.setString( 1, "users.comments.plugins");
-                addCommentPluginsProp.setString( 2, "");
-                addCommentPluginsProp.executeUpdate();
-                
-                // no need to update existing comments because plugins aren't enabled
+                addCommentHtmlProp.setString(2, "false");
+            }
+            addCommentHtmlProp.executeUpdate();
+            
+            // determine content-type for existing comments
+            String contentType = "text/plain";
+            if(htmlEnabled) {
+                contentType = "text/html";
+            }
+            
+            // determine plugins for existing comments
+            String plugins = "";
+            if(htmlEnabled && autoformatEnabled) {
+                plugins = "HTMLSubset,AutoFormat";
+            } else if(htmlEnabled) {
+                plugins = "HTMLSubset";
+            } else if(autoformatEnabled) {
+                plugins = "AutoFormat";
             }
+            
+            // set new comment plugins configuration property 'users.comments.plugins'
+            PreparedStatement addCommentPluginsProp = 
+                    con.prepareStatement("insert into roller_properties(name,value) values(?,?)");
+            addCommentPluginsProp.clearParameters();
+            addCommentPluginsProp.setString(1, "users.comments.plugins");
+            addCommentPluginsProp.setString(2, plugins);
+            addCommentPluginsProp.executeUpdate();
+            
+            // set content-type for all existing comments
+            PreparedStatement updateCommentsContentType = 
+                    con.prepareStatement("update roller_comment set contenttype = ?");
+            updateCommentsContentType.clearParameters();
+            updateCommentsContentType.setString(1, contentType);
+            updateCommentsContentType.executeUpdate();
+
+            // set plugins for all existing comments
+            PreparedStatement updateCommentsPlugins = 
+                    con.prepareStatement("update roller_comment set plugins = ?");
+            updateCommentsPlugins.clearParameters();
+            updateCommentsPlugins.setString(1, plugins);
+            updateCommentsPlugins.executeUpdate();
             
             if (!con.getAutoCommit()) con.commit();
            

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml
Thu Jul 12 14:33:47 2007
@@ -154,17 +154,13 @@
          <type>boolean</type>
          <default-value>true</default-value>
       </property-def>
-      <property-def  name="users.comments.plugins"  key="configForm.commentPlugins">
-         <type>string</type>
-         <default-value></default-value>
-      </property-def>
-      <property-def  name="users.comments.autoformat"  key="configForm.autoformatComments">
+      <property-def  name="users.comments.htmlenabled"  key="configForm.commentHtmlAllowed">
          <type>boolean</type>
          <default-value>true</default-value>
       </property-def>
-      <property-def  name="users.comments.escapehtml"  key="configForm.escapeCommentHtml">
-         <type>boolean</type>
-         <default-value>false</default-value>
+      <property-def  name="users.comments.plugins"  key="configForm.commentPlugins">
+         <type>string</type>
+         <default-value></default-value>
       </property-def>
       <property-def  name="users.comments.emailnotify"  key="configForm.emailComments">
          <type>boolean</type>

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.hbm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.hbm.xml?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.hbm.xml
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.hbm.xml
Thu Jul 12 14:33:47 2007
@@ -137,6 +137,15 @@
             unique="false"
         />
 
+        <property
+            name="contentType"
+            type="java.lang.String"
+            update="true"
+            insert="true"
+            column="contenttype"
+            unique="false"
+        />
+        
         <!--
             To add non XDoclet property mappings, create a file named
                 hibernate-properties-WeblogEntryComment.xml

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.java
Thu Jul 12 14:33:47 2007
@@ -51,6 +51,8 @@
     private String    referrer = null;
     private String    userAgent = null;
     private String    plugins = null;
+    private String    contentType = "text/plain";
+
     
     // associations
     private WeblogEntry weblogEntry = null;
@@ -253,6 +255,21 @@
      */
     public void setPlugins(String plugins) {
         this.plugins = plugins;
+    }
+    
+    
+    /**
+     * The content-type of the comment.
+     */
+    public String getContentType() {
+        return contentType;
+    }
+    
+    /**
+     * The content-type of the comment.
+     */
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
     }
     
     

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml
Thu Jul 12 14:33:47 2007
@@ -99,6 +99,9 @@
             <basic name="plugins">
                 <column name="plugins" insertable="true" updatable="true" unique="false"/>
             </basic>
+            <basic name="contentType">
+                <column name="contenttype" insertable="true" updatable="true" unique="false"/>
+            </basic>
             <many-to-one name="weblogEntry" target-entity="org.apache.roller.weblogger.pojos.WeblogEntry">
                 <join-column name="entryid" insertable="true" updatable="true" nullable="false"/>
             </many-to-one>

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogEntryCommentWrapper.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogEntryCommentWrapper.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogEntryCommentWrapper.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogEntryCommentWrapper.java
Thu Jul 12 14:33:47 2007
@@ -105,15 +105,14 @@
         
         String content = this.pojo.getContent();
         
-        // encode email
-        content = Utilities.encodeEmail(content);
+        // escape content if content-type is text/plain
+        if("text/plain".equals(this.pojo.getContentType())) {
+            content = StringEscapeUtils.escapeHtml(content);
+        }
         
-        // escape html
-        content = StringEscapeUtils.escapeHtml(content);
-        
-        // apply plugins for transformation
+        // apply plugins
         PluginManager pmgr = WebloggerFactory.getWeblogger().getPluginManager();
-        content = pmgr.applyCommentPlugins(this.pojo);
+        content = pmgr.applyCommentPlugins(this.pojo, content);
         
         // always add rel=nofollow for links
         content = Utilities.addNofollow(content);

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/ConfigModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/ConfigModel.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/ConfigModel.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/ConfigModel.java
Thu Jul 12 14:33:47 2007
@@ -85,13 +85,19 @@
     public boolean getFeedStyle() {
         return getBooleanProperty("site.newsfeeds.styledFeeds");
     }
-            
+    
+    public boolean getCommentHtmlAllowed() {
+        return getBooleanProperty("users.comments.htmlenabled");
+    }
+    
     public boolean getCommentAutoFormat() {
-        return getBooleanProperty("users.comments.autoformat");
+        // this prop was removed in 4.0
+        return false;
     }
     
     public boolean getCommentEscapeHtml() {
-        return getBooleanProperty("users.comments.escapehtml");
+        // replaced by new htmlallowed property in 4.0
+        return !getCommentHtmlAllowed();
     }
     
     public boolean getCommentEmailNotify() {

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/CommentServlet.java
Thu Jul 12 14:33:47 2007
@@ -237,6 +237,13 @@
         comment.setRemoteHost(request.getRemoteHost());
         comment.setPostTime(new Timestamp(System.currentTimeMillis()));
         
+        // set comment content-type depending on if html is allowed
+        if(WebloggerRuntimeConfig.getBooleanProperty("users.comments.htmlenabled")) {
+            comment.setContentType("text/html");
+        } else {
+            comment.setContentType("text/plain");
+        }
+        
         // set whatever comment plugins are configured
         comment.setPlugins(WebloggerRuntimeConfig.getProperty("users.comments.plugins"));
         
@@ -253,7 +260,7 @@
         if(!entry.getCommentsStillAllowed() || !entry.isPublished()) {
             error = messageUtils.getString("comments.disabled");
             
-            // if this is a real comment post then authenticate request
+        // if this is a real comment post then authenticate request
         } else if(!preview && !this.authenticator.authenticate(request)) {
             error = messageUtils.getString("error.commentAuthFailed");
             log.debug("Comment failed authentication");

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/ContextLoader.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/ContextLoader.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/ContextLoader.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/ContextLoader.java
Thu Jul 12 14:33:47 2007
@@ -279,13 +279,11 @@
         
         mLogger.debug("Loading comment values");
         
-        String escapeHtml =
-                WebloggerRuntimeConfig.getProperty("users.comments.escapehtml");
-        String autoFormat =
-                WebloggerRuntimeConfig.getProperty("users.comments.autoformat");
+        boolean escapeHtml =
+                !WebloggerRuntimeConfig.getBooleanProperty("users.comments.htmlenabled");
         ctx.put("isCommentPage",     Boolean.TRUE);
         ctx.put("escapeHtml",        new Boolean(escapeHtml) );
-        ctx.put("autoformat",        new Boolean(autoFormat) );
+        ctx.put("autoformat",        new Boolean(false) );
         
         // Make sure comment form object is available in context
         WeblogEntryCommentForm commentForm =

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java Thu
Jul 12 14:33:47 2007
@@ -324,7 +324,7 @@
         // Determine with mime type to use for e-mail
         StringBuffer msg = new StringBuffer();
         StringBuffer ownermsg = new StringBuffer();
-        boolean escapeHtml = WebloggerRuntimeConfig.getBooleanProperty("users.comments.escapehtml");
+        boolean escapeHtml = !WebloggerRuntimeConfig.getBooleanProperty("users.comments.htmlenabled");
         
         // first the commenter message
         

Modified: roller/trunk/apps/weblogger/src/sql/310-to-400-migration.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/sql/310-to-400-migration.vm?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/sql/310-to-400-migration.vm (original)
+++ roller/trunk/apps/weblogger/src/sql/310-to-400-migration.vm Thu Jul 12 14:33:47 2007
@@ -57,8 +57,9 @@
 #addColumnNull("roller_comment" "referrer" "varchar(255)")
 #addColumnNull("roller_comment" "useragent" "varchar(255)")
 
--- add new field to support comment plugins
+-- add new field to support comment plugins and content-type
 #addColumnNull("roller_comment" "plugins" "varchar(255)")
+#addColumnNotNull("roller_comment" "contenttype" "varchar(128)" "'text/plain'")
 
 -- add new status field to comment table to simplify queries
 #addColumnNotNull("roller_comment" "status" "varchar(20)" "'APPROVED'")

Modified: roller/trunk/apps/weblogger/src/sql/createdb.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/sql/createdb.vm?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/src/sql/createdb.vm (original)
+++ roller/trunk/apps/weblogger/src/sql/createdb.vm Thu Jul 12 14:33:47 2007
@@ -271,7 +271,8 @@
     referrer   varchar(255),
     useragent  varchar(255),
     status     varchar(20) not null,
-    plugins    varchar(255)
+    plugins    varchar(255),
+    contenttype varchar(128) default 'text/plain' not null
 );
 create index co_entryid_idx on roller_comment( entryid );
 create index co_status_idx on roller_comment( status );

Modified: roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/plugins/CommentPluginsTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/plugins/CommentPluginsTest.java?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/plugins/CommentPluginsTest.java
(original)
+++ roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/plugins/CommentPluginsTest.java
Thu Jul 12 14:33:47 2007
@@ -52,7 +52,7 @@
         comment.setPlugins("AutoFormat Plugin");
         
         // reformat
-        String output = pmgr.applyCommentPlugins(comment);
+        String output = pmgr.applyCommentPlugins(comment, comment.getContent());
         
         // make sure it turned out how we planned
         assertEquals(convertLinesFormatted, output);        

Modified: roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties?view=diff&rev=555776&r1=555775&r2=555776
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties Thu Jul
12 14:33:47 2007
@@ -372,6 +372,7 @@
 configForm.ignoreSpamComments=Don''t save comments thought to be spam
 configForm.enableTrackbacks=Allow weblog trackbacks?
 configForm.ignoreSpamTrackbacks=Don''t save trackbacks thought to be spam
+configForm.commentHtmlAllowed=Allow html in comments?
 configForm.commentPlugins=Enabled/Disable comment formatting plugins
 configForm.autoformatComments=Autoformat Comments?
 configForm.escapeCommentHtml=Escape Comment HTML?



Mime
View raw message