diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 352f7dffef..99211fa217 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -2148,5 +2148,9 @@ description_date_field_part3=for more information. wiki_reference_part1=For a more complete reference, please refer to the wiki_reference_part2=wiki. +msg_err_invalid_launch_date_on_submit=The launch date has already passed. Please choose a later launch date. +msg_err_invalid_expiration_date_on_submit=The expiration date(s) has already passed. Please choose a later date of expiration for the listed documents: {0} +msg_err_pattern_invalid_expiration_date_on_submit=Please select an expiration date(s) that is later than the launch date for the listed documents: {0} + # Team properties team_login_warning=The requested Alfresco Explorer page is unsupported. Access this page only at the direction of Alfresco Support. diff --git a/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java b/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java index c856f61814..f041f54d71 100644 --- a/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java +++ b/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java @@ -22,6 +22,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; @@ -96,9 +97,14 @@ public class AddUsersDialog extends BaseDialogBean protected String finishImpl(FacesContext context, String outcome) throws Exception { // add each selected user to the current group in turn + Set containedAuthorities = getAuthService().getContainedAuthorities(null, this.group, true); for (UserAuthorityDetails wrapper : this.usersForGroup) { - this.getAuthService().addAuthority(this.group, wrapper.getAuthority()); + String user = wrapper.getAuthority(); + if (!containedAuthorities.contains(user)) + { + this.getAuthService().addAuthority(this.group, user); + } } return outcome; diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java index e7e3ea4585..00bb637e82 100644 --- a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java @@ -19,6 +19,7 @@ package org.alfresco.web.bean.wcm; import java.io.Serializable; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -83,6 +84,10 @@ public class SubmitDialog extends BaseDialogBean private static final String MSG_DELETED_ITEM = "avm_node_deleted"; private static final String MSG_ERR_WORKFLOW_CONFIG = "submit_workflow_config_error"; + public static final String MSG_ERR_INVALID_LAUNCH_DATE = "msg_err_invalid_launch_date_on_submit"; + public static final String MSG_ERR_INVALID_EXPIRATION_DATE = "msg_err_invalid_expiration_date_on_submit"; + public static final String MSG_ERR_PATTERN_INVALID_EXPIRATION_DATE = "msg_err_pattern_invalid_expiration_date_on_submit"; + private String comment; private String label; private String[] workflowSelectedValue; @@ -340,6 +345,63 @@ public class SubmitDialog extends BaseDialogBean relativePaths.add(AVMUtil.getStoreRelativePath(wrapper.getDescriptor().getPath())); } + Date currentDate = new Date(); + if (launchDate !=null) + { + if (launchDate.before(currentDate)) + { + Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_INVALID_LAUNCH_DATE)); + return null; + } + } + + if ((submitItems != null) && (!submitItems.isEmpty()) && (expirationDates != null) && (!expirationDates.isEmpty())) + { + StringBuilder errorMessage = new StringBuilder(); + byte errFlag = 0; + for (ItemWrapper wrapper : submitItems) + { + String key = wrapper.descriptor.getPath(); + Date expiritionDate = expirationDates.get(key); + if (expiritionDate != null) + { + if (launchDate != null) + { + if (expiritionDate.before(launchDate)) + { + errFlag = 1; + errorMessage.append(wrapper.descriptor.getName()).append(", "); + } + } + else + { + if (expiritionDate.before(currentDate)) + { + errorMessage.append(wrapper.descriptor.getName()).append(", "); + errFlag = 2; + } + } + } + } + if (errorMessage.length()>0) + { + errorMessage.delete(errorMessage.length()-2, errorMessage.length()); + } + switch (errFlag) + { + case 1: + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, MSG_ERR_PATTERN_INVALID_EXPIRATION_DATE), errorMessage.toString())); + return null; + } + case 2: + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, MSG_ERR_INVALID_EXPIRATION_DATE), errorMessage.toString())); + return null; + } + } + } + final String sbStoreId = this.avmBrowseBean.getSandbox(); String submitLabel = this.label; diff --git a/source/java/org/alfresco/web/data/Sort.java b/source/java/org/alfresco/web/data/Sort.java index ec4c58e921..b0d1e1a0ff 100644 --- a/source/java/org/alfresco/web/data/Sort.java +++ b/source/java/org/alfresco/web/data/Sort.java @@ -189,7 +189,8 @@ public abstract class Sort } else { - s_logger.warn("Unsupported sort data type: " + returnType + " defaulting to .toString()"); + if (s_logger.isDebugEnabled()) + s_logger.debug("Unsupported sort data type: " + returnType + " defaulting to .toString()"); this.comparator = new SimpleComparator(); bknownType = false; } @@ -339,7 +340,7 @@ public abstract class Sort if (obj1 == null && obj2 == null) return 0; if (obj1 == null) return -1; if (obj2 == null) return 1; - return ((String)obj1).compareToIgnoreCase((String)obj2); + return (obj1.toString()).compareToIgnoreCase(obj2.toString()); } }