mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
12999: Fixed read-only bootstrap of SiteAVMBootstrap and removed incorrect use of 'assert' 13000: Added log4j to Eclipse classpath (unexported) 13001: Merged V2.1-A to V3.1 9127: Performance improvement to folder copy 9151: *RECORD-ONLY* Fix index back up failing with missing files 13002: Merged V2.1-A to V3.1 9174: Further fixes for ACT-2588 (Lucene backup read-write locks) 9279: Fix ADB-84. PHP module is not restricted by the upper version 10191: Fix for ADB-77: Need to have as the sender's email address the email address of the user triggering the rule 13006: Merged V2.1-A to V3.1 10893: Fixes for ADB-78 & ADB-98 - Fixed service getter/setter pattern as well 10903: Fix for ADB-115 ACT-4355 13010: Made AVMLockingBootstrap resilient to read-only mode 13011: Better message for InvalidStoreRefException 13013: Merged V2.1-A to V3.1 9189: Composite Conditions Support Part 1 of 2 (repo) 9190: Composite Conditions Support Part 1a of 2 ( missed file from repo) 13015: Port of Adobe CIFS/FTP configuration changes 13017: Convert avoids folders given by '--svn-status' option 13018: Merge V2.1A to V3.1 7746: (record-only) Added ability to specify a custom CIFS authenticator class 8533: (record-only) Added the <disableNativeCode/> configuration tag, disable use of JNI code on Windows 8700: (record-only) Update to prevent any native calls via configuration code 8705: (record-only) Filer out the '0.0.0.0' bind address 8864: (record-only) Added the getBean() method for custom authenticators to get access to beans 9054: (record-only) Added the 'AIX' platform type for use in the platforms="..." attribute 8863: (record-only) Fix passthru socket connection timeout, added 'protocolOrder' and 'offlineCheckInterval' config values 12144: (record-only) CIFS virtual circuit fixes 13020: Merged V2.1-A to V3.1 (Composite Actions) 9191: Composite Conditions Support Part 2 of 2 (client) 9243: Composite Conditions Support Part 1 of 2 (client) 9245: Composite Conditions Support Part 2 of 2 (repo) 13021: Merged V3.0 to V3.1 13008: Merged V2.2 to V3.0 12824: (record only) Change admin access to the web project staging store to be read-only in the virtualization view - ETWOTWO-933 13024: Ported CIFS configuration changes from Adobe V2.1A, missed checkin. ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V2.1-A:r9127,9151,9174,9189-9191,9243,9245,9279,10191,10893,10903 Merged /alfresco/BRANCHES/V3.1:r12999-13002,13006,13010-13011,13013,13015,13017-13018,13020-13021,13024 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13550 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2008,3 +2008,45 @@ SiteCollaborator=Site Collaborator
|
||||
SiteContributor=Site Contributor
|
||||
sites_space_warning=This space is managed by Alfresco Share. Please use the Alfresco Share application to work with content within this space and any sub-spaces.
|
||||
|
||||
# Composite conditions
|
||||
select_composite_condition=Select Composite Condition
|
||||
enter_text_condition=Enter condition parameters for a text property
|
||||
enter_integer_condition=Enter condition parameters for an integer-valued property
|
||||
enter_date_condition=Enter condition parameters for a date-valued property
|
||||
enter_boolean_condition=Enter condition parameters for a boolean-valued property
|
||||
select_default_qname=Select Default QName
|
||||
composite_condition_page_description=Create a condition by combining several others
|
||||
composite_condition_page_title=Create Composite Condition
|
||||
composite_condition_page_selected=Selected conditions to be combined By
|
||||
composite_condition_page_or=OR
|
||||
text_property_condition_property=Property name (e.g. cm:description)
|
||||
integer_property_condition_property=Property name (e.g. my:count)
|
||||
date_property_condition_property=Property name (e.g. cm:created)
|
||||
property_condition_operation=Value of the property
|
||||
property_condition_value=Value of the property
|
||||
property_condition_operation=Operation
|
||||
property_condition_equals=Equals To
|
||||
property_condition_contains=Contains
|
||||
property_condition_beginswith=Begins With
|
||||
property_condition_endswith=Ends With
|
||||
property_condition_greaterthan=Greater Than
|
||||
property_condition_greaterthanequals=Greater Than Or Equals
|
||||
property_condition_lessthan=Less Than
|
||||
property_condition_lessthanequals=Less Than or Equals
|
||||
property_date_condition_equals=Equals To
|
||||
property_date_condition_greaterthan=Is After
|
||||
property_date_condition_greaterthanequals=Is After or On
|
||||
property_date_condition_lessthan=Is Before
|
||||
property_date_condition_lessthanequals=Is Before or On
|
||||
property_condition_invalid=Invalid Operation
|
||||
condition_compare_text_property_value=Text Property ''{0}'' {1} ''{2}''
|
||||
condition_compare_text_property_value_not=Text Property ''{0}'' NOT {1} ''{2}''
|
||||
condition_compare_integer_property_value=Integer Property ''{0}'' {1} ''{2}''
|
||||
condition_compare_integer_property_value_not=Integer Property ''{0}'' NOT {1} ''{2}''
|
||||
condition_compare_date_property_value=Date Property ''{0}'' {1} ''{2}''
|
||||
condition_compare_date_property_value_not=Date Property ''{0}'' NOT {1} ''{2}''
|
||||
condition_compare_boolean_property_value=Boolean Property ''{0}'' {1} ''{2}''
|
||||
condition_compare_boolean_property_value_not=Boolean Property ''{0}'' NOT {1} ''{2}''
|
||||
condition_composite_summary=Composite Condition ({0} Conditions {1})
|
||||
condition_composite_summary_not=Composite Condition ({0} Conditions {1} and Inverted)
|
||||
condition_composite_error=Composite Condition (ERROR)
|
||||
|
@@ -400,6 +400,10 @@
|
||||
<handler name="has-aspect" class="org.alfresco.web.bean.rules.handlers.HasAspectHandler" />
|
||||
<handler name="in-category" class="org.alfresco.web.bean.rules.handlers.InCategoryHandler" />
|
||||
<handler name="is-subtype" class="org.alfresco.web.bean.rules.handlers.IsSubTypeHandler" />
|
||||
<handler name="composite-condition" class="org.alfresco.web.bean.rules.handlers.CompositeConditionHandler" />
|
||||
<handler name="compare-date-property" class="org.alfresco.web.bean.rules.handlers.property.DatePropertyValueConditionHandler" />
|
||||
<handler name="compare-integer-property" class="org.alfresco.web.bean.rules.handlers.property.IntegerPropertyValueConditionHandler" />
|
||||
<handler name="compare-text-property" class="org.alfresco.web.bean.rules.handlers.property.TextPropertyValueConditionHandler" />
|
||||
</condition-handlers>
|
||||
</config>
|
||||
|
||||
|
@@ -697,6 +697,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
{
|
||||
// use the built in JSF support for retrieving the object for the
|
||||
// row that was clicked by the user
|
||||
@SuppressWarnings("unchecked")
|
||||
Map actionToRemove = (Map)this.allActionsDataModel.getRowData();
|
||||
this.allActionsProperties.remove(actionToRemove);
|
||||
|
||||
@@ -951,6 +952,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
{
|
||||
try
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
Class klass = Class.forName(handlerClass);
|
||||
IHandler handler = (IHandler)klass.newInstance();
|
||||
this.actionHandlers.put(actionName, handler);
|
||||
@@ -1046,6 +1048,15 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
return aspects;
|
||||
}
|
||||
|
||||
public boolean isFinishButtonDisabled()
|
||||
{
|
||||
if (emailRecipients != null)
|
||||
{
|
||||
return emailRecipients.isEmpty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inner classes
|
||||
|
||||
|
@@ -35,9 +35,11 @@ import javax.faces.context.FacesContext;
|
||||
import javax.faces.event.ActionEvent;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.context.UIContextService;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.repo.component.shelf.UIClipboardShelfItem;
|
||||
@@ -64,6 +66,8 @@ public class ClipboardBean implements Serializable
|
||||
/** Current state of the clipboard items */
|
||||
private List<ClipboardItem> items = new ArrayList<ClipboardItem>(4);
|
||||
|
||||
transient private NodeService nodeService;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean property getters and setters
|
||||
@@ -84,6 +88,20 @@ public class ClipboardBean implements Serializable
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
private NodeService getNodeService()
|
||||
{
|
||||
if (nodeService == null)
|
||||
{
|
||||
nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
|
||||
}
|
||||
return nodeService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Navigation action event handlers
|
||||
@@ -158,6 +176,12 @@ public class ClipboardBean implements Serializable
|
||||
List<ClipboardItem> toRemove = new ArrayList<ClipboardItem>();
|
||||
for (ClipboardItem item : this.items)
|
||||
{
|
||||
if (!getNodeService().exists(item.getNodeRef()))
|
||||
{
|
||||
toRemove.add(item);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (performClipboardOperation(item, action) == true)
|
||||
{
|
||||
// if cut operation then remove item from the clipboard
|
||||
@@ -202,8 +226,7 @@ public class ClipboardBean implements Serializable
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(Application.getMessage(context,
|
||||
MSG_ERROR_PASTE) + err.getMessage(), err);
|
||||
Utils.addErrorMessage(Application.getMessage(context, MSG_ERROR_PASTE) + err.getMessage(), err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.rules;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.model.DataModel;
|
||||
import javax.faces.model.ListDataModel;
|
||||
import javax.faces.model.SelectItem;
|
||||
|
||||
import org.alfresco.config.Config;
|
||||
import org.alfresco.config.ConfigService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.actions.IHandler;
|
||||
import org.alfresco.web.bean.rules.handlers.BaseConditionHandler;
|
||||
import org.alfresco.web.bean.rules.handlers.CompositeConditionHandler;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(CreateCompositeRuleWizard.class);
|
||||
|
||||
private List<SelectItem> compositeConditions;
|
||||
|
||||
// Right now the UI only supports one level of recursion, although the
|
||||
// backend supports unlimited recursion for composites.
|
||||
// This limitation is introduced by the fact that we are have two "current"
|
||||
// conditions - either normal condition, or composite conditions
|
||||
// basically, the UI will have to store conditions in a more native way
|
||||
// (instead of DataModel) to get unlimited number of composite conditions
|
||||
// recursing
|
||||
protected DataModel currentCompositeConditionsDataModel;
|
||||
protected List<Map<String, Serializable>> currentCompositeConditionPropertiesList;
|
||||
|
||||
private boolean addingCompositeCondition;
|
||||
|
||||
public CreateCompositeRuleWizard()
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
super.init(parameters);
|
||||
|
||||
this.setAddingCompositeCondition(false);
|
||||
this.currentCompositeConditionsDataModel = null;
|
||||
this.currentCompositeConditionPropertiesList = null;
|
||||
|
||||
}
|
||||
|
||||
public void setupCompositeConditionsMode()
|
||||
{
|
||||
this.setAddingCompositeCondition(true);
|
||||
this.currentCompositeConditionsDataModel = new ListDataModel();
|
||||
this.currentCompositeConditionPropertiesList = new ArrayList<Map<String, Serializable>>();
|
||||
|
||||
}
|
||||
|
||||
private void clearCompositeConditionMode()
|
||||
{
|
||||
// reset the action drop down
|
||||
this.selectedCondition = null;
|
||||
// this.currentConditionProperties = null;
|
||||
this.currentCompositeConditionsDataModel = null;
|
||||
this.currentCompositeConditionPropertiesList = null;
|
||||
this.setAddingCompositeCondition(false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the properties for all the conditions as a JSF DataModel
|
||||
*
|
||||
* @return JSF DataModel representing the condition properties
|
||||
*/
|
||||
public DataModel getAllCompositeConditionsDataModel()
|
||||
{
|
||||
if (this.currentCompositeConditionsDataModel == null)
|
||||
{
|
||||
this.currentCompositeConditionsDataModel = new ListDataModel();
|
||||
}
|
||||
|
||||
this.currentCompositeConditionsDataModel.setWrappedData(this.currentCompositeConditionPropertiesList);
|
||||
|
||||
return this.currentCompositeConditionsDataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the settings page for the current condition being added (if
|
||||
* required)
|
||||
*/
|
||||
@Override
|
||||
public void promptForConditionValues()
|
||||
{
|
||||
if (CompositeConditionHandler.NAME.equals(this.selectedCondition))
|
||||
{
|
||||
setupCompositeConditionsMode();
|
||||
}
|
||||
|
||||
super.promptForConditionValues();
|
||||
}
|
||||
|
||||
public void finishAddingCompositeCondition()
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Finishing Adding Composite Condition.");
|
||||
|
||||
// reset the effective chosen condition to composite-condition
|
||||
this.selectedCondition = CompositeConditionHandler.NAME;
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
returnViewId = getWizardContainerViewId(context);
|
||||
|
||||
printConditionState();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("\tAdding Condition '" + selectedCondition + "'");
|
||||
|
||||
IHandler handler = this.conditionHandlers.get(this.selectedCondition);
|
||||
|
||||
// creating object temporarily so we can pass it to
|
||||
// CompositeConditionHandler
|
||||
// Map<String, Serializable> newCompositeCondition = new HashMap<String,
|
||||
// Serializable>();
|
||||
currentConditionProperties.put(CompositeConditionHandler.PROP_COMPOSITE_CONDITION,
|
||||
(Serializable) this.currentCompositeConditionPropertiesList);
|
||||
currentConditionProperties.put(PROP_CONDITION_NAME, this.selectedCondition);
|
||||
|
||||
// this is called from the actions page so there must be a handler
|
||||
// present so there's no need to check for null
|
||||
String summary = handler.generateSummary(context, this, currentConditionProperties);
|
||||
|
||||
if (summary != null)
|
||||
{
|
||||
currentConditionProperties.put(PROP_CONDITION_SUMMARY, summary);
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Generated Summary - [" + summary + "] + selectedCondition " + this.selectedCondition);
|
||||
|
||||
if (editingCondition == false)
|
||||
{
|
||||
this.allConditionsPropertiesList.add(currentConditionProperties);
|
||||
}
|
||||
clearCompositeConditionMode();
|
||||
// refresh the wizard
|
||||
goToPage(context, this.returnViewId);
|
||||
}
|
||||
|
||||
private String getWizardContainerViewId(FacesContext context)
|
||||
{
|
||||
String viewId = null;
|
||||
ConfigService configSvc = Application.getConfigService(context);
|
||||
Config globalConfig = configSvc.getGlobalConfig();
|
||||
if (globalConfig != null)
|
||||
{
|
||||
viewId = globalConfig.getConfigElement("wizard-container").getValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.error("plain-dialog-container configuraion setting is not found");
|
||||
}
|
||||
return viewId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelAddCondition()
|
||||
{
|
||||
if (isAddingCompositeCondition())
|
||||
{
|
||||
//don't clear when editing, since we are looking at a REFERENCE to an existing condition
|
||||
if (this.editingCondition == false) {
|
||||
this.currentConditionProperties.clear();
|
||||
}
|
||||
// reset the action drop down
|
||||
this.selectedCondition = null;
|
||||
IHandler handler = this.conditionHandlers.get(CompositeConditionHandler.NAME);
|
||||
goToPage(FacesContext.getCurrentInstance(), handler.getJSPPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
super.cancelAddCondition();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the condition just setup by the user to the list of composite
|
||||
* conditions This gathers the composite conditions in the
|
||||
*/
|
||||
@Override
|
||||
public void addCondition()
|
||||
{
|
||||
if (!isAddingCompositeCondition())
|
||||
{
|
||||
super.addCondition();
|
||||
printConditionState();
|
||||
return;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Adding Condition to Composite Condition. ");
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
|
||||
// this is called from the actions page so there must be a handler
|
||||
// present so there's no need to check for null
|
||||
IHandler handler = this.conditionHandlers.get(this.selectedCondition);
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
String summary = handler.generateSummary(context, this, this.currentConditionProperties);
|
||||
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, summary);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn("No Summary could be generated for rule condition " + this.selectedCondition);
|
||||
|
||||
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, "ERROR - No Summary for " + this.selectedCondition);
|
||||
}
|
||||
|
||||
if (editingCondition == false)
|
||||
{
|
||||
//this check is needed to prevent an condition when you are editing a composite, to prevent it from adding twice
|
||||
currentCompositeConditionPropertiesList.add(this.currentConditionProperties);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("\tAdded condition to Composite condition.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("\tEdited composite condition. ");
|
||||
//editingCondition = false;
|
||||
}
|
||||
|
||||
this.currentConditionProperties = new HashMap<String, Serializable>(3);
|
||||
|
||||
// resetting it for composite condition
|
||||
// TODO: this is not persistent currently, which causes a minor bug
|
||||
this.currentConditionProperties.put(PROP_CONDITION_NAME, CompositeConditionHandler.NAME);
|
||||
this.currentConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE);
|
||||
|
||||
// refresh the wizard
|
||||
printConditionState();
|
||||
goToPage(context, this.returnViewId);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the context for editing existing composite condition values
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void editCondition()
|
||||
{
|
||||
this.editingCondition = true;
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Editing Conditions. isAddingCompositeConditions - " + isAddingCompositeCondition());
|
||||
|
||||
//if user is on main conditions screen, check if the condition to be edited is a composite condition
|
||||
if (!isAddingCompositeCondition())
|
||||
{
|
||||
Map condition = (Map) this.allConditionsDataModel.getRowData();
|
||||
|
||||
if (condition.get(PROP_CONDITION_NAME).equals(CompositeConditionHandler.NAME))
|
||||
{
|
||||
logger.debug("Composite Condition selected, enabling CompositeCondition Mode");
|
||||
currentCompositeConditionPropertiesList = (List<Map<String, Serializable>>) condition
|
||||
.get(CompositeConditionHandler.PROP_COMPOSITE_CONDITION);
|
||||
addingCompositeCondition = true;
|
||||
}
|
||||
super.editCondition(condition );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Map subCondition = (Map) currentCompositeConditionsDataModel.getRowData();
|
||||
super.editCondition(subCondition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<SelectItem> getCompositeConditions()
|
||||
{
|
||||
if (this.compositeConditions == null)
|
||||
{
|
||||
this.compositeConditions = new ArrayList<SelectItem>();
|
||||
List<SelectItem> tempConditions = this.getConditions(); // loads up the conditions
|
||||
for (SelectItem item : tempConditions)
|
||||
{
|
||||
if (!((item.getValue().equals(CompositeConditionHandler.NAME)) || (item.getValue().equals("no-condition"))))
|
||||
{
|
||||
this.compositeConditions.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.compositeConditions;
|
||||
}
|
||||
|
||||
protected boolean isAddingCompositeCondition()
|
||||
{
|
||||
return addingCompositeCondition;
|
||||
}
|
||||
|
||||
protected void setAddingCompositeCondition(boolean addingCompositeCondition)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Setting addingCompositeCondition to " + addingCompositeCondition);
|
||||
|
||||
this.addingCompositeCondition = addingCompositeCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the requested condition from the list
|
||||
*/
|
||||
public void removeCondition()
|
||||
{
|
||||
if (!isAddingCompositeCondition())
|
||||
{
|
||||
super.removeCondition();
|
||||
return;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Removing Composite Conditions");
|
||||
|
||||
// use the built in JSF support for retrieving the object for the
|
||||
// row that was clicked by the user
|
||||
Map conditionToRemove = (Map) this.currentCompositeConditionsDataModel.getRowData();
|
||||
this.currentCompositeConditionPropertiesList.remove(conditionToRemove);
|
||||
// reset the action drop down
|
||||
this.selectedCondition = null;
|
||||
|
||||
// refresh the wizard
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
goToPage(context, context.getViewRoot().getViewId());
|
||||
}
|
||||
|
||||
protected void printConditionState()
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("\t\t*** GLOBAL ***");
|
||||
|
||||
logger.debug("\t\tallConditionsProperties");
|
||||
if (allConditionsPropertiesList == null)
|
||||
{
|
||||
logger.debug("\t\t\tempty");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Object obj : allConditionsPropertiesList)
|
||||
{
|
||||
logger.debug("\t\t\t" + obj.toString());
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("\t\t*** COMPOSITE ***");
|
||||
logger.debug("\t\taddingCompositeCondition " + addingCompositeCondition);
|
||||
|
||||
logger.debug("\t\tcurrentCompositeConditionsProperties");
|
||||
if (currentCompositeConditionPropertiesList == null)
|
||||
{
|
||||
logger.debug("\t\t\t EMPTY");
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 1;
|
||||
for (Map<String, Serializable> cond : currentCompositeConditionPropertiesList)
|
||||
{
|
||||
logger.debug("\t\t\tCondition" + i++);
|
||||
|
||||
for (String key : cond.keySet())
|
||||
{
|
||||
logger.debug("\t\t\t\tkey - {" + key + "} value - {" + cond.get(key) + "}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("\t\t*** BOTH ***");
|
||||
|
||||
logger.debug("\t\tcurrentConditionsProperties");
|
||||
if (currentConditionProperties == null)
|
||||
{
|
||||
logger.debug("\t\t\t EMPTY");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (String key : this.currentConditionProperties.keySet())
|
||||
{
|
||||
logger.debug("\t\t\tkey - {" + key + "} value - {" + this.currentConditionProperties.get(key) + "}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* FLOSS exception. You should have received a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
@@ -46,6 +46,7 @@ import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionCondition;
|
||||
import org.alfresco.service.cmr.action.ActionConditionDefinition;
|
||||
import org.alfresco.service.cmr.action.CompositeAction;
|
||||
import org.alfresco.service.cmr.action.CompositeActionCondition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
@@ -57,6 +58,7 @@ import org.alfresco.web.bean.actions.IHandler;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.rules.handlers.BaseConditionHandler;
|
||||
import org.alfresco.web.bean.rules.handlers.CompositeConditionHandler;
|
||||
import org.alfresco.web.data.IDataContainer;
|
||||
import org.alfresco.web.data.QuickSort;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
@@ -78,21 +80,29 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
transient private RuleService ruleService;
|
||||
protected RulesDialog rulesDialog;
|
||||
|
||||
private List<SelectItem> modelTypes;
|
||||
private List<SelectItem> mimeTypes;
|
||||
private List<SelectItem> modelTypes; //this is for subtype condition
|
||||
private List<SelectItem> mimeTypes; //for checking mime types condition
|
||||
private List<SelectItem> types;
|
||||
|
||||
private List<SelectItem> conditions;
|
||||
|
||||
protected Map<String, IHandler> conditionHandlers;
|
||||
protected Map<String, IHandler> conditionHandlers; //contains UI handlers, i.e. classes that know which JSP to to forward to
|
||||
|
||||
//This is where all the current condition properties go. When addConditions is called,
|
||||
//these are saved into allConditionsPropertiesList
|
||||
protected Map<String, Serializable> currentConditionProperties;
|
||||
protected List<Map<String, Serializable>> allConditionsProperties;
|
||||
|
||||
transient protected DataModel allConditionsDataModel;
|
||||
|
||||
// protected List<Map<String, Serializable>> allConditionsProperties;
|
||||
//allConditionsProperties needs to be able to store both Map<String, Serializable> and List<Map<String, Serializable>>
|
||||
//(for composite conditions)
|
||||
protected List<Map<String, Serializable>> allConditionsPropertiesList;
|
||||
|
||||
protected String title;
|
||||
protected String description;
|
||||
protected String type;
|
||||
protected String condition;
|
||||
protected String selectedCondition;
|
||||
protected boolean runInBackground;
|
||||
protected boolean applyToSubSpaces;
|
||||
protected boolean editingCondition;
|
||||
@@ -111,21 +121,23 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
this.title = null;
|
||||
this.description = null;
|
||||
this.type = "inbound";
|
||||
this.condition = null;
|
||||
this.selectedCondition = null;
|
||||
this.applyToSubSpaces = false;
|
||||
this.runInBackground = false;
|
||||
this.ruleDisabled = false;
|
||||
this.conditions = null;
|
||||
|
||||
this.allConditionsProperties = new ArrayList<Map<String, Serializable>>();
|
||||
this.allConditionsPropertiesList = new ArrayList<Map<String, Serializable>>();
|
||||
|
||||
initialiseConditionHandlers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("finishImpl called - saving rules");
|
||||
|
||||
// get hold of the space the rule will apply to and make sure
|
||||
// it is actionable
|
||||
Node currentSpace = this.browseBean.getActionSpace();
|
||||
@@ -160,14 +172,12 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
disabled = (this.allConditionsDataModel == null ||
|
||||
this.allConditionsDataModel.getRowCount() == 0);
|
||||
disabled = (this.allConditionsDataModel == null || this.allConditionsDataModel.getRowCount() == 0);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
disabled = (this.allActionsDataModel == null ||
|
||||
this.allActionsDataModel.getRowCount() == 0);
|
||||
disabled = (this.allActionsDataModel == null || this.allActionsDataModel.getRowCount() == 0);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
@@ -183,11 +193,9 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
if (this.allActionsDataModel != null &&
|
||||
this.allActionsDataModel.getRowCount() > 0 &&
|
||||
this.allConditionsDataModel != null &&
|
||||
this.allConditionsDataModel.getRowCount() > 0 &&
|
||||
this.title != null && this.title.length() > 0)
|
||||
if (this.allActionsDataModel != null && this.allActionsDataModel.getRowCount() > 0
|
||||
&& this.allConditionsDataModel != null && this.allConditionsDataModel.getRowCount() > 0
|
||||
&& this.title != null && this.title.length() > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -204,7 +212,7 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
{
|
||||
// create the summary using all the conditions
|
||||
StringBuilder conditionsSummary = new StringBuilder();
|
||||
for (Map<String, Serializable> props : this.allConditionsProperties)
|
||||
for (Map<String, Serializable> props : this.allConditionsPropertiesList)
|
||||
{
|
||||
conditionsSummary.append(Utils.encode((String)props.get(PROP_CONDITION_SUMMARY)));
|
||||
conditionsSummary.append("<br>");
|
||||
@@ -224,13 +232,13 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
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("rule_disabled"),
|
||||
bundle.getString("conditions"), bundle.getString("actions")},
|
||||
new String[] {this.type, Utils.encode(this.title), Utils.encode(this.description),
|
||||
subSpacesYesNo, backgroundYesNo, ruleDisabledYesNo,
|
||||
conditionsSummary.toString(), actionsSummary.toString()});
|
||||
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("rule_disabled"), bundle.getString("conditions"), bundle.getString("actions") },
|
||||
new String[]
|
||||
{ this.type, Utils.encode(this.title), Utils.encode(this.description), subSpacesYesNo, backgroundYesNo,
|
||||
ruleDisabledYesNo, conditionsSummary.toString(), actionsSummary.toString() });
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -279,7 +287,7 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
this.allConditionsDataModel = new ListDataModel();
|
||||
}
|
||||
|
||||
this.allConditionsDataModel.setWrappedData(this.allConditionsProperties);
|
||||
this.allConditionsDataModel.setWrappedData(this.allConditionsPropertiesList);
|
||||
|
||||
return this.allConditionsDataModel;
|
||||
}
|
||||
@@ -381,8 +389,7 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
for (ActionConditionDefinition ruleConditionDef : ruleConditions)
|
||||
{
|
||||
// add to SelectItem list
|
||||
this.conditions.add(new SelectItem(ruleConditionDef.getName(),
|
||||
ruleConditionDef.getTitle()));
|
||||
this.conditions.add(new SelectItem(ruleConditionDef.getName(), ruleConditionDef.getTitle()));
|
||||
}
|
||||
|
||||
// make sure the list is sorted by the label
|
||||
@@ -390,8 +397,8 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
sorter.sort();
|
||||
|
||||
// add the "Select a condition" entry at the beginning of the list
|
||||
this.conditions.add(0, new SelectItem("null",
|
||||
Application.getMessage(FacesContext.getCurrentInstance(), "select_a_condition")));
|
||||
this.conditions.add(0, new SelectItem("null", Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"select_a_condition")));
|
||||
}
|
||||
|
||||
return this.conditions;
|
||||
@@ -524,7 +531,7 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
*/
|
||||
public String getCondition()
|
||||
{
|
||||
return this.condition;
|
||||
return this.selectedCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -532,7 +539,7 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
*/
|
||||
public void setCondition(String condition)
|
||||
{
|
||||
this.condition = condition;
|
||||
this.selectedCondition = condition;
|
||||
}
|
||||
|
||||
|
||||
@@ -551,37 +558,45 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
this.returnViewId = context.getViewRoot().getViewId();
|
||||
String viewId = null;
|
||||
|
||||
HashMap<String, Serializable> condProps = new HashMap<String, Serializable>(3);
|
||||
condProps.put(PROP_CONDITION_NAME, this.condition);
|
||||
this.currentConditionProperties = condProps;
|
||||
this.currentConditionProperties = new HashMap<String, Serializable>(3);
|
||||
this.currentConditionProperties.put(PROP_CONDITION_NAME, this.selectedCondition);
|
||||
this.currentConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE);
|
||||
|
||||
// get the handler for the condition, if there isn't one we presume it
|
||||
// is a no-parameter condition
|
||||
IHandler handler = this.conditionHandlers.get(this.condition);
|
||||
IHandler handler = this.conditionHandlers.get(this.selectedCondition);
|
||||
if (handler != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Found Handler for selected condition - '" + this.selectedCondition + "'");
|
||||
|
||||
// setup any UI defaults the condition may have and get the location of
|
||||
// the JSP used to collect the parameters
|
||||
handler.setupUIDefaults(condProps);
|
||||
handler.setupUIDefaults(this.currentConditionProperties);
|
||||
viewId = handler.getJSPPath();
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Handler returned JSP page- '" + viewId + "' Handler Type " + handler.getClass().toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Did Not Find a handler for selected condition - '" + this.selectedCondition + "'");
|
||||
|
||||
// just add the action to the list and use the title as the summary
|
||||
ActionConditionDefinition conditionDef = this.getActionService().
|
||||
getActionConditionDefinition(this.condition);
|
||||
condProps.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle());
|
||||
condProps.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE);
|
||||
ActionConditionDefinition conditionDef = this.getActionService()
|
||||
.getActionConditionDefinition(this.selectedCondition);
|
||||
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle());
|
||||
this.currentConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE);
|
||||
// add the no params marker so we can disable the edit action
|
||||
condProps.put(NO_PARAMS_MARKER, "no-params");
|
||||
this.allConditionsProperties.add(condProps);
|
||||
this.currentConditionProperties.put(NO_PARAMS_MARKER, "no-params");
|
||||
this.allConditionsPropertiesList.add(this.currentConditionProperties);
|
||||
|
||||
// come back to the same page we're on now as there are no params to collect
|
||||
viewId = this.returnViewId;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Added '" + this.condition + "' condition to list");
|
||||
logger.debug("Currently creating '" + this.selectedCondition + "' condition");
|
||||
|
||||
// go to the page to collect the settings
|
||||
goToPage(context, viewId);
|
||||
@@ -593,22 +608,30 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
@SuppressWarnings("unchecked")
|
||||
public void editCondition()
|
||||
{
|
||||
// use the built in JSF support for retrieving the object for the
|
||||
// row that was clicked by the user
|
||||
Map conditionToEdit = (Map) this.allConditionsDataModel.getRowData();
|
||||
this.condition = (String)conditionToEdit.get(PROP_CONDITION_NAME);
|
||||
this.currentConditionProperties = conditionToEdit;
|
||||
editCondition(conditionToEdit);
|
||||
}
|
||||
|
||||
protected void editCondition(Map conditionToEdit)
|
||||
{
|
||||
// set the flag to show we are editing a condition
|
||||
this.editingCondition = true;
|
||||
|
||||
// use the built in JSF support for retrieving the object for the
|
||||
// row that was clicked by the user
|
||||
this.selectedCondition = (String) conditionToEdit.get(PROP_CONDITION_NAME);
|
||||
this.currentConditionProperties = conditionToEdit;
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Editing Condition '" + selectedCondition + "'");
|
||||
|
||||
// remember the page we're on
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
this.returnViewId = context.getViewRoot().getViewId();
|
||||
|
||||
// go to the condition page (as there is an edit option visible,
|
||||
// there must be a handler for the condition so we don't check)
|
||||
goToPage(context, this.conditionHandlers.get(this.condition).getJSPPath());
|
||||
goToPage(context, this.conditionHandlers.get(this.selectedCondition).getJSPPath());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -618,23 +641,30 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Adding Condition '" + selectedCondition + "'");
|
||||
|
||||
IHandler handler = this.conditionHandlers.get(this.selectedCondition);
|
||||
|
||||
// this is called from the actions page so there must be a handler
|
||||
// present so there's no need to check for null
|
||||
String summary = this.conditionHandlers.get(this.condition).generateSummary(
|
||||
context, this, this.currentConditionProperties);
|
||||
String summary = handler.generateSummary(context, this, this.currentConditionProperties);
|
||||
|
||||
if (summary != null)
|
||||
{
|
||||
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, summary);
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Generated Summary - [" + summary + "] + selectedCondition " + this.selectedCondition);
|
||||
|
||||
if (this.editingCondition == false)
|
||||
{
|
||||
this.allConditionsProperties.add(this.currentConditionProperties);
|
||||
this.allConditionsPropertiesList.add(this.currentConditionProperties);
|
||||
|
||||
}
|
||||
|
||||
// reset the action drop down
|
||||
this.condition = null;
|
||||
this.selectedCondition = null;
|
||||
|
||||
// refresh the wizard
|
||||
goToPage(context, this.returnViewId);
|
||||
@@ -648,10 +678,10 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
// use the built in JSF support for retrieving the object for the
|
||||
// row that was clicked by the user
|
||||
Map conditionToRemove = (Map) this.allConditionsDataModel.getRowData();
|
||||
this.allConditionsProperties.remove(conditionToRemove);
|
||||
this.allConditionsPropertiesList.remove(conditionToRemove);
|
||||
|
||||
// reset the action drop down
|
||||
this.condition = null;
|
||||
this.selectedCondition = null;
|
||||
|
||||
// refresh the wizard
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
@@ -669,7 +699,7 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
}
|
||||
|
||||
// reset the action drop down
|
||||
this.condition = null;
|
||||
this.selectedCondition = null;
|
||||
|
||||
// refresh the wizard
|
||||
goToPage(FacesContext.getCurrentInstance(), this.returnViewId);
|
||||
@@ -718,8 +748,12 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
* @param outcome The default outcome
|
||||
* @return The outcome
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected String setupRule(FacesContext context, Rule rule, String outcome)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Saving Rules - setupRule");
|
||||
|
||||
// setup the rule and add it to the space
|
||||
rule.setTitle(this.title);
|
||||
rule.setDescription(this.description);
|
||||
@@ -729,37 +763,43 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
|
||||
CompositeAction compositeAction = this.getActionService().createCompositeAction();
|
||||
rule.setAction(compositeAction);
|
||||
|
||||
int i = 1;
|
||||
// add all the conditions to the rule
|
||||
for (Map<String, Serializable> condParams : this.allConditionsProperties)
|
||||
for (Object condParamsObj : this.allConditionsPropertiesList)
|
||||
{
|
||||
String conditionName = (String)condParams.get(PROP_CONDITION_NAME);
|
||||
this.condition = conditionName;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Saving Condition " + i++ + " of " + this.allConditionsPropertiesList.size());
|
||||
|
||||
// get the condition handler to prepare for the save
|
||||
Map<String, Serializable> repoCondParams = new HashMap<String, Serializable>();
|
||||
IHandler handler = this.conditionHandlers.get(this.condition);
|
||||
if (handler != null)
|
||||
Map<String, Serializable> uiConditionParams = (Map<String, Serializable>) condParamsObj;
|
||||
|
||||
ActionCondition condition = createCondition(uiConditionParams);
|
||||
|
||||
if (condition instanceof CompositeActionCondition)
|
||||
{
|
||||
handler.prepareForSave(condParams, repoCondParams);
|
||||
CompositeActionCondition compositeCondition = (CompositeActionCondition) condition;
|
||||
|
||||
List<Map<String, Serializable>> subconditionProps = (List<Map<String, Serializable>>) uiConditionParams
|
||||
.get(CompositeConditionHandler.PROP_COMPOSITE_CONDITION);
|
||||
int j = 1;
|
||||
compositeCondition.setORCondition(((Boolean)uiConditionParams.get(CompositeConditionHandler.PROP_CONDITION_OR)).booleanValue());
|
||||
compositeCondition.setInvertCondition((((Boolean)uiConditionParams.get(CompositeConditionHandler.PROP_CONDITION_NOT)).booleanValue()));
|
||||
|
||||
for (Map<String, Serializable> props : subconditionProps)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Saving Composite Condition " + j++ + " of " + subconditionProps.size());
|
||||
|
||||
compositeCondition.addActionCondition(createCondition(props));
|
||||
}
|
||||
}
|
||||
|
||||
// add the condition to the rule
|
||||
ActionCondition condition = this.getActionService().
|
||||
createActionCondition(conditionName);
|
||||
condition.setParameterValues(repoCondParams);
|
||||
|
||||
// specify whether the condition result should be inverted
|
||||
Boolean not = (Boolean)condParams.get(BaseConditionHandler.PROP_CONDITION_NOT);
|
||||
condition.setInvertCondition(((Boolean)not).booleanValue());
|
||||
|
||||
compositeAction.addActionCondition(condition);
|
||||
}
|
||||
|
||||
// add all the actions to the rule
|
||||
for (Map<String, Serializable> actionParams : this.allActionsProperties)
|
||||
{
|
||||
// use the base class version of buildActionParams(), but for this we need
|
||||
// use the base class version of buildActionParams(), but for this
|
||||
// we need
|
||||
// to setup the currentActionProperties and action variables
|
||||
String actionName = (String) actionParams.get(PROP_ACTION_NAME);
|
||||
this.action = actionName;
|
||||
@@ -781,6 +821,38 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
return outcome;
|
||||
}
|
||||
|
||||
private ActionCondition createCondition(Map<String, Serializable> uiConditionParams)
|
||||
{
|
||||
// get the condition handler to prepare for the save
|
||||
|
||||
String conditionName = (String) uiConditionParams.get(PROP_CONDITION_NAME);
|
||||
|
||||
Map<String, Serializable> repoCondParams = new HashMap<String, Serializable>();
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("\tSaving " + conditionName);
|
||||
}
|
||||
IHandler handler = this.conditionHandlers.get(conditionName);
|
||||
if (handler != null)
|
||||
{
|
||||
handler.prepareForSave(uiConditionParams, repoCondParams);
|
||||
}
|
||||
|
||||
// add the condition to the rule
|
||||
ActionCondition condition = this.getActionService().createActionCondition(conditionName);
|
||||
condition.setParameterValues(repoCondParams);
|
||||
|
||||
// specify whether the condition result should be inverted
|
||||
Boolean not = (Boolean) uiConditionParams.get(BaseConditionHandler.PROP_CONDITION_NOT);
|
||||
if (not == null)
|
||||
{
|
||||
logger.warn("Property missing NOT parameter value (currently null)");
|
||||
not = Boolean.TRUE;
|
||||
}
|
||||
condition.setInvertCondition(((Boolean) not).booleanValue());
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialises the condition handlers from the current configuration.
|
||||
*/
|
||||
@@ -803,19 +875,20 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
String conditionName = child.getAttribute("name");
|
||||
String handlerClass = child.getAttribute("class");
|
||||
|
||||
if (conditionName != null && conditionName.length() > 0 &&
|
||||
handlerClass != null && handlerClass.length() > 0)
|
||||
if (conditionName != null && conditionName.length() > 0 && handlerClass != null
|
||||
&& handlerClass.length() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
Class klass = Class.forName(handlerClass);
|
||||
IHandler handler = (IHandler) klass.newInstance();
|
||||
this.conditionHandlers.put(conditionName, handler);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to setup condition handler for '" +
|
||||
conditionName + "'", e);
|
||||
throw new AlfrescoRuntimeException("Failed to setup condition handler for '" + conditionName
|
||||
+ "'", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -837,7 +910,7 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
in.defaultReadObject();
|
||||
|
||||
this.allConditionsDataModel = new ListDataModel();
|
||||
this.allConditionsDataModel.setWrappedData(this.allConditionsProperties);
|
||||
this.allConditionsDataModel.setWrappedData(this.allConditionsPropertiesList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@
|
||||
package org.alfresco.web.bean.rules;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -37,20 +38,21 @@ import org.alfresco.service.cmr.action.ActionCondition;
|
||||
import org.alfresco.service.cmr.action.ActionConditionDefinition;
|
||||
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
import org.alfresco.service.cmr.action.CompositeAction;
|
||||
import org.alfresco.service.cmr.action.CompositeActionCondition;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.web.bean.actions.IHandler;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.rules.handlers.BaseConditionHandler;
|
||||
import org.alfresco.web.bean.rules.handlers.CompositeConditionHandler;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Edit Rule" wizard
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class EditRuleWizard extends CreateRuleWizard
|
||||
public class EditRuleWizard extends CreateCompositeRuleWizard
|
||||
{
|
||||
private static final long serialVersionUID = -7222762769396254445L;
|
||||
|
||||
@@ -59,6 +61,8 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
/* Loads up conditions and actions from the repository
|
||||
*/
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
@@ -85,41 +89,19 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
// Get the composite action
|
||||
CompositeAction compositeAction = getCompositeAction(rule);
|
||||
|
||||
// populate the conditions list with maps of properties representing each condition
|
||||
List<ActionCondition> conditions = compositeAction.getActionConditions();
|
||||
for (ActionCondition condition : conditions)
|
||||
{
|
||||
this.currentConditionProperties = new HashMap<String, Serializable>(3);
|
||||
this.condition = condition.getActionConditionDefinitionName();
|
||||
this.currentConditionProperties.put(PROP_CONDITION_NAME, this.condition);
|
||||
this.currentConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT,
|
||||
Boolean.valueOf(condition.getInvertCondition()));
|
||||
populateConditions(context, compositeAction);
|
||||
|
||||
IHandler handler = this.conditionHandlers.get(this.condition);
|
||||
if (handler != null)
|
||||
{
|
||||
// use the handler to populate the properties and summary
|
||||
handler.prepareForEdit(this.currentConditionProperties,
|
||||
condition.getParameterValues());
|
||||
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY,
|
||||
handler.generateSummary(context, this, this.currentConditionProperties));
|
||||
}
|
||||
else
|
||||
{
|
||||
// there's no handler, so we presume it is a no-paramter
|
||||
// condition, use the condition title as the summary
|
||||
ActionConditionDefinition conditionDef = this.getActionService().
|
||||
getActionConditionDefinition(this.condition);
|
||||
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY,
|
||||
conditionDef.getTitle());
|
||||
// add the no params marker so we can disable the edit action
|
||||
this.currentConditionProperties.put(NO_PARAMS_MARKER, "no-params");
|
||||
}
|
||||
|
||||
// add the populated currentConditionProperties to the list
|
||||
this.allConditionsProperties.add(this.currentConditionProperties);
|
||||
populateActions(context, compositeAction);
|
||||
|
||||
// reset the current condition
|
||||
this.selectedCondition = null;
|
||||
|
||||
// reset the current action
|
||||
this.action = null;
|
||||
}
|
||||
|
||||
protected void populateActions(FacesContext context, CompositeAction compositeAction)
|
||||
{
|
||||
// populate the actions list with maps of properties representing each action
|
||||
List<Action> actions = compositeAction.getActions();
|
||||
for (Action action : actions)
|
||||
@@ -133,12 +115,12 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
{
|
||||
// use the handler to populate the properties and summary
|
||||
handler.prepareForEdit(this.currentActionProperties, action.getParameterValues());
|
||||
this.currentActionProperties.put(PROP_ACTION_SUMMARY,
|
||||
handler.generateSummary(context, this, this.currentActionProperties));
|
||||
this.currentActionProperties.put(PROP_ACTION_SUMMARY, handler.generateSummary(context, this,
|
||||
this.currentActionProperties));
|
||||
}
|
||||
else
|
||||
{
|
||||
// there's no handler, so we presume it is a no-paramter
|
||||
// there's no handler, so we presume it is a no-parameter
|
||||
// action, use the action title as the summary
|
||||
ActionDefinition actionDef = this.getActionService().getActionDefinition(this.action);
|
||||
this.currentActionProperties.put(PROP_ACTION_SUMMARY, actionDef.getTitle());
|
||||
@@ -149,12 +131,82 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
// add the populated currentActionProperties to the list
|
||||
this.allActionsProperties.add(this.currentActionProperties);
|
||||
}
|
||||
}
|
||||
|
||||
// reset the current condition
|
||||
this.condition = null;
|
||||
protected void populateConditions(FacesContext context, CompositeAction compositeAction)
|
||||
{
|
||||
// populate the conditions list with maps of properties representing each condition
|
||||
List<ActionCondition> conditions = compositeAction.getActionConditions();
|
||||
for (ActionCondition toplevel_condition : conditions)
|
||||
{
|
||||
this.selectedCondition = toplevel_condition.getActionConditionDefinitionName();
|
||||
this.currentConditionProperties = new HashMap<String, Serializable>();
|
||||
|
||||
// reset the current action
|
||||
this.action = null;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Preparing for Edit Condition " + this.selectedCondition);
|
||||
|
||||
if (toplevel_condition instanceof CompositeActionCondition)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("\tDetected CompositeCondition");
|
||||
|
||||
CompositeActionCondition compositeCondition = (CompositeActionCondition) toplevel_condition;
|
||||
this.currentCompositeConditionPropertiesList = new ArrayList<Map<String, Serializable>>();
|
||||
|
||||
//TODO: add OR property
|
||||
|
||||
for (ActionCondition subcondition : compositeCondition.getActionConditions())
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("\tSetting ... SubConditions " + subcondition.getActionConditionDefinitionName());
|
||||
|
||||
this.selectedCondition = subcondition.getActionConditionDefinitionName();
|
||||
Map<String, Serializable> subConditionProperties = new HashMap<String, Serializable>();
|
||||
populateProperties(context, subcondition, subConditionProperties);
|
||||
this.currentCompositeConditionPropertiesList.add(subConditionProperties);
|
||||
}
|
||||
|
||||
this.selectedCondition = CompositeConditionHandler.NAME;
|
||||
|
||||
this.currentConditionProperties.put(CompositeConditionHandler.PROP_COMPOSITE_CONDITION,
|
||||
(Serializable) this.currentCompositeConditionPropertiesList);
|
||||
|
||||
populateProperties(context, compositeCondition, currentConditionProperties);
|
||||
|
||||
} else
|
||||
populateProperties(context, toplevel_condition, this.currentConditionProperties);
|
||||
|
||||
// add the populated currentConditionProperties to the list
|
||||
this.allConditionsPropertiesList.add(this.currentConditionProperties);
|
||||
|
||||
printConditionState();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void populateProperties(FacesContext context, ActionCondition condition,
|
||||
Map<String, Serializable> uiConditionProperties)
|
||||
{
|
||||
uiConditionProperties.put(PROP_CONDITION_NAME, this.selectedCondition);
|
||||
uiConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.valueOf(condition.getInvertCondition()));
|
||||
|
||||
IHandler handler = this.conditionHandlers.get(this.selectedCondition);
|
||||
if (handler != null)
|
||||
{
|
||||
// use the handler to populate the properties and summary
|
||||
handler.prepareForEdit(uiConditionProperties, condition.getParameterValues());
|
||||
uiConditionProperties.put(PROP_CONDITION_SUMMARY, handler
|
||||
.generateSummary(context, this, uiConditionProperties));
|
||||
} else
|
||||
{
|
||||
// there's no handler, so we presume it is a no-parameter
|
||||
// condition, use the condition title as the summary
|
||||
ActionConditionDefinition conditionDef = this.getActionService().getActionConditionDefinition(this.selectedCondition);
|
||||
uiConditionProperties.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle());
|
||||
// add the no params marker so we can disable the edit action
|
||||
uiConditionProperties.put(NO_PARAMS_MARKER, "no-params");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.rules.handlers;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.action.ActionModel;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.wizard.IWizardBean;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* @author Jean Barmash
|
||||
* This class has no equivalent evaluator, since it
|
||||
*
|
||||
*/
|
||||
public class CompositeConditionHandler extends BaseConditionHandler
|
||||
{
|
||||
public static final String NAME = "composite-condition";
|
||||
public static final String PROP_COMPOSITE_CONDITION = "composite-condition";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(CompositeConditionHandler.class);
|
||||
|
||||
public static final String PROP_CONDITION_OR = "orconditions";
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.web.bean.actions.IHandler#generateSummary(javax.faces.context.FacesContext, org.alfresco.web.bean.wizard.IWizardBean, java.util.Map)
|
||||
*/
|
||||
public String generateSummary(FacesContext context, IWizardBean wizard,
|
||||
Map<String, Serializable> props)
|
||||
{
|
||||
List<Object> conditionPropertiesList = (List<Object>) props.get(PROP_COMPOSITE_CONDITION);
|
||||
if (conditionPropertiesList == null )
|
||||
{
|
||||
logger.error("Error - composite condition has no sub-conditions");
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
for (String str : props.keySet())
|
||||
{
|
||||
logger.debug("\t key - "+ str + " value " + props.get(str));
|
||||
}
|
||||
}
|
||||
|
||||
return Application.getMessage(context, "condition_composite_error");
|
||||
}
|
||||
|
||||
Boolean not = (Boolean) props.get(PROP_CONDITION_NOT);
|
||||
Boolean orconditions = (Boolean) props.get(PROP_CONDITION_OR);
|
||||
|
||||
String msgId = not.booleanValue() ? "condition_composite_summary_not" : "condition_composite_summary";
|
||||
return MessageFormat.format(Application.getMessage(context, msgId),
|
||||
new Object[] {conditionPropertiesList.size(), orconditions.booleanValue()?"ORed":"ANDed"});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.web.bean.actions.IHandler#getJSPPath()
|
||||
*/
|
||||
public String getJSPPath()
|
||||
{
|
||||
return getJSPPath(CompositeConditionHandler.NAME);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.web.bean.actions.IHandler#prepareForEdit(java.util.Map, java.util.Map)
|
||||
*/
|
||||
public void prepareForEdit(Map<String, Serializable> uiConditionProps,
|
||||
Map<String, Serializable> repoProps)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Preparing Composite Condition for Edit");
|
||||
|
||||
Boolean orconditions = (Boolean) repoProps.get(PROP_CONDITION_OR);
|
||||
if (orconditions == null)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn("orconditions is NULL, it should not be. Defaulting to false");
|
||||
|
||||
orconditions = Boolean.FALSE;
|
||||
}
|
||||
|
||||
uiConditionProps.put(PROP_CONDITION_OR, orconditions);
|
||||
}
|
||||
|
||||
public void prepareForSave(Map<String, Serializable> uiConditionProps,
|
||||
Map<String, Serializable> repoProps)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Saving Composite Condition");
|
||||
|
||||
// put the selected category in the condition params
|
||||
Boolean orconditions = (Boolean)uiConditionProps.get(PROP_CONDITION_OR);
|
||||
if (orconditions == null)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn("orconditions is NULL, it should not be. Defaulting to false");
|
||||
|
||||
orconditions = Boolean.FALSE;
|
||||
}
|
||||
|
||||
repoProps.put(PROP_CONDITION_OR, orconditions);
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* FLOSS exception. You should have received a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
@@ -52,6 +52,12 @@ public class PropertyValueHandler extends BaseConditionHandler
|
||||
|
||||
public void prepareForSave(Map<String, Serializable> conditionProps,
|
||||
Map<String, Serializable> repoProps)
|
||||
{
|
||||
prepareForSaveWithCorrectType(conditionProps, repoProps);
|
||||
}
|
||||
|
||||
//Responsible for serializing the value of the property, which could have different types
|
||||
protected void prepareForSaveWithCorrectType(Map<String, Serializable> conditionProps, Map<String, Serializable> repoProps)
|
||||
{
|
||||
String text = (String)conditionProps.get(PROP_CONTAINS_TEXT);
|
||||
repoProps.put(ComparePropertyValueEvaluator.PARAM_VALUE, text);
|
||||
@@ -59,11 +65,18 @@ public class PropertyValueHandler extends BaseConditionHandler
|
||||
|
||||
public void prepareForEdit(Map<String, Serializable> conditionProps,
|
||||
Map<String, Serializable> repoProps)
|
||||
{
|
||||
prepareForEditWithCorrectType(conditionProps, repoProps);
|
||||
}
|
||||
|
||||
protected void prepareForEditWithCorrectType(Map<String, Serializable> conditionProps,
|
||||
Map<String, Serializable> repoProps)
|
||||
{
|
||||
String propValue = (String)repoProps.get(ComparePropertyValueEvaluator.PARAM_VALUE);
|
||||
conditionProps.put(PROP_CONTAINS_TEXT, propValue);
|
||||
}
|
||||
|
||||
|
||||
public String generateSummary(FacesContext context, IWizardBean wizard,
|
||||
Map<String, Serializable> conditionProps)
|
||||
{
|
||||
|
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have received a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.rules.handlers.property;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
||||
import org.alfresco.repo.action.evaluator.compare.ComparePropertyValueOperation;
|
||||
|
||||
/**
|
||||
* Condition handler for the "compare-date-property" condition.
|
||||
*
|
||||
* @author Jean Barmash
|
||||
*/
|
||||
public class DatePropertyValueConditionHandler extends TextPropertyValueConditionHandler
|
||||
{
|
||||
|
||||
public static final String NAME = "compare-date-property";
|
||||
|
||||
@Override
|
||||
protected String getConditionName()
|
||||
{
|
||||
return DatePropertyValueConditionHandler.NAME;
|
||||
}
|
||||
|
||||
//Responsible for serializing the value of the property, which could have different types
|
||||
protected void prepareForSaveWithCorrectType(Map<String, Serializable> conditionProps, Map<String, Serializable> repoProps)
|
||||
{
|
||||
Date date = (Date) conditionProps.get(PROP_CONTAINS_TEXT);
|
||||
repoProps.put(ComparePropertyValueEvaluator.PARAM_VALUE, date);
|
||||
}
|
||||
|
||||
protected void prepareForEditWithCorrectType(Map<String, Serializable> conditionProps,
|
||||
Map<String, Serializable> repoProps)
|
||||
{
|
||||
Date dateValue = (Date) repoProps.get(ComparePropertyValueEvaluator.PARAM_VALUE);
|
||||
conditionProps.put(PROP_CONTAINS_TEXT, dateValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSummaryStringTemplate(Boolean not)
|
||||
{
|
||||
String msgId = not.booleanValue() ? "condition_compare_date_property_value_not"
|
||||
: "condition_compare_date_property_value";
|
||||
return msgId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String displayOperation(String operation)
|
||||
{
|
||||
ComparePropertyValueOperation op = ComparePropertyValueOperation.valueOf(operation);
|
||||
switch (op)
|
||||
{
|
||||
case EQUALS:
|
||||
return "property_date_condition_equals";
|
||||
case GREATER_THAN:
|
||||
return "property_date_condition_greaterthan";
|
||||
case GREATER_THAN_EQUAL:
|
||||
return "property_date_condition_greaterthanequals";
|
||||
case LESS_THAN:
|
||||
return "property_date_condition_lessthan";
|
||||
case LESS_THAN_EQUAL:
|
||||
return "property_date_condition_lessthanequals";
|
||||
default: return "property_condition_invalid";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have received a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.rules.handlers.property;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
||||
import org.alfresco.repo.action.evaluator.compare.ComparePropertyValueOperation;
|
||||
|
||||
/**
|
||||
* Condition handler for the "compare-integer-property" condition.
|
||||
*
|
||||
* @author Jean Barmash
|
||||
*/
|
||||
public class IntegerPropertyValueConditionHandler extends TextPropertyValueConditionHandler
|
||||
{
|
||||
|
||||
public static final String NAME = "compare-integer-property";
|
||||
|
||||
@Override
|
||||
protected String getConditionName()
|
||||
{
|
||||
return IntegerPropertyValueConditionHandler.NAME;
|
||||
}
|
||||
|
||||
//Responsible for serializing the value of the property, which could have different types
|
||||
protected void prepareForSaveWithCorrectType(Map<String, Serializable> conditionProps, Map<String, Serializable> repoProps)
|
||||
{
|
||||
Long number = Long.parseLong((String)conditionProps.get(PROP_CONTAINS_TEXT));
|
||||
repoProps.put(ComparePropertyValueEvaluator.PARAM_VALUE, number );
|
||||
}
|
||||
|
||||
protected void prepareForEditWithCorrectType(Map<String, Serializable> conditionProps,
|
||||
Map<String, Serializable> repoProps)
|
||||
{
|
||||
Long propValue = (Long)repoProps.get(ComparePropertyValueEvaluator.PARAM_VALUE);
|
||||
conditionProps.put(PROP_CONTAINS_TEXT, propValue.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSummaryStringTemplate(Boolean not)
|
||||
{
|
||||
String msgId = not.booleanValue() ? "condition_compare_integer_property_value_not"
|
||||
: "condition_compare_integer_property_value";
|
||||
return msgId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String displayOperation(String operation)
|
||||
{
|
||||
ComparePropertyValueOperation op = ComparePropertyValueOperation.valueOf(operation);
|
||||
switch (op)
|
||||
{
|
||||
case EQUALS:
|
||||
return "property_condition_equals";
|
||||
case GREATER_THAN:
|
||||
return "property_condition_greaterthan";
|
||||
case GREATER_THAN_EQUAL:
|
||||
return "property_condition_greaterthanequals";
|
||||
case LESS_THAN:
|
||||
return "property_condition_lessthan";
|
||||
case LESS_THAN_EQUAL:
|
||||
return "property_condition_lessthanequals";
|
||||
default: return "property_condition_invalid";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have received a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.rules.handlers.property;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
||||
import org.alfresco.repo.action.evaluator.compare.ComparePropertyValueOperation;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.rules.handlers.PropertyValueHandler;
|
||||
import org.alfresco.web.bean.wizard.IWizardBean;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Condition handler for the "compare-text-property" condition.
|
||||
*
|
||||
* @author Jean Barmash
|
||||
*/
|
||||
public class TextPropertyValueConditionHandler extends PropertyValueHandler
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(TextPropertyValueConditionHandler.class);
|
||||
public static final String NAME = "compare-text-property";
|
||||
|
||||
public static final String UI_PARAM_OPERATION = "operation";
|
||||
public static final String UI_PARAM_QNAME = "qname";
|
||||
|
||||
public String getJSPPath()
|
||||
{
|
||||
return getJSPPath(getConditionName());
|
||||
}
|
||||
|
||||
protected String getConditionName()
|
||||
{
|
||||
return TextPropertyValueConditionHandler.NAME;
|
||||
}
|
||||
|
||||
public void prepareForSave(Map<String, Serializable> conditionParams, Map<String, Serializable> repoProps)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Preparing to Save Text Condition Parameters");
|
||||
|
||||
super.prepareForSave(conditionParams, repoProps);
|
||||
String propertyString = (String) conditionParams.get(UI_PARAM_QNAME);
|
||||
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ServiceRegistry serviceRegistry = Repository.getServiceRegistry(fc);
|
||||
QName qname = null;
|
||||
|
||||
if ((propertyString.indexOf(':')) == -1) // TODO: there might be a better way to resolve namespaces
|
||||
qname = QName.createQName(propertyString);
|
||||
else
|
||||
qname = QName.createQName(propertyString, serviceRegistry.getNamespaceService());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.warn("Storing Property QName " + qname);
|
||||
|
||||
repoProps.put(ComparePropertyValueEvaluator.PARAM_PROPERTY, qname);
|
||||
|
||||
String operation = (String) conditionParams.get(UI_PARAM_OPERATION);
|
||||
repoProps.put(ComparePropertyValueEvaluator.PARAM_OPERATION, operation);
|
||||
}
|
||||
|
||||
public void prepareForEdit(Map<String, Serializable> conditionProps, Map<String, Serializable> repoProps)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Retrieving Text Condition Parameters for editing");
|
||||
|
||||
super.prepareForEdit(conditionProps, repoProps);
|
||||
conditionProps.put(UI_PARAM_QNAME, ((QName) repoProps.get(ComparePropertyValueEvaluator.PARAM_PROPERTY))
|
||||
.toPrefixString());
|
||||
conditionProps.put(UI_PARAM_OPERATION, repoProps.get(ComparePropertyValueEvaluator.PARAM_OPERATION).toString());
|
||||
}
|
||||
|
||||
public String generateSummary(FacesContext context, IWizardBean wizard, Map<String, Serializable> conditionProps)
|
||||
{
|
||||
Boolean not = (Boolean) conditionProps.get(PROP_CONDITION_NOT);
|
||||
String msgId = getSummaryStringTemplate(not);
|
||||
String text = conditionProps.get(PROP_CONTAINS_TEXT).toString();
|
||||
String operation = (String) conditionProps.get(UI_PARAM_OPERATION);
|
||||
String qname = (String) conditionProps.get(UI_PARAM_QNAME);
|
||||
|
||||
return MessageFormat.format(Application.getMessage(context, msgId), new Object[]
|
||||
{ qname, Application.getMessage(context, displayOperation(operation)), text });
|
||||
}
|
||||
|
||||
protected String displayOperation(String operation)
|
||||
{
|
||||
ComparePropertyValueOperation op = ComparePropertyValueOperation.valueOf(operation);
|
||||
switch (op)
|
||||
{
|
||||
case EQUALS:
|
||||
return "property_date_condition_equals";
|
||||
case CONTAINS:
|
||||
return "property_condition_contains";
|
||||
case BEGINS:
|
||||
return "property_condition_beginswith";
|
||||
case ENDS:
|
||||
return "property_condition_endswith";
|
||||
default: return "property_condition_invalid";
|
||||
}
|
||||
}
|
||||
|
||||
protected String getSummaryStringTemplate(Boolean not)
|
||||
{
|
||||
String msgId = not.booleanValue() ? "condition_compare_text_property_value_not"
|
||||
: "condition_compare_text_property_value";
|
||||
return msgId;
|
||||
}
|
||||
|
||||
}
|
@@ -518,6 +518,11 @@
|
||||
<managed-bean-name>ClipboardBean</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.clipboard.ClipboardBean</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
|
||||
<managed-property>
|
||||
<property-name>nodeService</property-name>
|
||||
<value>#{NodeService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
@@ -995,7 +1000,7 @@
|
||||
The bean that backs up the Create Rule Wizard
|
||||
</description>
|
||||
<managed-bean-name>CreateRuleWizard</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.rules.CreateRuleWizard</managed-bean-class>
|
||||
<managed-bean-class>org.alfresco.web.bean.rules.CreateCompositeRuleWizard</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>nodeService</property-name>
|
||||
|
@@ -47,19 +47,23 @@
|
||||
|
||||
function checkButtonState()
|
||||
{
|
||||
if (document.getElementById("email-action:subject").value.length == 0)
|
||||
var disableBtn = document.getElementById("finishButtonDisabled").innerHTML;
|
||||
if (document.getElementById("email-action:subject").value.length > 0 && disableBtn == "false")
|
||||
{
|
||||
document.getElementById("email-action:ok-button").disabled = true;
|
||||
document.getElementById("email-action:ok-button").disabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("email-action:ok-button").disabled = false;
|
||||
document.getElementById("email-action:ok-button").disabled = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<f:view>
|
||||
|
||||
<h:outputText id="finishButtonDisabled" value="#{WizardManager.bean.finishButtonDisabled}" style="display:none;"/>
|
||||
|
||||
|
||||
<%-- load a bundle of properties with I18N strings --%>
|
||||
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
|
||||
|
||||
|
208
source/web/jsp/rules/compare-date-property.jsp
Normal file
208
source/web/jsp/rules/compare-date-property.jsp
Normal file
@@ -0,0 +1,208 @@
|
||||
<%--
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
--%>
|
||||
<%@ 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" %>
|
||||
|
||||
<r:page titleId="title_condition_contains_text">
|
||||
|
||||
<script language="JavaScript1.2">
|
||||
function checkButtonState(inputField)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<f:view>
|
||||
|
||||
<%-- load a bundle of properties with I18N strings --%>
|
||||
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
|
||||
|
||||
<h:form acceptcharset="UTF-8" id="contains-text-condition">
|
||||
|
||||
<%-- Main outer table --%>
|
||||
<table cellspacing="0" cellpadding="2">
|
||||
|
||||
<%-- Title bar --%>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<%@ include file="../parts/titlebar.jsp" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%-- Main area --%>
|
||||
<tr valign="top">
|
||||
<%-- Shelf --%>
|
||||
<td>
|
||||
<%@ include file="../parts/shelf.jsp" %>
|
||||
</td>
|
||||
|
||||
<%-- Work Area --%>
|
||||
<td width="100%">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<%-- Breadcrumb --%>
|
||||
<%@ include file="../parts/breadcrumb.jsp" %>
|
||||
|
||||
<%-- Status and Actions --%>
|
||||
<tr>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)" width="4"></td>
|
||||
<td bgcolor="#dfe6ed">
|
||||
|
||||
<%-- Status and Actions inner contents table --%>
|
||||
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
|
||||
<table cellspacing="4" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td width="32">
|
||||
<h:graphicImage id="wizard-logo" url="/images/icons/new_rule_large.gif" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="mainTitle"><h:outputText value="#{WizardManager.title}" /></div>
|
||||
<div class="mainSubText"><h:outputText value="#{WizardManager.description}" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with gradient shadow --%>
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<%-- Details --%>
|
||||
<tr valign=top>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
|
||||
<td>
|
||||
<table cellspacing="0" cellpadding="3" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%" valign="top">
|
||||
|
||||
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
|
||||
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
||||
<table cellpadding="2" cellspacing="2" border="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="2" class="mainSubTitle"><h:outputText value="#{msg.set_condition_values}" /></td>
|
||||
</tr>
|
||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td colspan="2" class="mainSubText">
|
||||
<h:outputText value="#{msg.enter_date_condition}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.date_property_condition_property}"/>:
|
||||
</td> <td>
|
||||
<h:inputText id="qname" value="#{WizardManager.bean.conditionProperties.qname}" size="35" maxlength="1024" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.property_condition_operation}"/>:
|
||||
|
||||
</td> <td>
|
||||
<h:selectOneMenu value="#{WizardManager.bean.conditionProperties.operation}">
|
||||
<f:selectItem itemValue="EQUALS" itemLabel="#{msg.property_date_condition_equals}"/>
|
||||
<f:selectItem itemValue="GREATER_THAN" itemLabel="#{msg.property_date_condition_greaterthan}"/>
|
||||
<f:selectItem itemValue="GREATER_THAN_EQUAL" itemLabel="#{msg.property_date_condition_greaterthanequals}"/>
|
||||
<f:selectItem itemValue="LESS_THAN" itemLabel="#{msg.property_date_condition_lessthan}"/>
|
||||
<f:selectItem itemValue="LESS_THAN_EQUAL" itemLabel="#{msg.property_date_condition_lessthanequals}"/>
|
||||
</h:selectOneMenu>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h:outputText value="#{msg.property_condition_value}"/>:
|
||||
</td> <td>
|
||||
<a:inputDatePicker id="pattern" value="#{WizardManager.bean.conditionProperties.containstext}" showTime="true"
|
||||
startYear="#{DatePickerGenerator.startYear}" initialiseIfNull="true" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table><tr>
|
||||
<td><h:selectBooleanCheckbox value="#{WizardManager.bean.conditionProperties.notcondition}"/></td>
|
||||
<td><h:outputText value="#{msg.not_condition_result}"/></td>
|
||||
</tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="paddingRow"></td></tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %>
|
||||
<table cellpadding="1" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton id="ok-button" value="#{msg.ok}" action="#{WizardManager.bean.addCondition}"
|
||||
styleClass="wizardButton" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton value="#{msg.cancel_button}" action="#{WizardManager.bean.cancelAddCondition}"
|
||||
styleClass="wizardButton" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with bottom panel graphics --%>
|
||||
<tr>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif" width="4" height="4"></td>
|
||||
<td width="100%" align="center" style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif" width="4" height="4"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</h:form>
|
||||
|
||||
</f:view>
|
||||
|
||||
</r:page>
|
221
source/web/jsp/rules/compare-integer-property.jsp
Normal file
221
source/web/jsp/rules/compare-integer-property.jsp
Normal file
@@ -0,0 +1,221 @@
|
||||
<%--
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
--%>
|
||||
<%@ 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" %>
|
||||
|
||||
<r:page titleId="title_condition_contains_text">
|
||||
|
||||
<script language="JavaScript1.2">
|
||||
function checkButtonState(inputField)
|
||||
{
|
||||
var disabled = (inputField.value.length == 0);
|
||||
document.getElementById("contains-text-condition:ok-button").disabled = disabled;
|
||||
}
|
||||
</script>
|
||||
|
||||
<f:view>
|
||||
|
||||
<%-- load a bundle of properties with I18N strings --%>
|
||||
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
|
||||
|
||||
<h:form acceptcharset="UTF-8" id="contains-text-condition">
|
||||
|
||||
<%-- Main outer table --%>
|
||||
<table cellspacing="0" cellpadding="2">
|
||||
|
||||
<%-- Title bar --%>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<%@ include file="../parts/titlebar.jsp" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%-- Main area --%>
|
||||
<tr valign="top">
|
||||
<%-- Shelf --%>
|
||||
<td>
|
||||
<%@ include file="../parts/shelf.jsp" %>
|
||||
</td>
|
||||
|
||||
<%-- Work Area --%>
|
||||
<td width="100%">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<%-- Breadcrumb --%>
|
||||
<%@ include file="../parts/breadcrumb.jsp" %>
|
||||
|
||||
<%-- Status and Actions --%>
|
||||
<tr>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)" width="4"></td>
|
||||
<td bgcolor="#dfe6ed">
|
||||
|
||||
<%-- Status and Actions inner contents table --%>
|
||||
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
|
||||
<table cellspacing="4" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td width="32">
|
||||
<h:graphicImage id="wizard-logo" url="/images/icons/new_rule_large.gif" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="mainTitle"><h:outputText value="#{WizardManager.title}" /></div>
|
||||
<div class="mainSubText"><h:outputText value="#{WizardManager.description}" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with gradient shadow --%>
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<%-- Details --%>
|
||||
<tr valign=top>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
|
||||
<td>
|
||||
<table cellspacing="0" cellpadding="3" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%" valign="top">
|
||||
|
||||
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
|
||||
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
||||
<table cellpadding="2" cellspacing="2" border="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="2" class="mainSubTitle"><h:outputText value="#{msg.set_condition_values}" /></td>
|
||||
</tr>
|
||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td colspan="2" class="mainSubText">
|
||||
<h:outputText value="#{msg.enter_integer_condition}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.select_default_qname}"/>:
|
||||
</td> <td>
|
||||
<select id="select_default_qname">
|
||||
<option value="select">select qname</option>
|
||||
<option value="cm:name">cm:name</option>
|
||||
<option value="cm:description">cm:description</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.integer_property_condition_property}"/>:
|
||||
</td> <td>
|
||||
<h:inputText id="qname" value="#{WizardManager.bean.conditionProperties.qname}" size="35" maxlength="1024" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.property_condition_operation}"/>:
|
||||
</td> <td>
|
||||
<h:selectOneMenu value="#{WizardManager.bean.conditionProperties.operation}">
|
||||
<f:selectItem itemValue="EQUALS" itemLabel="#{msg.property_condition_equals}"/>
|
||||
<f:selectItem itemValue="GREATER_THAN" itemLabel="#{msg.property_condition_greaterthan}"/>
|
||||
<f:selectItem itemValue="GREATER_THAN_EQUAL" itemLabel="#{msg.property_condition_greaterthanequals}"/>
|
||||
<f:selectItem itemValue="LESS_THAN" itemLabel="#{msg.property_condition_lessthan}"/>
|
||||
<f:selectItem itemValue="LESS_THAN_EQUAL" itemLabel="#{msg.property_condition_lessthanequals}"/>
|
||||
</h:selectOneMenu>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h:outputText value="#{msg.property_condition_value}"/>:
|
||||
</td> <td>
|
||||
<h:inputText id="pattern" value="#{WizardManager.bean.conditionProperties.containstext}"
|
||||
onkeyup="javascript:checkButtonState(this);" size="35" maxlength="1024" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table><tr>
|
||||
<td><h:selectBooleanCheckbox value="#{WizardManager.bean.conditionProperties.notcondition}"/></td>
|
||||
<td><h:outputText value="#{msg.not_condition_result}"/></td>
|
||||
</tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="paddingRow"></td></tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %>
|
||||
<table cellpadding="1" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton id="ok-button" value="#{msg.ok}" action="#{WizardManager.bean.addCondition}"
|
||||
styleClass="wizardButton"
|
||||
disabled="#{WizardManager.bean.conditionProperties.containstext == null}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton value="#{msg.cancel_button}" action="#{WizardManager.bean.cancelAddCondition}"
|
||||
styleClass="wizardButton" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with bottom panel graphics --%>
|
||||
<tr>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif" width="4" height="4"></td>
|
||||
<td width="100%" align="center" style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif" width="4" height="4"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</h:form>
|
||||
|
||||
</f:view>
|
||||
|
||||
</r:page>
|
220
source/web/jsp/rules/compare-text-property.jsp
Normal file
220
source/web/jsp/rules/compare-text-property.jsp
Normal file
@@ -0,0 +1,220 @@
|
||||
<%--
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
--%>
|
||||
<%@ 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" %>
|
||||
|
||||
<r:page titleId="title_condition_contains_text">
|
||||
|
||||
<script language="JavaScript1.2">
|
||||
function checkButtonState(inputField)
|
||||
{
|
||||
var disabled = (inputField.value.length == 0);
|
||||
document.getElementById("contains-text-condition:ok-button").disabled = disabled;
|
||||
}
|
||||
</script>
|
||||
|
||||
<f:view>
|
||||
|
||||
<%-- load a bundle of properties with I18N strings --%>
|
||||
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
|
||||
|
||||
<h:form acceptcharset="UTF-8" id="contains-text-condition">
|
||||
|
||||
<%-- Main outer table --%>
|
||||
<table cellspacing="0" cellpadding="2">
|
||||
|
||||
<%-- Title bar --%>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<%@ include file="../parts/titlebar.jsp" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%-- Main area --%>
|
||||
<tr valign="top">
|
||||
<%-- Shelf --%>
|
||||
<td>
|
||||
<%@ include file="../parts/shelf.jsp" %>
|
||||
</td>
|
||||
|
||||
<%-- Work Area --%>
|
||||
<td width="100%">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<%-- Breadcrumb --%>
|
||||
<%@ include file="../parts/breadcrumb.jsp" %>
|
||||
|
||||
<%-- Status and Actions --%>
|
||||
<tr>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)" width="4"></td>
|
||||
<td bgcolor="#dfe6ed">
|
||||
|
||||
<%-- Status and Actions inner contents table --%>
|
||||
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
|
||||
<table cellspacing="4" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td width="32">
|
||||
<h:graphicImage id="wizard-logo" url="/images/icons/new_rule_large.gif" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="mainTitle"><h:outputText value="#{WizardManager.title}" /></div>
|
||||
<div class="mainSubText"><h:outputText value="#{WizardManager.description}" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with gradient shadow --%>
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<%-- Details --%>
|
||||
<tr valign=top>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
|
||||
<td>
|
||||
<table cellspacing="0" cellpadding="3" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%" valign="top">
|
||||
|
||||
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
|
||||
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
||||
<table cellpadding="2" cellspacing="2" border="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="2" class="mainSubTitle"><h:outputText value="#{msg.set_condition_values}" /></td>
|
||||
</tr>
|
||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td colspan="2" class="mainSubText">
|
||||
<h:outputText value="#{msg.enter_text_condition}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.select_default_qname}"/>:
|
||||
</td> <td>
|
||||
<select id="select_default_qname">
|
||||
<option value="select">select qname</option>
|
||||
<option value="cm:name">cm:name</option>
|
||||
<option value="cm:description">cm:description</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.text_property_condition_property}"/>:
|
||||
</td> <td>
|
||||
<h:inputText id="qname" value="#{WizardManager.bean.conditionProperties.qname}" size="35" maxlength="1024" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="200px">
|
||||
<h:outputText value="#{msg.property_condition_operation}"/>:
|
||||
</td> <td>
|
||||
<h:selectOneMenu value="#{WizardManager.bean.conditionProperties.operation}">
|
||||
<f:selectItem itemValue="EQUALS" itemLabel="#{msg.property_condition_equals}"/>
|
||||
<f:selectItem itemValue="CONTAINS" itemLabel="#{msg.property_condition_contains}"/>
|
||||
<f:selectItem itemValue="BEGINS" itemLabel="#{msg.property_condition_beginswith}"/>
|
||||
<f:selectItem itemValue="ENDS" itemLabel="#{msg.property_condition_endswith}h"/>
|
||||
</h:selectOneMenu>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h:outputText value="#{msg.property_condition_value}"/>:
|
||||
</td> <td>
|
||||
<h:inputText id="pattern" value="#{WizardManager.bean.conditionProperties.containstext}"
|
||||
onkeyup="javascript:checkButtonState(this);" size="35" maxlength="1024" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table><tr>
|
||||
<td><h:selectBooleanCheckbox value="#{WizardManager.bean.conditionProperties.notcondition}"/></td>
|
||||
<td><h:outputText value="#{msg.not_condition_result}"/></td>
|
||||
</tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="paddingRow"></td></tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %>
|
||||
<table cellpadding="1" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton id="ok-button" value="#{msg.ok}" action="#{WizardManager.bean.addCondition}"
|
||||
styleClass="wizardButton"
|
||||
disabled="#{WizardManager.bean.conditionProperties.containstext == null}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton value="#{msg.cancel_button}" action="#{WizardManager.bean.cancelAddCondition}"
|
||||
styleClass="wizardButton" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with bottom panel graphics --%>
|
||||
<tr>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif" width="4" height="4"></td>
|
||||
<td width="100%" align="center" style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif" width="4" height="4"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</h:form>
|
||||
|
||||
</f:view>
|
||||
|
||||
</r:page>
|
276
source/web/jsp/rules/composite-condition.jsp
Normal file
276
source/web/jsp/rules/composite-condition.jsp
Normal file
@@ -0,0 +1,276 @@
|
||||
<%--
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
--%>
|
||||
<%@ 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" %>
|
||||
|
||||
<r:page titleId="title_condition_in_category">
|
||||
|
||||
|
||||
|
||||
<f:view>
|
||||
|
||||
<%-- load a bundle of properties with I18N strings --%>
|
||||
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function itemSelected(inputField)
|
||||
{
|
||||
if (inputField.selectedIndex == 0)
|
||||
{
|
||||
document.getElementById("composite-condition:set-add-button").disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("composite-condition:set-add-button").disabled = false;
|
||||
}
|
||||
|
||||
// also check to see if the 'no-condition' option has been selected, if it has, change
|
||||
// the explanation text and the button label
|
||||
var short_text = "<a:outputText value='#{msg.click_add_to_list}' />";
|
||||
var long_text = "<a:outputText value='#{msg.click_set_and_add}' />";
|
||||
var short_label = "<a:outputText value='#{msg.add_to_list_button}' encodeForJavaScript='true' />";
|
||||
var long_label = "<a:outputText value='#{msg.set_and_add_button}' encodeForJavaScript='true' />";
|
||||
|
||||
if (inputField.value == "no-condition")
|
||||
{
|
||||
document.getElementById("composite-condition:set-add-button").value = decodeURI(short_label);
|
||||
document.getElementById("composite-condition:instruction-text").innerHTML = short_text;
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("composite-condition:set-add-button").value = decodeURI(long_label);
|
||||
document.getElementById("composite-condition:instruction-text").innerHTML = long_text;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<h:form acceptcharset="UTF-8" id="composite-condition">
|
||||
|
||||
<%-- Main outer table --%>
|
||||
<table cellspacing="0" cellpadding="2">
|
||||
|
||||
<%-- Title bar --%>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<%@ include file="../parts/titlebar.jsp" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%-- Main area --%>
|
||||
<tr valign="top">
|
||||
<%-- Shelf --%>
|
||||
<td>
|
||||
<%@ include file="../parts/shelf.jsp" %>
|
||||
</td>
|
||||
|
||||
<%-- Work Area --%>
|
||||
<td width="100%">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<%-- Breadcrumb --%>
|
||||
<%@ include file="../parts/breadcrumb.jsp" %>
|
||||
|
||||
<%-- Status and Actions --%>
|
||||
<tr>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)" width="4"></td>
|
||||
<td bgcolor="#dfe6ed">
|
||||
|
||||
<%-- Status and Actions inner contents table --%>
|
||||
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
|
||||
<table cellspacing="4" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td width="32">
|
||||
<h:graphicImage id="wizard-logo" url="/images/icons/new_rule_large.gif" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="mainTitle"> <h:outputText value="#{WizardManager.title}" /> - <h:outputText value="#{msg.composite_condition_page_title}" /> </div>
|
||||
<div class="mainSubText"><h:outputText value="#{msg.composite_condition_page_description}" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with gradient shadow --%>
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<%-- Details --%>
|
||||
<tr valign=top>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
|
||||
<td>
|
||||
<table cellspacing="0" cellpadding="3" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%" valign="top">
|
||||
|
||||
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
|
||||
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
||||
|
||||
<table cellpadding="2" cellspacing="2" border="0" width="100%">
|
||||
<tr>
|
||||
<td>1.</td>
|
||||
<td>
|
||||
<h:outputText value="#{msg.select_condition}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td width="98%">
|
||||
<h:selectOneMenu value="#{WizardManager.bean.condition}"
|
||||
id="condition" onchange="javascript:itemSelected(this);">
|
||||
<f:selectItems value="#{WizardManager.bean.compositeConditions}" />
|
||||
</h:selectOneMenu>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td>2.</td>
|
||||
<td>
|
||||
<h:outputText value="#{msg.click_set_and_add}" id="instruction-text"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<h:commandButton id="set-add-button" value="#{msg.set_and_add_button}"
|
||||
action="#{WizardManager.bean.promptForConditionValues}"
|
||||
disabled="true"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<h:outputText value="#{msg.composite_condition_page_selected}" />
|
||||
<h:selectBooleanCheckbox value="#{WizardManager.bean.conditionProperties.orconditions}"/>
|
||||
<h:outputText value="#{msg.composite_condition_page_or}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<h:dataTable value="#{WizardManager.bean.allCompositeConditionsDataModel}" var="row"
|
||||
rowClasses="selectedItemsRow,selectedItemsRowAlt"
|
||||
styleClass="selectedItems" headerClass="selectedItemsHeader"
|
||||
cellspacing="0" cellpadding="4"
|
||||
rendered="#{WizardManager.bean.allCompositeConditionsDataModel.rowCount != 0}">
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="#{msg.summary}" />
|
||||
</f:facet>
|
||||
<h:outputText value="#{row.conditionSummary}" />
|
||||
</h:column>
|
||||
<h:column>
|
||||
<a:actionLink action="#{WizardManager.bean.removeCondition}" image="/images/icons/delete.gif"
|
||||
value="#{msg.remove}" showLink="false" style="padding-left:6px;padding-right:2px" />
|
||||
<a:actionLink action="#{WizardManager.bean.editCondition}" image="/images/icons/edit_icon.gif"
|
||||
value="#{msg.change}" showLink="false" rendered='#{row.noParamsMarker == null}' />
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
<a:panel id="no-items" rendered="#{WizardManager.bean.allCompositeConditionsDataModel.rowCount == 0}">
|
||||
<table cellspacing='0' cellpadding='2' border='0' class='selectedItems'>
|
||||
<tr>
|
||||
<td colspan='2' class='selectedItemsHeader'>
|
||||
<h:outputText id="no-items-name" value="#{msg.summary}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='selectedItemsRow'>
|
||||
<h:outputText id="no-items-msg" value="#{msg.no_selected_items}" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</a:panel>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
|
||||
<table><tr>
|
||||
<td><h:selectBooleanCheckbox value="#{WizardManager.bean.conditionProperties.notcondition}"/></td>
|
||||
<td><h:outputText value="#{msg.not_condition_result}"/></td>
|
||||
</tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %>
|
||||
<table cellpadding="1" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton value="#{msg.ok}" action="#{WizardManager.bean.finishAddingCompositeCondition}" styleClass="wizardButton"
|
||||
disabled="#{WizardManager.bean.conditionProperties == null}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton value="#{msg.cancel_button}" action="#{WizardManager.bean.cancelAddCondition}"
|
||||
styleClass="wizardButton" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
|
||||
</tr>
|
||||
|
||||
<%-- separator row with bottom panel graphics --%>
|
||||
<tr>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif" width="4" height="4"></td>
|
||||
<td width="100%" align="center" style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif" width="4" height="4"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</h:form>
|
||||
|
||||
</f:view>
|
||||
|
||||
</r:page>
|
Reference in New Issue
Block a user