localizing xforms codebase. adding javascript hash for string used from js.

multibyte fixes

appearance hints for textareas (full = rich text editor, minimal = plain text)

using xs:string for xforms:textarea
using xs:normalizedString for xforms:input

IMPORTANT:  you will need to recreate all forms in the web project after i check this in.  and for any of your own forms, you need to use xs:normalizedString as the type for textfields.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5028 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-02-03 00:01:08 +00:00
parent c971f1f818
commit f6bf4acd5d
24 changed files with 278 additions and 124 deletions

View File

@@ -1488,3 +1488,11 @@ validation_regex={0} is invalid.
validation_regex_not_match={0} is invalid.
validation_numeric_range={0} must be between {1} and {2}.
validation_invalid_character=is an invalid character.
validation_provide_values_for_required_fields=Please provide values for all required fields
# XForms ui
idle=Idle
loading=Loading
# File Picker
go_up=Go up

View File

@@ -555,7 +555,9 @@ public class Schema2XForms
final ResourceBundle resourceBundle)
{
if (annotation == null)
{
return null;
}
// write annotation to empty doc
final Document doc = XMLUtil.newDocument();
annotation.writeAnnotation(doc, XSAnnotation.W3C_DOM_DOCUMENT);
@@ -664,9 +666,11 @@ public class Schema2XForms
//remove "@" in nodeset
String name = nodeset.substring(1);
if (name.equals(attributeName))
{
bindId = bind.getAttributeNS(null, "id");
}
}
}
//find the control
Element control = null;
@@ -715,7 +719,6 @@ public class Schema2XForms
? null
: currentAttributeUse.getConstraintValue());
defaultInstanceElement.setAttributeNS(this.targetNamespace,
// XXXarielb - i probably need the prefix here i.e. "alf:" + attributeName
attributeName,
defaultValue);
}
@@ -1013,13 +1016,17 @@ public class Schema2XForms
}
else
{
final SchemaUtil.Occurance o = SchemaUtil.getOccurance(elementDecl);
//create the bind in case it is a repeat
LOGGER.debug("Adding empty bind for control " + controlType +
" type " + typeName +
" nodeset " + pathToRoot);
" nodeset " + pathToRoot +
" occurs " + o);
// create the <xforms:bind> element and add it to the model.
final Element bindElement = this.createBind(xformsDocument, pathToRoot);
final Element bindElement =
this.createBind(xformsDocument,
pathToRoot + (o.isRepeated() ? "[position() != last()]" : ""));
final String bindId = bindElement.getAttributeNS(null, "id");
modelSection.appendChild(bindElement);
@@ -1027,7 +1034,7 @@ public class Schema2XForms
schema,
controlType,
null,
SchemaUtil.getOccurance(elementDecl));
o);
}
return this.addComplexType(xformsDocument,
modelSection,
@@ -1443,7 +1450,7 @@ public class Schema2XForms
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("AddRepeatIfNecessary for multiple element for type " +
controlType.getName() + ", maxOccurs=" + o.maximum);
controlType.getName() + ", maxOccurs = " + o.maximum);
}
final Element repeatSection =
@@ -1688,8 +1695,10 @@ public class Schema2XForms
else
{
formControl = this.createControlForAtomicType(xformsDocument,
(XSSimpleTypeDefinition)controlType,
owner,
caption,
(XSSimpleTypeDefinition)controlType);
resourceBundle);
}
formControl.setAttributeNS(NamespaceConstants.XFORMS_NS,
@@ -1850,19 +1859,22 @@ public class Schema2XForms
final ResourceBundle resourceBundle)
{
// add a group node and recurse
final Element groupElement =
final Element result =
xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":group");
this.setXFormsId(groupElement);
groupElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
this.setXFormsId(result);
final String appearance = this.extractPropertyFromAnnotation(NamespaceService.ALFRESCO_URI,
"appearance",
this.getAnnotation(owner),
resourceBundle);
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":appearance",
"full");
appearance == null || appearance.length() == 0 ? "full" : appearance);
//groupElement = (Element) formSection.appendChild(groupElement);
formSection.appendChild(groupElement);
groupElement.appendChild(this.createLabel(xformsDocument,
formSection.appendChild(result);
result.appendChild(this.createLabel(xformsDocument,
this.createCaption(owner, resourceBundle)));
return groupElement;
return result;
}
public String createCaption(final String text,
@@ -2003,10 +2015,9 @@ public class Schema2XForms
final Element control = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":textarea");
this.setXFormsId(control);
// control.setAttributeNS(Schema2XForms.CHIBA_NS,
// Schema2XForms.CHIBA_PREFIX + "height",
// "3");
control.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":appearance",
"compact");
control.appendChild(this.createLabel(xformsDocument, caption));
return control;
}
@@ -2025,9 +2036,13 @@ public class Schema2XForms
* @param controlType The XML Schema type for which the form control is to be created.
* @return The element for the form control.
*/
public Element createControlForAtomicType(Document xformsDocument,
String caption,
XSSimpleTypeDefinition controlType)
public Element createControlForAtomicType(final Document xformsDocument,
final XSSimpleTypeDefinition controlType,
final XSObject owner,
final String caption,
final ResourceBundle resourceBundle)
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("creating a control for atomic type {name: " + controlType.getName() +
", numeric: " + controlType.getNumeric() +
@@ -2043,7 +2058,11 @@ public class Schema2XForms
", builtInTypeName: " + SchemaUtil.getBuiltInTypeName(controlType) +
", builtInType: " + SchemaUtil.getBuiltInType(controlType) +
"}");
}
String appearance = this.extractPropertyFromAnnotation(NamespaceService.ALFRESCO_URI,
"appearance",
this.getAnnotation(owner),
resourceBundle);
Element result = null;
if ("boolean".equals(controlType.getName()))
{
@@ -2056,6 +2075,15 @@ public class Schema2XForms
result.appendChild(item);
}
}
else if ("string".equals(controlType.getName()))
{
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":textarea");
if (appearance == null || appearance.length() == 0)
{
appearance = "compact";
}
}
else if ("anyURI".equals(controlType.getName()))
{
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
@@ -2100,10 +2128,21 @@ public class Schema2XForms
{
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":input");
if ((appearance == null || appearance.length() == 0) &&
SchemaUtil.getBuiltInType(controlType) == XSConstants.NORMALIZEDSTRING_DT)
{
appearance = "full";
}
}
this.setXFormsId(result);
result.appendChild(this.createLabel(xformsDocument, caption));
if (appearance != null && appearance.length() != 0)
{
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":appearance",
appearance);
}
return result;
}

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.forms.xforms;
import java.io.*;
import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
@@ -28,6 +29,7 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.chiba.xml.ns.NamespaceConstants;
import org.chiba.xml.xforms.exception.XFormsException;
@@ -46,7 +48,7 @@ public class XFormsProcessor
{ "alfresco", NamespaceService.ALFRESCO_URI, NamespaceService.ALFRESCO_PREFIX }
};
private final String[] JS_SCRIPTS =
private final static String[] JS_SCRIPTS =
{
"/scripts/tiny_mce/" + (LOGGER.isDebugEnabled()
? "tiny_mce_src.js"
@@ -59,6 +61,18 @@ public class XFormsProcessor
};
private final static String[] BUNDLE_KEYS =
{
"validation_provide_values_for_required_fields",
"idle",
"loading",
"add_content",
"go_up",
"cancel",
"upload",
"path"
};
public XFormsProcessor()
{
}
@@ -139,6 +153,17 @@ public class XFormsProcessor
append(ns[0].toUpperCase()).
append("_PREFIX = '").append(ns[2]).append("';\n");
}
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
js.append("alfresco_xforms_constants.resources = {\n");
for (String k : BUNDLE_KEYS)
{
js.append(k).
append(": '").
append(bundle.getString(k)).
append("'").
append(k.equals(BUNDLE_KEYS[BUNDLE_KEYS.length - 1]) ? "\n}" : ",\n");
}
e.appendChild(result.createTextNode(js.toString()));
div.appendChild(e);

