- 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
This commit is contained in:
Roy Wetherall
2006-08-16 13:27:35 +00:00
parent 5bea6b9727
commit edc31cf75c
7 changed files with 125 additions and 3 deletions

View File

@@ -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

View File

@@ -480,6 +480,12 @@
<action-listener>#{RulesBean.reapplyRules}</action-listener>
</action>
<!-- Ignore Inherited Rules -->
<action id="ignore-inherited-rules">
<label>#{RulesBean.ignoreInheritedRulesLabelId}</label>
<image>/images/icons/reapply_rules.gif</image>
<action-listener>#{RulesBean.ignoreInheritedRules}</action-listener>
</action>
<!-- the 'action-group' elements define unique blocks of actions that reference the actions
as defined above and can override or supply display elements for the group of actions -->
@@ -622,6 +628,7 @@
<!-- Actions Menu for Manage Rules screen -->
<action-group id="rules_actions_menu">
<action idref="reapply-rules" />
<action idref="ignore-inherited-rules" />
</action-group>
</actions>

View File

@@ -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<Map<String, Serializable>>();
@@ -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);

View File

@@ -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();

View File

@@ -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
*

View File

@@ -102,7 +102,38 @@
<tr>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_7.gif" width="4" height="9"></td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_8.gif)"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_9.gif" width="4" height="9"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_6.gif" width="4" height="9"></td>
</tr>
<%-- infomation panel --%>
<tr>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
<td>
<h:panelGroup rendered="#{RulesBean.ignoreInheritedRules}">
<tr height='5'><td></td></tr>
<tr>
<td>
<f:verbatim>
<%PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc");%>
<table><tr><td>
</f:verbatim>
<h:graphicImage url="/images/icons/info_icon.gif" />
<f:verbatim>
</td><td>
</f:verbatim>
<h:outputText value="#{msg.inherited_rules_being_ignored}" />
<f:verbatim>
</td></tr></table>
<%PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner");%>
</f:verbatim>
</td>
</tr>
<tr height='5'><td></td></tr>
</h:panelGroup>
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
</tr>
<%-- Details --%>

View File

@@ -104,6 +104,16 @@
<f:verbatim>
</td>
</tr>
<tr>
<td colspan="2">
</f:verbatim>
<h:panelGrid columns="2">
<h:selectBooleanCheckbox value="#{WizardManager.bean.ruleDisabled}" />
<h:outputText value="#{msg.rule_disabled}" />
</h:panelGrid>
<f:verbatim>
</td>
</tr>
<tr>
<td colspan="2">
<div id="rule-info" style="padding-left: 26px;">