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/09/15 00:50:31 UTC

svn commit: r280961 - in /incubator/roller/branches/roller_2.0: src/org/roller/pojos/ src/org/roller/presentation/velocity/ src/org/roller/util/ web/ web/WEB-INF/classes/

Author: snoopdave
Date: Wed Sep 14 15:50:12 2005
New Revision: 280961

URL: http://svn.apache.org/viewcvs?rev=280961&view=rev
Log:
Fix for ROL-814 (edit links not appearing on blog pages)

Modified:
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageHelper.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageModel.java
    incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java
    incubator/roller/branches/roller_2.0/web/WEB-INF/classes/comments.vm
    incubator/roller/branches/roller_2.0/web/WEB-INF/classes/navbar.vm
    incubator/roller/branches/roller_2.0/web/WEB-INF/classes/weblog.vm
    incubator/roller/branches/roller_2.0/web/main.jsp

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java Wed Sep 14 15:50:12 2005
@@ -153,7 +153,6 @@
     * Get password.
     * If password encryption is enabled, will return encrypted password.
     *
-    * @roller.wrapPojoMethod type="simple"
     * @ejb:persistent-field 
     * @hibernate.property column="passphrase" non-null="true"
     */

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java Wed Sep 14 15:50:12 2005
@@ -371,6 +371,7 @@
      * Short URL safe string that uniquely identifies the website.
      * @ejb:persistent-field
      * @hibernate.property column="handle" non-null="true" unique="true"
+     * @roller.wrapPojoMethod type="simple"
      */
     public String getHandle()
     {

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageHelper.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageHelper.java?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageHelper.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageHelper.java Wed Sep 14 15:50:12 2005
@@ -407,7 +407,7 @@
         String path, String val1, String val2)
     {
         Hashtable params = new Hashtable();
-        return strutsUrlHelper( useIds, isAction, path, val1, val2, params);
+        return strutsUrlHelper1( useIds, isAction, path, val1, val2, params);
     }
     
     //------------------------------------------------------------------------
@@ -422,7 +422,7 @@
      * @param val2
      * @return String
      */
-    public String strutsUrlHelper( boolean useIds, boolean isAction, 
+    public String strutsUrlHelper1( boolean useIds, boolean isAction, 
         String path, String val1, String val2, Hashtable params)
     {
         if (useIds)
@@ -441,8 +441,7 @@
         if (StringUtils.isNotEmpty(val1) && !val1.equals("null"))
         {
             params.clear();
-            params.put("rmk", val1);
-            params.put("rmik", val2);
+            params.put("weblog", val1);
         }
         
         String returnUrl = "";

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageModel.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageModel.java?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageModel.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageModel.java Wed Sep 14 15:50:12 2005
@@ -751,12 +751,33 @@
             if (rses.getAuthenticatedUser() != null 
                    && mRollerReq.getWebsite() != null)
             {
+                return rses.isUserAuthorizedToAuthor(mRollerReq.getWebsite());
+            }
+        }
+        catch (Exception e)
+        {
+            mLogger.warn("PageModel.isUserAuthorizedToEdit()", e);
+        }
+        return false;
+    }
+    
+    //------------------------------------------------------------------------
+    
+    public boolean isUserAuthorizedToAdmin()
+    {
+        try
+        {
+            RollerSession rses = 
+                RollerSession.getRollerSession(mRollerReq.getRequest());
+            if (rses.getAuthenticatedUser() != null 
+                   && mRollerReq.getWebsite() != null)
+            {
                 return rses.isUserAuthorizedToAdmin(mRollerReq.getWebsite());
             }
         }
         catch (Exception e)
         {
-            mLogger.warn("PageModel.isUserAuthorizedToEdit)", e);
+            mLogger.warn("PageModel.isUserAuthorizedToAdmin()", e);
         }
         return false;
     }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java Wed Sep 14 15:50:12 2005