View File

@@ -25,8 +25,8 @@ Describes a press release and related assets.
<xs:element name="company_footer">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="body" type="xs:anyType" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="name" type="xs:normalizedString"/>
<xs:element name="body" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@@ -26,7 +26,7 @@ Describes a press release and related assets.
<xs:include schemaLocation="/media/releases/get_company_footer_choices_simple_type.jsp"/>
<xs:simpleType name="category">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="Product"/>
<xs:enumeration value="Partnership"/>
<xs:enumeration value="Company"/>
@@ -39,13 +39,13 @@ Describes a press release and related assets.
<xs:element name="press_release">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="abstract" type="xs:string"/>
<xs:element name="location" type="xs:string"/>
<xs:element name="body" type="xs:anyType" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="title" type="xs:normalizedString"/>
<xs:element name="abstract" type="xs:normalizedString"/>
<xs:element name="location" type="xs:normalizedString"/>
<xs:element name="body" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="include_company_footer" type="pr:company_footer_choices" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="include_media_contacts" type="xs:boolean" default="true"/>
<xs:element name="keywords" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="keywords" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="category" type="pr:category" default="Company"/>
<xs:element name="launch_date" type="xs:date"/>
<xs:element name="expiration_date" type="xs:date"/>

View File

@@ -2,7 +2,7 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:simpleType name="attribute-choices" >
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="string1"/>
<xs:enumeration value="string2"/>
<xs:enumeration value="string3-is-the-default"/>
@@ -16,31 +16,31 @@
<xs:complexType>
<xs:sequence>
<xs:element name="element_string_no_default"
type="xs:string"
type="xs:normalizedString"
minOccurs="1"
maxOccurs="1"/>
<xs:element name="element_string_with_default"
type="xs:string"
type="xs:normalizedString"
minOccurs="1"
maxOccurs="1"
default="default string value"/>
</xs:sequence>
<xs:attribute name="required_string_no_default"
type="xs:string"
type="xs:normalizedString"
use="required"/>
<xs:attribute name="optional_string_no_default"
type="xs:string"
type="xs:normalizedString"
use="optional"/>
<xs:attribute name="required_string_with_default"
type="xs:string"
type="xs:normalizedString"
use="required"
default="default string value"/>
<xs:attribute name="optional_string_with_default"
type="xs:string"
type="xs:normalizedString"
use="optional"
default="default string value"/>
<xs:attribute name="fixed_string"
type="xs:string"
type="xs:normalizedString"
use="optional"
fixed="fixed string value"/>
<xs:attribute name="required_choices_no_default"

