You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/06/29 21:15:35 UTC
svn commit: r418118 - in /incubator/roller/branches/roller_3.0:
src/org/apache/roller/ui/core/ web/ web/WEB-INF/ web/WEB-INF/jsps/admin/
web/WEB-INF/jsps/tiles/
Author: agilliland
Date: Thu Jun 29 12:15:35 2006
New Revision: 418118
URL: http://svn.apache.org/viewvc?rev=418118&view=rev
Log:
part of Atlas work, EOLing the old main.do page and enabling the frontpage blog.
- modified the index.jsp file to forward to the frontpage blog.
- EOLed old main.do struts action, it just sends a 301 redirect now.
- removed old tiles defs and jsps for main displaying main page.
- also cleaned up old search results jsp which isn't used anymore.
Removed:
incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/admin/main-sidebar.jsp
incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/admin/main.jsp
incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/tiles/footerMain.jsp
incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/tiles/head-main.jsp
incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/tiles/searchResults.jsp
Modified:
incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/MainPageAction.java
incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml
incubator/roller/branches/roller_3.0/web/index.jsp
Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/MainPageAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/MainPageAction.java?rev=418118&r1=418117&r2=418118&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/MainPageAction.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/MainPageAction.java Thu Jun 29 12:15:35 2006
@@ -1,147 +1,51 @@
/*
-* 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;
+ * 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.
+ */
-import java.util.Date;
-import java.util.List;
+package org.apache.roller.ui.core;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
-import org.apache.roller.RollerException;
-import org.apache.roller.config.RollerRuntimeConfig;
-import org.apache.roller.model.Roller;
-import org.apache.roller.model.RollerFactory;
-import org.apache.roller.model.WeblogManager;
-import org.apache.roller.pojos.WeblogEntryData;
/**
- * Main page action for Roller.
+ * Old main page action for Roller. This action is no longer functional
+ * and instead just sends a 301 redirect to the application root which is
+ * the true homepage now.
+ *
* @struts.action name="main" path="/main" scope="request"
- * @struts.action-forward name="main.page" path=".main"
*/
public class MainPageAction extends Action {
- private static Log mLogger =
- LogFactory.getFactory().getInstance(MainPageAction.class);
- /**
- * Loads model and forwards to main.page.
- */
- public ActionForward execute(
- ActionMapping mapping, ActionForm form,
- HttpServletRequest req, HttpServletResponse res)
+ public ActionForward execute(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
throws Exception {
- RollerContext rctx = RollerContext.getRollerContext();
-
- req.setAttribute("version",rctx.getRollerVersion());
- req.setAttribute("buildTime",rctx.getRollerBuildTime());
- req.setAttribute("baseURL", rctx.getContextUrl(req));
-
- MainPageData model = new MainPageData(req, res, mapping);
- req.setAttribute("model", model);
- req.setAttribute("data", model);
-
- // Determines if register new sers
- boolean allowNewUsers =
- RollerRuntimeConfig.getBooleanProperty("users.registration.enabled");
- java.security.Principal prince = req.getUserPrincipal();
- if (prince != null) {
- req.setAttribute("loggedIn",Boolean.TRUE);
- req.setAttribute("userName",prince.getName());
- } else if (allowNewUsers) {
- req.setAttribute("allowNewUsers",Boolean.TRUE);
- }
- req.setAttribute("leftPage","/theme/status.jsp");
+ // send an HTTP 301 response
+ response.setStatus(response.SC_MOVED_PERMANENTLY);
+ response.setHeader("Location", request.getContextPath()+"/");
- return mapping.findForward("main.page");
- }
-
- /**
- * Page model.
- */
- public static class MainPageData extends BasePageModel {
- private HttpServletRequest mRequest = null;
-
- public MainPageData(
- HttpServletRequest req,
- HttpServletResponse res,
- ActionMapping mapping) {
- super("dummyTitleKey", req, res, mapping);
- mRequest = req;
- }
-
- /**
- * Get list of most popular websites in terms of day hits.
- * @param num Number of entries to return (takes effect on next cache refresh)
- */
- public List getPopularWebsites(int num) throws RollerException {
- List list = null;
- mLogger.debug("Refreshing popular websites list");
- Roller roller = RollerFactory.getRoller();
- list = roller.getRefererManager().getDaysPopularWebsites(0, num);
- return list;
- }
-
- /**
- * Get list of recent weblog entries.
- * @param num Number of entries to return (takes effect on next cache refresh)
- */
- public List getRecentWeblogEntries(int num) throws RollerException {
- List list = null;
- try {
- mLogger.debug("Refreshing recent entries list");
- Roller roller = RollerFactory.getRoller();
- list = roller.getWeblogManager().getWeblogEntries(
- null, // userName
- null,
- null, // startDate
- new Date(), // endDate
- null, // catName
- WeblogEntryData.PUBLISHED, // status
- null, // sortby (null for pubTime)
- 0, num); // maxEntries
- } catch (Exception e) {
- mLogger.error(e);
- }
- return list;
- }
-
- /**
- * Get list of recent weblog pinned entries
- * @param num Number of entries to return (takes effect on next cache refresh)
- */
- public List getWeblogEntriesPinnedToMain(int num) throws RollerException {
- List list = null;
- mLogger.debug("Refreshing pinned entries list");
- Roller roller = RollerFactory.getRoller();
- list = roller.getWeblogManager()
- .getWeblogEntriesPinnedToMain(new Integer(num));
- return list;
- }
+ return null;
}
+
}
Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml?rev=418118&r1=418117&r2=418118&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml Thu Jun 29 12:15:35 2006
@@ -72,12 +72,6 @@
<put name="menu" value="/WEB-INF/jsps/tiles/menu-admin.jsp" />
</definition>
-<definition name=".main" extends=".tiles-frontpage" >
- <put name="content" value="/WEB-INF/jsps/admin/main.jsp" />
- <put name="head" value="/WEB-INF/jsps/tiles/head-main.jsp" />
- <put name="sidebar" value="/WEB-INF/jsps/admin/main-sidebar.jsp" />
-</definition>
-
<definition name=".planet" extends=".tiles-frontpage" >
<put name="content" value="/WEB-INF/jsps/admin/planet.jsp" />
<put name="head" value="/WEB-INF/jsps/admin/head-planet.jsp" />
@@ -87,6 +81,11 @@
<!-- main menu pages (and associates) -->
+<definition name=".login" extends=".tiles-simplepage" >
+ <put name="banner" value="/WEB-INF/jsps/tiles/banner.jsp" />
+ <put name="content" value="/WEB-INF/jsps/loginBody.jsp" />
+</definition>
+
<definition name=".YourWebsites" extends=".tiles-mainmenupage" >
<put name="content" value="/WEB-INF/jsps/authoring/YourWebsites.jsp" />
<put name="sidebar" value="/WEB-INF/jsps/authoring/YourWebsitesSidebar.jsp" />
@@ -96,19 +95,17 @@
<definition name=".YourProfile" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/authoring/YourProfile.jsp" />
</definition>
+
<definition name=".CreateWebsite" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/authoring/CreateWebsite.jsp" />
</definition>
<definition name=".CreateWebsiteDone" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/authoring/CreateWebsiteDone.jsp" />
</definition>
+
<definition name=".welcome" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/authoring/welcome.jsp" />
</definition>
-<definition name=".search" extends=".tiles-simplepage" >
- <put name="content" value="/WEB-INF/jsps/tiles/searchResults.jsp" />
- <put name="banner" value="/WEB-INF/jsps/tiles/banner.jsp" />
-</definition>
<!-- weblog editor pages (and associates) -->
@@ -260,12 +257,7 @@
</definition>
-<!-- Misc login and error pages -->
-
-<definition name=".login" extends=".tiles-simplepage" >
- <put name="banner" value="/WEB-INF/jsps/tiles/banner.jsp" />
- <put name="content" value="/WEB-INF/jsps/loginBody.jsp" />
-</definition>
+<!-- error pages -->
<definition name=".denied" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/denied.jsp" />
@@ -278,9 +270,6 @@
</definition>
<definition name=".error404" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/error404.jsp" />
-</definition>
-<definition name=".loginerror" extends=".tiles-simplepage" >
- <put name="content" value="/login.jsp?error=true" />
</definition>
</tiles-definitions>
Modified: incubator/roller/branches/roller_3.0/web/index.jsp
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/index.jsp?rev=418118&r1=418117&r2=418118&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/index.jsp (original)
+++ incubator/roller/branches/roller_3.0/web/index.jsp Thu Jun 29 12:15:35 2006
@@ -1,4 +1,4 @@
-<!--
+<%--
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
@@ -14,6 +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 language="java" %>
-<jsp:forward page="main.do?rmik=tabbedmenu.main&rmk=tabbedmenu.main" />
\ No newline at end of file
+--%><%@ page import="org.apache.roller.config.RollerRuntimeConfig" %><%
+
+// lets see if we have a frontpage blog
+String frontpageBlog =
+ RollerRuntimeConfig.getProperty("site.frontpage.weblog.handle");
+
+if(frontpageBlog == null || frontpageBlog.equals("")) {
+ // not set yet, so show the new install page
+ response.setContentType("text/plain");
+ response.getWriter().println("frontpage blog not set");
+} else {
+ // dispatch to frontpage blog
+ RequestDispatcher homepage =
+ request.getRequestDispatcher("/roller-ui/rendering/page/"+frontpageBlog);
+ homepage.forward(request, response);
+}
+
+%>
\ No newline at end of file