mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
14628: Second attempt at ETHREEOH-2144 fix - tested against several known good webforms. 14854: Fix for ETHREEOH-2206. Also fixes minor issue where rule condition selection box was not reset after adding a condition to a composite. 14862: Fix for ETHREEOH-1946 - correctly coerce nodes returned from javascript into AVMTemplateNode objects if they are AVM NodeRef objects. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14864 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -55,16 +55,18 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
// 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
|
||||
// (instead of DataModel) to get unlimited number of composite conditions recursing
|
||||
protected DataModel currentCompositeConditionsDataModel;
|
||||
protected List<Map<String, Serializable>> currentCompositeConditionPropertiesList;
|
||||
|
||||
private boolean addingCompositeCondition;
|
||||
private boolean editCurrentCompositeCondition;
|
||||
|
||||
private int rowIndex = -1;
|
||||
|
||||
|
||||
public CreateCompositeRuleWizard()
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +77,6 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
this.setAddingCompositeCondition(false);
|
||||
this.currentCompositeConditionsDataModel = null;
|
||||
this.currentCompositeConditionPropertiesList = null;
|
||||
|
||||
}
|
||||
|
||||
public void setupCompositeConditionsMode()
|
||||
@@ -83,7 +84,6 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
this.setAddingCompositeCondition(true);
|
||||
this.currentCompositeConditionsDataModel = new ListDataModel();
|
||||
this.currentCompositeConditionPropertiesList = new ArrayList<Map<String, Serializable>>();
|
||||
|
||||
}
|
||||
|
||||
private void clearCompositeConditionMode()
|
||||
@@ -94,7 +94,6 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
this.currentCompositeConditionsDataModel = null;
|
||||
this.currentCompositeConditionPropertiesList = null;
|
||||
this.setAddingCompositeCondition(false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,10 +146,7 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
|
||||
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>();
|
||||
// creating object temporarily so we can pass it to CompositeConditionHandler
|
||||
currentConditionProperties.put(CompositeConditionHandler.PROP_COMPOSITE_CONDITION,
|
||||
(Serializable) this.currentCompositeConditionPropertiesList);
|
||||
currentConditionProperties.put(PROP_CONDITION_NAME, this.selectedCondition);
|
||||
@@ -166,10 +162,21 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Generated Summary - [" + summary + "] + selectedCondition " + this.selectedCondition);
|
||||
|
||||
if (editingCondition == false)
|
||||
if (this.editCurrentCompositeCondition == true)
|
||||
{
|
||||
if (rowIndex != -1)
|
||||
{
|
||||
this.allConditionsPropertiesList.remove(rowIndex);
|
||||
this.allConditionsPropertiesList.add(rowIndex, currentConditionProperties);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.allConditionsPropertiesList.add(currentConditionProperties);
|
||||
}
|
||||
|
||||
this.editCurrentCompositeCondition = false;
|
||||
this.rowIndex = -1;
|
||||
clearCompositeConditionMode();
|
||||
// refresh the wizard
|
||||
goToPage(context, this.returnViewId);
|
||||
@@ -194,6 +201,8 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
@Override
|
||||
public void cancelAddCondition()
|
||||
{
|
||||
this.editCurrentCompositeCondition = false;
|
||||
this.rowIndex = -1;
|
||||
if (isAddingCompositeCondition())
|
||||
{
|
||||
// don't clear when editing, since we are looking at a REFERENCE to an existing condition
|
||||
@@ -224,7 +233,6 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
super.cancelAddCondition();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,7 +282,6 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("\tEdited composite condition. ");
|
||||
//editingCondition = false;
|
||||
}
|
||||
|
||||
this.currentConditionProperties = new HashMap<String, Serializable>(3);
|
||||
@@ -284,10 +291,12 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
this.currentConditionProperties.put(PROP_CONDITION_NAME, CompositeConditionHandler.NAME);
|
||||
this.currentConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE);
|
||||
|
||||
// reset the action drop down
|
||||
this.selectedCondition = null;
|
||||
|
||||
// refresh the wizard
|
||||
printConditionState();
|
||||
goToPage(context, this.returnViewId);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,6 +314,8 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
if (!isAddingCompositeCondition())
|
||||
{
|
||||
Map condition = (Map) this.allConditionsDataModel.getRowData();
|
||||
this.rowIndex = this.allConditionsDataModel.getRowIndex();
|
||||
this.editCurrentCompositeCondition = true;
|
||||
|
||||
if (condition.get(PROP_CONDITION_NAME).equals(CompositeConditionHandler.NAME))
|
||||
{
|
||||
@@ -323,8 +334,6 @@ public class CreateCompositeRuleWizard extends CreateRuleWizard
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<SelectItem> getCompositeConditions()
|
||||
{
|
||||
if (this.compositeConditions == null)
|
||||
|
@@ -22,27 +22,42 @@
|
||||
* http://www.alfresco.com/legal/licensing" */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import freemarker.ext.dom.NodeModel;
|
||||
import freemarker.cache.TemplateLoader;
|
||||
import freemarker.template.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import freemarker.cache.TemplateLoader;
|
||||
import freemarker.ext.dom.NodeModel;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.SimpleDate;
|
||||
import freemarker.template.SimpleHash;
|
||||
import freemarker.template.SimpleNumber;
|
||||
import freemarker.template.SimpleScalar;
|
||||
import freemarker.template.SimpleSequence;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateBooleanModel;
|
||||
import freemarker.template.TemplateException;
|
||||
import freemarker.template.TemplateExceptionHandler;
|
||||
import freemarker.template.TemplateHashModel;
|
||||
import freemarker.template.TemplateMethodModel;
|
||||
import freemarker.template.TemplateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* Implementation of a form data renderer for processing xml instance data
|
||||
* using a freemarker template.
|
||||
@@ -249,6 +264,10 @@ public class FreeMarkerRenderingEngine
|
||||
{
|
||||
return (Boolean)value ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
|
||||
}
|
||||
else if (value instanceof Date)
|
||||
{
|
||||
return new SimpleDate(((Date)value), SimpleDate.DATETIME);
|
||||
}
|
||||
else if (value instanceof Document)
|
||||
{
|
||||
return NodeModel.wrap((Document)value);
|
||||
|
@@ -384,7 +384,7 @@ public class RenderingEngineTemplateImpl
|
||||
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
|
||||
"date",
|
||||
namespacePrefixResolver),
|
||||
new SimpleDate(new Date(), SimpleDate.DATETIME));
|
||||
new Date());
|
||||
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
|
||||
"avm_sandbox_url",
|
||||
namespacePrefixResolver),
|
||||
|
Reference in New Issue
Block a user