Author: agilliland
Date: Thu May 17 10:53:34 2007
New Revision: 539041
URL: http://svn.apache.org/viewvc?view=rev&rev=539041
Log:
adding a new struts2 action for the setup page.
Added:
roller/trunk/src/org/apache/roller/ui/core/struts2/Setup.java
roller/trunk/web/WEB-INF/jsps/core/struts2/Setup.jsp
Modified:
roller/trunk/web/WEB-INF/classes/struts.xml
roller/trunk/web/WEB-INF/tiles.xml
Added: roller/trunk/src/org/apache/roller/ui/core/struts2/Setup.java
URL:
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/core/struts2/Setup.java?view=auto&rev=539041
==============================================================================
--- roller/trunk/src/org/apache/roller/ui/core/struts2/Setup.java (added)
+++ roller/trunk/src/org/apache/roller/ui/core/struts2/Setup.java Thu May 17
10:53:34 2007
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * 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.
+ */
+
+package org.apache.roller.ui.core.struts2;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.business.RollerFactory;
+import org.apache.roller.business.UserManager;
+import org.apache.roller.ui.core.util.struts2.UIAction;
+
+
+/**
+ * Page used to display Roller isntall instructions.
+ */
+public class Setup extends UIAction {
+
+ private static final Log log = LogFactory.getLog(Setup.class);
+
+ private long userCount = 0;
+ private long blogCount = 0;
+
+
+ public Setup() {
+ // TODO: i18n
+ this.pageTitle = "index.heading";
+ }
+
+
+ @Override
+ public boolean isUserRequired() {
+ return false;
+ }
+
+ @Override
+ public boolean isWeblogRequired() {
+ return false;
+ }
+
+
+ public String execute() {
+
+ try {
+ UserManager umgr = RollerFactory.getRoller().getUserManager();
+ setUserCount(umgr.getUserCount());
+ setBlogCount(umgr.getWeblogCount());
+ } catch (RollerException ex) {
+ log.error("Error getting user/weblog counts", ex);
+ }
+
+ return SUCCESS;
+ }
+
+
+ public long getUserCount() {
+ return userCount;
+ }
+
+ public void setUserCount(long userCount) {
+ this.userCount = userCount;
+ }
+
+ public long getBlogCount() {
+ return blogCount;
+ }
+
+ public void setBlogCount(long blogCount) {
+ this.blogCount = blogCount;
+ }
+
+}
Modified: roller/trunk/web/WEB-INF/classes/struts.xml
URL:
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/classes/struts.xml?view=diff&rev=539041&r1=539040&r2=539041
==============================================================================
--- roller/trunk/web/WEB-INF/classes/struts.xml (original)
+++ roller/trunk/web/WEB-INF/classes/struts.xml Thu May 17 10:53:34 2007
@@ -84,6 +84,11 @@
</action>
+ <action name="setup"
+ class="org.apache.roller.ui.core.struts2.Setup">
+ <result name="success" type="tiles">.Setup</result>
+ </action>
+
<action name="login"
class="org.apache.roller.ui.core.struts2.Login">
<result type="tiles">.Login</result>
Added: roller/trunk/web/WEB-INF/jsps/core/struts2/Setup.jsp
URL:
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/jsps/core/struts2/Setup.jsp?view=auto&rev=539041
==============================================================================
--- roller/trunk/web/WEB-INF/jsps/core/struts2/Setup.jsp (added)
+++ roller/trunk/web/WEB-INF/jsps/core/struts2/Setup.jsp Thu May 17 10:53:34
2007
@@ -0,0 +1,72 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. The ASF licenses this file to You
+ under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ 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.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<s:text name="index.prompt" /><br /><br />
+<div style="width:75%">
+ <ul>
+ <%--
+ Tell the user how to complete their Roller install, with
helpful
+ notes and links to the appropriate places in the Roller UI.
+ --%>
+
+ <%-- STEP 1: Create a user if you don't already have one --%>
+ <li><b><s:text name="index.createUser" />
+ <s:if test="userCount > 0"> -
+ <s:text name="index.createUserDone">
+ <s:param value="userCount" />
+ </s:text>
+ </s:if>
+ </b><br /><br />
+ <s:text name="index.createUserHelp" /><br /><br />
+ <s:text name="index.createUserBy" />
+ <a href='<s:url action="register"/>'>
+ <s:text name="index.createUserPage" />
+ </a>.
+ <br /><br /><br />
+ </li>
+
+ <%-- STEP 2: Create a weblog if you don't already have one --%>
+ <li><b><s:text name="index.createWeblog" />
+ <s:if test="blogCount > 0"> -
+ <s:text name="index.createWeblogDone">
+ <s:param value="blogCount" />
+ </s:text>
+ </s:if>
+ </b><br /><br />
+ <s:text name="index.createWeblogHelp" /><br /><br />
+ <s:text name="index.createWeblogBy" />
+ <a href='<s:url action="createWeblog"/>'>
+ <s:text name="index.createWeblogPage" />
+ </a>
+ <br /><br /><br />
+ </li>
+
+ <%-- STEP 3: Designate a weblog to be the frontpage weblot --%>
+ <li><b><s:text name="index.setFrontpage" /></b><br />
+ <br />
+ <s:text name="index.setFrontpageHelp" /><br />
+ <br />
+ <s:text name="index.setFrontpageBy" />
+ <a href='<s:url action="globalConfig" namespace="/roller-ui/admin"
/>'>
+ <s:text name="index.setFrontpagePage" />
+ </a>
+ </li>
+
+ </ul>
+</div>
Modified: roller/trunk/web/WEB-INF/tiles.xml
URL:
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/tiles.xml?view=diff&rev=539041&r1=539040&r2=539041
==============================================================================
--- roller/trunk/web/WEB-INF/tiles.xml (original)
+++ roller/trunk/web/WEB-INF/tiles.xml Thu May 17 10:53:34 2007
@@ -54,6 +54,10 @@
<!-- core pages (and associates) -->
+ <definition name=".Setup" extends=".tiles-simplepage" >
+ <put name="content" value="/WEB-INF/jsps/core/struts2/Setup.jsp" />
+ </definition>
+
<definition name=".Login" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/core/struts2/Login.jsp" />
</definition>