mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
checkpoint of xforms improvements
- mostly functional hgroup implementation - refactoring to support hgroups, make widgets behave better as inline elements - figured out a way to get rid of dojo's inflight error watcher - partial support for totalDigits (blocked by a dojo bug) - improved support for length schema constraint - refactoring of create widget code on the way to supporting config based on schema type, xform type, and appearance - fix for silly bug in select workflow portion of create form wizard git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5573 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
* 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"
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
@@ -657,7 +657,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
}
|
||||
|
||||
/**
|
||||
* @param formName Sets the currently selected form
|
||||
* @param form Sets the currently selected form
|
||||
*/
|
||||
public void setFormName(final String formName)
|
||||
{
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* 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" */
|
||||
* http://www.alfresco.com/legal/licensing */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import freemarker.ext.dom.NodeModel;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* 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" */
|
||||
* http://www.alfresco.com/legal/licensing */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
@@ -19,27 +19,22 @@
|
||||
* 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" */
|
||||
* http://www.alfresco.com/legal/licensing */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import freemarker.ext.dom.NodeModel;
|
||||
import freemarker.template.SimpleDate;
|
||||
import freemarker.template.SimpleHash;
|
||||
import freemarker.template.SimpleScalar;
|
||||
import freemarker.template.TemplateHashModel;
|
||||
import freemarker.template.TemplateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import java.util.*;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
@@ -49,16 +44,16 @@ import org.alfresco.repo.template.TemplateNode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.remote.AVMRemote;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
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 org.alfresco.service.cmr.repository.TemplateException;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.namespace.DynamicNamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.*;
|
||||
import org.alfresco.service.cmr.remote.AVMRemote;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.AVMConstants;
|
||||
@@ -66,15 +61,9 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.jsf.FacesContextUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.*;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import freemarker.ext.dom.NodeModel;
|
||||
import freemarker.template.SimpleDate;
|
||||
import freemarker.template.SimpleHash;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of a rendering engine template
|
||||
|
@@ -2320,6 +2320,10 @@ public class Schema2XForms
|
||||
", maxInc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) +
|
||||
", minExc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINEXCLUSIVE) +
|
||||
", maxExc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXEXCLUSIVE) +
|
||||
", totalDigits: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_TOTALDIGITS) +
|
||||
", length: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_LENGTH) +
|
||||
", minLength: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINLENGTH) +
|
||||
", maxLength: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH) +
|
||||
", fractionDigits: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS) +
|
||||
", builtInTypeName: " + SchemaUtil.getBuiltInTypeName(controlType) +
|
||||
", builtInType: " + SchemaUtil.getBuiltInType(controlType) +
|
||||
@@ -2362,32 +2366,49 @@ public class Schema2XForms
|
||||
NamespaceConstants.XFORMS_PREFIX + ":ref",
|
||||
".");
|
||||
}
|
||||
else if (controlType.getBounded() &&
|
||||
controlType.getNumeric() &&
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) != null &&
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE) != null)
|
||||
else if (controlType.getNumeric())
|
||||
{
|
||||
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||
NamespaceConstants.XFORMS_PREFIX + ":range");
|
||||
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||
NamespaceConstants.XFORMS_PREFIX + ":start",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE));
|
||||
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||
NamespaceConstants.XFORMS_PREFIX + ":end",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE));
|
||||
String fractionDigits = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS);
|
||||
if (fractionDigits == null || fractionDigits.length() == 0)
|
||||
if (controlType.getBounded() &&
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) != null &&
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE) != null)
|
||||
{
|
||||
final short builtInType = SchemaUtil.getBuiltInType(controlType);
|
||||
fractionDigits = (builtInType >= XSConstants.INTEGER_DT && builtInType <= XSConstants.POSITIVEINTEGER_DT
|
||||
? "0"
|
||||
: null);
|
||||
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||
NamespaceConstants.XFORMS_PREFIX + ":range");
|
||||
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||
NamespaceConstants.XFORMS_PREFIX + ":start",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE));
|
||||
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||
NamespaceConstants.XFORMS_PREFIX + ":end",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE));
|
||||
}
|
||||
if (fractionDigits != null)
|
||||
else
|
||||
{
|
||||
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||
NamespaceConstants.XFORMS_PREFIX + ":input");
|
||||
}
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS))
|
||||
{
|
||||
String fractionDigits = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS);
|
||||
if (fractionDigits == null || fractionDigits.length() == 0)
|
||||
{
|
||||
final short builtInType = SchemaUtil.getBuiltInType(controlType);
|
||||
fractionDigits = (builtInType >= XSConstants.INTEGER_DT && builtInType <= XSConstants.POSITIVEINTEGER_DT
|
||||
? "0"
|
||||
: null);
|
||||
}
|
||||
if (fractionDigits != null)
|
||||
{
|
||||
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
|
||||
NamespaceService.ALFRESCO_PREFIX + ":fractionDigits",
|
||||
fractionDigits);
|
||||
}
|
||||
}
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_TOTALDIGITS))
|
||||
{
|
||||
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
|
||||
NamespaceService.ALFRESCO_PREFIX + ":fractionDigits",
|
||||
fractionDigits);
|
||||
NamespaceService.ALFRESCO_PREFIX + ":totalDigits",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_TOTALDIGITS));
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2399,14 +2420,27 @@ public class Schema2XForms
|
||||
{
|
||||
appearance = "full";
|
||||
}
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH) ||
|
||||
controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_LENGTH))
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_LENGTH))
|
||||
{
|
||||
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
|
||||
NamespaceService.ALFRESCO_PREFIX + ":maxLength",
|
||||
(controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH)
|
||||
? controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH)
|
||||
: controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH)));
|
||||
NamespaceService.ALFRESCO_PREFIX + ":length",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_LENGTH));
|
||||
}
|
||||
else if(controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MINLENGTH) ||
|
||||
controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH))
|
||||
{
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MINLENGTH))
|
||||
{
|
||||
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
|
||||
NamespaceService.ALFRESCO_PREFIX + ":minlength",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINLENGTH));
|
||||
}
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH))
|
||||
{
|
||||
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
|
||||
NamespaceService.ALFRESCO_PREFIX + ":maxlength",
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setXFormsId(result);
|
||||
|
@@ -231,7 +231,7 @@ public class SchemaUtil
|
||||
final XSImplementation xsImpl = (XSImplementation)
|
||||
registry.getDOMImplementation("XS-Loader");
|
||||
final XSLoader schemaLoader = xsImpl.createXSLoader(null);
|
||||
final DOMConfiguration config = schemaLoader.getConfig();
|
||||
final DOMConfiguration config = (DOMConfiguration)schemaLoader.getConfig();
|
||||
final LinkedList<DOMError> errors = new LinkedList<DOMError>();
|
||||
config.setParameter("error-handler", new DOMErrorHandler()
|
||||
{
|
||||
|
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
elementFormDefault="qualified">
|
||||
<xs:complexType name="fields">
|
||||
<xs:sequence>
|
||||
<xs:element name="unbounded_string" type="xs:normalizedString" default="unbounded string value"/>
|
||||
<xs:element name="one_char" default="A">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:length value="1"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="five_digits" default="12345">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:integer">
|
||||
<xs:totalDigits value="5"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="root_group">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="full_group" type="fields">
|
||||
<xs:annotation><xs:appinfo><alf:appearance>full</alf:appearance></xs:appinfo></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="compact_group" type="fields">
|
||||
<xs:annotation><xs:appinfo><alf:appearance>compact</alf:appearance></xs:appinfo></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="minimal_group" type="fields">
|
||||
<xs:annotation><xs:appinfo><alf:appearance>minimal</alf:appearance></xs:appinfo></xs:annotation>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@@ -5,6 +5,15 @@
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.xformsItemRequiredImage
|
||||
{
|
||||
vertical-align: middle;
|
||||
margin: 0px 5px;
|
||||
left: 0px;
|
||||
position: relative;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.xformsItemLabelSubmitError
|
||||
{
|
||||
color: red;
|
||||
@@ -229,3 +238,4 @@
|
||||
{
|
||||
color: grey;
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
* 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"
|
||||
* 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" %>
|
||||
@@ -27,22 +27,23 @@
|
||||
<script type="text/javascript">
|
||||
function apply_default_workflow_changed(value)
|
||||
{
|
||||
document.getElementById("wizard:wizard-body:sdw-pg-2").style.display = value == 'true' ? "block" : "none";
|
||||
value = String(value) == 'true';
|
||||
document.getElementById("wizard:wizard-body:sdw-pg-2").style.display = value ? "block" : "none";
|
||||
}
|
||||
</script>
|
||||
<h:panelGroup id="sdw-pg-1">
|
||||
<h:outputText id="sdw-question"
|
||||
value="#{msg.create_form_select_default_workflow_apply_default_workflow}"
|
||||
escape="false" />
|
||||
<h:selectOneRadio id="sdw-apply-default-workflow-yes"
|
||||
|
||||
<h:selectOneRadio id="sdw-apply-default-workflow-select-one"
|
||||
required="false"
|
||||
onchange="apply_default_workflow_changed(this.value)"
|
||||
value="#{WizardManager.bean.applyDefaultWorkflow}">
|
||||
<f:selectItem id="sdw-apply-default-workflow-yes-item"
|
||||
itemLabel="#{msg.yes}" itemValue="true"/>
|
||||
<f:selectItem id="sdw-apply-defalt-workflow-no-item"
|
||||
itemLabel="#{msg.no_not_now}" itemValue="false"/>
|
||||
<f:selectItem itemLabel="#{msg.yes}" itemValue="#{true}"/>
|
||||
<f:selectItem itemLabel="#{msg.no_not_now}" itemValue="#{false}"/>
|
||||
</h:selectOneRadio>
|
||||
|
||||
<f:verbatim><div style="margin-top:10px"> </div></f:verbatim>
|
||||
<h:panelGroup id="sdw-pg-2" style="#{WizardManager.bean.applyDefaultWorkflow?'display:block':'display:none'}">
|
||||
<h:outputText id="sdw-select-workflow"
|
||||
|
@@ -45,7 +45,12 @@ alfresco.AjaxHelper.createRequest = function(target, serverMethod, methodArgs, l
|
||||
result.target = target;
|
||||
result.content = methodArgs;
|
||||
result.method = "POST";
|
||||
result.load = load;
|
||||
result._baseLoadHandler = load;
|
||||
result.load = function(type, data, event, kwArgs)
|
||||
{
|
||||
// escape from dojo's watchInFlight errors so we get real javascript errors thrown
|
||||
setTimeout(function() { result._baseLoadHandler(type, data, event, kwArgs); }, 10);
|
||||
}
|
||||
dojo.event.connect(result, "load", function(type, data, evt)
|
||||
{
|
||||
alfresco.AjaxHelper._loadHandler(result);
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user