- making textfield wider for string types per john's request

- fixing a bug in multiselect lists (this was leftover from some changes i made yesterday - definitely a desirable fix)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4098 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-10-11 14:15:04 +00:00
parent 253a51f5e4
commit 5517918179

View File

@@ -77,7 +77,6 @@ dojo.declare("alfresco.xforms.Widget",
}, },
isValidForSubmit: function() isValidForSubmit: function()
{ {
var result = true;
if (!this.valid) if (!this.valid)
return false; return false;
if (!this.modified && this.isRequired() && this.getInitialValue() == null) if (!this.modified && this.isRequired() && this.getInitialValue() == null)
@@ -264,6 +263,9 @@ dojo.declare("alfresco.xforms.TextField",
this.widget.setAttribute("type", "text"); this.widget.setAttribute("type", "text");
this.widget.setAttribute("id", this.id + "-widget"); this.widget.setAttribute("id", this.id + "-widget");
this.widget.setAttribute("value", initial_value); this.widget.setAttribute("value", initial_value);
if (this.xform.getType(this.node) == "string")
this.widget.style.width = "100%";
this.domNode.appendChild(this.widget); this.domNode.appendChild(this.widget);
// this.widget = dojo.widget.createWidget("ValidationTextBox", // this.widget = dojo.widget.createWidget("ValidationTextBox",
// { // {
@@ -369,6 +371,8 @@ dojo.declare("alfresco.xforms.Select",
", " + values[i].label + ", " + values[i].value); ", " + values[i].label + ", " + values[i].value);
} }
var initial_value = this.getInitialValue(); var initial_value = this.getInitialValue();
initial_value = initial_value ? initial_value.split(' ') : [];
this._selectedValues = [];
if (values.length <= 5) if (values.length <= 5)
{ {
for (var i = 0; i < values.length; i++) for (var i = 0; i < values.length; i++)
@@ -380,7 +384,7 @@ dojo.declare("alfresco.xforms.Select",
checkbox.setAttribute("name", this.id + "_" + i + "-widget"); checkbox.setAttribute("name", this.id + "_" + i + "-widget");
checkbox.setAttribute("type", "checkbox"); checkbox.setAttribute("type", "checkbox");
checkbox.setAttribute("value", values[i].value); checkbox.setAttribute("value", values[i].value);
if (initial_value.indexOf(values[i].value)) if (initial_value.indexOf(values[i].value) != -1)
{ {
this._selectedValues.push(values[i].value); this._selectedValues.push(values[i].value);
checkbox.setAttribute("checked", "true"); checkbox.setAttribute("checked", "true");
@@ -392,7 +396,6 @@ dojo.declare("alfresco.xforms.Select",
} }
else else
{ {
initial_value = initial_value ? initial_value.split(' ') : [];
this.widget = document.createElement("select"); this.widget = document.createElement("select");
this.widget.setAttribute("id", this.id + "-widget"); this.widget.setAttribute("id", this.id + "-widget");
this.widget.setAttribute("multiple", true); this.widget.setAttribute("multiple", true);
@@ -848,9 +851,9 @@ dojo.declare("alfresco.xforms.Repeat",
swapChildren: function(fromIndex, toIndex) swapChildren: function(fromIndex, toIndex)
{ {
dojo.debug(this.id + ".swapChildren(" + fromIndex + dojo.debug(this.id + ".swapChildren(" + fromIndex +
", " + toIndex + ")"); ", " + toIndex + ")");
var fromChild = this.getChildAt(fromIndex); var fromChild = this.getChildAt(fromIndex);
var toChild = this.getChildAt(toIndex); var toChild = this.getChildAt(toIndex);
// var toChildCoords = dojo.style.getAbsolutePosition(toChild.domContainer); // var toChildCoords = dojo.style.getAbsolutePosition(toChild.domContainer);
// toChildCoords = [ toChildCoords.x, toChildCoords.y ]; // toChildCoords = [ toChildCoords.x, toChildCoords.y ];
// alert("to coords [ " + toChildCoords[0] + ", " + toChildCoords[0] + "]"); // alert("to coords [ " + toChildCoords[0] + ", " + toChildCoords[0] + "]");
@@ -860,18 +863,17 @@ dojo.declare("alfresco.xforms.Repeat",
// dojo.lfx.html.slideTo(fromChild.domContainer, 5000, toChildCoords); // dojo.lfx.html.slideTo(fromChild.domContainer, 5000, toChildCoords);
// dojo.lfx.html.slideTo(toChild.domContainer, 5000, fromChildCoords); // dojo.lfx.html.slideTo(toChild.domContainer, 5000, fromChildCoords);
var swapNode = document.createElement("div");
var swapNode = document.createElement("div");
// dojo.dom.removeNode(toChild.domContainer); // dojo.dom.removeNode(toChild.domContainer);
// dojo.dom.removeNode(fromChild.domContainer); // dojo.dom.removeNode(fromChild.domContainer);
this.domNode.replaceChild(swapNode, fromChild.domContainer); this.domNode.replaceChild(swapNode, fromChild.domContainer);
this.domNode.replaceChild(fromChild.domContainer, toChild.domContainer); this.domNode.replaceChild(fromChild.domContainer, toChild.domContainer);
this.domNode.replaceChild(toChild.domContainer, swapNode); this.domNode.replaceChild(toChild.domContainer, swapNode);
this.children[fromIndex] = toChild; this.children[fromIndex] = toChild;
this.children[toIndex] = fromChild; this.children[toIndex] = fromChild;
this._selectedIndex = toIndex; this._selectedIndex = toIndex;
this._updateDisplay(); this._updateDisplay();
}, },
setFocusedChild: function(child) setFocusedChild: function(child)
{ {