View File

@@ -2,7 +2,7 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:simpleType name="five_string_values">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>
@@ -11,7 +11,7 @@
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ten_string_values">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>
@@ -27,7 +27,7 @@
<xs:element name="default-values">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:string" default="default string value"/>
<xs:element name="string" type="xs:normalizedString" default="default string value"/>
<xs:element name="integer" type="xs:integer" default="3"/>
<xs:element name="date" type="xs:date" default="1978-08-08"/>
<xs:element name="radio" type="five_string_values" default="three"/>

View File

@@ -9,7 +9,7 @@
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="referenced_element_attribute" type="xs:string" use="required"/>
<xs:attribute name="referenced_element_attribute" type="xs:normalizedString" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
@@ -17,7 +17,7 @@
<xs:complexType name="complex_type_1">
<xs:sequence>
<xs:element name="string_in_ct" type="xs:string"/>
<xs:element name="string_in_ct" type="xs:normalizedString"/>
<xs:element ref="mynsprefix:referenced_element"/>
</xs:sequence>
</xs:complexType>
@@ -25,7 +25,7 @@
<xs:element name="element-ref-test">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:string"/>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="complex_type_1" type="mynsprefix:complex_type_1"/>
</xs:sequence>
</xs:complexType>

View File

@@ -6,7 +6,7 @@
targetNamespace="http://mine.org/mynsuri">
<xs:simpleType name="yes_or_no">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="yes"/>
<xs:enumeration value="no"/>
</xs:restriction>

View File

@@ -5,7 +5,7 @@
attributeFormDefault="qualified"
targetNamespace="http://other.org/othernsuri">
<xs:simpleType name="type1">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:minLength value="5"/>
<xs:maxLength value="5"/>
</xs:restriction>

View File

