Author: gmazza
Date: Wed Aug 28 02:48:43 2013
New Revision: 1518056
URL: http://svn.apache.org/r1518056
Log:
ROL-929 Add a resignation confirmation page.
Added:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MemberResign.java
roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MemberResign.jsp
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/MainMenu.java
roller/trunk/app/src/main/resources/ApplicationResources.properties
roller/trunk/app/src/main/resources/struts.xml
roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/MainMenu.jsp
roller/trunk/app/src/main/webapp/WEB-INF/tiles.xml
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/MainMenu.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/MainMenu.java?rev=1518056&r1=1518055&r2=1518056&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/MainMenu.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/MainMenu.java
Wed Aug 28 02:48:43 2013
@@ -99,31 +99,7 @@ public class MainMenu extends UIAction {
return SUCCESS;
}
-
-
- public String resign() {
- try {
- UserManager umgr =
WebloggerFactory.getWeblogger().getUserManager();
- WeblogManager wmgr =
WebloggerFactory.getWeblogger().getWeblogManager();
- Weblog weblog = wmgr.getWeblog(getWebsiteId());
- String handle = weblog.getHandle();
- // TODO ROLLER_2.0: notify website members that user has resigned
- // TODO EXCEPTIONS: better exception handling
- umgr.revokeWeblogPermission(weblog, getAuthenticatedUser(),
WeblogPermission.ALL_ACTIONS);
- WebloggerFactory.getWeblogger().flush();
- addMessage("yourWebsites.resigned", handle);
-
- } catch (WebloggerException ex) {
- log.error("Error doing weblog resign - "+getWebsiteId(), ex);
- // TODO: i18n
- addError("resignation failed.");
- }
-
- return SUCCESS;
- }
-
-
public List getExistingPermissions() {
try {
UserManager mgr = WebloggerFactory.getWeblogger().getUserManager();
Added:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MemberResign.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MemberResign.java?rev=1518056&view=auto
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MemberResign.java
(added)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MemberResign.java
Wed Aug 28 02:48:43 2013
@@ -0,0 +1,77 @@
+/*
+ * 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.weblogger.ui.struts2.editor;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.UserManager;
+import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
+import org.apache.roller.weblogger.ui.struts2.util.UIAction;
+
+/**
+ * Action for resigning from a weblog.
+ */
+public class MemberResign extends UIAction {
+
+ private static Log log = LogFactory.getLog(MemberResign.class);
+
+ public MemberResign() {
+ this.actionName = "memberResign";
+ this.desiredMenu = "editor";
+ this.pageTitle = "yourWebsites.resign";
+ }
+
+ public List<String> requiredWeblogPermissionActions() {
+ return Collections.singletonList(WeblogPermission.EDIT_DRAFT);
+ }
+
+ public boolean isWeblogRequired() {
+ return false;
+ }
+
+ /**
+ * Show member resign confirmation
+ */
+ public String execute() {
+ return INPUT;
+ }
+
+ /**
+ * Resign from a weblog
+ */
+ public String resign() {
+ try {
+ UserManager umgr =
WebloggerFactory.getWeblogger().getUserManager();
+ // TODO: notify website members that user has resigned
+ // TODO EXCEPTIONS: better exception handling
+ umgr.revokeWeblogPermission(getActionWeblog(),
getAuthenticatedUser(), WeblogPermission.ALL_ACTIONS);
+ WebloggerFactory.getWeblogger().flush();
+ addMessage("yourWebsites.resigned", getWeblog());
+ } catch (WebloggerException ex) {
+ log.error("Error doing weblog resign - " +
getActionWeblog().getHandle(), ex);
+ // TODO: i18n
+ addError("Resignation failed.");
+ }
+ return SUCCESS;
+ }
+}
Modified: roller/trunk/app/src/main/resources/ApplicationResources.properties
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources.properties?rev=1518056&r1=1518055&r2=1518056&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources.properties
(original)
+++ roller/trunk/app/src/main/resources/ApplicationResources.properties Wed Aug
28 02:48:43 2013
@@ -2417,7 +2417,7 @@ yourWebsites.tableDescription=Descriptio
yourWebsites.select=Select
yourWebsites.resign=Resign
yourWebsites.permission=Permission
-yourWebsites.confirmResignation=Are you sure you wish to resign from weblog
+yourWebsites.confirmResignation=Are you sure you wish to resign from weblog
[{0}]?
yourWebsites.notAllowed=Not allowed
yourWebsites.weblog=Link
yourWebsites.description=Description
Modified: roller/trunk/app/src/main/resources/struts.xml
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/struts.xml?rev=1518056&r1=1518055&r2=1518056&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/struts.xml (original)
+++ roller/trunk/app/src/main/resources/struts.xml Wed Aug 28 02:48:43 2013
@@ -468,7 +468,14 @@
<result name="disabled" type="tiles">.disabled</result>
<result name="success" type="chain">members</result>
</action>
-
+
+ <action name="memberResign!*" method="{1}"
+
class="org.apache.roller.weblogger.ui.struts2.editor.MemberResign">
+ <result name="input" type="tiles">.MemberResign</result>
+ <result name="error" type="chain">menu</result>
+ <result name="success" type="chain">menu</result>
+ </action>
+
<action name="pings!*" method="{1}"
class="org.apache.roller.weblogger.ui.struts2.editor.Pings">
<result name="list" type="tiles">.Pings</result>
Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/MainMenu.jsp
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/MainMenu.jsp?rev=1518056&r1=1518055&r2=1518056&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/MainMenu.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/MainMenu.jsp Wed Aug 28
02:48:43 2013
@@ -157,8 +157,8 @@
<%-- don't allow last admin to resign from blog --%>
<s:if test='!(#perms.hasAction("admin") &&
#perms.weblog.adminUserCount == 1)'>
<img src='<c:url value="/images/delete.png"/>' />
- <s:url action="menu!resign" id="resignWeblog">
- <s:param name="websiteId"
value="#perms.weblog.id" />
+ <s:url action="memberResign"
namespace="/roller-ui/authoring" id="resignWeblog">
+ <s:param name="weblog"
value="#perms.weblog.handle" />
</s:url>
<a href='<s:property value="resignWeblog" />'>
<s:text name='yourWebsites.resign' />
Added: roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MemberResign.jsp
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MemberResign.jsp?rev=1518056&view=auto
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MemberResign.jsp
(added)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MemberResign.jsp Wed
Aug 28 02:48:43 2013
@@ -0,0 +1,37 @@
+<%--
+ 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" %>
+
+<p>
+ <s:text name="yourWebsites.confirmResignation">
+ <s:param value="weblog" />
+ </s:text>
+</p>
+
+<table>
+<tr>
+<td>
+ <s:form action="memberResign!resign">
+ <s:hidden name="salt" />
+ <s:hidden name="weblog" />
+ <s:submit value="%{getText('application.yes')}" />
+ <s:submit value="%{getText('application.no')}" action="menu"/>
+ </s:form>
+</td>
+</tr>
+</table>
Modified: roller/trunk/app/src/main/webapp/WEB-INF/tiles.xml
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/tiles.xml?rev=1518056&r1=1518055&r2=1518056&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/tiles.xml (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/tiles.xml Wed Aug 28 02:48:43 2013
@@ -451,7 +451,12 @@
<put-attribute name="content"
value="/WEB-INF/jsps/editor/MembersInvite.jsp" />
<put-attribute name="styles"
value="/WEB-INF/jsps/tiles/css-nosidebar.jsp" />
</definition>
-
+
+ <definition name=".MemberResign" extends=".tiles-tabbedpage" >
+ <put-attribute name="content"
value="/WEB-INF/jsps/editor/MemberResign.jsp" />
+ <put-attribute name="styles"
value="/WEB-INF/jsps/tiles/css-nosidebar.jsp" />
+ </definition>
+
<definition name=".Pings" extends=".tiles-tabbedpage" >
<put-attribute name="content" value="/WEB-INF/jsps/editor/Pings.jsp" />
</definition>