From: <ap...@vh...> - 2005-08-29 05:29:17
|
Author: apevec Date: 2005-08-29 07:20:48 +0200 (Mon, 29 Aug 2005) New Revision: 729 Modified: ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig.java ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties ccm-cms/trunk/src/com/arsdigita/cms/enterprise.init ccm-cms/trunk/src/com/arsdigita/cms/installer/ContentSectionSetup.java Log: Default Task Alert configuration is moved out of enterprise.init in a new registry parameter: com.arsdigita.cms.default_task_alerts to make it easier to reconfigure default workflow alerts behviour. Modified: ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig.java 2005-08-29 05:18:32 UTC (rev 728) +++ ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig.java 2005-08-29 05:20:48 UTC (rev 729) @@ -91,6 +91,7 @@ private final Parameter m_publishLifecycleListenerClass; private final Parameter m_notifyAuthorOnLifecycle; private final Parameter m_saveTextCleansWordTags; + private final Parameter m_defaultTaskAlerts; /** * Do not instantiate this class directly. @@ -116,6 +117,14 @@ PublishToFile.class, PublishToFileListener.class); + m_defaultTaskAlerts = new StringArrayParameter + ("com.arsdigita.cms.default_task_alerts", + Parameter.REQUIRED, new String[] { + "Authoring:enable:finish:rollback", + "Approval:enable:finish:rollback", + "Deploy:enable:finish:rollback" } + ); + // XXX these are probably temporary parameters, as the // item/template resolvers will be determined by the successor // to SectionInitializer. However, it still may be useful to @@ -243,6 +252,7 @@ register(m_publishLifecycleListenerClass); register(m_notifyAuthorOnLifecycle); register(m_saveTextCleansWordTags); + register(m_defaultTaskAlerts); loadInfo(); } @@ -351,6 +361,10 @@ return ((Boolean) get(m_saveTextCleansWordTags)).booleanValue(); } + public final String[] getDefaultTaskAlerts() { + return (String[]) get(m_defaultTaskAlerts); + } + private class SpecificClassParameter extends ClassParameter { private Class m_requiredClass; Modified: ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties 2005-08-29 05:18:32 UTC (rev 728) +++ ccm-cms/trunk/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties 2005-08-29 05:20:48 UTC (rev 729) @@ -122,3 +122,10 @@ com.arsdigita.cms.save_text_cleans_word_tags.purpose=Wether the Wysiwyg editor should clear the text of MSWord tags, everytime the user clicks on 'Save' com.arsdigita.cms.save_text_cleans_word_tags.example=false com.arsdigita.cms.save_text_cleans_word_tags.format=[boolean] + + +com.arsdigita.cms.default_task_alerts.title=Default task alerts +com.arsdigita.cms.default_task_alerts.purpose=Define for each task type on which workflow actions alert notifications are generated +com.arsdigita.cms.default_task_alerts.example=Authoring:enable:finish:rollback,Approval:enable:finish:rollback,Deploy:enable:finish:rollback +com.arsdigita.cms.default_task_alerts.format=[string,string,string] + Modified: ccm-cms/trunk/src/com/arsdigita/cms/enterprise.init =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/enterprise.init 2005-08-29 05:18:32 UTC (rev 728) +++ ccm-cms/trunk/src/com/arsdigita/cms/enterprise.init 2005-08-29 05:20:48 UTC (rev 729) @@ -129,17 +129,20 @@ // changes. There are four action types for each task type: enable, // disable, finish, and rollback. Note that the values below are // based on the task labels, and as such are not globalized. - taskAlerts = { - { "Authoring", - { "enable", "finish", "rollback" } - }, - { "Approval", - { "enable", "finish", "rollback" } - }, - { "Deploy", - { "enable", "finish", "rollback" } - } - }; + // + // Default value (site-wide) is handled via the parameter + // com.arsdigita.cms.default_task_alerts. + // taskAlerts = { + // { "Authoring", + // { "enable", "finish", "rollback" } + // }, + // { "Approval", + // { "enable", "finish", "rollback" } + // }, + // { "Deploy", + // { "enable", "finish", "rollback" } + // } + // }; // Parameters controlling Overdue Task alerts: @@ -158,15 +161,15 @@ maxAlerts = 5; // default value (site-wide) is handled via the parameter - // com.arsdigita.cms.ContentSectionConfig.default_item_resolver_class. - // section-specific override cna be added here. only uncomment if + // com.arsdigita.cms.default_item_resolver_class. + // section-specific override can be added here. only uncomment if // you are changing from the default for a specific content section // Name of the item resolver class. This class must implement com.arsdigita.cms.dispatcher.ItemResolver. //itemResolverClass = "com.arsdigita.cms.dispatcher.MultilingualItemResolver"; // default value (site-wide) is handled via the parameter - // com.arsdigita.cms.ContentSectionConfig.default_template_resolver_class. - // section-specific override cna be added here. only uncomment if + // com.arsdigita.cms.default_template_resolver_class. + // section-specific override can be added here. only uncomment if // you are changing from the default for a specific content section // Name of the template resolver class. This class must implement com.arsdigita.cms.dispatcher.TemplateResolver. //templateResolverClass = "com.arsdigita.cms.dispatcher.DefaultTemplateResolver"; Modified: ccm-cms/trunk/src/com/arsdigita/cms/installer/ContentSectionSetup.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/installer/ContentSectionSetup.java 2005-08-29 05:18:32 UTC (rev 728) +++ ccm-cms/trunk/src/com/arsdigita/cms/installer/ContentSectionSetup.java 2005-08-29 05:20:48 UTC (rev 729) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * Copyright (C) 2003-2005 Red Hat Inc. All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -18,6 +18,24 @@ */ package com.arsdigita.cms.installer; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Date; +import java.util.EmptyStackException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Stack; +import java.util.StringTokenizer; +import java.util.Timer; + +import org.apache.log4j.Logger; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.DefaultHandler; + import com.arsdigita.categorization.Category; import com.arsdigita.categorization.RootCategoryCollection; import com.arsdigita.cms.ContentSection; @@ -36,11 +54,9 @@ import com.arsdigita.domain.DomainObject; import com.arsdigita.initializer.InitializationException; import com.arsdigita.kernel.ACSObjectInstantiator; -import com.arsdigita.kernel.EmailAddress; import com.arsdigita.kernel.Party; import com.arsdigita.kernel.PartyCollection; import com.arsdigita.kernel.Role; -import com.arsdigita.kernel.User; import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.persistence.DataObject; @@ -49,20 +65,6 @@ import com.arsdigita.web.ApplicationSetup; import com.arsdigita.workflow.simple.WorkflowTemplate; import com.arsdigita.xml.XML; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Date; -import java.util.EmptyStackException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Stack; -import java.util.Timer; -import org.apache.log4j.Logger; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.DefaultHandler; /** * Sets up the content section. @@ -509,11 +511,25 @@ } public void loadAlertPrefs(List tasks) { - Iterator taskIter = null; - if (tasks != null) { - taskIter = tasks.iterator(); - } - if (taskIter != null) { + if (tasks == null) { + // fallback to default com.arsdigita.cms.default_task_alerts registry parameter + String[] defaultTaskAlerts = ContentSection.getConfig().getDefaultTaskAlerts(); + if (defaultTaskAlerts != null) { + for (int i=0,n=defaultTaskAlerts.length; i<n; i++) { + StringTokenizer tok = new StringTokenizer(defaultTaskAlerts[i],":"); + try { + String taskName = tok.nextToken(); + while (tok.hasMoreTokens()) { + String operation = tok.nextToken(); + CMSTask.addAlert(m_section, taskName, operation); + } + } catch (NoSuchElementException nsee) { + s_log.warn("Invalid task alerts definition"); + } + } + } + } else { + Iterator taskIter = tasks.iterator(); while (taskIter.hasNext()) { List oneTask = (List) taskIter.next(); String taskName = (String) oneTask.get(0); |