diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 707aba7ab0..0ea4fa836c 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -104,6 +104,7 @@ linkdetails_description=View the details about the link object. previewdocument_description=Preview the content or space within a Template. spacedetails_description=View the details about the space. undocheckoutfile_description=Cancel the check out of a document and discard any changes. +cancel_editing_file_description=Cancel editing of a document and discard any changes. updatefile_description=Update a document on the repository with content from your computer. editfile_description=Edit the content of the file. editfileinline_description=Edit the content of the document, then click Save. @@ -342,6 +343,7 @@ checkin=Check In checkout=Check Out checkout_document=Check out this document undocheckout=Undo Check Out +cancel_editing=Cancel File Editing delete_space=Delete Space delete_file=Delete File delete_rule=Delete Rule @@ -646,6 +648,8 @@ download_complete=When the download is complete, click OK. undo_checkout_for=Undo Check Out for undo_checkout=Undo Check Out undo_checkout_info=If you undo the check out of a document, the associated working copy will be deleted and all changes to it since the Check Out will be lost. +cancel_editing_for=Cancel Editing for +cancel_editing_info=If you cancel editing of a document, the associated working copy will be deleted and all changes to it since the Check Out will be lost. complete=complete working_copy_for=Working copy for working_copy_missing_info=The working copy is no longer available. This could be due to an active rule(s) applied to the space you checked-out to. diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index eb5106cad4..d03e16bd4d 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -129,6 +129,18 @@ #{actionContext.id} + + + + org.alfresco.web.action.evaluator.CancelCheckoutDocEvaluator + cancel_editing + /images/icons/cancel_editing.gif + #{CancelEditingDialog.setupContentAction} + dialog:cancelEditing + + #{actionContext.id} + + @@ -978,6 +990,7 @@ + diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 6925c0050b..e35bb04cd9 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -350,6 +350,11 @@ icon="/images/icons/cancel_checkout_large.gif" title-id="undo_checkout_for" description-id="undocheckoutfile_description" /> + + + diff --git a/source/java/org/alfresco/web/bean/coci/CancelEditingDialog.java b/source/java/org/alfresco/web/bean/coci/CancelEditingDialog.java new file mode 100644 index 0000000000..0fa0f07547 --- /dev/null +++ b/source/java/org/alfresco/web/bean/coci/CancelEditingDialog.java @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.coci; + +import javax.faces.context.FacesContext; + +import org.alfresco.model.ContentModel; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.ui.common.Utils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class CancelEditingDialog extends CheckinCheckoutDialog +{ + public static final String LBL_CANCEL_EDITING = "cancel_editing"; + public static final String MSG_CANCEL_EDITING_FOR = "cancel_editing_for"; + + private static Log logger = LogFactory.getLog(CheckinCheckoutDialog.class); + + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + return undoCheckoutFile(context, outcome); + } + + @Override + public String getContainerTitle() + { + + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CANCEL_EDITING_FOR) + " '" + property.getDocument().getName() + "'"; + } + + @Override + public boolean getFinishButtonDisabled() + { + return false; + } + + @Override + public String getFinishButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CANCEL_EDITING); + + } + + /** + * Action to undo the checkout of a locked document. This document may + * either by the original copy or the working copy node. Therefore calculate + * which it is, if the working copy is found then we simply cancel checkout + * on that document. If the original copy is found then we need to find the + * appropriate working copy and perform the action on that node. + */ + public String undoCheckoutFile(FacesContext context, String outcome) + { + Node node = property.getDocument(); + if (node != null) + { + try + { + if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY)) + { + this.property.getVersionOperationsService().cancelCheckout(node.getNodeRef()); + } + else if (node.hasAspect(ContentModel.ASPECT_LOCKABLE)) + { + // TODO: find the working copy for this document and cancel + // the checkout on it + // is this possible? as currently only the workingcopy + // aspect has the copyReference + // attribute - this means we cannot find out where the copy + // is to cancel it! + // can we construct an XPath node lookup? + throw new RuntimeException("NOT IMPLEMENTED"); + } + else + { + throw new IllegalStateException("Node supplied for undo checkout has neither Working Copy or Locked aspect!"); + } + + resetState(); + } + catch (Throwable err) + { + Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), MSG_ERROR_CANCELCHECKOUT) + err.getMessage(), err); + } + } + else + { + logger.warn("WARNING: undoCheckout called without a current WorkingDocument!"); + } + + return outcome; + } + +} diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index a11ebcd12e..a1827bb23c 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -5465,6 +5465,20 @@ + + The bean for the Cancel Editing File Screen. + CancelEditingDialog + + org.alfresco.web.bean.coci.CancelEditingDialog + + session + + property + #{CCProperties} + + + + The bean for the Working Copy Missing Screen. CCWorkingCopyMissingDialog diff --git a/source/web/jsp/coci/cancel-editing-file.jsp b/source/web/jsp/coci/cancel-editing-file.jsp new file mode 100644 index 0000000000..b92ec428fa --- /dev/null +++ b/source/web/jsp/coci/cancel-editing-file.jsp @@ -0,0 +1,48 @@ +<%-- + * Copyright (C) 2005-2007 Alfresco Software Limited. + + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %> + + + + + +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %> +
+
\ No newline at end of file