diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 634a4a5dd2..7a3b17f1eb 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -688,6 +688,7 @@ encoding=Encoding encoding_utf8=UTF-8 rule_type=Rule Type rule_background_info=If this option is selected the rule will execute in the background so the results may not appear immediately. +selected_recipients=Select email recipients # New Space Wizard messages new_space_title=New Space Wizard diff --git a/source/java/org/alfresco/web/bean/wizard/BaseActionWizard.java b/source/java/org/alfresco/web/bean/wizard/BaseActionWizard.java index a71ccf360b..b5b5e42c38 100644 --- a/source/java/org/alfresco/web/bean/wizard/BaseActionWizard.java +++ b/source/java/org/alfresco/web/bean/wizard/BaseActionWizard.java @@ -23,6 +23,9 @@ import java.util.List; import java.util.Map; import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.faces.model.DataModel; +import javax.faces.model.ListDataModel; import javax.faces.model.SelectItem; import org.alfresco.config.Config; @@ -50,6 +53,8 @@ import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.web.app.Application; @@ -57,6 +62,7 @@ import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; +import org.alfresco.web.ui.common.component.UIGenericPicker; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -100,9 +106,13 @@ public abstract class BaseActionWizard extends AbstractWizardBean // new rule/action wizard specific properties protected boolean multiActionMode = false; protected String action; + protected ActionService actionService; protected DictionaryService dictionaryService; protected MimetypeService mimetypeService; + protected PersonService personService; + protected AuthorityService authorityService; + protected List actions; protected List transformers; protected List imageTransformers; @@ -112,8 +122,18 @@ public abstract class BaseActionWizard extends AbstractWizardBean protected Map actionDescriptions; protected Map currentActionProperties; protected List objectTypes; - /** cache of email templates that last 10 seconds - enough for a couple of page refreshes */ - protected ExpiringValueCache> cachedTemplates = new ExpiringValueCache>(1000*10); + /** cache of email templates that last 30 seconds - enough for a few page refreshes */ + protected ExpiringValueCache> cachedTemplates = new ExpiringValueCache>(1000*30); + + /** datamodel for table of selected email recipients */ + protected DataModel emailRecipientsDataModel; + + /** selected email recipients */ + protected List emailRecipients; + + + // ------------------------------------------------------------------------------ + // Wizard implementation /** * Initialises the wizard @@ -126,6 +146,8 @@ public abstract class BaseActionWizard extends AbstractWizardBean this.users = null; this.actions = null; this.actionDescriptions = null; + this.emailRecipientsDataModel = null; + this.emailRecipients = new ArrayList(4); this.currentActionProperties = new HashMap(3); @@ -321,14 +343,20 @@ public abstract class BaseActionWizard extends AbstractWizardBean } else if (this.action.equals(MailActionExecuter.NAME)) { + // add the person(s) it's going to as a list of authorities + List recipients = new ArrayList(emailRecipients.size()); + for (int i=0; i recipients = (List)actionProps.get(MailActionExecuter.PARAM_TO_MANY); + if (recipients != null && recipients.size() != 0) + { + // rebuild the list of RecipientWrapper objects from the stored action + for (String authority : recipients) + { + this.emailRecipients.add( + new RecipientWrapper(displayLabelForAuthority(authority), authority)); + } + } + } + + NodeRef templateRef = (NodeRef)actionProps.get(MailActionExecuter.PARAM_TEMPLATE); + if (templateRef != null) + { + this.currentActionProperties.put(PROP_TEMPLATE, templateRef.getId()); + } } else if (this.action.equals(ImporterActionExecuter.NAME)) { @@ -474,6 +525,10 @@ public abstract class BaseActionWizard extends AbstractWizardBean } } + + // ------------------------------------------------------------------------------ + // Bean Getters and Setters + /** * @return Returns the selected action */ @@ -503,7 +558,7 @@ public abstract class BaseActionWizard extends AbstractWizardBean /** * Sets the dictionary service * - * @param dictionaryService the dictionary service + * @param dictionaryService The dictionary service */ public void setDictionaryService(DictionaryService dictionaryService) { @@ -513,13 +568,46 @@ public abstract class BaseActionWizard extends AbstractWizardBean /** * Sets the mimetype service * - * @param mimetypeService The mimetype service + * @param mimetypeService The mimetype service */ public void setMimetypeService(MimetypeService mimetypeService) { this.mimetypeService = mimetypeService; } + + /** + * @param personService The personService to set. + */ + public void setPersonService(PersonService personService) + { + this.personService = personService; + } + + /** + * @param authorityService The authorityService to set. + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + /** + * Returns the properties for email recipients JSF DataModel + * + * @return JSF DataModel wrapping the current email recipients + */ + public DataModel getEmailRecipientsDataModel() + { + if (this.emailRecipientsDataModel == null) + { + this.emailRecipientsDataModel = new ListDataModel(); + } + + this.emailRecipientsDataModel.setWrappedData(this.emailRecipients); + + return this.emailRecipientsDataModel; + } + /** * @return Returns the list of selectable actions */ @@ -989,4 +1077,112 @@ public abstract class BaseActionWizard extends AbstractWizardBean return templates; } + + + // ------------------------------------------------------------------------------ + // Action event handlers + + /** + * Action handler called when the Add button is pressed to add an email recipient + */ + public void addRecipient(ActionEvent event) + { + UIGenericPicker picker = (UIGenericPicker)event.getComponent(); + String[] results = picker.getSelectedResults(); + if (results != null && results.length != 0) + { + for (String authority : results) + { + // first check the authority has not already been added to the list + boolean alreadyAdded = false; + for (int i=0; irulesBean #{RulesBean} + + personService + #{PersonService} + + + authorityService + #{AuthorityService} + @@ -507,6 +515,14 @@ mimetypeService #{MimetypeService} + + personService + #{PersonService} + + + authorityService + #{AuthorityService} + diff --git a/source/web/jsp/wizard/create-action/action-email.jsp b/source/web/jsp/wizard/create-action/action-email.jsp index f67cba1739..c71076599f 100644 --- a/source/web/jsp/wizard/create-action/action-email.jsp +++ b/source/web/jsp/wizard/create-action/action-email.jsp @@ -1,241 +1,274 @@ -<%-- - Copyright (C) 2005 Alfresco, Inc. - - Licensed under the Mozilla Public License version 1.1 - with a permitted attribution clause. You may obtain a - copy of the License at - - http://www.alfresco.org/legal/license.txt - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - either express or implied. See the License for the specific - language governing permissions and limitations under the - License. ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> - - - - - - - - - <%-- load a bundle of properties with I18N strings --%> - - - - - <%-- Main outer table --%> - - - <%-- Title bar --%> - - - - - <%-- Main area --%> - - <%-- Shelf --%> - - - <%-- Work Area --%> - - -
- <%@ include file="../../parts/titlebar.jsp" %> -
- <%@ include file="../../parts/shelf.jsp" %> - - - <%-- Breadcrumb --%> - <%@ include file="../../parts/breadcrumb.jsp" %> - - <%-- Status and Actions --%> - - - - - - - <%-- separator row with gradient shadow --%> - - - - - - - <%-- Details --%> - - - - - - - <%-- separator row with bottom panel graphics --%> - - - - - - -
- - <%-- Status and Actions inner contents table --%> - <%-- Generally this consists of an icon, textual summary and actions for the current object --%> - - - - - -
- -
-
''
-
- -
- - - - - - - - -
- <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> -
- - - - - - <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> -
- - - - <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
: -  * -
: - -
: - <%-- Templates drop-down selector --%> - - - -
: - - - -
- <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> -
- <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> - - - - - - - - - - - - - - -
- -
- -
- -
- -
- <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> -
-
-
- -
- -
- +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../../parts/titlebar.jsp" %> +
+ <%@ include file="../../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
+
''
+
+ +
+ + + + + + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> +
+ + + + + + <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+ + + + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- Picker to select Users/Groups --%> + + + + + + + + + + + + +
: +  * +
: + +
: + <%-- Templates drop-down selector --%> + + + +
+ +
: + + + + + + + + + + + + + + + + + + + +
+
+
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+
+ +
+ +
+
\ No newline at end of file diff --git a/source/web/jsp/wizard/new-rule/action-email.jsp b/source/web/jsp/wizard/new-rule/action-email.jsp index 44218ef0d0..9cd1570165 100644 --- a/source/web/jsp/wizard/new-rule/action-email.jsp +++ b/source/web/jsp/wizard/new-rule/action-email.jsp @@ -39,8 +39,7 @@ function checkButtonState() { - if (document.getElementById("new-rule-email:subject").value.length == 0 || - document.getElementById("new-rule-email:address").value.length == 0) + if (document.getElementById("new-rule-email:subject").value.length == 0) { document.getElementById("new-rule-email:ok-button").disabled = true; } @@ -131,9 +130,8 @@ : -  * +  * @@ -143,7 +141,7 @@ : + rows="4" cols="75" /> @@ -159,13 +157,46 @@ + + + + <%-- Picker to select Users/Groups --%> + + + + + : - - - + + + + + + + + + + + + + + + + + + + +
+