mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
add CancelEditingDialog for canceling online/offline editing
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8196 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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.
|
||||
|
@@ -130,6 +130,18 @@
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Cancel editing document -->
|
||||
<action id="cancelediting_doc">
|
||||
<evaluator>org.alfresco.web.action.evaluator.CancelCheckoutDocEvaluator</evaluator>
|
||||
<label-id>cancel_editing</label-id>
|
||||
<image>/images/icons/cancel_editing.gif</image>
|
||||
<action-listener>#{CancelEditingDialog.setupContentAction}</action-listener>
|
||||
<action>dialog:cancelEditing</action>
|
||||
<params>
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Done-editing document -->
|
||||
<action id="done_editing_doc">
|
||||
<evaluator>org.alfresco.web.action.evaluator.CheckinDocEvaluator</evaluator>
|
||||
@@ -978,6 +990,7 @@
|
||||
<action idref="preview_doc" />
|
||||
<action idref="update_doc" />
|
||||
<action idref="cancelcheckout_doc" />
|
||||
<action idref="cancelediting_doc" />
|
||||
<action idref="approve_doc" />
|
||||
<action idref="reject_doc" />
|
||||
<action idref="cut_node" />
|
||||
|
@@ -350,6 +350,11 @@
|
||||
icon="/images/icons/cancel_checkout_large.gif" title-id="undo_checkout_for"
|
||||
description-id="undocheckoutfile_description" />
|
||||
|
||||
<dialog name="cancelEditing" page="/jsp/coci/cancel-editing-file.jsp" managed-bean="CancelEditingDialog"
|
||||
icon="/images/icons/cancel_editing_large.gif" title-id="cancel_editing_for"
|
||||
description-id="cancel_editing_file_description" />
|
||||
|
||||
|
||||
<dialog name="checkoutFile" page="/jsp/coci/checkout-file.jsp" managed-bean="CCCheckoutFileDialog"
|
||||
icon="/images/icons/check_out_large.gif" title-id="check_out"
|
||||
description-id="checkoutfile_description" />
|
||||
|
118
source/java/org/alfresco/web/bean/coci/CancelEditingDialog.java
Normal file
118
source/java/org/alfresco/web/bean/coci/CancelEditingDialog.java
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -5465,6 +5465,20 @@
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>The bean for the Cancel Editing File Screen.</description>
|
||||
<managed-bean-name>CancelEditingDialog</managed-bean-name>
|
||||
<managed-bean-class>
|
||||
org.alfresco.web.bean.coci.CancelEditingDialog
|
||||
</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>property</property-name>
|
||||
<value>#{CCProperties}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
|
||||
<managed-bean>
|
||||
<description>The bean for the Working Copy Missing Screen.</description>
|
||||
<managed-bean-name>CCWorkingCopyMissingDialog</managed-bean-name>
|
||||
|
48
source/web/jsp/coci/cancel-editing-file.jsp
Normal file
48
source/web/jsp/coci/cancel-editing-file.jsp
Normal file
@@ -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" %>
|
||||
|
||||
<f:verbatim>
|
||||
<table cellspacing="0" cellpadding="3" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%" valign="top">
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td valign=top style="padding-top:2px" width=20></f:verbatim><h:graphicImage url="/images/icons/info_icon.gif" width="16" height="16"/><f:verbatim></td>
|
||||
<td class="mainSubText"></f:verbatim><h:outputText value="#{msg.cancel_editing_info}" /><f:verbatim></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</f:verbatim>
|
Reference in New Issue
Block a user