diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index f91123259c..2af4db2ddc 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -963,6 +963,7 @@ select_reject_step=Do you want to provide a reject step? choose_copy_move_location=Choose whether you want to move or copy the content and also the location. start_workflow=Start Advanced Workflow start_workflow_wizard=Start Advanced Workflow Wizard +start_named_workflow_wizard=Start {0} Workflow Wizard start_workflow_desc=This wizard helps you start an advanced workflow for an item in the repository. available_workflows=Available workflows step_choose_workflow=Choose Workflow @@ -1207,6 +1208,7 @@ status_space_updated=Successfully updated space ''{0}''. # Validation Messages validation_mandatory={0} is a mandatory field. validation_string_length={0} must be between {1} and {2} characters in length. +validation_is_number={0} must contain a number. validation_regex={0} is invalid. validation_regex_not_match={0} is invalid. validation_numeric_range={0} must be between {1} and {2}. diff --git a/config/alfresco/web-client-config-wizards.xml b/config/alfresco/web-client-config-wizards.xml index 1c2c1c0f07..3846908f8c 100644 --- a/config/alfresco/web-client-config-wizards.xml +++ b/config/alfresco/web-client-config-wizards.xml @@ -184,8 +184,7 @@ + description-id="start_workflow_desc" icon="/images/icons/new_workflow_large.gif"> emptyList(); this.contentNodes = Collections.emptyList(); try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} @@ -840,7 +843,7 @@ public class BrowseBean implements IContextListener catch (InvalidNodeRefException refErr) { Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}) ); + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr ); this.containerNodes = Collections.emptyList(); this.contentNodes = Collections.emptyList(); try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} diff --git a/source/java/org/alfresco/web/bean/TrashcanBean.java b/source/java/org/alfresco/web/bean/TrashcanBean.java index aa1d88f5a1..eba6e8ee2f 100644 --- a/source/java/org/alfresco/web/bean/TrashcanBean.java +++ b/source/java/org/alfresco/web/bean/TrashcanBean.java @@ -157,6 +157,8 @@ public class TrashcanBean implements IContextListener /** User filter search box text */ private String userSearchText = null; + private boolean inProgress = false; + // ------------------------------------------------------------------------------ // Bean property getters and setters @@ -784,43 +786,54 @@ public class TrashcanBean implements IContextListener */ public String recoverListedItemsOK() { - FacesContext fc = FacesContext.getCurrentInstance(); + if (inProgress == true) return null; - // restore the nodes - the user may have requested a restore to a different parent - List nodeRefs = new ArrayList(this.listedItems.size()); - for (Node node : this.listedItems) - { - nodeRefs.add(node.getNodeRef()); - } - List reports; - if (this.destination == null) - { - reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs); - } - else - { - reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null); - } + inProgress = true; - UserTransaction tx = null; try { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); + FacesContext fc = FacesContext.getCurrentInstance(); - saveReportDetail(reports); + // restore the nodes - the user may have requested a restore to a different parent + List nodeRefs = new ArrayList(this.listedItems.size()); + for (Node node : this.listedItems) + { + nodeRefs.add(node.getNodeRef()); + } + List reports; + if (this.destination == null) + { + reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs); + } + else + { + reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null); + } - tx.commit(); + UserTransaction tx = null; + try + { + tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); + tx.begin(); + + saveReportDetail(reports); + + tx.commit(); + } + catch (Throwable err) + { + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + // most exceptions will be caught and returned as RestoreNodeReport objects by the service + String reason = err.getMessage(); + String msg = MessageFormat.format( + Application.getMessage(fc, Repository.ERROR_GENERIC), reason); + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg); + fc.addMessage(null, facesMsg); + } } - catch (Throwable err) + finally { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - // most exceptions will be caught and returned as RestoreNodeReport objects by the service - String reason = err.getMessage(); - String msg = MessageFormat.format( - Application.getMessage(fc, Repository.ERROR_GENERIC), reason); - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg); - fc.addMessage(null, facesMsg); + inProgress = false; } return OUTCOME_RECOVERY_REPORT; @@ -831,38 +844,49 @@ public class TrashcanBean implements IContextListener */ public String recoverAllItemsOK() { - FacesContext fc = FacesContext.getCurrentInstance(); + if (inProgress == true) return null; - // restore all nodes - the user may have requested a restore to a different parent - List reports; - if (this.destination == null) - { - reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef()); - } - else - { - reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null); - } + inProgress = true; - UserTransaction tx = null; try { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); + FacesContext fc = FacesContext.getCurrentInstance(); - saveReportDetail(reports); + // restore all nodes - the user may have requested a restore to a different parent + List reports; + if (this.destination == null) + { + reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef()); + } + else + { + reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null); + } - tx.commit(); + UserTransaction tx = null; + try + { + tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); + tx.begin(); + + saveReportDetail(reports); + + tx.commit(); + } + catch (Throwable err) + { + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + // most exceptions will be caught and returned as RestoreNodeReport objects by the service + String reason = err.getMessage(); + String msg = MessageFormat.format( + Application.getMessage(fc, Repository.ERROR_GENERIC), reason); + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg); + fc.addMessage(null, facesMsg); + } } - catch (Throwable err) + finally { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - // most exceptions will be caught and returned as RestoreNodeReport objects by the service - String reason = err.getMessage(); - String msg = MessageFormat.format( - Application.getMessage(fc, Repository.ERROR_GENERIC), reason); - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg); - fc.addMessage(null, facesMsg); + inProgress = false; } return OUTCOME_RECOVERY_REPORT; @@ -883,6 +907,10 @@ public class TrashcanBean implements IContextListener */ public String deleteListedItemsOK() { + if (inProgress == true) return null; + + inProgress = true; + try { List nodeRefs = new ArrayList(this.listedItems.size()); @@ -897,6 +925,10 @@ public class TrashcanBean implements IContextListener Utils.addErrorMessage(MessageFormat.format(Application.getMessage( FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); } + finally + { + inProgress = false; + } return OUTCOME_DIALOGCLOSE; } @@ -906,6 +938,10 @@ public class TrashcanBean implements IContextListener */ public String deleteAllItemsOK() { + if (inProgress == true) return null; + + inProgress = true; + try { this.nodeArchiveService.purgeAllArchivedNodes(Repository.getStoreRef()); @@ -915,6 +951,10 @@ public class TrashcanBean implements IContextListener Utils.addErrorMessage(MessageFormat.format(Application.getMessage( FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); } + finally + { + inProgress = false; + } return OUTCOME_DIALOGCLOSE; } diff --git a/source/java/org/alfresco/web/bean/dialog/DialogManager.java b/source/java/org/alfresco/web/bean/dialog/DialogManager.java index abeff99b4d..f4238e9131 100644 --- a/source/java/org/alfresco/web/bean/dialog/DialogManager.java +++ b/source/java/org/alfresco/web/bean/dialog/DialogManager.java @@ -48,13 +48,27 @@ public final class DialogManager */ public void setCurrentDialog(DialogConfig config) { + // make sure the managed bean is present String beanName = config.getManagedBean(); - IDialogBean dialog = (IDialogBean)FacesHelper.getManagedBean( - FacesContext.getCurrentInstance(), beanName); - if (dialog == null) + Object bean = FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), beanName); + + if (bean == null) { - throw new AlfrescoRuntimeException("Failed to find managed bean '" + beanName + "'"); + throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName + + "' has not been defined"); + } + + // make sure the bean implements the IDialogBean interface + IDialogBean dialog = null; + if (bean instanceof IDialogBean) + { + dialog = (IDialogBean)bean; + } + else + { + throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName + + "' does not implement the required IDialogBean interface"); } // initialise the managed bean diff --git a/source/java/org/alfresco/web/bean/generator/CategorySelectorGenerator.java b/source/java/org/alfresco/web/bean/generator/CategorySelectorGenerator.java index 0e2d9e928d..00a8f9fb4f 100644 --- a/source/java/org/alfresco/web/bean/generator/CategorySelectorGenerator.java +++ b/source/java/org/alfresco/web/bean/generator/CategorySelectorGenerator.java @@ -5,6 +5,7 @@ import javax.faces.context.FacesContext; import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.ui.repo.RepoConstants; +import org.alfresco.web.ui.repo.component.UIMultiValueEditor; import org.alfresco.web.ui.repo.component.property.PropertySheetItem; import org.alfresco.web.ui.repo.component.property.UIPropertySheet; @@ -37,14 +38,29 @@ public class CategorySelectorGenerator extends BaseComponentGenerator protected void setupMandatoryValidation(FacesContext context, UIPropertySheet propertySheet, PropertySheetItem item, UIComponent component, boolean realTimeChecking, String idSuffix) { - // Override the setup of the mandatory validation - // so we can send the _selected id suffix. - // We also enable real time so the page load check disabled - // the ok button if necessary, as the control is used the - // page will be refreshed and therefore re-check the status. - - super.setupMandatoryValidation(context, propertySheet, item, - component, true, "_selected"); + if (component instanceof UIMultiValueEditor) + { + // Override the setup of the mandatory validation + // so we can send the _current_value id suffix. + // We also enable real time so the page load + // check disables the ok button if necessary, as the user + // adds or removes items from the multi value list the + // page will be refreshed and therefore re-check the status. + + super.setupMandatoryValidation(context, propertySheet, item, + component, true, "_current_value"); + } + else + { + // Override the setup of the mandatory validation + // so we can send the _selected id suffix. + // We also enable real time so the page load check disabled + // the ok button if necessary, as the control is used the + // page will be refreshed and therefore re-check the status. + + super.setupMandatoryValidation(context, propertySheet, item, + component, true, "_selected"); + } } @Override diff --git a/source/java/org/alfresco/web/bean/generator/TextFieldGenerator.java b/source/java/org/alfresco/web/bean/generator/TextFieldGenerator.java index cdbe96d52e..053438fbd8 100644 --- a/source/java/org/alfresco/web/bean/generator/TextFieldGenerator.java +++ b/source/java/org/alfresco/web/bean/generator/TextFieldGenerator.java @@ -1,5 +1,6 @@ package org.alfresco.web.bean.generator; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -12,12 +13,15 @@ import javax.faces.model.SelectItem; import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; import org.alfresco.service.cmr.dictionary.Constraint; import org.alfresco.service.cmr.dictionary.ConstraintDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.web.app.Application; import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.ui.common.ComponentConstants; import org.alfresco.web.ui.repo.component.UIMultiValueEditor; import org.alfresco.web.ui.repo.component.property.PropertySheetItem; import org.alfresco.web.ui.repo.component.property.UIPropertySheet; +import org.alfresco.web.ui.repo.component.property.UIPropertySheet.ClientValidation; /** * Generates a text field component. @@ -166,6 +170,47 @@ public class TextFieldGenerator extends BaseComponentGenerator } } + @Override + @SuppressWarnings("unchecked") + protected void setupConstraints(FacesContext context, + UIPropertySheet propertySheet, PropertySheetItem property, + PropertyDefinition propertyDef, UIComponent component) + { + // do the default processing first + super.setupConstraints(context, propertySheet, property, + propertyDef, component); + + // if the property type is a number based type and the property + // sheet is in edit mode and validation is turned, on add the + // validateIsNumber validation function + if (propertySheet.inEditMode() && propertySheet.isValidationEnabled() && + propertyDef != null) + { + // check the type of the property is a number + if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || + propertyDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) || + propertyDef.getDataType().getName().equals(DataTypeDefinition.INT) || + propertyDef.getDataType().getName().equals(DataTypeDefinition.LONG)) + { + List params = new ArrayList(3); + + // add the value parameter + String value = "document.getElementById('" + + component.getClientId(context) + "')"; + params.add(value); + + // add the validation failed message to show + String msg = Application.getMessage(context, "validation_is_number"); + addStringConstraintParam(params, + MessageFormat.format(msg, new Object[] {property.getResolvedDisplayLabel()})); + + // add the validation case to the property sheet + propertySheet.addClientValidation(new ClientValidation("validateIsNumber", + params, false)); + } + } + } + /** * Retrieves the list of values constraint for the item, if it has one * @@ -174,8 +219,8 @@ public class TextFieldGenerator extends BaseComponentGenerator * @param item The item being generated * @return The constraint if the item has one, null otherwise */ - protected ListOfValuesConstraint getListOfValuesConstraint(FacesContext context, UIPropertySheet propertySheet, - PropertySheetItem item) + protected ListOfValuesConstraint getListOfValuesConstraint(FacesContext context, + UIPropertySheet propertySheet, PropertySheetItem item) { ListOfValuesConstraint lovConstraint = null; diff --git a/source/java/org/alfresco/web/bean/repository/User.java b/source/java/org/alfresco/web/bean/repository/User.java index 99bbd61bc3..027ded644d 100644 --- a/source/java/org/alfresco/web/bean/repository/User.java +++ b/source/java/org/alfresco/web/bean/repository/User.java @@ -16,7 +16,9 @@ */ package org.alfresco.web.bean.repository; +import java.io.Serializable; import java.util.List; +import java.util.Map; import javax.faces.context.FacesContext; @@ -213,4 +215,21 @@ public final class User return prefRef; } + + /** + * Returns the full name of the user represented by the given NodeRef + * + * @param nodeService The node service instance + * @param user The user to get the full name for + * @return The full name + */ + public static String getFullName(NodeService nodeService, NodeRef user) + { + Map props = nodeService.getProperties(user); + String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME); + String lastName = (String)props.get(ContentModel.PROP_LASTNAME); + String fullName = firstName + " " + (lastName != null ? lastName : ""); + + return fullName; + } } diff --git a/source/java/org/alfresco/web/bean/wizard/WizardManager.java b/source/java/org/alfresco/web/bean/wizard/WizardManager.java index 333f236118..6d705ab83f 100644 --- a/source/java/org/alfresco/web/bean/wizard/WizardManager.java +++ b/source/java/org/alfresco/web/bean/wizard/WizardManager.java @@ -56,13 +56,27 @@ public final class WizardManager */ public void setCurrentWizard(WizardConfig config) { + // make sure the managed bean is present String beanName = config.getManagedBean(); - IWizardBean wizard = (IWizardBean)FacesHelper.getManagedBean( - FacesContext.getCurrentInstance(), beanName); - if (wizard == null) + Object bean = FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), beanName); + + if (bean == null) { - throw new AlfrescoRuntimeException("Failed to find managed bean '" + beanName + "'"); + throw new AlfrescoRuntimeException("Failed to start wizard as managed bean '" + beanName + + "' has not been defined"); + } + + // make sure the bean implements the IWizardBean interface + IWizardBean wizard = null; + if (bean instanceof IWizardBean) + { + wizard = (IWizardBean)bean; + } + else + { + throw new AlfrescoRuntimeException("Failed to start wizard as managed bean '" + beanName + + "' does not implement the required IWizardBean interface"); } // initialise the managed bean diff --git a/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java b/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java index c9c0b78964..f9176eb878 100644 --- a/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java @@ -5,6 +5,7 @@ import java.util.Map; import javax.faces.context.FacesContext; +import org.alfresco.service.cmr.workflow.WorkflowInstance; import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.dialog.BaseDialogBean; @@ -18,7 +19,7 @@ import org.apache.commons.logging.LogFactory; */ public class CancelWorkflowDialog extends BaseDialogBean { - protected String workflowInstanceId; + protected WorkflowInstance workflowInstance; protected WorkflowService workflowService; private static final Log logger = LogFactory.getLog(CancelWorkflowDialog.class); @@ -32,11 +33,17 @@ public class CancelWorkflowDialog extends BaseDialogBean super.init(parameters); // make sure the workflow instance id has been passed - this.workflowInstanceId = this.parameters.get("workflow-instance-id"); - if (this.workflowInstanceId == null || this.workflowInstanceId.length() == 0) + String workflowInstanceId = this.parameters.get("workflow-instance-id"); + if (workflowInstanceId == null || workflowInstanceId.length() == 0) { throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id"); } + + this.workflowInstance = workflowService.getWorkflowById(workflowInstanceId); + if (this.workflowInstance == null) + { + throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId); + } } @Override @@ -44,13 +51,13 @@ public class CancelWorkflowDialog extends BaseDialogBean throws Exception { if (logger.isDebugEnabled()) - logger.debug("Cancelling workflow with id: " + this.workflowInstanceId); + logger.debug("Cancelling workflow with id: " + this.workflowInstance.id); // cancel the workflow - this.workflowService.cancelWorkflow(this.workflowInstanceId); + this.workflowService.cancelWorkflow(this.workflowInstance.id); if (logger.isDebugEnabled()) - logger.debug("Cancelled workflow with id: " + this.workflowInstanceId); + logger.debug("Cancelled workflow with id: " + this.workflowInstance.id); return outcome; } @@ -67,9 +74,21 @@ public class CancelWorkflowDialog extends BaseDialogBean return false; } + @Override + public String getCancelButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), "no"); + } + + @Override + public String getFinishButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), "yes"); + } + // ------------------------------------------------------------------------------ // Bean Getters and Setters - + /** * Returns the confirmation to display to the user before deleting the content. * @@ -80,8 +99,13 @@ public class CancelWorkflowDialog extends BaseDialogBean String confirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), "cancel_workflow_confirm"); - return MessageFormat.format(confirmMsg, - new Object[] {this.parameters.get("workflow-instance-name")}); + String workflowLabel = this.workflowInstance.definition.title; + if (this.workflowInstance.description != null && this.workflowInstance.description.length() > 0) + { + workflowLabel = workflowLabel + " (" + this.workflowInstance.description + ")"; + } + + return MessageFormat.format(confirmMsg, new Object[] {workflowLabel}); } /** diff --git a/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java index 7f6a72ee46..6a9ce7be3b 100644 --- a/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java @@ -15,10 +15,6 @@ import javax.transaction.UserTransaction; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.namespace.NamespaceService; diff --git a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java index 8922ebd0f1..7425da8575 100644 --- a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java +++ b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java @@ -233,9 +233,31 @@ public class StartWorkflowWizard extends BaseWizardBean return this.nextButtonDisabled; } + @Override + public String getContainerTitle() + { + String wizTitle = null; + + ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); + String stepName = Application.getWizardManager().getCurrentStepName(); + + if ("choose-workflow".equals(stepName) == false && this.selectedWorkflow != null) + { + String titlePattern = bundle.getString("start_named_workflow_wizard"); + WorkflowDefinition workflowDef = this.workflows.get(this.selectedWorkflow); + wizTitle = MessageFormat.format(titlePattern, new Object[] {workflowDef.title}); + } + else + { + wizTitle = bundle.getString("start_workflow_wizard"); + } + + return wizTitle; + } + // ------------------------------------------------------------------------------ // Event Handlers - + /** * Prepares the dialog to allow the user to add an item to the workflow package * diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java index f90d4b369b..4e5da783fd 100644 --- a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java +++ b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java @@ -260,7 +260,6 @@ public class WorkflowBean // add the workflow instance id and name this taks belongs to node.getProperties().put("workflowInstanceId", task.path.instance.id); - node.getProperties().put("workflowInstanceName", task.path.instance.definition.title); } return node; diff --git a/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java b/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java index 92f36fcdfb..34323c25ed 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java +++ b/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java @@ -21,6 +21,7 @@ import org.alfresco.service.namespace.QName; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.repository.User; import org.alfresco.web.ui.common.component.SelfRenderingComponent; /** @@ -305,27 +306,25 @@ public class UINodeWorkflowInfo extends SelfRenderingComponent { out.write("
  • "); out.write(wi.definition.title); - if (wi.definition.description != null && wi.definition.description.length() > 0) + if (wi.description != null && wi.description.length() > 0) { - out.write(" ("); - out.write(wi.definition.description); + out.write(" ("); + out.write(wi.description); out.write(")"); } - out.write(" "); + out.write(" "); if (wi.startDate != null) { out.write(bundle.getString("started_on").toLowerCase()); out.write(" "); out.write(format.format(wi.startDate)); - out.write(" "); + out.write(" "); } if (wi.initiator != null) { out.write(bundle.getString("by")); out.write(" "); - String userName = (String)nodeService.getProperty(wi.initiator, - ContentModel.PROP_USERNAME); - out.write(userName); + out.write(User.getFullName(nodeService, wi.initiator)); out.write("."); } out.write("
  • "); diff --git a/source/java/org/alfresco/web/ui/repo/component/UIWorkflowSummary.java b/source/java/org/alfresco/web/ui/repo/component/UIWorkflowSummary.java index 955a8fac13..f8aded5c93 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UIWorkflowSummary.java +++ b/source/java/org/alfresco/web/ui/repo/component/UIWorkflowSummary.java @@ -8,11 +8,10 @@ import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; import javax.faces.el.ValueBinding; -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.workflow.WorkflowInstance; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.repository.User; import org.alfresco.web.ui.common.component.SelfRenderingComponent; /** @@ -87,20 +86,19 @@ public class UIWorkflowSummary extends SelfRenderingComponent out.write(bundle.getString("title")); out.write(":"); out.write(wi.definition.title); - out.write(""); - out.write(bundle.getString("description")); - out.write(":"); - out.write(wi.definition.description); + if (wi.definition.description != null && wi.definition.description.length() > 0) + { + out.write(" ("); + out.write(wi.definition.description); + out.write(")"); + } out.write(""); out.write(bundle.getString("initiated_by")); out.write(":"); if (wi.initiator != null) { - NodeService nodeService = Repository.getServiceRegistry( - context).getNodeService(); - String userName = (String)nodeService.getProperty( - wi.initiator, ContentModel.PROP_USERNAME); - out.write(userName); + out.write(User.getFullName(Repository.getServiceRegistry( + context).getNodeService(), wi.initiator)); } out.write(""); out.write(bundle.getString("started_on")); diff --git a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java index 026c8e88e0..3cf4ac6590 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java @@ -18,7 +18,6 @@ package org.alfresco.web.ui.repo.component.property; import java.io.IOException; -import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -47,6 +46,7 @@ import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.DataDictionary; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.repository.User; import org.alfresco.web.ui.common.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -704,12 +704,7 @@ public abstract class BaseAssociationEditor extends UIInput if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetRef))) { - //out.write((String)nodeService.getProperty(targetRef, ContentModel.PROP_USERNAME)); - Map props = nodeService.getProperties(targetRef); - String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME); - String lastName = (String)props.get(ContentModel.PROP_LASTNAME); - String fullName = firstName + " " + (lastName != null ? lastName : ""); - out.write(fullName); + out.write(User.getFullName(nodeService, targetRef)); } else { @@ -832,17 +827,13 @@ public abstract class BaseAssociationEditor extends UIInput // if the node represents a person, show the username instead of the name if (ContentModel.TYPE_PERSON.equals(nodeService.getType(item))) { - Map props = nodeService.getProperties(item); - String userName = (String)props.get(ContentModel.PROP_USERNAME); + String userName = (String)nodeService.getProperty(item, ContentModel.PROP_USERNAME); if (userName != null && (userName.equals(PermissionService.GUEST_AUTHORITY) == false)) { out.write(""); } } diff --git a/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java index dbd65eaf0d..169a05cb9f 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java @@ -33,6 +33,7 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.repository.User; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -157,7 +158,7 @@ public class UIAssociationEditor extends BaseAssociationEditor // if the node represents a person, show the username instead of the name if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode))) { - out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME)); + out.write(User.getFullName(nodeService, targetNode)); } else { diff --git a/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java index 9d693ffc36..4ecc833994 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java @@ -33,6 +33,7 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.repository.User; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -157,7 +158,7 @@ public class UIChildAssociationEditor extends BaseAssociationEditor // if the node represents a person, show the username instead of the name if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode))) { - out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME)); + out.write(User.getFullName(nodeService, targetNode)); } else { diff --git a/source/web/jsp/workflow/manage-task-dialog.jsp b/source/web/jsp/workflow/manage-task-dialog.jsp index aaaeb662f5..68f8ff50db 100644 --- a/source/web/jsp/workflow/manage-task-dialog.jsp +++ b/source/web/jsp/workflow/manage-task-dialog.jsp @@ -41,7 +41,7 @@ rendered="#{not empty DialogManager.bean.resources}"> <%-- Name column --%> - + @@ -54,7 +54,7 @@ <%-- Description column --%> - + @@ -62,7 +62,7 @@ <%-- Path column --%> - + @@ -71,7 +71,7 @@ <%-- Created Date column --%> - + @@ -81,7 +81,7 @@ <%-- Modified Date column --%> - + @@ -91,25 +91,13 @@ <%-- Actions column --%> - + - - <%-- Completed column --%> - <%-- - - - - - - - - - --%> diff --git a/source/web/jsp/workflow/tasks-completed-dashlet.jsp b/source/web/jsp/workflow/tasks-completed-dashlet.jsp index f7e2b59cb3..87b422232c 100644 --- a/source/web/jsp/workflow/tasks-completed-dashlet.jsp +++ b/source/web/jsp/workflow/tasks-completed-dashlet.jsp @@ -14,7 +14,7 @@ <%-- Primary column for details view mode --%> - + - <%-- Task id column --%> + <%-- Task type --%> - + - + - <%-- Task type --%> - + <%-- Task id column --%> + - + - + <%-- Source column --%> - + - + - <%-- Created Date column --%> - + - + - + <%-- Completed date column --%> - + - + - + <%-- Outcome column --%> - + - + - + <%-- Actions column --%> - + - + - diff --git a/source/web/jsp/workflow/tasks-todo-dashlet.jsp b/source/web/jsp/workflow/tasks-todo-dashlet.jsp index 8f5543483b..be2f84d44c 100644 --- a/source/web/jsp/workflow/tasks-todo-dashlet.jsp +++ b/source/web/jsp/workflow/tasks-todo-dashlet.jsp @@ -14,7 +14,7 @@ <%-- Primary column for details view mode --%> - + - <%-- Task id column --%> + <%-- Task type --%> - + - + - - <%-- Task type --%> - + + <%-- Task id column --%> + - + - + <%-- Source column --%> - + - + - <%-- Created Date column --%> - + - + - + <%-- Due date column --%> - + - + - + <%-- Status column --%> - + - + - + <%-- Priority column --%> - + - + - + <%-- Actions column --%> - + - + - diff --git a/source/web/jsp/workflow/view-completed-task-dialog.jsp b/source/web/jsp/workflow/view-completed-task-dialog.jsp index a40a0f9d79..3c97d2c8b7 100644 --- a/source/web/jsp/workflow/view-completed-task-dialog.jsp +++ b/source/web/jsp/workflow/view-completed-task-dialog.jsp @@ -41,7 +41,7 @@ rendered="#{not empty DialogManager.bean.resources}"> <%-- Name column --%> - + @@ -54,7 +54,7 @@ <%-- Description column --%> - + @@ -62,7 +62,7 @@ <%-- Path column --%> - + @@ -71,7 +71,7 @@ <%-- Created Date column --%> - + @@ -81,7 +81,7 @@ <%-- Modified Date column --%> - + diff --git a/source/web/scripts/validation.js b/source/web/scripts/validation.js index c7ba9fe046..be31a382e1 100644 --- a/source/web/scripts/validation.js +++ b/source/web/scripts/validation.js @@ -52,6 +52,24 @@ function validateNumberRange(control, min, max, message, showMessage) return result; } +/** + * Ensures the value of the 'control' is a number. + * + * @return true if the value is a number + */ +function validateIsNumber(control, message, showMessage) +{ + var result = true; + + if (isNaN(control.value)) + { + informUser(control, message, showMessage); + result = false; + } + + return result; +} + /** * Ensures the value of the 'control' has a string length more than 'min' and less than 'max'. *