From edc31cf75c40e058bf8b39c5bce56f5278da265f Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Wed, 16 Aug 2006 13:27:35 +0000 Subject: [PATCH] - Rule and action tasks for 1.4 - Updated W/S include paths git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3526 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 4 ++ config/alfresco/web-client-config-actions.xml | 7 +++ .../web/bean/rules/CreateRuleWizard.java | 24 ++++++++- .../web/bean/rules/EditRuleWizard.java | 1 + .../alfresco/web/bean/rules/RulesBean.java | 49 +++++++++++++++++++ source/web/jsp/dialog/rules.jsp | 33 ++++++++++++- source/web/jsp/rules/details.jsp | 10 ++++ 7 files changed, 125 insertions(+), 3 deletions(-) diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 8e492a9219..f2fffa3db6 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -234,6 +234,9 @@ advanced_space_wizard=Advanced Space Wizard create_rule=Create Rule reapply_rules=Reapply Rules reapply_rules_success=The rules have been successfully reapplied. +ignore_inherited_rules=Ignore Inherited Rules +include_inherited_rules=Include Inherited Rules +inherited_rules_being_ignored=Inherited rules are being ignored. manage_rules=Manage Content Rules manage_users=Manage System Users manage_groups=Manage User Groups @@ -677,6 +680,7 @@ condition_contains_hints=Hints condition_contains_hints_desc=Use zz* to match any name that begins with zz; use *.txt to match any text file; use *zz* to match any file name that contains zz anywhere including the beginning or end. apply_to_sub_spaces=Apply rule to sub spaces run_in_background=Run rule in background +rule_disabled=Disable rule not=Not click_set_and_add=Click to set values and add to list click_add_to_list=Click to add to list diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index 80ca1668cd..c6a6467ef7 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -480,6 +480,12 @@ #{RulesBean.reapplyRules} + + + + /images/icons/reapply_rules.gif + #{RulesBean.ignoreInheritedRules} + @@ -622,6 +628,7 @@ + diff --git a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java index c8aa4a726a..1b8be56344 100644 --- a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java +++ b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java @@ -68,6 +68,7 @@ public class CreateRuleWizard extends BaseActionWizard protected boolean runInBackground; protected boolean applyToSubSpaces; protected boolean editingCondition; + protected boolean ruleDisabled; private static final Log logger = LogFactory.getLog(CreateRuleWizard.class); @@ -85,6 +86,7 @@ public class CreateRuleWizard extends BaseActionWizard this.condition = null; this.applyToSubSpaces = false; this.runInBackground = false; + this.ruleDisabled = false; this.conditions = null; this.allConditionsProperties = new ArrayList>(); @@ -192,12 +194,13 @@ public class CreateRuleWizard extends BaseActionWizard String backgroundYesNo = this.runInBackground ? bundle.getString("yes") : bundle.getString("no"); String subSpacesYesNo = this.applyToSubSpaces ? bundle.getString("yes") : bundle.getString("no"); + String ruleDisabledYesNo = this.ruleDisabled ? bundle.getString("yes") : bundle.getString("no"); return buildSummary( new String[] {bundle.getString("rule_type"), bundle.getString("name"), bundle.getString("description"), - bundle.getString("apply_to_sub_spaces"), bundle.getString("run_in_background"), + bundle.getString("apply_to_sub_spaces"), bundle.getString("run_in_background"), bundle.getString("rule_disabled"), bundle.getString("conditions"), bundle.getString("actions")}, - new String[] {this.type, this.title, this.description, subSpacesYesNo, backgroundYesNo, + new String[] {this.type, this.title, this.description, subSpacesYesNo, backgroundYesNo, ruleDisabledYesNo, conditionsSummary.toString(), actionsSummary.toString()}); } @@ -455,6 +458,22 @@ public class CreateRuleWizard extends BaseActionWizard this.applyToSubSpaces = applyToSubSpaces; } + /** + * @return Returns whether the rule is disabled or not. + */ + public boolean getRuleDisabled() + { + return this.ruleDisabled; + } + + /** + * @param ruleDisabled Sets whether the rule is disabled or not + */ + public void setRuleDisabled(boolean ruleDisabled) + { + this.ruleDisabled = ruleDisabled; + } + /** * @return Returns the type. */ @@ -668,6 +687,7 @@ public class CreateRuleWizard extends BaseActionWizard rule.setDescription(this.description); rule.applyToChildren(this.applyToSubSpaces); rule.setExecuteAsynchronously(this.runInBackground); + rule.setRuleDisabled(this.ruleDisabled); CompositeAction compositeAction = this.actionService.createCompositeAction(); rule.setAction(compositeAction); diff --git a/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java b/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java index f1a199b2da..bd4e13059e 100644 --- a/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java +++ b/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java @@ -52,6 +52,7 @@ public class EditRuleWizard extends CreateRuleWizard this.description = rule.getDescription(); this.applyToSubSpaces = rule.isAppliedToChildren(); this.runInBackground = rule.getExecuteAsynchronously(); + this.ruleDisabled = rule.getRuleDisabled(); FacesContext context = FacesContext.getCurrentInstance(); diff --git a/source/java/org/alfresco/web/bean/rules/RulesBean.java b/source/java/org/alfresco/web/bean/rules/RulesBean.java index 18cf3a5bf1..2a45f58c61 100644 --- a/source/java/org/alfresco/web/bean/rules/RulesBean.java +++ b/source/java/org/alfresco/web/bean/rules/RulesBean.java @@ -29,6 +29,7 @@ import javax.transaction.UserTransaction; import org.alfresco.model.ContentModel; import org.alfresco.repo.action.executer.ExecuteAllRulesActionExecuter; +import org.alfresco.repo.rule.RuleModel; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.repository.NodeRef; @@ -57,6 +58,8 @@ public class RulesBean implements IContextListener { private static final String MSG_ERROR_DELETE_RULE = "error_delete_rule"; private static final String MSG_REAPPLY_RULES_SUCCESS = "reapply_rules_success"; + private static final String MSG_IGNORE_INHERTIED_RULES = "ignore_inherited_rules"; + private static final String MSG_INCLUDE_INHERITED_RULES = "include_inherited_rules"; private static final String LOCAL = "local"; private static final String INHERITED = "inherited"; @@ -200,6 +203,52 @@ public class RulesBean implements IContextListener } } + /** + * Gets the label id from the ignore inhertied action + * + * @return the message id + */ + public String getIgnoreInheritedRulesLabelId() + { + FacesContext fc = FacesContext.getCurrentInstance(); + String result = Application.getMessage(fc, MSG_IGNORE_INHERTIED_RULES); + + if (this.nodeService.hasAspect(this.getSpace().getNodeRef(), RuleModel.ASPECT_IGNORE_INHERITED_RULES) == true) + { + result = Application.getMessage(fc, MSG_INCLUDE_INHERITED_RULES); + } + return result; + } + + public boolean getIgnoreInheritedRules() + { + return this.nodeService.hasAspect(this.getSpace().getNodeRef(), RuleModel.ASPECT_IGNORE_INHERITED_RULES); + } + + /** + * Action listener to ignore (or include) inherited rules. + * + * @param event the action event object + */ + public void ignoreInheritedRules(ActionEvent event) + { + NodeRef nodeRef = this.getSpace().getNodeRef(); + if (this.nodeService.hasAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES) == true) + { + this.nodeService.removeAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES); + } + else + { + this.nodeService.addAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + } + + // force the list to be re-queried when the page is refreshed + if (this.richList != null) + { + this.richList.setValue(null); + } + } + /** * Returns the current rule * diff --git a/source/web/jsp/dialog/rules.jsp b/source/web/jsp/dialog/rules.jsp index 4cc77466e7..e6ed79ef71 100644 --- a/source/web/jsp/dialog/rules.jsp +++ b/source/web/jsp/dialog/rules.jsp @@ -102,7 +102,38 @@ - + + + + <%-- infomation panel --%> + + + + + + + + + + <%PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc");%> +
+ + + + + + + +
+ <%PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner");%> +
+ + + +
+ + + <%-- Details --%> diff --git a/source/web/jsp/rules/details.jsp b/source/web/jsp/rules/details.jsp index 235d878755..1f03e9e4e1 100644 --- a/source/web/jsp/rules/details.jsp +++ b/source/web/jsp/rules/details.jsp @@ -104,6 +104,16 @@ + + + + + + + + + +