mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
10205: Fix for ETWOTWO-48: Cancelled import of war into a Web project and Web Project became unusable 10206: Fix for ETWOTWO-181: Deletion of checked out document git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10680 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -303,6 +303,7 @@ edit_doc_offline=Edit offline
|
||||
edit_doc_online=Edit online
|
||||
upload_new_version=Upload new version
|
||||
checkin_this_file=Check in this file
|
||||
cannot_delete_node_has_working_copy=Cannot delete file \"{0}\" as it has an associated working copy.
|
||||
|
||||
# Properties
|
||||
username=User Name
|
||||
|
@@ -258,10 +258,10 @@
|
||||
<evaluator>org.alfresco.web.action.evaluator.DeleteDocEvaluator</evaluator>
|
||||
<label-id>delete</label-id>
|
||||
<image>/images/icons/delete.gif</image>
|
||||
<action-listener>#{BrowseBean.setupContentAction}</action-listener>
|
||||
<action>dialog:deleteFile</action>
|
||||
<action-listener>#{BrowseBean.deleteFile}</action-listener>
|
||||
<params>
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
<param name="ref">#{actionContext.nodeRef}</param>
|
||||
</params>
|
||||
</action>
|
||||
|
||||
|
@@ -35,6 +35,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.faces.application.NavigationHandler;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.event.ActionEvent;
|
||||
import javax.transaction.UserTransaction;
|
||||
@@ -2055,6 +2056,64 @@ public class BrowseBean implements IContextListener, Serializable
|
||||
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler used when a file is being deleted, checks that the node
|
||||
* does not have an associated working copy.
|
||||
*
|
||||
* @param event The event
|
||||
*/
|
||||
|
||||
public void deleteFile(ActionEvent event)
|
||||
{
|
||||
setupContentAction(event);
|
||||
|
||||
UIActionLink link = (UIActionLink)event.getComponent();
|
||||
Map<String, String> params = link.getParameterMap();
|
||||
|
||||
String ref = params.get("ref");
|
||||
if (ref != null && ref.length() > 0)
|
||||
{
|
||||
NodeRef nodeRef = new NodeRef(ref);
|
||||
|
||||
boolean hasWorkingCopy = false;
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try
|
||||
{
|
||||
// query for a working copy
|
||||
resultSet = getSearchService().query(nodeRef.getStoreRef(), SearchService.LANGUAGE_LUCENE,
|
||||
"ASPECT:\"" + ContentModel.ASPECT_WORKING_COPY.toString() +
|
||||
"\" AND +@\\{http\\://www.alfresco.org/model/content/1.0\\}" +
|
||||
ContentModel.PROP_COPY_REFERENCE.getLocalName() + ":\"" + nodeRef.toString() + "\"");
|
||||
|
||||
if (resultSet.getNodeRefs().size() != 0)
|
||||
{
|
||||
hasWorkingCopy = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (resultSet != null)
|
||||
{
|
||||
resultSet.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasWorkingCopy)
|
||||
{
|
||||
// if node has a working copy setup error message and return
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), MSG_CANNOT_DELETE_NODE_HAS_WORKING_COPY),
|
||||
new Object[] {getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME)}));
|
||||
return;
|
||||
}
|
||||
|
||||
// if there isn't a working copy go to normal delete dialog
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
|
||||
navigationHandler.handleNavigation(fc, null, "dialog:deleteFile");
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inner classes
|
||||
@@ -2135,6 +2194,7 @@ public class BrowseBean implements IContextListener, Serializable
|
||||
/** I18N messages */
|
||||
private static final String MSG_DELETE_COMPANYROOT = "delete_companyroot_confirm";
|
||||
public static final String MSG_SEARCH_MINIMUM = "search_minimum";
|
||||
private static final String MSG_CANNOT_DELETE_NODE_HAS_WORKING_COPY = "cannot_delete_node_has_working_copy";
|
||||
|
||||
/** The NodeService to be used by the bean */
|
||||
private transient NodeService nodeService;
|
||||
|
@@ -37,6 +37,26 @@
|
||||
|
||||
|
||||
<f:verbatim>
|
||||
<script type="text/javascript">
|
||||
window.onload = pageLoaded;
|
||||
|
||||
function finishButton_click()
|
||||
{
|
||||
var disable = function()
|
||||
{
|
||||
document.getElementById('dialog:ok-button').setProperty('disabled', 'disabled');
|
||||
document.getElementById('dialog:cancel-button').setProperty('disabled', 'disabled');
|
||||
}
|
||||
disable.delay(50, this);
|
||||
document.getElementById('progress').style.display='inline';
|
||||
}
|
||||
|
||||
function pageLoaded()
|
||||
{
|
||||
document.getElementById('dialog:ok-button').onclick = finishButton_click;
|
||||
}
|
||||
</script>
|
||||
|
||||
<table cellpadding="2" cellspacing="2" border="0" width="100%">
|
||||
</f:verbatim>
|
||||
<%
|
||||
|
Reference in New Issue
Block a user