roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r264827 - in /incubator/roller/branches/roller_2.0: src/org/roller/presentation/weblog/actions/ web/WEB-INF/classes/ web/weblog/ web/website/
Date Tue, 30 Aug 2005 19:05:04 GMT
Author: snoopdave
Date: Tue Aug 30 12:04:46 2005
New Revision: 264827

URL: http://svn.apache.org/viewcvs?rev=264827&view=rev
Log:
NPE fixes in ping pages

Modified:
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/BasePingTargetsAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/CustomPingTargetsAction.java
    incubator/roller/branches/roller_2.0/web/WEB-INF/classes/ApplicationResources.properties
    incubator/roller/branches/roller_2.0/web/weblog/CategoryForm.jsp
    incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetDeleteOK.jsp
    incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetEdit.jsp
    incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargets.jsp
    incubator/roller/branches/roller_2.0/web/website/CommonPingTargetEdit.jsp

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/BasePingTargetsAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/BasePingTargetsAction.java?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/BasePingTargetsAction.java
(original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/BasePingTargetsAction.java
Tue Aug 30 12:04:46 2005
@@ -24,6 +24,7 @@
 import org.roller.RollerException;
 import org.roller.model.PingTargetManager;
 import org.roller.model.RollerFactory;
+import org.roller.pojos.WebsiteData;
 import org.roller.pojos.PingTargetData;
 import org.roller.presentation.BasePageModel;
 import org.roller.presentation.forms.PingTargetForm;
@@ -92,7 +93,7 @@
             BasePageModel pageModel = 
                 new BasePageModel(getPingTargetsTitle(), req, res, mapping);
             req.setAttribute("model",pageModel);            
-            if (!hasRequiredRights(rreq))
+            if (!hasRequiredRights(rreq, rreq.getWebsite()))
             {
                 return mapping.findForward(ACCESS_DENIED_PAGE);
             }
@@ -131,7 +132,7 @@
             BasePageModel pageModel = 
                 new BasePageModel(getPingTargetEditTitle(), req, res, mapping);
             req.setAttribute("model",pageModel);            
-            if (!hasRequiredRights(rreq))
+            if (!hasRequiredRights(rreq, rreq.getWebsite()))
             {
                 return mapping.findForward(ACCESS_DENIED_PAGE);
             }
@@ -220,7 +221,7 @@
             BasePageModel pageModel = 
                 new BasePageModel(getPingTargetEditTitle(), req, res, mapping);
             req.setAttribute("model",pageModel);            
-            if (!hasRequiredRights(rreq))
+            if (!hasRequiredRights(rreq, rreq.getWebsite()))
             {
                 return mapping.findForward(ACCESS_DENIED_PAGE);
             }
@@ -256,7 +257,7 @@
             BasePageModel pageModel = new BasePageModel(
                     getPingTargetDeleteOKTitle(), req, res, mapping);
             req.setAttribute("model",pageModel);            
-            if (!hasRequiredRights(rreq))
+            if (!hasRequiredRights(rreq, rreq.getWebsite()))
             {
                 return mapping.findForward(ACCESS_DENIED_PAGE);
             }
@@ -290,7 +291,7 @@
         PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
         try
         {
-            if (!hasRequiredRights(rreq))
+            if (!hasRequiredRights(rreq, rreq.getWebsite()))
             {
                 return mapping.findForward(ACCESS_DENIED_PAGE);
             }
@@ -311,7 +312,7 @@
     }
 
     // TODO: Consider unifying with other RollerRequest methods
-    /*
+    /**
      * Helper to select the ping target specified by the id in the request.
      * @param rreq
      * @return the ping target specified by the id in the request
@@ -334,19 +335,22 @@
         return pingTarget;
     }
 
-    /*
+    /**
      * Private helper to validate a ping target.
-     * @param rreq       the request
+     * @param rreq the request
      * @param pingTarget the ping target to validate
-     * @return an <code>ActionMessages</code> object with <code>ActionMessage</code>
for each error encountered, empty if no
-     * errors were encountered.
+     * @return an <code>ActionMessages</code> object with 
+     *         <code>ActionMessage</code> for each error encountered, 
+     *         empty if no errors were encountered.
      * @throws RollerException
      */
-    private ActionMessages validate(RollerRequest rreq, PingTargetData pingTarget) throws
RollerException
+    private ActionMessages validate(
+        RollerRequest rreq, PingTargetData pingTarget) throws RollerException
     {
         ActionMessages errors = new ActionMessages();
 
-        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
+        PingTargetManager pingTargetMgr = 
+                RollerFactory.getRoller().getPingTargetManager();
         if (!pingTargetMgr.isNameUnique(pingTarget))
         {
             errors.add(ActionMessages.GLOBAL_MESSAGE,
@@ -365,26 +369,33 @@
     }
 
 
-    /*
-     *  Helper defined by the subclass to determine if user has adequate rights for the action.
-     *  This and the {@link org.roller.pojos.PingTargetData#canSave()} method determine the
access
-     *  control for the action.
+    /**
+     * Helper defined by the subclass to determine if user has adequate 
+     * rights for the action. This and the 
+     * {@link org.roller.pojos.PingTargetData#canSave()} method determine the 
+     * access control for the action.
      */
-    protected abstract boolean hasRequiredRights(RollerRequest rreq) throws RollerException;
+    protected abstract boolean hasRequiredRights(
+            RollerRequest rreq, WebsiteData website) throws RollerException;
 
-    /*
+    /**
      * Get the logger from the concrete subclass
      */
     protected abstract Log getLogger();
 
-    /*
-     * Get the ping targets for the view.  This is implemented differently in the concrete
subclasses.
+    /**
+     * Get the ping targets for the view.  This is implemented differently in 
+     * the concrete subclasses.
      */
-    protected abstract List getPingTargets(RollerRequest rreq) throws RollerException;
+    protected abstract List getPingTargets(RollerRequest rreq) 
+        throws RollerException;
 
 
-    /*
-     * Create a new ping target (blank). This is implemented differently in the concrete
subclasses.
+    /**
+     * Create a new ping target (blank). This is implemented differently in 
+     * the concrete subclasses.
      */
-    protected abstract PingTargetData createPingTarget(RollerRequest rreq, PingTargetForm
pingTargetForm) throws RollerException;
+    protected abstract PingTargetData createPingTarget(
+        RollerRequest rreq, PingTargetForm pingTargetForm) 
+            throws RollerException;
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/CustomPingTargetsAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/CustomPingTargetsAction.java?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/CustomPingTargetsAction.java
(original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/CustomPingTargetsAction.java
Tue Aug 30 12:04:46 2005
@@ -24,6 +24,7 @@
 import org.roller.model.PingTargetManager;
 import org.roller.model.RollerFactory;
 import org.roller.pojos.PingTargetData;
+import org.roller.pojos.WebsiteData;
 import org.roller.presentation.forms.PingTargetForm;
 import org.roller.presentation.RollerRequest;
 import org.roller.presentation.RollerSession;
@@ -99,10 +100,11 @@
     /*
      *  Check if the user has editing rights.
      */
-    protected boolean hasRequiredRights(RollerRequest rreq) throws RollerException
+    protected boolean hasRequiredRights(RollerRequest rreq, WebsiteData website) 
+        throws RollerException
     {
         RollerSession rses = RollerSession.getRollerSession(rreq.getRequest());
-        return (rses.isUserAuthorizedToAdmin(rreq.getWebsite()) 
+        return (rses.isUserAuthorizedToAdmin(website)
             && !PingConfig.getDisallowCustomTargets());
     }
 

Modified: incubator/roller/branches/roller_2.0/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/WEB-INF/classes/ApplicationResources.properties?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/WEB-INF/classes/ApplicationResources.properties
(original)
+++ incubator/roller/branches/roller_2.0/web/WEB-INF/classes/ApplicationResources.properties
Tue Aug 30 12:04:46 2005
@@ -694,6 +694,7 @@
 disabled on this site. To get an additional common ping target added, \
 Please contact an administrator.
 
+
 pings.title=Configure Automatic Weblog Pings
 pings.subtitle=Setup automatic pings for weblog [<b>{0}</b>]
 pings.explanation=Pings allow you to notify sites that your weblog has changed \
@@ -727,7 +728,12 @@
 a site administrator.
 pingResult.OK=OK
 
+
 pingTarget.pingTarget=Ping Target
+
+customPingTarget.subtitle=Editing custom ping target in weblog [{0}]
+commonPingTarget.subtitle=Editing common ping target
+
 pingTarget.name=Name
 pingTarget.pingUrl=Ping URL
 pingTarget.addNew=Add New

Modified: incubator/roller/branches/roller_2.0/web/weblog/CategoryForm.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/weblog/CategoryForm.jsp?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/weblog/CategoryForm.jsp (original)
+++ incubator/roller/branches/roller_2.0/web/weblog/CategoryForm.jsp Tue Aug 30 12:04:46 2005
@@ -3,7 +3,8 @@
 
 <p class="subtitle">
 <c:if test="${state == 'add'}">
-    <fmt:message key="categoryForm.add.subtitle" /></h3>
+    <fmt:message key="categoryForm.add.subtitle" />
+    
 </c:if>
 <c:if test="${state == 'edit'}">
     <fmt:message key="categoryForm.edit.subtitle" />

Modified: incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetDeleteOK.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetDeleteOK.jsp?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetDeleteOK.jsp (original)
+++ incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetDeleteOK.jsp Tue Aug 30
12:04:46 2005
@@ -13,6 +13,7 @@
 <tr>
 <td>
 <html:form action="/editor/customPingTargets" method="post">
+    <input type="hidden" name="weblog" value='<c:out value="${model.website.handle}"
/>' />
     <html:hidden property="method" value="deleteConfirmed" />
     <html:hidden property="id" />
     <div class="control">
@@ -22,6 +23,7 @@
 </td>
 <td>
 <html:form action="/editor/customPingTargets" method="post">
+    <input type="hidden" name="weblog" value='<c:out value="${model.website.handle}"
/>' />
     <!-- Results in returning to the view on common ping targets. -->
     <div class="control">
        <input type="submit" value='<fmt:message key="pingTarget.cancel" />' />

Modified: incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetEdit.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetEdit.jsp?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetEdit.jsp (original)
+++ incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargetEdit.jsp Tue Aug 30 12:04:46
2005
@@ -8,10 +8,16 @@
 // -->
 </script> 
 
-<br />
+<p class="subtitle">
+<fmt:message key="customPingTarget.subtitle">
+    <fmt:param value="${model.website.handle}" />
+</fmt:message>
+</p>
+
 <html:form action="/editor/customPingTargets" method="post" focus="name">
     <html:hidden property="method" value="save" />
     <html:hidden property="id" />
+    <input type="hidden" name="weblog" value='<c:out value="${model.website.handle}"
/>' />
 
     <div class="formrow">
        <label for="name" class="formrow"><fmt:message key="pingTarget.name" /></label>

Modified: incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargets.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargets.jsp?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargets.jsp (original)
+++ incubator/roller/branches/roller_2.0/web/weblog/CustomPingTargets.jsp Tue Aug 30 12:04:46
2005
@@ -1,5 +1,9 @@
 <%@ page import="org.roller.presentation.RollerRequest"%>
 <%@ include file="/taglibs.jsp" %>
+<%
+BasePageModel pageModel = (BasePageModel)request.getAttribute("model");
+String websiteHandle = pageModel.getWebsite().getHandle();
+%>
 
 <p class="subtitle">
    <fmt:message key="customPingTargets.subtitle" >
@@ -42,6 +46,8 @@
                            id="<%= RollerRequest.PINGTARGETID_KEY %>"
                            name="pingTarget" property="id" />
                        <roller:linkparam
+                           id="weblog" value="<%= websiteHandle %>" />
+                       <roller:linkparam
     	                   id="method" value="editSelected" />
                        <img src='<c:url value="/images/Edit16.png"/>' border="0"
                             alt="<fmt:message key="pingTarget.edit" />" />
@@ -54,6 +60,8 @@
     	                   id="<%= RollerRequest.PINGTARGETID_KEY %>"
     	                   name="pingTarget" property="id" />
                        <roller:linkparam
+                           id="weblog" value="<%= websiteHandle %>" />
+                       <roller:linkparam
     	                   id="method" value="deleteSelected" />
                        <img src='<c:url value="/images/Remove16.gif"/>' border="0"
                             alt="<fmt:message key="pingTarget.remove" />" />
@@ -70,6 +78,7 @@
     <html:form action="/editor/customPingTargets" method="post">
         <div class="control">
            <html:hidden property="method" value="addNew" />
+           <input type="hidden" name="weblog" value='<c:out value="${model.website.handle}"
/>' />           
            <input type="submit" value='<fmt:message key="pingTarget.addNew"/>' />
         </div>
     </html:form>

Modified: incubator/roller/branches/roller_2.0/web/website/CommonPingTargetEdit.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/website/CommonPingTargetEdit.jsp?rev=264827&r1=264826&r2=264827&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/website/CommonPingTargetEdit.jsp (original)
+++ incubator/roller/branches/roller_2.0/web/website/CommonPingTargetEdit.jsp Tue Aug 30 12:04:46
2005
@@ -1,7 +1,10 @@
 <%@ include file="/taglibs.jsp" %>
 
 
-<br />
+<p class="subtitle">
+<fmt:message key="commonPingTarget.subtitle"/>
+</p>
+
 <html:form action="/admin/commonPingTargets" method="post" focus="name">
     <html:hidden property="method" value="save" />
     <html:hidden property="id" />



Mime
View raw message