You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/11/18 20:00:23 UTC

svn commit: r345539 - in /incubator/roller/trunk: src/org/roller/presentation/website/actions/WebsiteFormAction.java web/website/edit-website.jsp

Author: snoopdave
Date: Fri Nov 18 11:00:19 2005
New Revision: 345539

URL: http://svn.apache.org/viewcvs?rev=345539&view=rev
Log:
Fixing problem introduced in plugin-instantiation fix

Modified:
    incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
    incubator/roller/trunk/web/website/edit-website.jsp

Modified: incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java?rev=345539&r1=345538&r2=345539&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java Fri Nov 18 11:00:19 2005
@@ -4,7 +4,9 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
@@ -36,6 +38,8 @@
 import org.roller.presentation.RollerRequest;
 import org.roller.presentation.RollerSession;
 import org.roller.presentation.pagecache.PageCacheFilter;
+import org.roller.presentation.velocity.ContextLoader;
+import org.roller.presentation.velocity.PagePlugin;
 import org.roller.presentation.website.formbeans.WebsiteFormEx;
 
 
@@ -328,6 +332,27 @@
         }
         public void setGroupBloggingEnabled(boolean groupBloggingEnabled) {
             this.groupBloggingEnabled = groupBloggingEnabled;
+        }
+        public boolean getHasPagePlugins() {
+            return ContextLoader.hasPlugins();
+        }
+        public List getPagePlugins() {
+            List list = new ArrayList();
+            if (getHasPagePlugins()) {
+                Map pluginClasses = ContextLoader.getPagePluginClasses();
+                Iterator it = pluginClasses.values().iterator();
+                while (it.hasNext()) {
+                    try {
+                        Class pluginClass = (Class)it.next();
+                        PagePlugin plugin = (PagePlugin)pluginClass.newInstance();
+                        // no need to init plugins, we're not gonna run them
+                        list.add(plugin);
+                    } catch (Exception e) {
+                        mLogger.warn("Unable to create a PagePlugin: ", e);
+                    }
+                }
+            }
+            return list;
         }
     }
 }

Modified: incubator/roller/trunk/web/website/edit-website.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/website/edit-website.jsp?rev=345539&r1=345538&r2=345539&view=diff
==============================================================================
--- incubator/roller/trunk/web/website/edit-website.jsp (original)
+++ incubator/roller/trunk/web/website/edit-website.jsp Fri Nov 18 11:00:19 2005
@@ -1,5 +1,9 @@
 <%@ include file="/taglibs.jsp" %>
-
+<%@ page import="org.roller.presentation.website.actions.WebsiteFormAction" %>
+<%
+WebsiteFormAction.WebsitePageModel model = 
+    (WebsiteFormAction.WebsitePageModel)request.getAttribute("model");
+%>
 <p class="subtitle">
    <fmt:message key="websiteSettings.subtitle" >
        <fmt:param value="${model.website.handle}" />
@@ -134,26 +138,28 @@
         <td colspan="3"><h2><fmt:message key="websiteSettings.formatting" /></h2></td>
     </tr>
 
-
-<% if (org.roller.presentation.velocity.ContextLoader.hasPlugins()) { %>
-    <tr>
-        <td class="label">Default Entry Formatters <br />(applied in the listed order)</td>
-        <td class="field">
-        <logic:iterate id="plugin" type="org.roller.presentation.velocity.PagePlugin"
-            collection="<%= org.roller.presentation.velocity.ContextLoader.getPagePlugins() %>">
-            <html:multibox property="defaultPluginsArray"
-                title="<%= plugin.getName() %>" value="<%= plugin.getName() %>" /></input>
-            <label for="<%= plugin.getName() %>"><%= plugin.getName() %></label>
-            <a href="javascript:void(0);" onmouseout="return nd();"
-            onmouseover="return overlib('<%= plugin.getDescription() %>', STICKY, MOUSEOFF, TIMEOUT, 3000);">?</a>
-            <br />
-        </logic:iterate>
-        </td>
-        <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
-    </tr>
-<% } else { %>
-    <html:hidden property="defaultPlugins" />
-<% } %>
+<c:choose>
+    <c:when test="${model.hasPagePlugins}">
+        <tr>
+            <td class="label">Default Entry Formatters <br />(applied in the listed order)</td>
+            <td class="field">
+            <logic:iterate id="plugin" type="org.roller.presentation.velocity.PagePlugin"
+                collection="<%= model.getPagePlugins() %>">
+                <html:multibox property="defaultPluginsArray"
+                    title="<%= plugin.getName() %>" value="<%= plugin.getName() %>" /></input>
+                <label for="<%= plugin.getName() %>"><%= plugin.getName() %></label>
+                <a href="javascript:void(0);" onmouseout="return nd();"
+                onmouseover="return overlib('<%= plugin.getDescription() %>', STICKY, MOUSEOFF, TIMEOUT, 3000);">?</a>
+                <br />
+            </logic:iterate>
+            </td>
+            <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
+        </tr>
+    </c:when>
+    <c:otherwise>
+        <html:hidden property="defaultPlugins" />
+    </c:otherwise>
+</c:choose>
 
 
     <%-- ***** Spam prevention settings ***** --%>