@@ -5,19 +5,19 @@
targetNamespace="http://www.alfresco.org/alf">
<xs:complexType name="multi">
<xs:sequence>
<xs:element name="multi1" type="xs:string"/>
<xs:element name="multi2" type="xs:string"/>
<xs:element name="multi1" type="xs:normalizedString"/>
<xs:element name="multi2" type="xs:normalizedString"/>
</xs:sequence>
</xs:complexType>
<xs:element name="xml-namespaces-test">
<xs:complexType>
<xs:sequence>
<xs:element name="string_with_default" type="xs:string" default="default string value"/>
<xs:element name="string_no_default" type="xs:string"/>
<xs:element name="string_with_default" type="xs:normalizedString" default="default string value"/>
<xs:element name="string_no_default" type="xs:normalizedString"/>
<xs:element name="multi" type="alf:multi" minOccurs="2" maxOccurs="3"/>
</xs:sequence>
<xs:attribute name="string_attribute_with_default" type="xs:string" default="default string value"/>
<xs:attribute name="string_attribute_no_default" type="xs:string"/>
<xs:attribute name="string_attribute_with_default" type="xs:normalizedString" default="default string value"/>
<xs:attribute name="string_attribute_no_default" type="xs:normalizedString"/>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -4,7 +4,7 @@
<xs:element name="simple">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:string" default="default string value"/>
<xs:element name="string" type="xs:normalizedString" default="default string value"/>
<xs:element name="uri" type="xs:anyURI" default="/index.jsp"/>
</xs:sequence>
</xs:complexType>

View File

@@ -3,14 +3,14 @@
elementFormDefault="qualified">
<xs:complexType name="multi-input">
<xs:sequence>
<xs:element name="string" type="xs:string"/>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="int" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="repeat-multi-simple">
<xs:complexType>
<xs:sequence>
<xs:element name="zero-to-inf-single" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="zero-to-inf-single" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="zero-to-inf-multi" type="multi-input" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

View File

@@ -2,7 +2,7 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:simpleType name="five_string_values">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>
@@ -11,7 +11,7 @@
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ten_string_values">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>
@@ -26,14 +26,14 @@
</xs:simpleType>
<xs:complexType name="multi-input">
<xs:sequence>
<xs:element name="string" type="xs:string"/>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="any" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
<xs:element name="repeat-components">
<xs:complexType>
<xs:sequence>
<xs:element name="zero-to-one" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="zero-to-one" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
<xs:element name="one-to-one" type="xs:anyType" minOccurs="1" maxOccurs="1"/>
<xs:element name="one-to-inf" type="xs:date" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="zero-to-inf" type="xs:integer" minOccurs="0" maxOccurs="unbounded"/>

View File

