Author: agilliland
Date: Thu May 17 11:30:07 2007
New Revision: 539068

URL: http://svn.apache.org/viewvc?view=rev&rev=539068
Log:
struts2 is now officially used for the Roller UI.  This commit changes all the 
normal entry points into the UI so that they now point to struts2 urls.

additionally this commit replaces the existing text and xinha editors with 
struts2 versions since we couldn't copy those jsps to new locations.


Modified:
    roller/trunk/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java
    roller/trunk/src/org/apache/roller/ui/rendering/servlets/PageServlet.java
    
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldPageHelper.java
    roller/trunk/src/org/apache/roller/util/MailUtil.java
    roller/trunk/src/org/apache/roller/util/URLUtilities.java
    roller/trunk/web/WEB-INF/security.xml
    roller/trunk/web/index.jsp
    roller/trunk/web/roller-ui/authoring/editors/editor-text.jsp
    roller/trunk/web/roller-ui/authoring/editors/editor-xinha.jsp
    roller/trunk/web/roller-ui/login-redirect.jsp

Modified: 
roller/trunk/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- 
roller/trunk/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java 
(original)
+++ 
roller/trunk/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java 
Thu May 17 11:30:07 2007
@@ -533,7 +533,7 @@
             ownermsg.append((escapeHtml) ? "\n" : "<br />");
             
             StringBuffer deleteURL = new StringBuffer(rootURL);
-            
deleteURL.append("/roller-ui/authoring/commentManagement.do?method=query&entryId="
 + entry.getId());
