diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index a3df611ac0..f385768192 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1361,6 +1361,7 @@ deployed_to_servers=Deployed To no_deploy_attempts=There are no deployment attempts to display in this date range. no_deploy_reports=Deployment details cannot be found, this is probably because the deployment is still progressing, refresh this page until details appear. port_must_be_number=Port must contain a number. +host_wrong_format=Hostname is not a valid format. edit_deploy_server=Edit Deployment Server Details delete_deploy_server=Delete Deployment Server no_deploy_servers=No deployment servers have been configured. @@ -1705,6 +1706,7 @@ in_progress=In Progress by=by assignee=Assignee comment=Comment +invalid_task=The task being viewed is no longer valid, it has probably been completed by another user. # Workflow Definitions wf_review_options=Review Options diff --git a/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java index d613aa0620..e389c2fab8 100644 --- a/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java @@ -261,6 +261,20 @@ public class EditContentPropertiesDialog extends BaseDialogBean @Override protected String formatErrorMessage(Throwable exception) { + if(editableNode != null) + { + + // special case for Mimetype - since this is a sub-property of the ContentData object + // we must extract it so it can be edited in the client, then we check for it later + // and create a new ContentData object to wrap it and it's associated URL + ContentData content = (ContentData)this.editableNode.getProperties().get(ContentModel.PROP_CONTENT); + if (content != null) + { + this.editableNode.getProperties().put(TEMP_PROP_MIMETYPE, content.getMimetype()); + this.editableNode.getProperties().put(TEMP_PROP_ENCODING, content.getEncoding()); + } + } + if (exception instanceof FileExistsException) { return MessageFormat.format(Application.getMessage( diff --git a/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java b/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java index 8922d0925c..c51ed0a538 100644 --- a/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java @@ -82,20 +82,22 @@ public class RevertSelectedDialog extends BaseDialogBean String userSandboxId = this.avmBrowseBean.getSandbox(); List selected = this.avmBrowseBean.getSelectedSandboxItems(); - - List relativePaths = new ArrayList(selected.size()); - for (AVMNodeDescriptor node : selected) + if (selected != null && selected.size() > 0) { - relativePaths.add(AVMUtil.getStoreRelativePath(node.getPath())); + List relativePaths = new ArrayList(selected.size()); + for (AVMNodeDescriptor node : selected) + { + relativePaths.add(AVMUtil.getStoreRelativePath(node.getPath())); + } + + getSandboxService().revertList(userSandboxId, relativePaths); + + String msg = MessageFormat.format(Application.getMessage( + context, MSG_REVERTSELECTED_SUCCESS), this.avmBrowseBean.getUsername()); + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); + context.addMessage(AVMBrowseBean.FORM_ID + ':' + AVMBrowseBean.COMPONENT_SANDBOXESPANEL, facesMsg); } - getSandboxService().revertList(userSandboxId, relativePaths); - - String msg = MessageFormat.format(Application.getMessage( - context, MSG_REVERTSELECTED_SUCCESS), this.avmBrowseBean.getUsername()); - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); - context.addMessage(AVMBrowseBean.FORM_ID + ':' + AVMBrowseBean.COMPONENT_SANDBOXESPANEL, facesMsg); - return outcome; } diff --git a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java index 9eacffe7c2..429359f0a0 100644 --- a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java @@ -49,6 +49,7 @@ import org.alfresco.service.cmr.workflow.WorkflowInstance; import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.cmr.workflow.WorkflowTask; import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition; +import org.alfresco.service.cmr.workflow.WorkflowTaskState; import org.alfresco.service.cmr.workflow.WorkflowTransition; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; @@ -179,6 +180,14 @@ public class ManageTaskDialog extends BaseDialogBean if (LOGGER.isDebugEnabled()) LOGGER.debug("Saving task: " + this.getWorkflowTask().id); + // before updating the task still exists and is not completed + WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id); + if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED) + { + Utils.addErrorMessage(Application.getMessage(context, "invalid_task")); + return outcome; + } + // prepare the edited parameters for saving Map params = WorkflowUtil.prepareTaskParams(this.taskNode); @@ -224,10 +233,17 @@ public class ManageTaskDialog extends BaseDialogBean if (this.transitions != null) { + Object hiddenTransitions = this.taskNode.getProperties().get(WorkflowModel.PROP_HIDDEN_TRANSITIONS); for (WorkflowTransition trans : this.transitions) { - buttons.add(new DialogButtonConfig(ID_PREFIX + trans.title, trans.title, null, - "#{DialogManager.bean.transition}", "false", null)); + if (hiddenTransitions == null || + (hiddenTransitions instanceof String && ((String)hiddenTransitions).equals("")) || + (hiddenTransitions instanceof String && !((String)hiddenTransitions).equals(trans.id)) || + (hiddenTransitions instanceof List) && !((List)hiddenTransitions).contains(trans.id)) + { + buttons.add(new DialogButtonConfig(ID_PREFIX + trans.title, trans.title, null, + "#{DialogManager.bean.transition}", "false", null)); + } } } } @@ -274,6 +290,15 @@ public class ManageTaskDialog extends BaseDialogBean LOGGER.debug("Taking ownership of task: " + this.getWorkflowTask().id); FacesContext context = FacesContext.getCurrentInstance(); + + // before taking ownership check the task still exists and is not completed + WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id); + if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED) + { + Utils.addErrorMessage(Application.getMessage(context, "invalid_task")); + return outcome; + } + UserTransaction tx = null; try @@ -314,6 +339,14 @@ public class ManageTaskDialog extends BaseDialogBean LOGGER.debug("Returning ownership of task to pool: " + this.getWorkflowTask().id); FacesContext context = FacesContext.getCurrentInstance(); + // before returning ownership check the task still exists and is not completed + WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id); + if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED) + { + Utils.addErrorMessage(Application.getMessage(context, "invalid_task")); + return outcome; + } + UserTransaction tx = null; try @@ -351,10 +384,18 @@ public class ManageTaskDialog extends BaseDialogBean if (LOGGER.isDebugEnabled()) LOGGER.debug("Transitioning task: " + this.getWorkflowTask().id); + // before transitioning check the task still exists and is not completed + FacesContext context = FacesContext.getCurrentInstance(); + WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id); + if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED) + { + Utils.addErrorMessage(Application.getMessage(context, "invalid_task")); + return outcome; + } + // to find out which transition button was pressed we need // to look for the button's id in the request parameters, // the first non-null result is the button that was pressed. - FacesContext context = FacesContext.getCurrentInstance(); Map reqParams = context.getExternalContext().getRequestParameterMap(); String selectedTransition = null; diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java index 72b1a30cda..51df3a5101 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java @@ -160,9 +160,12 @@ public class UIDeploymentServers extends UIInput tx.begin(); String contextPath = context.getExternalContext().getRequestContextPath(); - out.write("\n\n\n"); + + out.write("\n"); out.write("
"); diff --git a/source/web/scripts/ajax/deployment.js b/source/web/scripts/ajax/deployment.js index 2da2cbfe57..bf432ce92a 100644 --- a/source/web/scripts/ajax/deployment.js +++ b/source/web/scripts/ajax/deployment.js @@ -140,6 +140,7 @@ Alfresco.validateDeployConfig = function() var valid = true; var port = document.getElementById('wizard:wizard-body:deployServerPort'); + var localhost = document.getElementById('wizard:wizard-body:deployServerHost'); if (port != null && port.value.length > 0) { @@ -151,6 +152,16 @@ Alfresco.validateDeployConfig = function() } } + if (localhost != null && localhost.value.length > 0) + { + if(!localhost.value.test(/^[A-Za-z0-9][A-Za-z0-9\.\-]*$/)) + { + alert(MSG_HOST_WRONG_FORMAT); + localhost.focus(); + valid = false; + } + } + return valid; } else