mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- upgrading to dojo-0.4.1 to take advantage of some bug fixes, and some nicer apis.
- adding some preliminary support for xf:ranges for numerical types (chiba does not yet support ranges for date types). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4896 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -48,7 +48,7 @@
|
|||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<mkdir dir="${dir.assemble}/scripts/ajax"/>
|
<mkdir dir="${dir.assemble}/scripts/ajax"/>
|
||||||
<property name="dojo.version" value="0.3.1-ajax"/>
|
<property name="dojo.version" value="0.4.1-ajax"/>
|
||||||
|
|
||||||
<unzip src="${dir.common.lib}/dojo-${dojo.version}.zip"
|
<unzip src="${dir.common.lib}/dojo-${dojo.version}.zip"
|
||||||
dest="${dir.assemble}/scripts/ajax">
|
dest="${dir.assemble}/scripts/ajax">
|
||||||
|
@@ -75,12 +75,6 @@ public class Schema2XForms
|
|||||||
|
|
||||||
private static final String PROPERTY_PREFIX =
|
private static final String PROPERTY_PREFIX =
|
||||||
"http://www.chiba.org/properties/schemaFormBuilder/";
|
"http://www.chiba.org/properties/schemaFormBuilder/";
|
||||||
/**
|
|
||||||
* Property to control the cascading style sheet used for the XForm - corresponds to envelope@chiba:css-style.
|
|
||||||
*/
|
|
||||||
public static final String CSS_STYLE_PROP =
|
|
||||||
PROPERTY_PREFIX + "envelope@css-style";
|
|
||||||
private static final String DEFAULT_CSS_STYLE_PROP = "style.css";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property to control the selection of UI control for a selectOne control.
|
* Property to control the selection of UI control for a selectOne control.
|
||||||
@@ -379,7 +373,6 @@ public class Schema2XForms
|
|||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
this.counter.clear();
|
this.counter.clear();
|
||||||
setProperty(CSS_STYLE_PROP, DEFAULT_CSS_STYLE_PROP);
|
|
||||||
setProperty(SELECTMANY_LONG_LIST_SIZE_PROP, DEFAULT_LONG_LIST_MAX_SIZE);
|
setProperty(SELECTMANY_LONG_LIST_SIZE_PROP, DEFAULT_LONG_LIST_MAX_SIZE);
|
||||||
setProperty(SELECTMANY_UI_CONTROL_SHORT_PROP,
|
setProperty(SELECTMANY_UI_CONTROL_SHORT_PROP,
|
||||||
DEFAULT_SELECTMANY_UI_CONTROL_SHORT_PROP);
|
DEFAULT_SELECTMANY_UI_CONTROL_SHORT_PROP);
|
||||||
@@ -612,12 +605,19 @@ public class Schema2XForms
|
|||||||
final Map<String, Element> result = new HashMap<String, Element>();
|
final Map<String, Element> result = new HashMap<String, Element>();
|
||||||
for (XSTypeDefinition type : choiceValues)
|
for (XSTypeDefinition type : choiceValues)
|
||||||
{
|
{
|
||||||
String textValue = type.getName();
|
final String textValue = type.getName();
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
{
|
{
|
||||||
LOGGER.debug("addChoicesForSelectSwitchControl, processing " + textValue);
|
LOGGER.debug("addChoicesForSelectSwitchControl, processing " + textValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//build the case element
|
||||||
|
final Element caseElement = xForm.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||||
|
NamespaceConstants.XFORMS_PREFIX + ":case");
|
||||||
|
final String caseId = this.setXFormsId(caseElement);
|
||||||
|
result.put(textValue, caseElement);
|
||||||
|
|
||||||
final Element item = this.createXFormsItem(xForm,
|
final Element item = this.createXFormsItem(xForm,
|
||||||
this.createCaption(textValue),
|
this.createCaption(textValue),
|
||||||
textValue);
|
textValue);
|
||||||
@@ -637,12 +637,6 @@ public class Schema2XForms
|
|||||||
NamespaceConstants.XFORMS_PREFIX + ":toggle");
|
NamespaceConstants.XFORMS_PREFIX + ":toggle");
|
||||||
this.setXFormsId(toggle);
|
this.setXFormsId(toggle);
|
||||||
|
|
||||||
//build the case element
|
|
||||||
final Element caseElement = xForm.createElementNS(NamespaceConstants.XFORMS_NS,
|
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":case");
|
|
||||||
final String caseId = this.setXFormsId(caseElement);
|
|
||||||
result.put(textValue, caseElement);
|
|
||||||
|
|
||||||
toggle.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
toggle.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":case",
|
NamespaceConstants.XFORMS_PREFIX + ":case",
|
||||||
caseId);
|
caseId);
|
||||||
@@ -2234,41 +2228,66 @@ public class Schema2XForms
|
|||||||
String caption,
|
String caption,
|
||||||
XSSimpleTypeDefinition controlType)
|
XSSimpleTypeDefinition controlType)
|
||||||
{
|
{
|
||||||
Element control;
|
LOGGER.debug("creating a control for atomic type {name: " + controlType.getName() +
|
||||||
|
", numeric: " + controlType.getNumeric() +
|
||||||
|
", bounded: " + controlType.getBounded() +
|
||||||
|
", finite: " + controlType.getFinite() +
|
||||||
|
", ordered: " + controlType.getOrdered() +
|
||||||
|
", final: " + controlType.getFinal() +
|
||||||
|
", minInc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE) +
|
||||||
|
", maxInc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) +
|
||||||
|
", minExc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINEXCLUSIVE) +
|
||||||
|
", maxExc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXEXCLUSIVE) +
|
||||||
|
", builtInTypeName: " + SchemaUtil.getBuiltInTypeName(controlType) +
|
||||||
|
"}");
|
||||||
|
|
||||||
|
Element result = null;
|
||||||
if ("boolean".equals(controlType.getName()))
|
if ("boolean".equals(controlType.getName()))
|
||||||
{
|
{
|
||||||
control = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":select1");
|
NamespaceConstants.XFORMS_PREFIX + ":select1");
|
||||||
this.setXFormsId(control);
|
|
||||||
final String[] values = { "true", "false" };
|
final String[] values = { "true", "false" };
|
||||||
for (String v : values)
|
for (String v : values)
|
||||||
{
|
{
|
||||||
final Element item = this.createXFormsItem(xformsDocument, v, v);
|
final Element item = this.createXFormsItem(xformsDocument, v, v);
|
||||||
control.appendChild(item);
|
result.appendChild(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ("anyURI".equals(controlType.getName()))
|
else if ("anyURI".equals(controlType.getName()))
|
||||||
{
|
{
|
||||||
control = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":upload");
|
NamespaceConstants.XFORMS_PREFIX + ":upload");
|
||||||
final Element e = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
final Element e = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":filename");
|
NamespaceConstants.XFORMS_PREFIX + ":filename");
|
||||||
control.appendChild(e);
|
this.setXFormsId(e);
|
||||||
|
result.appendChild(e);
|
||||||
e.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
e.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":ref",
|
NamespaceConstants.XFORMS_PREFIX + ":ref",
|
||||||
".");
|
".");
|
||||||
this.setXFormsId(control);
|
}
|
||||||
|
else if (controlType.getBounded() &&
|
||||||
|
controlType.getNumeric() &&
|
||||||
|
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) != null &&
|
||||||
|
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE) != 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));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
control = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS, NamespaceConstants.XFORMS_PREFIX + ":input");
|
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||||
this.setXFormsId(control);
|
NamespaceConstants.XFORMS_PREFIX + ":input");
|
||||||
}
|
}
|
||||||
|
this.setXFormsId(result);
|
||||||
|
result.appendChild(this.createLabel(xformsDocument, caption));
|
||||||
|
|
||||||
control.appendChild(this.createLabel(xformsDocument, caption));
|
return result;
|
||||||
|
|
||||||
return control;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2441,7 +2460,7 @@ public class Schema2XForms
|
|||||||
? getProperty(SELECTMANY_UI_CONTROL_SHORT_PROP)
|
? getProperty(SELECTMANY_UI_CONTROL_SHORT_PROP)
|
||||||
: getProperty(SELECTMANY_UI_CONTROL_LONG_PROP)));
|
: getProperty(SELECTMANY_UI_CONTROL_LONG_PROP)));
|
||||||
Element choices = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
Element choices = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":choices");
|
NamespaceConstants.XFORMS_PREFIX + ":choices");
|
||||||
this.setXFormsId(choices);
|
this.setXFormsId(choices);
|
||||||
control.appendChild(choices);
|
control.appendChild(choices);
|
||||||
|
|
||||||
|
@@ -94,8 +94,24 @@
|
|||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="integer" type="xs:integer"/>
|
<xs:element name="integer" type="xs:integer"/>
|
||||||
|
<xs:element name="bounded_integer">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:integer">
|
||||||
|
<xs:minInclusive value="-100"/>
|
||||||
|
<xs:maxInclusive value="100"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
<xs:element name="positive_integer" type="xs:positiveInteger"/>
|
<xs:element name="positive_integer" type="xs:positiveInteger"/>
|
||||||
<xs:element name="double" type="xs:double"/>
|
<xs:element name="double" type="xs:double"/>
|
||||||
|
<xs:element name="bounded_double">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:double">
|
||||||
|
<xs:minInclusive value="0.0"/>
|
||||||
|
<xs:maxInclusive value="1.0"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
@@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
|
xmlns:alf="http://www.alfresco.org"
|
||||||
|
elementFormDefault="qualified">
|
||||||
|
<xs:simpleType name="jan_to_dec_2006">
|
||||||
|
<xs:restriction base="xs:date">
|
||||||
|
<xs:minInclusive value="2006-01-01"/>
|
||||||
|
<xs:maxInclusive value="2006-12-31"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="neg_10_unbounded">
|
||||||
|
<xs:restriction base="xs:integer">
|
||||||
|
<xs:minInclusive value="-10"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="neg_10_to_pos_10">
|
||||||
|
<xs:restriction base="xs:integer">
|
||||||
|
<xs:minInclusive value="-10"/>
|
||||||
|
<xs:maxInclusive value="10"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:element name="range-test">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="integer">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="unbounded_integer"
|
||||||
|
type="xs:integer"
|
||||||
|
minOccurs="1"
|
||||||
|
maxOccurs="1"/>
|
||||||
|
<xs:element name="range_neg_10_to_pos_10"
|
||||||
|
minOccurs="1"
|
||||||
|
maxOccurs="1">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:integer">
|
||||||
|
<xs:minInclusive value="-10"/>
|
||||||
|
<xs:maxInclusive value="10"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="double">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="unbounded_double"
|
||||||
|
type="xs:double"
|
||||||
|
minOccurs="1"
|
||||||
|
maxOccurs="1"/>
|
||||||
|
<xs:element name="range_neg_0_to_1"
|
||||||
|
minOccurs="1"
|
||||||
|
maxOccurs="1">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:double">
|
||||||
|
<xs:minInclusive value="0.0"/>
|
||||||
|
<xs:maxInclusive value="1.0"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="date">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="unbounded_date"
|
||||||
|
type="xs:date"
|
||||||
|
minOccurs="1"
|
||||||
|
maxOccurs="1"/>
|
||||||
|
<xs:element name="range_2006"
|
||||||
|
minOccurs="1"
|
||||||
|
maxOccurs="1">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:date">
|
||||||
|
<xs:minInclusive value="2006-01-01"/>
|
||||||
|
<xs:maxInclusive value="2006-12-31"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
@@ -28,11 +28,13 @@
|
|||||||
//
|
//
|
||||||
// Initiliaze dojo requirements, tinymce, and add a hook to load the xform.
|
// Initiliaze dojo requirements, tinymce, and add a hook to load the xform.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
dojo.require("dojo.date");
|
dojo.require("dojo.debug.console");
|
||||||
|
dojo.require("dojo.date.common");
|
||||||
dojo.require("dojo.widget.DebugConsole");
|
dojo.require("dojo.widget.DebugConsole");
|
||||||
dojo.require("dojo.widget.DatePicker");
|
dojo.require("dojo.widget.DatePicker");
|
||||||
dojo.require("dojo.widget.TimePicker");
|
dojo.require("dojo.widget.TimePicker");
|
||||||
dojo.require("dojo.widget.Button");
|
dojo.require("dojo.widget.Button");
|
||||||
|
dojo.require("dojo.widget.Slider");
|
||||||
dojo.require("dojo.lfx.html");
|
dojo.require("dojo.lfx.html");
|
||||||
dojo.hostenv.writeIncludes();
|
dojo.hostenv.writeIncludes();
|
||||||
|
|
||||||
@@ -88,30 +90,29 @@ alfresco_xforms_constants.COLLAPSED_IMAGE.src =
|
|||||||
*/
|
*/
|
||||||
dojo.declare("alfresco.xforms.Widget",
|
dojo.declare("alfresco.xforms.Widget",
|
||||||
null,
|
null,
|
||||||
|
function(xform, xformsNode)
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
this.xform = xform;
|
||||||
|
this.xformsNode = xformsNode;
|
||||||
|
this.id = this.xformsNode.getAttribute("id");
|
||||||
|
this._modified = false;
|
||||||
|
this._valid = true;
|
||||||
|
var b = this.xform.getBinding(this.xformsNode);
|
||||||
|
if (b)
|
||||||
{
|
{
|
||||||
this.xform = xform;
|
dojo.debug("adding " + this.id + " to binding " + b.id);
|
||||||
this.xformsNode = xformsNode;
|
b.widgets[this.id] = this;
|
||||||
this.id = this.xformsNode.getAttribute("id");
|
}
|
||||||
this._modified = false;
|
else
|
||||||
this._valid = true;
|
{
|
||||||
var b = this.xform.getBinding(this.xformsNode);
|
dojo.debug("no binding found for " + this.id);
|
||||||
if (b)
|
}
|
||||||
{
|
this.domNode = document.createElement("div");
|
||||||
dojo.debug("adding " + this.id + " to binding " + b.id);
|
this.domNode.setAttribute("id", this.id + "-domNode");
|
||||||
b.widgets[this.id] = this;
|
this.domNode.widget = this;
|
||||||
}
|
dojo.html.setClass(this.domNode, "xformsItem");
|
||||||
else
|
},
|
||||||
{
|
{
|
||||||
dojo.debug("no binding found for " + this.id);
|
|
||||||
}
|
|
||||||
this.domNode = document.createElement("div");
|
|
||||||
this.domNode.setAttribute("id", this.id + "-domNode")
|
|
||||||
this.domNode.widget = this;
|
|
||||||
dojo.html.setClass(this.domNode, "xformsItem");
|
|
||||||
},
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// properties
|
// properties
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -146,7 +147,10 @@ dojo.declare("alfresco.xforms.Widget",
|
|||||||
{
|
{
|
||||||
this._modified = b;
|
this._modified = b;
|
||||||
this._updateDisplay();
|
this._updateDisplay();
|
||||||
this.hideAlert();
|
if (this.isValidForSubmit())
|
||||||
|
{
|
||||||
|
this.hideAlert();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Sets the widget's valid state, as indicated by an XFormsEvent */
|
/** Sets the widget's valid state, as indicated by an XFormsEvent */
|
||||||
@@ -154,7 +158,14 @@ dojo.declare("alfresco.xforms.Widget",
|
|||||||
{
|
{
|
||||||
this._valid = b;
|
this._valid = b;
|
||||||
this._updateDisplay();
|
this._updateDisplay();
|
||||||
this.hideAlert();
|
if (this.isValidForSubmit())
|
||||||
|
{
|
||||||
|
this.hideAlert();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.showAlert();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,7 +174,7 @@ dojo.declare("alfresco.xforms.Widget",
|
|||||||
*/
|
*/
|
||||||
isValidForSubmit: function()
|
isValidForSubmit: function()
|
||||||
{
|
{
|
||||||
if (!this._valid)
|
if (typeof this._valid != "undefined" && !this._valid)
|
||||||
{
|
{
|
||||||
dojo.debug(this.id + " is invalid");
|
dojo.debug(this.id + " is invalid");
|
||||||
return false;
|
return false;
|
||||||
@@ -427,7 +438,7 @@ dojo.declare("alfresco.xforms.Widget",
|
|||||||
var node = this._getAlertNode();
|
var node = this._getAlertNode();
|
||||||
return node ? dojo.dom.textContent(node) : "";
|
return node ? dojo.dom.textContent(node) : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Makes the label red. */
|
/** Makes the label red. */
|
||||||
showAlert: function()
|
showAlert: function()
|
||||||
{
|
{
|
||||||
@@ -545,7 +556,7 @@ dojo.declare("alfresco.xforms.FilePicker",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inherited("setValue", [ value, forceCommit ]);
|
alfresco.xforms.FilePicker.superclass.setValue.call(this, value, forceCommit);
|
||||||
this.widget.setValue(value);
|
this.widget.setValue(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -564,7 +575,7 @@ dojo.declare("alfresco.xforms.FilePicker",
|
|||||||
var w = fpw.node.widget;
|
var w = fpw.node.widget;
|
||||||
w.domContainer.style.height =
|
w.domContainer.style.height =
|
||||||
Math.max(fpw.node.offsetHeight +
|
Math.max(fpw.node.offsetHeight +
|
||||||
dojo.style.getMarginHeight(w.domNode.parentNode),
|
dojo.html.getMargin(w.domNode.parentNode).height,
|
||||||
20) + "px";
|
20) + "px";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -615,7 +626,7 @@ dojo.declare("alfresco.xforms.TextField",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inherited("setValue", [ value, forceCommit ]);
|
alfresco.xforms.TextField.superclass.setValue.call(this, value, forceCommit);
|
||||||
this.widget.value = value;
|
this.widget.value = value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -637,6 +648,92 @@ dojo.declare("alfresco.xforms.TextField",
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** The number range widget which handle xforms widget xf:range with any numerical type */
|
||||||
|
dojo.declare("alfresco.xforms.NumericalRange",
|
||||||
|
alfresco.xforms.Widget,
|
||||||
|
function(xform, xformsNode)
|
||||||
|
{
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
// overridden methods
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
render: function(attach_point)
|
||||||
|
{
|
||||||
|
var initial_value = this.getInitialValue() || "";
|
||||||
|
attach_point.appendChild(this.domNode);
|
||||||
|
var sliderDiv = document.createElement("div");
|
||||||
|
sliderDiv.style.fontWeight = "bold";
|
||||||
|
sliderDiv.style.marginBottom = "5px";
|
||||||
|
this.domNode.appendChild(sliderDiv);
|
||||||
|
|
||||||
|
var minimum = Number(this.xformsNode.getAttribute(alfresco_xforms_constants.XFORMS_PREFIX + ":start"));
|
||||||
|
var maximum = Number(this.xformsNode.getAttribute(alfresco_xforms_constants.XFORMS_PREFIX + ":end"));
|
||||||
|
var snapValues = 0;
|
||||||
|
if (this.xform.getBinding(this.xformsNode).getType() == "integer")
|
||||||
|
{
|
||||||
|
snapValues = maximum - minimum + 1;
|
||||||
|
}
|
||||||
|
sliderDiv.appendChild(document.createTextNode(minimum));
|
||||||
|
|
||||||
|
var sliderWidgetDiv = document.createElement("div");
|
||||||
|
sliderDiv.appendChild(sliderWidgetDiv);
|
||||||
|
this.widget = dojo.widget.createWidget("SliderHorizontal",
|
||||||
|
{
|
||||||
|
initialValue: initial_value,
|
||||||
|
minimumX: minimum,
|
||||||
|
maximumX: maximum,
|
||||||
|
showButtons: false,
|
||||||
|
activeDrag: false,
|
||||||
|
snapValues: snapValues
|
||||||
|
},
|
||||||
|
sliderWidgetDiv);
|
||||||
|
sliderDiv.appendChild(document.createTextNode(maximum));
|
||||||
|
|
||||||
|
this.currentValueDiv = document.createElement("div");
|
||||||
|
this.domNode.appendChild(this.currentValueDiv);
|
||||||
|
this.currentValueDiv.appendChild(document.createTextNode("Value: " + initial_value));
|
||||||
|
|
||||||
|
dojo.event.connect(this.widget,
|
||||||
|
"onValueChanged",
|
||||||
|
this,
|
||||||
|
this._hSlider_valueChangedHandler);
|
||||||
|
},
|
||||||
|
|
||||||
|
setValue: function(value, forceCommit)
|
||||||
|
{
|
||||||
|
if (!this.widget)
|
||||||
|
{
|
||||||
|
this.setInitialValue(value, forceCommit);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alfresco.xforms.NumericalRange.superclass.setValue.call(this, value, forceCommit);
|
||||||
|
this.widget.setValue(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getValue: function()
|
||||||
|
{
|
||||||
|
return this.widget.getValue();
|
||||||
|
},
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
// DOM event handlers
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
_hSlider_valueChangedHandler: function(value)
|
||||||
|
{
|
||||||
|
this.currentValueDiv.replaceChild(document.createTextNode("Value: " + value),
|
||||||
|
this.currentValueDiv.firstChild);
|
||||||
|
if (!this.widget._isDragInProgress)
|
||||||
|
{
|
||||||
|
this._commitValueChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/** The textfield widget which handle xforms widget xf:textarea. */
|
/** The textfield widget which handle xforms widget xf:textarea. */
|
||||||
dojo.declare("alfresco.xforms.TextArea",
|
dojo.declare("alfresco.xforms.TextArea",
|
||||||
alfresco.xforms.Widget,
|
alfresco.xforms.Widget,
|
||||||
@@ -715,7 +812,7 @@ dojo.declare("alfresco.xforms.TextArea",
|
|||||||
|
|
||||||
setReadonly: function(readonly)
|
setReadonly: function(readonly)
|
||||||
{
|
{
|
||||||
this.inherited("setReadonly", [ readonly ]);
|
alfresco.xforms.TextArea.superclass.setReadonly.call(this, readonly);
|
||||||
var mce = tinyMCE.getInstanceById(this.id);
|
var mce = tinyMCE.getInstanceById(this.id);
|
||||||
if (readonly && mce)
|
if (readonly && mce)
|
||||||
{
|
{
|
||||||
@@ -729,7 +826,7 @@ dojo.declare("alfresco.xforms.TextArea",
|
|||||||
|
|
||||||
_destroy: function()
|
_destroy: function()
|
||||||
{
|
{
|
||||||
this.inherited("_destroy", []);
|
alfresco.xforms.TextArea.superclass._destroy.call(this);
|
||||||
if (!this.isReadonly())
|
if (!this.isReadonly())
|
||||||
{
|
{
|
||||||
dojo.debug("removing mce control " + this.id);
|
dojo.debug("removing mce control " + this.id);
|
||||||
@@ -751,6 +848,7 @@ dojo.declare("alfresco.xforms.TextArea",
|
|||||||
widget._commitValueChange();
|
widget._commitValueChange();
|
||||||
this.focused = false;
|
this.focused = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_tinyMCE_focusHandler: function(event)
|
_tinyMCE_focusHandler: function(event)
|
||||||
{
|
{
|
||||||
var widget = event.target.widget;
|
var widget = event.target.widget;
|
||||||
@@ -781,11 +879,10 @@ dojo.declare("alfresco.xforms.TextArea",
|
|||||||
/** Base class for all select widgets. */
|
/** Base class for all select widgets. */
|
||||||
dojo.declare("alfresco.xforms.AbstractSelectWidget",
|
dojo.declare("alfresco.xforms.AbstractSelectWidget",
|
||||||
alfresco.xforms.Widget,
|
alfresco.xforms.Widget,
|
||||||
|
function(xform, xformsNode)
|
||||||
|
{
|
||||||
|
},
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// methods
|
// methods
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -802,30 +899,34 @@ dojo.declare("alfresco.xforms.AbstractSelectWidget",
|
|||||||
alfresco_xforms_constants.XFORMS_PREFIX,
|
alfresco_xforms_constants.XFORMS_PREFIX,
|
||||||
"item");
|
"item");
|
||||||
var result = [];
|
var result = [];
|
||||||
for (var v = 0; v < values.length; v++)
|
for (var i = 0; i < values.length; i++)
|
||||||
{
|
{
|
||||||
var label = _getElementsByTagNameNS(values[v],
|
var label = _getElementsByTagNameNS(values[i],
|
||||||
alfresco_xforms_constants.XFORMS_NS,
|
alfresco_xforms_constants.XFORMS_NS,
|
||||||
alfresco_xforms_constants.XFORMS_PREFIX,
|
alfresco_xforms_constants.XFORMS_PREFIX,
|
||||||
"label")[0];
|
"label")[0];
|
||||||
var value = _getElementsByTagNameNS(values[v],
|
var value = _getElementsByTagNameNS(values[i],
|
||||||
alfresco_xforms_constants.XFORMS_NS,
|
alfresco_xforms_constants.XFORMS_NS,
|
||||||
alfresco_xforms_constants.XFORMS_PREFIX,
|
alfresco_xforms_constants.XFORMS_PREFIX,
|
||||||
"value")[0];
|
"value")[0];
|
||||||
var valid = true;
|
var valid = true;
|
||||||
if (binding.constraint)
|
if (binding.constraint)
|
||||||
{
|
{
|
||||||
dojo.debug("testing " + binding.constraint +
|
|
||||||
" on " + dojo.dom.textContent(value));
|
|
||||||
valid = _evaluateXPath(binding.constraint, value, XPathResult.BOOLEAN_TYPE);
|
valid = _evaluateXPath(binding.constraint, value, XPathResult.BOOLEAN_TYPE);
|
||||||
|
dojo.debug("evaludated constraint " + binding.constraint +
|
||||||
|
" on " + dojo.dom.textContent(value) +
|
||||||
|
" to " + valid);
|
||||||
}
|
}
|
||||||
dojo.debug("valid " + dojo.dom.textContent(value) + "? " + valid);
|
|
||||||
result.push({
|
result.push({
|
||||||
id: value.getAttribute("id"),
|
id: value.getAttribute("id"),
|
||||||
label: valid ? dojo.dom.textContent(label) : "",
|
label: valid ? dojo.dom.textContent(label) : "",
|
||||||
value: valid ? dojo.dom.textContent(value) : "_invalid_value_",
|
value: valid ? dojo.dom.textContent(value) : "_invalid_value_",
|
||||||
valid: valid
|
valid: valid
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dojo.debug("values["+ i + "] = {id: " + result[i].id +
|
||||||
|
",label: " + result[i].label + ",value: " + result[i].value +
|
||||||
|
",valid: " + result[i].valid + "}");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -837,11 +938,10 @@ dojo.declare("alfresco.xforms.AbstractSelectWidget",
|
|||||||
*/
|
*/
|
||||||
dojo.declare("alfresco.xforms.Select",
|
dojo.declare("alfresco.xforms.Select",
|
||||||
alfresco.xforms.AbstractSelectWidget,
|
alfresco.xforms.AbstractSelectWidget,
|
||||||
|
function(xform, xformsNode)
|
||||||
|
{
|
||||||
|
},
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// overridden methods
|
// overridden methods
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -849,11 +949,6 @@ dojo.declare("alfresco.xforms.Select",
|
|||||||
render: function(attach_point)
|
render: function(attach_point)
|
||||||
{
|
{
|
||||||
var values = this._getItemValues();
|
var values = this._getItemValues();
|
||||||
for (var i in values)
|
|
||||||
{
|
|
||||||
dojo.debug("values["+ i + "] = " + values[i].id +
|
|
||||||
", " + values[i].label + ", " + values[i].value);
|
|
||||||
}
|
|
||||||
var initial_value = this.getInitialValue();
|
var initial_value = this.getInitialValue();
|
||||||
initial_value = initial_value ? initial_value.split(' ') : [];
|
initial_value = initial_value ? initial_value.split(' ') : [];
|
||||||
this._selectedValues = [];
|
this._selectedValues = [];
|
||||||
@@ -913,7 +1008,7 @@ dojo.declare("alfresco.xforms.Select",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inherited("setValue", [ value, forceCommit ]);
|
alfresco.xforms.Select.superclass.setValue(this, value, forceCommit);
|
||||||
this._selectedValues = value.split(' ');
|
this._selectedValues = value.split(' ');
|
||||||
if (this.widget.nodeName.toLowerCase() == "div")
|
if (this.widget.nodeName.toLowerCase() == "div")
|
||||||
{
|
{
|
||||||
@@ -983,11 +1078,10 @@ dojo.declare("alfresco.xforms.Select",
|
|||||||
*/
|
*/
|
||||||
dojo.declare("alfresco.xforms.Select1",
|
dojo.declare("alfresco.xforms.Select1",
|
||||||
alfresco.xforms.AbstractSelectWidget,
|
alfresco.xforms.AbstractSelectWidget,
|
||||||
|
function(xform, xformsNode)
|
||||||
|
{
|
||||||
|
},
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// overridden methods
|
// overridden methods
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -995,11 +1089,6 @@ dojo.declare("alfresco.xforms.Select1",
|
|||||||
render: function(attach_point)
|
render: function(attach_point)
|
||||||
{
|
{
|
||||||
var values = this._getItemValues();
|
var values = this._getItemValues();
|
||||||
for (var i in values)
|
|
||||||
{
|
|
||||||
dojo.debug("values["+ i + "] = " + values[i].id +
|
|
||||||
", " + values[i].label + ", " + values[i].value);
|
|
||||||
}
|
|
||||||
var initial_value = this.getInitialValue();
|
var initial_value = this.getInitialValue();
|
||||||
if (values.length <= 5)
|
if (values.length <= 5)
|
||||||
{
|
{
|
||||||
@@ -1063,7 +1152,7 @@ dojo.declare("alfresco.xforms.Select1",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inherited("setValue", [ value, forceCommit ]);
|
alfresco.xforms.Select1.superclass.setValue.call(this, value, forceCommit);
|
||||||
this._selectedValue = value;
|
this._selectedValue = value;
|
||||||
if (this.widget.nodeName.toLowerCase() == "div")
|
if (this.widget.nodeName.toLowerCase() == "div")
|
||||||
{
|
{
|
||||||
@@ -1126,11 +1215,10 @@ dojo.declare("alfresco.xforms.Select1",
|
|||||||
*/
|
*/
|
||||||
dojo.declare("alfresco.xforms.Checkbox",
|
dojo.declare("alfresco.xforms.Checkbox",
|
||||||
alfresco.xforms.Widget,
|
alfresco.xforms.Widget,
|
||||||
|
function(xform, xformsNode)
|
||||||
|
{
|
||||||
|
},
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// overridden methods
|
// overridden methods
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -1158,7 +1246,7 @@ dojo.declare("alfresco.xforms.Checkbox",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inherited("setValue", [ value, forceCommit ]);
|
alfresco.xforms.Checkbox.superclass.setValue.call(this, value, forceCommit);
|
||||||
this.widget.checked = value == "true";
|
this.widget.checked = value == "true";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1197,7 +1285,6 @@ dojo.declare("alfresco.xforms.DatePicker",
|
|||||||
render: function(attach_point)
|
render: function(attach_point)
|
||||||
{
|
{
|
||||||
var initial_value = this.getInitialValue() || "";
|
var initial_value = this.getInitialValue() || "";
|
||||||
|
|
||||||
attach_point.appendChild(this.domNode);
|
attach_point.appendChild(this.domNode);
|
||||||
this.widget = document.createElement("input");
|
this.widget = document.createElement("input");
|
||||||
this.widget.setAttribute("id", this.id + "-widget");
|
this.widget.setAttribute("id", this.id + "-widget");
|
||||||
@@ -1211,18 +1298,18 @@ dojo.declare("alfresco.xforms.DatePicker",
|
|||||||
|
|
||||||
var dp_initial_value = (initial_value
|
var dp_initial_value = (initial_value
|
||||||
? initial_value
|
? initial_value
|
||||||
: dojo.widget.DatePicker.util.toRfcDate(new Date()));
|
: dojo.date.toRfc3339(new Date()));
|
||||||
this.widget.picker = dojo.widget.createWidget("DatePicker",
|
this.widget.picker = dojo.widget.createWidget("DatePicker",
|
||||||
{
|
{
|
||||||
isHidden: true,
|
isHidden: true,
|
||||||
storedDate: dp_initial_value
|
value: dp_initial_value
|
||||||
},
|
},
|
||||||
datePickerDiv);
|
datePickerDiv);
|
||||||
this.widget.picker.hide();
|
this.widget.picker.hide();
|
||||||
dojo.event.connect(this.widget.picker,
|
dojo.event.connect(this.widget.picker,
|
||||||
"onSetDate",
|
"onValueChanged",
|
||||||
this,
|
this,
|
||||||
this._datePicker_setDateHandler);
|
this._datePicker_valueChangedHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue: function(value, forceCommit)
|
setValue: function(value, forceCommit)
|
||||||
@@ -1233,7 +1320,7 @@ dojo.declare("alfresco.xforms.DatePicker",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inherited("setValue", [ value, forceCommit ]);
|
alfresco.xforms.DatePicker.superclass.setValue.call(this, value, forceCommit);
|
||||||
this.widget.setAttribute("value", value);
|
this.widget.setAttribute("value", value);
|
||||||
this.widget.picker.setDate(value);
|
this.widget.picker.setDate(value);
|
||||||
}
|
}
|
||||||
@@ -1252,23 +1339,23 @@ dojo.declare("alfresco.xforms.DatePicker",
|
|||||||
|
|
||||||
_dateTextBox_focusHandler: function(event)
|
_dateTextBox_focusHandler: function(event)
|
||||||
{
|
{
|
||||||
dojo.style.hide(this.widget);
|
dojo.html.hide(this.widget);
|
||||||
this.widget.picker.show();
|
this.widget.picker.show();
|
||||||
this.domContainer.style.height =
|
this.domContainer.style.height =
|
||||||
Math.max(this.widget.picker.domNode.offsetHeight +
|
Math.max(this.widget.picker.domNode.offsetHeight +
|
||||||
dojo.style.getMarginHeight(this.domNode.parentNode),
|
dojo.html.getMargin(this.domNode.parentNode).height,
|
||||||
20) + "px";
|
20) + "px";
|
||||||
},
|
},
|
||||||
|
|
||||||
_datePicker_setDateHandler: function(event)
|
_datePicker_valueChangedHandler: function(date)
|
||||||
{
|
{
|
||||||
this.widget.picker.hide();
|
this.widget.picker.hide();
|
||||||
dojo.style.show(this.widget);
|
dojo.html.show(this.widget);
|
||||||
this.domContainer.style.height =
|
this.domContainer.style.height =
|
||||||
Math.max(this.domNode.parentNode.offsetHeight +
|
Math.max(this.domNode.parentNode.offsetHeight +
|
||||||
dojo.style.getMarginHeight(this.domNode.parentNode),
|
dojo.html.getMargin(this.domNode.parentNode).height,
|
||||||
20) + "px";
|
20) + "px";
|
||||||
this.widget.value = dojo.widget.DatePicker.util.toRfcDate(this.widget.picker.date);
|
this.widget.value = dojo.date.toRfc3339(date, "dateOnly");
|
||||||
this._commitValueChange();
|
this._commitValueChange();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1313,7 +1400,7 @@ dojo.declare("alfresco.xforms.TimePicker",
|
|||||||
|
|
||||||
// don't let it float - it screws up layout somehow
|
// don't let it float - it screws up layout somehow
|
||||||
this.widget.picker.domNode.style.cssFloat = "none";
|
this.widget.picker.domNode.style.cssFloat = "none";
|
||||||
this.domNode.style.height = dojo.style.getMarginBoxHeight(this.widget.picker.domNode) + "px";
|
this.domNode.style.height = dojo.html.getMarginBox(this.widget.picker.domNode).height + "px";
|
||||||
dojo.event.connect(this.widget.picker,
|
dojo.event.connect(this.widget.picker,
|
||||||
"onSetTime",
|
"onSetTime",
|
||||||
this,
|
this,
|
||||||
@@ -1328,14 +1415,14 @@ dojo.declare("alfresco.xforms.TimePicker",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inherited("setValue", [ value, forceCommit ]);
|
alfresco.xforms.TimePicker.superclass.setValue.call(this, value, forceCommit);
|
||||||
this.widget.picker.setDateTime(value);
|
this.widget.picker.setDateTime(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getValue: function()
|
getValue: function()
|
||||||
{
|
{
|
||||||
return dojo.date.format(this.widget.picker.time, "%H:%M:00");
|
return dojo.date.strftime(this.widget.picker.time, "%H:%M:00");
|
||||||
},
|
},
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -1362,26 +1449,29 @@ dojo.declare("alfresco.xforms.YearPicker",
|
|||||||
|
|
||||||
render: function(attach_point)
|
render: function(attach_point)
|
||||||
{
|
{
|
||||||
this.inherited("render", [ attach_point ]);
|
alfresco.xforms.YearPicker.superclass.render.call(this, attach_point);
|
||||||
this.widget.size = "4";
|
this.widget.size = "4";
|
||||||
this.widget.setAttribute("maxlength", "4");
|
this.widget.setAttribute("maxlength", "4");
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialValue: function()
|
getInitialValue: function()
|
||||||
{
|
{
|
||||||
var result = this.inherited("getInitialValue", []);
|
var result = alfresco.xforms.YearPicker.superclass.getInitialValue.call(this);
|
||||||
return result ? result.replace(/^0*([^0]+)$/, "$1") : result;
|
return result ? result.replace(/^0*([^0]+)$/, "$1") : result;
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue: function(value, forceCommit)
|
setValue: function(value, forceCommit)
|
||||||
{
|
{
|
||||||
this.inherited("setValue",
|
alfresco.xforms.YearPicker.superclass.setValue.call(this,
|
||||||
[ value ? value.replace(/^0*([^0]+)$/, "$1") : null, forceCommit ]);
|
(value
|
||||||
|
? value.replace(/^0*([^0]+)$/, "$1")
|
||||||
|
: null),
|
||||||
|
forceCommit);
|
||||||
},
|
},
|
||||||
|
|
||||||
getValue: function()
|
getValue: function()
|
||||||
{
|
{
|
||||||
var result = this.inherited("getValue", []);
|
var result = alfresco.xforms.YearPicker.superclass.getValue.call(this);
|
||||||
return result ? dojo.string.padLeft(result, 4, "0") : null;
|
return result ? dojo.string.padLeft(result, 4, "0") : null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1428,15 +1518,13 @@ dojo.declare("alfresco.xforms.MonthPicker",
|
|||||||
{
|
{
|
||||||
var result = [];
|
var result = [];
|
||||||
result.push({id: "month_empty", label: "", value: "", valid: false});
|
result.push({id: "month_empty", label: "", value: "", valid: false});
|
||||||
for (var i = 0; i <= dojo.date.months.length; i++)
|
for (var i = 0; i <= 12; i++)
|
||||||
{
|
{
|
||||||
if (typeof dojo.date.months[i] != "string")
|
var d = new Date();
|
||||||
{
|
d.setMonth(i);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
result.push({
|
result.push({
|
||||||
id: "month_" + i,
|
id: "month_" + i,
|
||||||
label: dojo.date.months[i],
|
label: dojo.date.getMonthName(d),
|
||||||
value: "--" + (i + 1 < 10 ? "0" + (i + 1) : i + 1),
|
value: "--" + (i + 1 < 10 ? "0" + (i + 1) : i + 1),
|
||||||
valid: true});
|
valid: true});
|
||||||
}
|
}
|
||||||
@@ -1681,14 +1769,13 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
{
|
{
|
||||||
child.domContainer.style.height =
|
child.domContainer.style.height =
|
||||||
Math.max(contentDiv.offsetHeight +
|
Math.max(contentDiv.offsetHeight +
|
||||||
dojo.style.getMarginHeight(contentDiv), 20) + "px";
|
dojo.html.getMargin(contentDiv).height, 20) + "px";
|
||||||
// child.domContainer.style.lineHeight = child.domContainer.style.height;
|
// child.domContainer.style.lineHeight = child.domContainer.style.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
dojo.debug(contentDiv.getAttribute("id") + " offsetTop is " + contentDiv.offsetTop);
|
dojo.debug(contentDiv.getAttribute("id") + " offsetTop is " + contentDiv.offsetTop);
|
||||||
// alert(contentDiv.offsetTop - dojo.style.getPixelValue(contentDiv, "margin-top"));
|
|
||||||
contentDiv.style.top = "-" + Math.max(0, contentDiv.offsetTop -
|
contentDiv.style.top = "-" + Math.max(0, contentDiv.offsetTop -
|
||||||
dojo.style.getPixelValue(contentDiv, "margin-top")) + "px";
|
dojo.html.getPixelValue(contentDiv, "margin-top")) + "px";
|
||||||
if (labelDiv)
|
if (labelDiv)
|
||||||
{
|
{
|
||||||
labelDiv.style.top = (contentDiv.offsetTop + ((.5 * contentDiv.offsetHeight) -
|
labelDiv.style.top = (contentDiv.offsetTop + ((.5 * contentDiv.offsetHeight) -
|
||||||
@@ -1740,6 +1827,11 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
// overridden methods & properties
|
// overridden methods & properties
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
isValidForSubmit: function()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
/** Iterates all children a produces an array of widgets which are invalid for submit. */
|
/** Iterates all children a produces an array of widgets which are invalid for submit. */
|
||||||
getWidgetsInvalidForSubmit: function()
|
getWidgetsInvalidForSubmit: function()
|
||||||
{
|
{
|
||||||
@@ -1761,7 +1853,7 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
/** Recusively destroys all children. */
|
/** Recusively destroys all children. */
|
||||||
_destroy: function()
|
_destroy: function()
|
||||||
{
|
{
|
||||||
this.inherited("_destroy", []);
|
alfresco.xforms.Group.superclass._destroy.call(this);
|
||||||
for (var i = 0; i < this._children.length; i++)
|
for (var i = 0; i < this._children.length; i++)
|
||||||
{
|
{
|
||||||
this._children[i]._destroy();
|
this._children[i]._destroy();
|
||||||
@@ -1770,7 +1862,7 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
|
|
||||||
setReadonly: function(readonly)
|
setReadonly: function(readonly)
|
||||||
{
|
{
|
||||||
this.inherited("setReadonly", [ readonly ]);
|
alfresco.xforms.Group.superclass.setReadonly.call(this, readonly);
|
||||||
for (var i = 0; i < this._children.length; i++)
|
for (var i = 0; i < this._children.length; i++)
|
||||||
{
|
{
|
||||||
this._children[i].setReadonly(readonly);
|
this._children[i].setReadonly(readonly);
|
||||||
@@ -1800,9 +1892,9 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.domNode.style.width = (1 - ((dojo.style.getBorderWidth(this.domNode) +
|
this.domNode.style.width = (1 - ((dojo.html.getBorder(this.domNode).width +
|
||||||
dojo.style.getPaddingWidth(this.domNode) +
|
dojo.html.getPadding(this.domNode).width +
|
||||||
dojo.style.getMarginWidth(this.domNode)) /
|
dojo.html.getMargin(this.domNode).width) /
|
||||||
attach_point.offsetWidth)) * 100 + "%";
|
attach_point.offsetWidth)) * 100 + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1866,9 +1958,9 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.domNode.style.width = (1 - ((dojo.style.getBorderWidth(this.domNode) +
|
this.domNode.style.width = (1 - ((dojo.html.getBorder(this.domNode).width +
|
||||||
dojo.style.getPaddingWidth(this.domNode) +
|
dojo.html.getPadding(this.domNode).width +
|
||||||
dojo.style.getMarginWidth(this.domNode)) /
|
dojo.html.getMargin(this.domNode).width) /
|
||||||
this.domNode.parentNode.offsetWidth)) * 100 + "%";
|
this.domNode.parentNode.offsetWidth)) * 100 + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1895,11 +1987,11 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
{
|
{
|
||||||
this._children[i].domContainer.style.height =
|
this._children[i].domContainer.style.height =
|
||||||
Math.max(contentDiv.offsetHeight +
|
Math.max(contentDiv.offsetHeight +
|
||||||
dojo.style.getMarginHeight(contentDiv), 20) + "px";
|
dojo.html.getMargin(contentDiv).height, 20) + "px";
|
||||||
}
|
}
|
||||||
|
|
||||||
contentDiv.style.top = "-" + Math.max(0, contentDiv.offsetTop -
|
contentDiv.style.top = "-" + Math.max(0, contentDiv.offsetTop -
|
||||||
dojo.style.getPixelValue(contentDiv, "margin-top")) + "px";
|
dojo.html.getPixelValue(contentDiv, "margin-top")) + "px";
|
||||||
|
|
||||||
var labelDiv = document.getElementById(this._children[i].id + "-label");
|
var labelDiv = document.getElementById(this._children[i].id + "-label");
|
||||||
if (labelDiv)
|
if (labelDiv)
|
||||||
@@ -1934,6 +2026,7 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// DOM event handlers
|
// DOM event handlers
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
_toggleExpanded_clickHandler: function(event)
|
_toggleExpanded_clickHandler: function(event)
|
||||||
{
|
{
|
||||||
this.setExpanded(!this.isExpanded());
|
this.setExpanded(!this.isExpanded());
|
||||||
@@ -1942,20 +2035,19 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
|
|
||||||
dojo.declare("alfresco.xforms.SwitchGroup",
|
dojo.declare("alfresco.xforms.SwitchGroup",
|
||||||
alfresco.xforms.Group,
|
alfresco.xforms.Group,
|
||||||
|
function(xform, xformsNode)
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
this.selectedCaseId = null;
|
||||||
|
var widgets = this.xform.getBinding(this.xformsNode).widgets;
|
||||||
|
for (var i in widgets)
|
||||||
{
|
{
|
||||||
this.selectedCaseId = null;
|
if (widgets[i] instanceof alfresco.xforms.Select1)
|
||||||
var widgets = this.xform.getBinding(this.xformsNode).widgets;
|
|
||||||
for (var i in widgets)
|
|
||||||
{
|
{
|
||||||
if (widgets[i] instanceof alfresco.xforms.Select1)
|
widgets[i].setValue(this.getInitialValue(), "true");
|
||||||
{
|
|
||||||
widgets[i].setValue(this.getInitialValue(), "true");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// overridden methods & properties
|
// overridden methods & properties
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -1963,7 +2055,8 @@ dojo.declare("alfresco.xforms.SwitchGroup",
|
|||||||
/** */
|
/** */
|
||||||
_insertChildAt: function(child, position)
|
_insertChildAt: function(child, position)
|
||||||
{
|
{
|
||||||
var childDomContainer = this.inherited("_insertChildAt", [child, position]);
|
var childDomContainer =
|
||||||
|
alfresco.xforms.SwitchGroup.superclass._insertChildAt.call(this, child, position);
|
||||||
this.selectedCaseId = this.selectedCaseId || child.id;
|
this.selectedCaseId = this.selectedCaseId || child.id;
|
||||||
if (this.selectedCaseId != child.id)
|
if (this.selectedCaseId != child.id)
|
||||||
{
|
{
|
||||||
@@ -2004,11 +2097,11 @@ dojo.declare("alfresco.xforms.SwitchGroup",
|
|||||||
*/
|
*/
|
||||||
dojo.declare("alfresco.xforms.ViewRoot",
|
dojo.declare("alfresco.xforms.ViewRoot",
|
||||||
alfresco.xforms.Group,
|
alfresco.xforms.Group,
|
||||||
|
function(xform, xformsNode)
|
||||||
|
{
|
||||||
|
this.focusedRepeat = null;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
|
||||||
{
|
|
||||||
this.focusedRepeat = null;
|
|
||||||
},
|
|
||||||
render: function(attach_point)
|
render: function(attach_point)
|
||||||
{
|
{
|
||||||
this.domNode.widget = this;
|
this.domNode.widget = this;
|
||||||
@@ -2055,13 +2148,12 @@ alfresco.xforms.RepeatIndexData = function(repeat, index)
|
|||||||
*/
|
*/
|
||||||
dojo.declare("alfresco.xforms.Repeat",
|
dojo.declare("alfresco.xforms.Repeat",
|
||||||
alfresco.xforms.Group,
|
alfresco.xforms.Group,
|
||||||
|
function(xform, xformsNode)
|
||||||
|
{
|
||||||
|
this.repeatControls = [];
|
||||||
|
this._selectedIndex = -1;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
initializer: function(xform, xformsNode)
|
|
||||||
{
|
|
||||||
this.repeatControls = [];
|
|
||||||
this._selectedIndex = -1;
|
|
||||||
},
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// methods & properties
|
// methods & properties
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -2211,13 +2303,13 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
var removeEnabled = this.isRemoveRepeatItemEnabled();
|
var removeEnabled = this.isRemoveRepeatItemEnabled();
|
||||||
for (var i = 0; i < this.repeatControls.length; i++)
|
for (var i = 0; i < this.repeatControls.length; i++)
|
||||||
{
|
{
|
||||||
dojo.style.setOpacity(this.repeatControls[i].moveRepeatItemUpImage,
|
dojo.html.setOpacity(this.repeatControls[i].moveRepeatItemUpImage,
|
||||||
i == 0 ? .3 : 1);
|
i == 0 ? .3 : 1);
|
||||||
dojo.style.setOpacity(this.repeatControls[i].moveRepeatItemDownImage,
|
dojo.html.setOpacity(this.repeatControls[i].moveRepeatItemDownImage,
|
||||||
i == this.repeatControls.length - 1 ? .3 : 1);
|
i == this.repeatControls.length - 1 ? .3 : 1);
|
||||||
dojo.style.setOpacity(this.repeatControls[i].insertRepeatItemImage,
|
dojo.html.setOpacity(this.repeatControls[i].insertRepeatItemImage,
|
||||||
insertEnabled ? 1 : .3);
|
insertEnabled ? 1 : .3);
|
||||||
dojo.style.setOpacity(this.repeatControls[i].removeRepeatItemImage,
|
dojo.html.setOpacity(this.repeatControls[i].removeRepeatItemImage,
|
||||||
removeEnabled ? 1 : .3);
|
removeEnabled ? 1 : .3);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2260,12 +2352,12 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
img.style.margin = "2px 5px 2px " + (i == 0 ? 5 : 0) + "px";
|
img.style.margin = "2px 5px 2px " + (i == 0 ? 5 : 0) + "px";
|
||||||
img.repeat = this;
|
img.repeat = this;
|
||||||
repeatControlsWidth += (parseInt(img.style.width) +
|
repeatControlsWidth += (parseInt(img.style.width) +
|
||||||
dojo.style.getMarginWidth(img));
|
dojo.html.getMargin(img).width);
|
||||||
this.repeatControls[position].appendChild(img);
|
this.repeatControls[position].appendChild(img);
|
||||||
dojo.event.connect(img, "onclick", this, images[i].action);
|
dojo.event.connect(img, "onclick", this, images[i].action);
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = this.inherited("_insertChildAt", [ child, position ]);
|
var result = alfresco.xforms.Repeat.superclass._insertChildAt.call(this, child, position);
|
||||||
child.repeat = this;
|
child.repeat = this;
|
||||||
dojo.event.connect(result, "onclick", function(event)
|
dojo.event.connect(result, "onclick", function(event)
|
||||||
{
|
{
|
||||||
@@ -2291,8 +2383,8 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
result.style.paddingBottom = (.5 * this.repeatControls[position].offsetHeight) + "px";
|
result.style.paddingBottom = (.5 * this.repeatControls[position].offsetHeight) + "px";
|
||||||
|
|
||||||
this.repeatControls[position].style.top = -(.5 * (this.repeatControls[position].offsetHeight ) +
|
this.repeatControls[position].style.top = -(.5 * (this.repeatControls[position].offsetHeight ) +
|
||||||
dojo.style.getPixelValue(result, "margin-bottom") +
|
dojo.html.getPixelValue(result, "margin-bottom") +
|
||||||
dojo.style.getBorderExtent(result, "bottom")) + "px";
|
dojo.html.getBorderExtent(result, "bottom")) + "px";
|
||||||
this.repeatControls[position].style.marginRight =
|
this.repeatControls[position].style.marginRight =
|
||||||
(.5 * result.offsetWidth -
|
(.5 * result.offsetWidth -
|
||||||
.5 * this.repeatControls[position].offsetWidth) + "px";
|
.5 * this.repeatControls[position].offsetWidth) + "px";
|
||||||
@@ -2313,13 +2405,13 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
dojo.dom.removeChildren(this.repeatControls[position]);
|
dojo.dom.removeChildren(this.repeatControls[position]);
|
||||||
dojo.dom.removeNode(this.repeatControls[position]);
|
dojo.dom.removeNode(this.repeatControls[position]);
|
||||||
this.repeatControls.splice(position, 1);
|
this.repeatControls.splice(position, 1);
|
||||||
return this.inherited("_removeChildAt", [ position ]);
|
return alfresco.xforms.Repeat.superclass._removeChildAt.call(this, position);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Disables insert before. */
|
/** Disables insert before. */
|
||||||
_childAdded: function(child)
|
_childAdded: function(child)
|
||||||
{
|
{
|
||||||
dojo.style.setOpacity(this.headerInsertRepeatItemImage, .3);
|
dojo.html.setOpacity(this.headerInsertRepeatItemImage, .3);
|
||||||
this._updateRepeatControls();
|
this._updateRepeatControls();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2328,14 +2420,14 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
{
|
{
|
||||||
if (this._children.length == 0)
|
if (this._children.length == 0)
|
||||||
{
|
{
|
||||||
dojo.style.setOpacity(this.headerInsertRepeatItemImage, 1);
|
dojo.html.setOpacity(this.headerInsertRepeatItemImage, 1);
|
||||||
}
|
}
|
||||||
this._updateRepeatControls();
|
this._updateRepeatControls();
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function(attach_point)
|
render: function(attach_point)
|
||||||
{
|
{
|
||||||
this.domNode = this.inherited("render", [ attach_point ]);
|
this.domNode = alfresco.xforms.Repeat.superclass.render.call(this, attach_point);
|
||||||
dojo.html.addClass(this.domNode, "xformsRepeat");
|
dojo.html.addClass(this.domNode, "xformsRepeat");
|
||||||
|
|
||||||
// clear the border bottom for the group header since we'll be getting it
|
// clear the border bottom for the group header since we'll be getting it
|
||||||
@@ -2372,7 +2464,7 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
|
|
||||||
_updateDisplay: function()
|
_updateDisplay: function()
|
||||||
{
|
{
|
||||||
this.inherited("_updateDisplay", []);
|
alfresco.xforms.Repeat.superclass._updateDisplay.call(this);
|
||||||
if (this.getViewRoot().focusedRepeat != null &&
|
if (this.getViewRoot().focusedRepeat != null &&
|
||||||
(this.getViewRoot().focusedRepeat == this ||
|
(this.getViewRoot().focusedRepeat == this ||
|
||||||
this.getViewRoot().focusedRepeat.isAncestorOf(this)))
|
this.getViewRoot().focusedRepeat.isAncestorOf(this)))
|
||||||
@@ -2681,10 +2773,6 @@ dojo.declare("alfresco.xforms.Submit",
|
|||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render: function(attach_point)
|
|
||||||
{
|
|
||||||
this.inherited("render", [ attach_point ]);
|
|
||||||
},
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// DOM event handlers
|
// DOM event handlers
|
||||||
@@ -2861,7 +2949,7 @@ dojo.declare("alfresco.xforms.XForm",
|
|||||||
this._bindings = this._loadBindings(this.getModel());
|
this._bindings = this._loadBindings(this.getModel());
|
||||||
|
|
||||||
var bindings = this.getBindings();
|
var bindings = this.getBindings();
|
||||||
for (var i in bindings)
|
for (var i = 0; false && i < bindings.length; i++)
|
||||||
{
|
{
|
||||||
dojo.debug("bindings[" + i + "]=" + bindings[i].id +
|
dojo.debug("bindings[" + i + "]=" + bindings[i].id +
|
||||||
", parent = " + (bindings[i].parent
|
", parent = " + (bindings[i].parent
|
||||||
@@ -2894,6 +2982,32 @@ dojo.declare("alfresco.xforms.XForm",
|
|||||||
return new alfresco.xforms.TextArea(this, xformsNode);
|
return new alfresco.xforms.TextArea(this, xformsNode);
|
||||||
case alfresco_xforms_constants.XFORMS_PREFIX + ":upload":
|
case alfresco_xforms_constants.XFORMS_PREFIX + ":upload":
|
||||||
return new alfresco.xforms.FilePicker(this, xformsNode);
|
return new alfresco.xforms.FilePicker(this, xformsNode);
|
||||||
|
case alfresco_xforms_constants.XFORMS_PREFIX + ":range":
|
||||||
|
{
|
||||||
|
var type = this.getBinding(xformsNode).getType();
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
// number types
|
||||||
|
case "byte":
|
||||||
|
case "double":
|
||||||
|
case "float":
|
||||||
|
case "int":
|
||||||
|
case "integer":
|
||||||
|
case "long":
|
||||||
|
case "negativeInteger":
|
||||||
|
case "nonNegativeInteger":
|
||||||
|
case "nonPositiveInteger":
|
||||||
|
case "short":
|
||||||
|
case "unsignedByte":
|
||||||
|
case "unsignedInt":
|
||||||
|
case "unsignedLong":
|
||||||
|
case "unsignedShort":
|
||||||
|
case "positiveInteger":
|
||||||
|
return new alfresco.xforms.NumericalRange(this, xformsNode);
|
||||||
|
default:
|
||||||
|
throw new Error("range not supported for type " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
case alfresco_xforms_constants.XFORMS_PREFIX + ":input":
|
case alfresco_xforms_constants.XFORMS_PREFIX + ":input":
|
||||||
{
|
{
|
||||||
var type = this.getBinding(xformsNode).getType();
|
var type = this.getBinding(xformsNode).getType();
|
||||||
@@ -3001,7 +3115,6 @@ dojo.declare("alfresco.xforms.XForm",
|
|||||||
_loadBindings: function(bind, parent, result)
|
_loadBindings: function(bind, parent, result)
|
||||||
{
|
{
|
||||||
result = result || [];
|
result = result || [];
|
||||||
dojo.debug("loading bindings for " + bind.nodeName);
|
|
||||||
for (var i = 0; i < bind.childNodes.length; i++)
|
for (var i = 0; i < bind.childNodes.length; i++)
|
||||||
{
|
{
|
||||||
if (bind.childNodes[i].nodeName.toLowerCase() ==
|
if (bind.childNodes[i].nodeName.toLowerCase() ==
|
||||||
@@ -3168,22 +3281,26 @@ dojo.declare("alfresco.xforms.XForm",
|
|||||||
{
|
{
|
||||||
dojo.debug("handleStateChanged(" + xfe.targetId + ")");
|
dojo.debug("handleStateChanged(" + xfe.targetId + ")");
|
||||||
xfe.getTarget().setModified(true);
|
xfe.getTarget().setModified(true);
|
||||||
xfe.getTarget().setValid(xfe.properties["valid"] == "true");
|
if ("valid" in xfe.properties)
|
||||||
xfe.getTarget().setRequired(xfe.properties["required"] == "true");
|
{
|
||||||
xfe.getTarget().setReadonly(xfe.properties["readonly"] == "true");
|
xfe.getTarget().setValid(xfe.properties["valid"] == "true");
|
||||||
xfe.getTarget().setEnabled(xfe.properties["enabled"] == "true");
|
}
|
||||||
|
if ("required" in xfe.properties)
|
||||||
|
{
|
||||||
|
xfe.getTarget().setRequired(xfe.properties["required"] == "true");
|
||||||
|
}
|
||||||
|
if ("readonly" in xfe.properties)
|
||||||
|
{
|
||||||
|
xfe.getTarget().setReadonly(xfe.properties["readonly"] == "true");
|
||||||
|
}
|
||||||
|
if ("enabled" in xfe.properties)
|
||||||
|
{
|
||||||
|
xfe.getTarget().setEnabled(xfe.properties["enabled"] == "true");
|
||||||
|
}
|
||||||
if ("value" in xfe.properties)
|
if ("value" in xfe.properties)
|
||||||
{
|
{
|
||||||
dojo.debug("setting " + xfe.getTarget().id + " = " + xfe.properties["value"]);
|
dojo.debug("setting " + xfe.getTarget().id + " = " + xfe.properties["value"]);
|
||||||
try
|
xfe.getTarget().setValue(xfe.properties["value"]);
|
||||||
{
|
|
||||||
xfe.getTarget().setValue(xfe.properties["value"]);
|
|
||||||
}
|
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
//XXXarielb remove once setValues are implemented.
|
|
||||||
dojo.debug("Error in set value: " + e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3430,7 +3547,7 @@ AjaxHelper._getLoaderElement = function()
|
|||||||
result = document.createElement("div");
|
result = document.createElement("div");
|
||||||
result.setAttribute("id", alfresco_xforms_constants.AJAX_LOADER_DIV_ID);
|
result.setAttribute("id", alfresco_xforms_constants.AJAX_LOADER_DIV_ID);
|
||||||
dojo.html.setClass(result, "xformsAjaxLoader");
|
dojo.html.setClass(result, "xformsAjaxLoader");
|
||||||
dojo.style.hide(result);
|
dojo.html.hide(result);
|
||||||
document.body.appendChild(result);
|
document.body.appendChild(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3450,11 +3567,11 @@ AjaxHelper._updateLoaderDisplay = function()
|
|||||||
dojo.debug(ajaxLoader.innerHTML);
|
dojo.debug(ajaxLoader.innerHTML);
|
||||||
if (/* djConfig.isDebug && */ AjaxHelper._requests.length != 0)
|
if (/* djConfig.isDebug && */ AjaxHelper._requests.length != 0)
|
||||||
{
|
{
|
||||||
dojo.style.show(ajaxLoader);
|
dojo.html.show(ajaxLoader);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dojo.style.hide(ajaxLoader);
|
dojo.html.hide(ajaxLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3723,7 +3840,7 @@ _showStatus: function(text, isError)
|
|||||||
}
|
}
|
||||||
this.statusDiv.appendChild(d.createTextNode(text));
|
this.statusDiv.appendChild(d.createTextNode(text));
|
||||||
this.node.style.height = (parseInt(this.node.style.height) +
|
this.node.style.height = (parseInt(this.node.style.height) +
|
||||||
dojo.style.getMarginHeight(this.statusDiv) +
|
dojo.html.getMargin(this.statusDiv).height +
|
||||||
this.statusDiv.offsetHeight) + "px";
|
this.statusDiv.offsetHeight) + "px";
|
||||||
this.resize_callback(this);
|
this.resize_callback(this);
|
||||||
}
|
}
|
||||||
@@ -3788,8 +3905,8 @@ _showSelectedValue: function()
|
|||||||
|
|
||||||
this.selectedPathInput.style.width = (1 -
|
this.selectedPathInput.style.width = (1 -
|
||||||
((this.selectButton.offsetWidth +
|
((this.selectButton.offsetWidth +
|
||||||
dojo.style.getMarginWidth(this.selectButton)) /
|
dojo.html.getMargin(this.selectButton).width) /
|
||||||
dojo.style.getContentBoxWidth(this.node))) * 100 + "%";
|
dojo.html.getContentBox(this.node).width)) * 100 + "%";
|
||||||
dojo.event.browser.addListener(this.selectButton,
|
dojo.event.browser.addListener(this.selectButton,
|
||||||
"click",
|
"click",
|
||||||
function(event)
|
function(event)
|
||||||
@@ -3946,7 +4063,7 @@ _showPicker: function(data)
|
|||||||
|
|
||||||
var navigateToParentNodeImage = d.createElement("img");
|
var navigateToParentNodeImage = d.createElement("img");
|
||||||
navigateToParentNodeImage.style.borderWidth = "0px";
|
navigateToParentNodeImage.style.borderWidth = "0px";
|
||||||
dojo.style.setOpacity(navigateToParentNodeImage, (currentPathName == "/" ? .3 : 1));
|
dojo.html.setOpacity(navigateToParentNodeImage, (currentPathName == "/" ? .3 : 1));
|
||||||
navigateToParentNodeImage.style.margin = "0px 2px 0px 2px";
|
navigateToParentNodeImage.style.margin = "0px 2px 0px 2px";
|
||||||
navigateToParentNodeImage.align = "absmiddle";
|
navigateToParentNodeImage.align = "absmiddle";
|
||||||
navigateToParentNodeImage.setAttribute("src", alfresco_xforms_constants.WEBAPP_CONTEXT + "/images/icons/up.gif");
|
navigateToParentNodeImage.setAttribute("src", alfresco_xforms_constants.WEBAPP_CONTEXT + "/images/icons/up.gif");
|
||||||
|
Reference in New Issue
Block a user