@@ -974,7 +974,7 @@
      */
     public static final String textToHTML(String text, boolean xml)
     {
-        if (text == null) return null;
+        if (text == null) return "null";
         final StringBuffer html = new StringBuffer();
 
         // Loop thru each characters of the text
@@ -1019,6 +1019,7 @@
      */
     public static final String textToCDATA(String text)
     {
+        if (text == null) return "null";
         final StringBuffer html = new StringBuffer();
 
         // Loop thru each characters of the text

Modified: incubator/roller/branches/roller_2.0/web/WEB-INF/classes/comments.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/WEB-INF/classes/comments.vm?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/WEB-INF/classes/comments.vm (original)
+++ incubator/roller/branches/roller_2.0/web/WEB-INF/classes/comments.vm Wed Sep 14 15:50:12 2005
@@ -340,7 +340,7 @@
                 <td>$text.get( "macro.weblog.url" )</td>
                 <td><input name="url" type="text" class="commentFormInput" size="50"/></td>
            </tr>
-           #if ($model.emailComments)
+           #if ($pageModel.emailComments)
            <tr>
               <td></td>
               <td>

Modified: incubator/roller/branches/roller_2.0/web/WEB-INF/classes/navbar.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/WEB-INF/classes/navbar.vm?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/WEB-INF/classes/navbar.vm (original)
+++ incubator/roller/branches/roller_2.0/web/WEB-INF/classes/navbar.vm Wed Sep 14 15:50:12 2005
@@ -86,17 +86,19 @@
     #end
 
     ## strutsUrlHelper( useIds, isAction, path, val1, val2)
-    #if( $model.isUserAuthorizedToAuthor() )
-        #set( $editUrl = $pageHelper.strutsUrlHelper(false, true, "weblogCreate", "tabbedmenu.weblog", "tabbedmenu.weblog.newEntry") )
+    #if( $pageModel.isUserAuthorizedToEdit() )
+        #set( $editUrl = $pageHelper.strutsUrlHelper(false, true, "weblogCreate", $website.handle, "") )
         #printNavLink( $editUrl $text.get("navigationBar.newEntry") $useCSS $vertical $delimiter )
 
-        #set( $editUrl = $pageHelper.strutsUrlHelper(false, true, "editWebsite", "tabbedmenu.website", "tabbedmenu.website.settings") )
-        #printNavLink( $editUrl $text.get("navigationBar.settings") $useCSS $vertical $delimiter )
+        #if( $pageModel.isUserAuthorizedToAdmin() )
+           #set( $editUrl = $pageHelper.strutsUrlHelper(false, true, "editWebsite", $website.handle, "") )
+           #printNavLink( $editUrl $text.get("navigationBar.settings") $useCSS $vertical $delimiter )
+        #end
 
         #set( $editUrl = $pageHelper.strutsUrlHelper(false, true, "logout-redirect", "", "") )
         #printNavLink( $editUrl $text.get("navigationBar.logout") $useCSS $vertical $delimiter )
     #else
-        #if( $model.isUserAuthenticated() )
+        #if( $pageModel.isUserAuthenticated() )
            #set( $editUrl = $pageHelper.strutsUrlHelper(false, true, "logout-redirect", "", "") )
            #printNavLink( $editUrl $text.get("navigationBar.logout") $useCSS $vertical $delimiter )
         #else

Modified: incubator/roller/branches/roller_2.0/web/WEB-INF/classes/weblog.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/WEB-INF/classes/weblog.vm?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/WEB-INF/classes/weblog.vm (original)
+++ incubator/roller/branches/roller_2.0/web/WEB-INF/classes/weblog.vm Wed Sep 14 15:50:12 2005
@@ -134,7 +134,7 @@
     <a href="$baseURL$entry.permaLink"
         title="$text.get( "macro.weblog.entrypermalink.title" )"
         class="entrypermalink">Permalink</a>
-    #if ($pageHelper.isUserAuthorizedToAuthor())
+    #if ($pageHelper.isUserAuthorizedToEdit())
         [<a href="$pageHelper.getEntryEditUrl($entry)">$text.get( "macro.weblog.entrypermalink.edit" )</a>]
     #end
 #end
@@ -348,7 +348,7 @@
            #else
               $var.title
            #end
-           #if ($pageHelper.isUserAuthorizedToAuthor())
+           #if ($pageHelper.isUserAuthorizedToEdit())
               &nbsp;[<a href="$pageHelper.getEntryEditUrl($var)">$text.get( "macro.weblog.editentry" )</a>]
            #end
            </li>

Modified: incubator/roller/branches/roller_2.0/web/main.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/main.jsp?rev=280961&r1=280960&r2=280961&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/main.jsp (original)
+++ incubator/roller/branches/roller_2.0/web/main.jsp Wed Sep 14 15:50:12 2005
@@ -56,6 +56,7 @@
 </c:if>
 
 <c:forEach var="post" items="${recentPosts}">
+    <c:if test="${!post.pinnedToMain}">
     <div class="entryBox">
 
         <a href='<c:out value="${baseURL}" /><c:out value="${post.permaLink}" />' class="entryTitle">
@@ -84,6 +85,7 @@
         <roller:ApplyPlugins name="post" scope="page" stripHtml="true" maxLength="200" skipFlag="true" />
 
     </div>
+    </c:if>
 </c:forEach>
 
 <br />