@@ -3,20 +3,20 @@
elementFormDefault="qualified">
<xs:complexType name="multi-input">
<xs:sequence>
<xs:element name="string" type="xs:string"/>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="int" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="repeat-constraints">
<xs:complexType>
<xs:sequence>
<xs:element name="zero-to-one" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="one-to-one" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="one-to-inf" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="zero-to-inf" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="one-to-five" type="xs:string" minOccurs="1" maxOccurs="5"/>
<xs:element name="three-to-five" type="xs:string" minOccurs="3" maxOccurs="5"/>
<xs:element name="zero-to-five" type="xs:string" minOccurs="0" maxOccurs="5"/>
<xs:element name="zero-to-one" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
<xs:element name="one-to-one" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
<xs:element name="one-to-inf" type="xs:normalizedString" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="zero-to-inf" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="one-to-five" type="xs:normalizedString" minOccurs="1" maxOccurs="5"/>
<xs:element name="three-to-five" type="xs:normalizedString" minOccurs="3" maxOccurs="5"/>
<xs:element name="zero-to-five" type="xs:normalizedString" minOccurs="0" maxOccurs="5"/>
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@@ -3,15 +3,15 @@
elementFormDefault="qualified">
<xs:complexType name="repeat-simple">
<xs:sequence>
<xs:element name="one-to-one" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="one-to-inf" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="one-to-one" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
<xs:element name="one-to-inf" type="xs:normalizedString" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="repeat-nested">
<xs:complexType>
<xs:sequence>
<xs:element name="repeat-simple" type="repeat-simple" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="not-repeated" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="not-repeated" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@@ -4,10 +4,10 @@
<xs:element name="repeat-simple">
<xs:complexType>
<xs:sequence>
<xs:element name="zero-to-one" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="one-to-one" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="one-to-inf" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="zero-to-inf" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="zero-to-one" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
<xs:element name="one-to-one" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
<xs:element name="one-to-inf" type="xs:normalizedString" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="zero-to-inf" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@@ -3,7 +3,7 @@
xmlns:alf="http://www.alfresco.org"
elementFormDefault="qualified">
<xs:simpleType name="five_string_values">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="one">
<xs:annotation>
<xs:appinfo>
@@ -42,7 +42,7 @@
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ten_string_values">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>
@@ -69,7 +69,7 @@
<xs:element name="text_components">
<xs:complexType>
<xs:sequence>
<xs:element name="required_textfield" type="xs:string" minOccurs="1" maxOccurs="1">
<xs:element name="required_textfield" type="xs:normalizedString" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:label>${components-test.required_textfield.label}</alf:label>
@@ -77,7 +77,7 @@
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="optional_textfield" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:element name="optional_textfield" type="xs:normalizedString" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:label>${components-test.optional_textfield.label}</alf:label>
@@ -85,8 +85,28 @@
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="prefilled_textfield" type="xs:string" minOccurs="0" maxOccurs="1" default="i am the default value"/>
<xs:element name="textarea" type="xs:anyType"/>
<xs:element name="prefilled_textfield" type="xs:normalizedString" minOccurs="0" maxOccurs="1" default="i am the default value"/>
<xs:element name="plain_textarea" type="xs:string">
<xs:annotation>
<xs:appinfo>
<alf:appearance>minimal</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="plain_text_with_toggle" type="xs:string">
<xs:annotation>
<xs:appinfo>
<alf:appearance>compact</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="rich_text_editor" type="xs:string">
<xs:annotation>
<xs:appinfo>
<alf:appearance>full</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -158,7 +178,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="file" type="xs:anyURI"/>
<xs:element name="repeat" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="repeat" type="xs:normalizedString" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="checkbox_default_true" type="xs:boolean" default="true"/>
<xs:element name="checkbox_default_false" type="xs:boolean" default="false"/>
<xs:element name="checkbox_no_default" type="xs:boolean"/>

View File

@@ -5,18 +5,18 @@
<xs:complexType name="complex-type">
<xs:sequence>
<xs:element name="fixed_string_element" type="xs:string" minOccurs="1" maxOccurs="1" fixed="fixed value"/>
<xs:element name="fixed_string_element" type="xs:normalizedString" minOccurs="1" maxOccurs="1" fixed="fixed value"/>
</xs:sequence>
<xs:attribute name="required_string_attribute" type="xs:string" use="required"/>
<xs:attribute name="required_string_attribute" type="xs:normalizedString" use="required"/>
</xs:complexType>
<xs:complexType name="inheritence-type">
<xs:complexContent>
<xs:extension base="complex-type">
<xs:sequence>
<xs:element name="additional_required_string_element" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="additional_required_string_element" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="additional_fixed_string_attribute" type="xs:string" use="required" fixed="additional fixed value"/>
<xs:attribute name="additional_fixed_string_attribute" type="xs:normalizedString" use="required" fixed="additional fixed value"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

View File

@@ -3,7 +3,7 @@
xmlns:alf="http://www.alfresco.org"
elementFormDefault="qualified">
<xs:simpleType name="four_presidents">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="washington"/>
<xs:enumeration value="jefferson"/>
<xs:enumeration value="lincoln"/>
@@ -18,7 +18,7 @@
<xs:list itemType="four_presidents"/>
</xs:simpleType>
<xs:simpleType name="thirteen_colonies">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="massachusetts"/>
<xs:enumeration value="NH">
<xs:annotation>

View File

@@ -3,7 +3,7 @@
xmlns:alf="http://www.alfresco.org"
elementFormDefault="qualified">
<xs:simpleType name="ten_string_values">
<xs:restriction base="xs:string">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>

View File

