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:
Gavin Cornwell
2008-09-03 11:22:46 +00:00
parent 14a172a3d0
commit 81ff6bba16
4 changed files with 85 additions and 4 deletions

View File

@@ -302,7 +302,8 @@ label=Label
edit_doc_offline=Edit offline edit_doc_offline=Edit offline
edit_doc_online=Edit online edit_doc_online=Edit online
upload_new_version=Upload new version upload_new_version=Upload new version
checkin_this_file=Check in this file 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 # Properties
username=User Name username=User Name

View File

@@ -258,10 +258,10 @@
<evaluator>org.alfresco.web.action.evaluator.DeleteDocEvaluator</evaluator> <evaluator>org.alfresco.web.action.evaluator.DeleteDocEvaluator</evaluator>
<label-id>delete</label-id> <label-id>delete</label-id>
<image>/images/icons/delete.gif</image> <image>/images/icons/delete.gif</image>
<action-listener>#{BrowseBean.setupContentAction}</action-listener> <action-listener>#{BrowseBean.deleteFile}</action-listener>
<action>dialog:deleteFile</action>
<params> <params>
<param name="id">#{actionContext.id}</param> <param name="id">#{actionContext.id}</param>
<param name="ref">#{actionContext.nodeRef}</param>
</params> </params>
</action> </action>

View File

@@ -35,6 +35,7 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.faces.application.NavigationHandler;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent; import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
@@ -43,7 +44,7 @@ import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService; import org.alfresco.config.ConfigService;
import org.alfresco.model.ApplicationModel; import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.SearcherException; import org.alfresco.repo.search.SearcherException;
import org.alfresco.repo.web.scripts.FileTypeImageUtils; import org.alfresco.repo.web.scripts.FileTypeImageUtils;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -2055,7 +2056,65 @@ public class BrowseBean implements IContextListener, Serializable
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome); 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 // Inner classes
@@ -2135,6 +2194,7 @@ public class BrowseBean implements IContextListener, Serializable
/** I18N messages */ /** I18N messages */
private static final String MSG_DELETE_COMPANYROOT = "delete_companyroot_confirm"; private static final String MSG_DELETE_COMPANYROOT = "delete_companyroot_confirm";
public static final String MSG_SEARCH_MINIMUM = "search_minimum"; 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 */ /** The NodeService to be used by the bean */
private transient NodeService nodeService; private transient NodeService nodeService;

View File

@@ -37,6 +37,26 @@
<f:verbatim> <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%"> <table cellpadding="2" cellspacing="2" border="0" width="100%">
</f:verbatim> </f:verbatim>
<% <%