+            deleteURL.append("/roller-ui/authoring/comments.rol?entryId=" + 
entry.getId());
             
             if (escapeHtml) {
                 ownermsg.append(deleteURL.toString());

Modified: 
roller/trunk/src/org/apache/roller/ui/rendering/servlets/PageServlet.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/rendering/servlets/PageServlet.java?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/src/org/apache/roller/ui/rendering/servlets/PageServlet.java 
(original)
+++ roller/trunk/src/org/apache/roller/ui/rendering/servlets/PageServlet.java 
Thu May 17 11:30:07 2007
@@ -581,7 +581,7 @@
                     if (lastSlash == -1) lastSlash = requestUrl.length();
                     String requestSite = requestUrl.substring(0, lastSlash);
                     
-                    if (referrerUrl.matches(requestSite + ".*\\.do.*")) {
+                    if (referrerUrl.matches(requestSite + ".*\\.rol.*")) {
                         referrerUrl = null;
                     } else 
if(BlacklistChecker.checkReferrer(pageRequest.getWeblog(), referrerUrl)) {
                         return true;

Modified: 
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldPageHelper.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldPageHelper.java?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- 
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldPageHelper.java
 (original)
+++ 
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldPageHelper.java
 Thu May 17 11:30:07 2007
@@ -25,13 +25,11 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Vector;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.jsp.PageContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.struts.Globals;
 import org.apache.struts.util.RequestUtils;
 import org.apache.roller.RollerException;
 import org.apache.roller.business.WeblogEntryPlugin;
@@ -51,6 +49,7 @@
 import org.apache.roller.ui.core.tags.calendar.BigWeblogCalendarModel;
 import org.apache.roller.ui.core.tags.calendar.WeblogCalendarModel;
 import org.apache.roller.ui.rendering.util.WeblogPageRequest;
+import org.apache.roller.util.URLUtilities;
 
 /**
  * Provides assistance to VelociMacros, filling in where Velocity falls.
@@ -130,19 +129,7 @@
     
     /** Build the URL for editing an WeblogEntry **/
     public String getEntryEditUrl(WeblogEntryDataWrapper entry) {
-        Hashtable params = new Hashtable();
-        params.put( RequestConstants.WEBLOGENTRY_ID, entry.getId());
-        params.put( RequestConstants.ANCHOR,        entry.getAnchor());
-        if (mWebsite != null) {
-            params.put( RequestConstants.USERNAME,  mWebsite.getHandle());
-        }
-        try {
-            return RequestUtils.computeURL( mPageContext,
-                    "weblogEdit", null, null, null, params, null, false);
-        } catch (MalformedURLException mue) {
-            mLogger.warn("RollerRequest.editEntryUrl exception: ", mue);
-        }
-        return mRequest.getContextPath() + "edtior/weblog.do?method=edit";
+        return URLUtilities.getEntryEditURL(entry.getWebsite().getHandle(), 
entry.getId(), false);
     }
     
     

Modified: roller/trunk/src/org/apache/roller/util/MailUtil.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/util/MailUtil.java?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/src/org/apache/roller/util/MailUtil.java (original)
+++ roller/trunk/src/org/apache/roller/util/MailUtil.java Thu May 17 11:30:07 
2007
@@ -113,9 +113,7 @@
             to = (String[])reviewers.toArray(new String[reviewers.size()]);
             
             // Figure URL to entry edit page
-            String rootURL = RollerRuntimeConfig.getAbsoluteContextURL();
-            String editURL = rootURL
-                    + "/roller-ui/authoring/weblog.do?method=edit&entryId=" + 
entry.getId();
+            String editURL = 
URLUtilities.getEntryEditURL(entry.getWebsite().getHandle(), entry.getId(), 
true);
             
             ResourceBundle resources = ResourceBundle.getBundle(
                     "ApplicationResources", 
entry.getWebsite().getLocaleInstance());
@@ -169,7 +167,7 @@
             
             // Figure URL to entry edit page
             String rootURL = RollerRuntimeConfig.getAbsoluteContextURL();
-            String url = rootURL + "/roller-ui/yourWebsites.do";
+            String url = rootURL + "/roller-ui/menu.rol";
             
             ResourceBundle resources = ResourceBundle.getBundle(
                     "ApplicationResources",

Modified: roller/trunk/src/org/apache/roller/util/URLUtilities.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/util/URLUtilities.java?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/src/org/apache/roller/util/URLUtilities.java (original)
+++ roller/trunk/src/org/apache/roller/util/URLUtilities.java Thu May 17 
11:30:07 2007
@@ -26,6 +26,7 @@
 import java.util.List;
 import java.util.Map;
 import org.apache.roller.config.RollerRuntimeConfig;
+import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WeblogTheme;
 import org.apache.roller.pojos.WebsiteData;
 
@@ -381,6 +382,31 @@
         }
         
         return url.toString();
+    }
+    
+    
+    /**
+     * Get a url to edit a specific weblog entry.
+     */
+    public static final String getEntryEditURL(String weblogHandle,
+                                               String entryId,
+                                               boolean absolute) {
+        
+        StringBuffer url = new StringBuffer();
+        
+        if(absolute) {
+            url.append(RollerRuntimeConfig.getAbsoluteContextURL());
+        } else {
+            url.append(RollerRuntimeConfig.getRelativeContextURL());
+        }
+        
+        url.append("/roller-ui/authoring/entryEdit.rol");
+        
+        Map params = new HashMap();
+        params.put("weblog", weblogHandle);
+        params.put("bean.id", entryId);
+        
+        return url.toString() + getQueryString(params);
     }
     
     

Modified: roller/trunk/web/WEB-INF/security.xml
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/security.xml?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/web/WEB-INF/security.xml (original)
+++ roller/trunk/web/WEB-INF/security.xml Thu May 17 11:30:07 2007
@@ -180,7 +180,7 @@
     
     <bean id="authenticationProcessingFilter" 
class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
         <property name="authenticationManager" ref="authenticationManager"/>
-        <property name="authenticationFailureUrl" 
value="/roller-ui/login.do?error=true"/>
+        <property name="authenticationFailureUrl" 
value="/roller-ui/login.rol?error=true"/>
         <property name="defaultTargetUrl" value="/"/>
         <property name="filterProcessesUrl" value="/roller_j_security_check"/>
         <property name="rememberMeServices" ref="rememberMeServices"/>
@@ -198,7 +198,7 @@
     <bean id="remoteUserFilter" 
class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter"/>
 
     <bean id="authenticationProcessingFilterEntryPoint" 
class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
-        <property name="loginFormUrl" value="/roller-ui/login.do"/>
+        <property name="loginFormUrl" value="/roller-ui/login.rol"/>
         <property name="forceHttps" value="false"/>
     </bean>
 

Modified: roller/trunk/web/index.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/index.jsp?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/web/index.jsp (original)
+++ roller/trunk/web/index.jsp Thu May 17 11:30:07 2007
@@ -14,33 +14,21 @@
   limitations under the License.  For additional information regarding
   copyright in this work, please see the NOTICE file in the top level
   directory of this distribution.
---%><%@ 
-page import="org.apache.roller.config.RollerRuntimeConfig" session="false" %><%
+--%><%@ page session="false" %><%
+
 // lets see if we have a frontpage blog
 String frontpageBlog =
-        RollerRuntimeConfig.getProperty("site.frontpage.weblog.handle");
+        
org.apache.roller.config.RollerRuntimeConfig.getProperty("site.frontpage.weblog.handle");
 
 if (frontpageBlog != null && !"".equals(frontpageBlog.trim())) {
     // dispatch to frontpage blog
     RequestDispatcher homepage =
             
request.getRequestDispatcher("/roller-ui/rendering/page/"+frontpageBlog);
     homepage.forward(request, response);
-    return;
 } else {
-    // need to create a session before response is committed
-    request.getSession(true);
+    // dispatch to setup page
+    RequestDispatcher setuppage = 
request.getRequestDispatcher("/roller-ui/setup.rol");
+    setuppage.forward(request, response);
 }
 
-// otherwise, show the "Here's how to finish your Roller install page"
-
-%><% response.setContentType("text/html; charset=UTF-8"); %><!DOCTYPE html 
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<%@ include file="/WEB-INF/jsps/taglibs.jsp" %>
-<tiles:insert page="/WEB-INF/jsps/tiles/tiles-simplepage.jsp">
-   <tiles:put name="banner"       value="/WEB-INF/jsps/tiles/banner.jsp" />
-   <tiles:put name="bannerStatus" value="/WEB-INF/jsps/tiles/bannerStatus.jsp" 
/>
-   <tiles:put name="head"         value="/WEB-INF/jsps/tiles/head.jsp" />
-   <tiles:put name="styles"       value="/WEB-INF/jsps/tiles/empty.jsp" />
-   <tiles:put name="messages"     value="/WEB-INF/jsps/tiles/messages.jsp" />
-   <tiles:put name="content"      value="/WEB-INF/jsps/setupBody.jsp" />
-   <tiles:put name="footer"       value="/WEB-INF/jsps/tiles/footer.jsp" />
-</tiles:insert>
+%>
\ No newline at end of file

Modified: roller/trunk/web/roller-ui/authoring/editors/editor-text.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/roller-ui/authoring/editors/editor-text.jsp?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/web/roller-ui/authoring/editors/editor-text.jsp (original)
+++ roller/trunk/web/roller-ui/authoring/editors/editor-text.jsp Thu May 17 
11:30:07 2007
@@ -16,14 +16,12 @@
   directory of this distribution.
 --%>
 <%-- This page is designed to be included in edit-weblog.jsp --%>
-<%@ include file="/WEB-INF/jsps/taglibs.jsp" %>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
 
 <script type="text/javascript">
 <!--
-function postWeblogEntry(publish) {
-    if (publish)
-        document.weblogEntryFormEx.publishEntry.value = "true";
-    document.weblogEntryFormEx.submit();
+function postWeblogEntry() {
+    // no-op
 }
 function changeSize(e, num) {
     a = e.rows + num;
@@ -43,35 +41,35 @@
 </script>
 
 <%-- ===================================================================== --%>
-<p class="toplabel"><fmt:message key="weblogEdit.content" /></p>
+<p class="toplabel"><s:text name="weblogEdit.content" /></p>
 
-<html:textarea property="text" cols="75" rows="25" style="width: 100%" 
tabindex="5"/>
+<s:textarea name="bean.text" cols="75" rows="25" cssStyle="width: 100%" 
tabindex="5"/>
 <script type="text/javascript">
     <!--
     if (getCookie("editorSize1") != null) {
-        document.weblogEntryFormEx.text.rows = getCookie("editorSize1");
+        document.getElementById('entry_bean_text').rows = 
getCookie("editorSize1");
     }
     -->
 </script>
 <table style="width:100%"><tr><td align="right">
   <!-- Add buttons to make this textarea taller or shorter -->
-  <input type="button" name="taller" value=" &darr; " 
onclick="changeSize1(document.weblogEntryFormEx.text, 5)" />
-  <input type="button" name="shorter" value=" &uarr; " 
onclick="changeSize1(document.weblogEntryFormEx.text, -5)" />
+  <input type="button" name="taller" value=" &darr; " 
onclick="changeSize1(document.getElementById('entry_bean_text'), 5)" />
+  <input type="button" name="shorter" value=" &uarr; " 
onclick="changeSize1(document.getElementById('entry_bean_text'), -5)" />
 </td></tr></table>
 
 <%-- ===================================================================== --%>
-<p class="toplabel"><fmt:message key="weblogEdit.summary" /></p>
+<p class="toplabel"><s:text name="weblogEdit.summary" /></p>
 
-<html:textarea property="summary" cols="75" rows="5" style="width: 100%" 
tabindex="6"/>
+<s:textarea name="bean.summary" cols="75" rows="5" cssStyle="width: 100%" 
tabindex="6"/>
 <script type="text/javascript">
     <!--
     if (getCookie("editorSize") != null) {
-        document.weblogEntryFormEx.summary.rows = getCookie("editorSize");
+        document.getElementById('entry_bean_summary').rows = 
getCookie("editorSize");
     }
     -->
 </script>
 <table style="width:100%"><tr><td align="right">
   <!-- Add buttons to make this textarea taller or shorter -->
-  <input type="button" name="taller" value=" &darr; " 
onclick="changeSize(document.weblogEntryFormEx.summary, 5)" />
-  <input type="button" name="shorter" value=" &uarr; " 
onclick="changeSize(document.weblogEntryFormEx.summary, -5)" />
+  <input type="button" name="taller" value=" &darr; " 
onclick="changeSize(document.getElementById('entry_bean_summary'), 5)" />
+  <input type="button" name="shorter" value=" &uarr; " 
onclick="changeSize(document.getElementById('entry_bean_summary'), -5)" />
 </td></tr></table>

Modified: roller/trunk/web/roller-ui/authoring/editors/editor-xinha.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/roller-ui/authoring/editors/editor-xinha.jsp?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/web/roller-ui/authoring/editors/editor-xinha.jsp (original)
+++ roller/trunk/web/roller-ui/authoring/editors/editor-xinha.jsp Thu May 17 
11:30:07 2007
@@ -15,35 +15,33 @@
   copyright in this work, please see the NOTICE file in the top level
   directory of this distribution.
 --%>
-<%-- This page is designed to be included in edit-weblog.jsp --%>
-<%@ include file="/WEB-INF/jsps/taglibs.jsp" %>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
 
 <script type="text/javascript">
 <!--
 function postWeblogEntry() {
-    document.weblogEntryFormEx.text.value =    
xinha_editors.xe_content.getHTML().trim();
+    document.weblogEntryFormEx.text.value = 
xinha_editors.xe_content.getHTML().trim();
     document.weblogEntryFormEx.summary.value = 
xinha_editors.xe_summary.getHTML().trim();
-    document.weblogEntryFormEx.submit();
 }
 
 // (preferably absolute) URL (including trailing slash) where Xinha is 
installed
-_editor_url  = '<c:url value="/roller-ui/authoring/editors/xinha/" />' 
+_editor_url  = '<s:url value="/roller-ui/authoring/editors/xinha/" />' 
 
 // And the language we need to use in the editor.
 _editor_lang = "en"; 
 -->
 </script>
-<script type="text/javascript" src='<c:url 
value="/roller-ui/authoring/editors/xinha/htmlarea.js" />'></script>
-<script type="text/javascript" src='<c:url 
value="/roller-ui/authoring/editors/xinha/my_config.js" />'></script> 
+<script type="text/javascript" src='<s:url 
value="/roller-ui/authoring/editors/xinha/htmlarea.js" />'></script>
+<script type="text/javascript" src='<s:url 
value="/roller-ui/authoring/editors/xinha/my_config.js" />'></script> 
 <noscript><p><b>Javascript must be enabled to use this form.</b></p></noscript>
 
 <%-- ===================================================================== --%>
-<b><fmt:message key="weblogEdit.content" /></b><br />
-<html:textarea styleId="xe_content" property="text" rows="25" cols="50" 
style="width: 100%"></html:textarea>
+<b><s:text name="weblogEdit.content" /></b><br />
+<s:textarea id="xe_content" name="bean.text" rows="25" cols="50" 
cssStyle="width: 100%" />
 
 <%-- ===================================================================== --%>
-<b><fmt:message key="weblogEdit.summary" /></b><br />
-<html:textarea styleId="xe_summary" property="summary" rows="10" cols="50" 
style="width: 100%"></html:textarea>
+<b><s:text name="weblogEdit.summary" /></b><br />
+<s:textarea id="xe_summary" name="bean.summary" rows="10" cols="50" 
cssStyle="width: 100%" />
 
 
  

Modified: roller/trunk/web/roller-ui/login-redirect.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/roller-ui/login-redirect.jsp?view=diff&rev=539068&r1=539067&r2=539068
==============================================================================
--- roller/trunk/web/roller-ui/login-redirect.jsp (original)
+++ roller/trunk/web/roller-ui/login-redirect.jsp Thu May 17 11:30:07 2007
@@ -26,9 +26,9 @@
 
 if (websites.size() == 1) {
     WebsiteData website = (WebsiteData) websites.get(0);
-    
response.sendRedirect(request.getContextPath()+"/roller-ui/authoring/weblog.do?method=create&weblog="+website.getHandle());
+    
response.sendRedirect(request.getContextPath()+"/roller-ui/authoring/entryAdd.rol&weblog="+website.getHandle());
 } else {
-    
response.sendRedirect(request.getContextPath()+"/roller-ui/yourWebsites.do");
+    response.sendRedirect(request.getContextPath()+"/roller-ui/menu.rol");
 }
 
 %>


Reply via email to