@@ -4,7 +4,7 @@
<xs:element name="simple">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:string" default="default string value"/>
<xs:element name="string" type="xs:normalizedString" default="default string value"/>
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@@ -4,7 +4,7 @@
<xs:element name="upload-simple">
<xs:complexType>
<xs:sequence>
<xs:element name="string_with_default" type="xs:string" default="default value"/>
<xs:element name="string_with_default" type="xs:normalizedString" default="default value"/>
<xs:element name="file_from_element" type="xs:anyURI" minOccurs="1" maxOccurs="1"/>
<xs:element name="file_from_element_with_default" type="xs:anyURI" default="/index.jsp"/>
</xs:sequence>

View File

@@ -609,7 +609,7 @@ dojo.declare("alfresco.xforms.TextField",
this.widget.setAttribute("type", "text");
this.widget.setAttribute("id", this.id + "-widget");
this.widget.setAttribute("value", initial_value);
if (this.xform.getBinding(this.xformsNode).getType() == "string")
if (this.getAppearance() == "full")
{
this.widget.style.width = "100%";
}
@@ -745,8 +745,64 @@ dojo.declare("alfresco.xforms.NumericalRange",
}
});
/** The textfield widget which handle xforms widget xf:textarea. */
dojo.declare("alfresco.xforms.TextArea",
/** The text area widget handles xforms widget xf:textarea with appearance minimal */
dojo.declare("alfresco.xforms.PlainTextEditor",
alfresco.xforms.Widget,
function(xform, xformsNode)
{
},
{
/////////////////////////////////////////////////////////////////
// overridden methods
/////////////////////////////////////////////////////////////////
render: function(attach_point)
{
attach_point.appendChild(this.domNode);
dojo.html.prependClass(this.domNode, "xformsTextArea");
var initialValue = this.getInitialValue() || "";
this.widget = document.createElement("textarea");
this.domNode.appendChild(this.widget);
this.widget.setAttribute("id", this.id + "-widget");
this.widget.setAttribute("value", initialValue);
if (this.isReadonly())
{
this.widget.setAttribute("readonly", this.isReadonly());
}
this.widget.style.width = "100%";
this.widget.style.height = "100%";
dojo.event.connect(this.widget, "onchange", this, this._textarea_changeHandler);
},
setValue: function(value, forceCommit)
{
if (!this.widget)
{
this.setInitialValue(value, forceCommit);
}
else
{
alfresco.xform.PlainTextEditor.superclass.setValue.call(this, value, forceCommit);
this.widget.value = value;
}
},
getValue: function()
{
return this.widget.value;
},
/////////////////////////////////////////////////////////////////
// DOM event handlers
/////////////////////////////////////////////////////////////////
_textarea_changeHandler: function(event)
{
this._commitValueChange();
}
});
/** The textfield widget which handle xforms widget xf:textarea. with appearance full or compact */
dojo.declare("alfresco.xforms.RichTextEditor",
alfresco.xforms.Widget,
function(xform, xformsNode)
{
@@ -823,7 +879,7 @@ dojo.declare("alfresco.xforms.TextArea",
setReadonly: function(readonly)
{
alfresco.xforms.TextArea.superclass.setReadonly.call(this, readonly);
alfresco.xforms.RichTextEditor.superclass.setReadonly.call(this, readonly);
var mce = tinyMCE.getInstanceById(this.id);
if (readonly && mce)
{
@@ -837,7 +893,7 @@ dojo.declare("alfresco.xforms.TextArea",
_destroy: function()
{
alfresco.xforms.TextArea.superclass._destroy.call(this);
alfresco.xforms.RichTextEditor.superclass._destroy.call(this);
if (!this.isReadonly())
{
dojo.debug("removing mce control " + this.id);
@@ -3146,7 +3202,9 @@ dojo.declare("alfresco.xforms.XForm",
case alfresco_xforms_constants.XFORMS_PREFIX + ":repeat":
return new alfresco.xforms.Repeat(this, xformsNode);
case alfresco_xforms_constants.XFORMS_PREFIX + ":textarea":
return new alfresco.xforms.TextArea(this, xformsNode);
return (new alfresco.xforms.Widget(this, xformsNode).getAppearance() == "minimal"
? new alfresco.xforms.PlainTextEditor(this, xformsNode)
: new alfresco.xforms.RichTextEditor(this, xformsNode));
case alfresco_xforms_constants.XFORMS_PREFIX + ":upload":
return new alfresco.xforms.FilePicker(this, xformsNode);
case alfresco_xforms_constants.XFORMS_PREFIX + ":range":
@@ -3579,7 +3637,7 @@ dojo.declare("alfresco.xforms.XForm",
{
this.submitWidget = null;
var invalid = this.rootWidget.getWidgetsInvalidForSubmit();
_show_error(document.createTextNode("Please provide values for all required fields."));
_show_error(document.createTextNode(alfresco_xforms_constants.resources["validation_provide_values_for_required_fields"]));
var error_list = document.createElement("ul");
for (var j = 0; j < invalid.length; j++)
{
@@ -3703,10 +3761,11 @@ AjaxHelper._updateLoaderDisplay = function()
{
var ajaxLoader = AjaxHelper._getLoaderElement();
ajaxLoader.innerHTML = (AjaxHelper._requests.length == 0
? "Idle"
: "Loading" + (AjaxHelper._requests.length > 1
? alfresco_xforms_constants.resources["idle"]
: (alfresco_xforms_constants.resources["loading"] +
(AjaxHelper._requests.length > 1
? " (" + AjaxHelper._requests.length + ")"
: "..."));
: "...")));
dojo.debug(ajaxLoader.innerHTML);
if (/* djConfig.isDebug && */ AjaxHelper._requests.length != 0)
{
@@ -4182,7 +4241,8 @@ _showPicker: function(data)
addContentImage.align = "absmiddle";
addContentImage.setAttribute("src", alfresco_xforms_constants.WEBAPP_CONTEXT + "/images/icons/add.gif");
addContentLink.appendChild(addContentImage);
addContentLink.appendChild(d.createTextNode("Add Content"));
addContentLink.appendChild(d.createTextNode(alfresco_xforms_constants.resources["add_content"]));
var navigateToParentLink = d.createElement("a");
headerRightDiv.appendChild(navigateToParentLink);
@@ -4211,7 +4271,7 @@ _showPicker: function(data)
navigateToParentNodeImage.align = "absmiddle";
navigateToParentNodeImage.setAttribute("src", alfresco_xforms_constants.WEBAPP_CONTEXT + "/images/icons/up.gif");
navigateToParentLink.appendChild(navigateToParentNodeImage);
navigateToParentLink.appendChild(d.createTextNode("Go up"));
navigateToParentLink.appendChild(d.createTextNode(alfresco_xforms_constants.resources["go_up"]));
headerRightDiv.style.position = "absolute";
headerRightDiv.style.height = headerDiv.style.height;
@@ -4232,7 +4292,8 @@ _showPicker: function(data)
var cancelButton = d.createElement("input");
cancelButton.type = "button";
cancelButton.filePickerWidget = this;
cancelButton.value = "Cancel";
cancelButton.value = alfresco_xforms_constants.resources["cancel"];
footerDiv.appendChild(cancelButton);
cancelButton.style.margin = ((.5 * footerDiv.offsetHeight) -
@@ -4396,7 +4457,7 @@ _showAddContent: function(currentPath)
dojo.dom.removeChildren(w.addContentDiv);
var fileName = event.target.value.replace(/.*[\/\\]([^\/\\]+)/, "$1");
w.addContentDiv.appendChild(d.createTextNode("Upload: " + fileName));
w.addContentDiv.appendChild(d.createTextNode(alfresco_xforms_constants.resources["upload"] + ": " + fileName));
var img = d.createElement("img");
img.setAttribute("src", alfresco_xforms_constants.WEBAPP_CONTEXT +
"/images/icons/process_animation.gif");
@@ -4506,7 +4567,8 @@ _openParentPathMenu: function(target, path)
var pathTextDiv = d.createElement("div");
pathTextDiv.style.fontWeight = "bold";
pathTextDiv.style.paddingLeft = "5px";
pathTextDiv.appendChild(d.createTextNode("Path"));
pathTextDiv.appendChild(d.createTextNode(alfresco_xforms_constants.resources["path"]));
this.parentPathMenu.appendChild(pathTextDiv);
var currentPathNodes = [];
for (var i = 0; i < parentNodes.length; i++)