ALF-12273: Merge V3.4 (3.4.7) to HEAD (4.0)

This is a merge takes out the fix for ALF-10282 and related changes from V3.4-BUG-FIX which also got merged to 4.0 but then was found to introduce more issues.
   32979: ALF-12114: Reverse merged ALF-10282 and related changes from V3.4-BUG-FIX, which have caused serious regressions
      31840: Fix for ALF-10282 - Web Browser freezes with large xml files Web form transformation
      32341: Fix for ALF-9883 - WCM Forms: Changing 'abstract' type carries previously-added elements

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33048 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2012-01-05 00:45:27 +00:00
parent dc6be9c82c
commit 4144459b4d

View File

@@ -1645,8 +1645,8 @@ alfresco.xforms.ComboboxSelect1 = alfresco.xforms.AbstractSelectWidget.extend({
var values = this._getItemValues(); var values = this._getItemValues();
var initial_value = this.getInitialValue(); var initial_value = this.getInitialValue();
this.domNode = new Element("select"); this.domNode = new Element("select");
attach_point.appendChild(this.domNode);
this.widget = this.domNode; this.widget = this.domNode;
var option = new Element("option");
for (var i = 0; i < values.length; i++) for (var i = 0; i < values.length; i++)
{ {
if (!values[i].valid) if (!values[i].valid)
@@ -1654,23 +1654,22 @@ alfresco.xforms.ComboboxSelect1 = alfresco.xforms.AbstractSelectWidget.extend({
// always skip the invalid values for combos // always skip the invalid values for combos
continue; continue;
} }
var opt = option.cloneNode(true); var option = new Element("option");
opt.appendChild(document.createTextNode(values[i].label)); this.widget.appendChild(option);
opt.setAttribute("value", values[i].value); option.appendChild(document.createTextNode(values[i].label));
option.setAttribute("value", values[i].value);
if (values[i].value == initial_value) if (values[i].value == initial_value)
{ {
this._selectedValue = initial_value; this._selectedValue = initial_value;
opt.selected = true; option.selected = true;
} }
if (this.isReadonly()) if (this.isReadonly())
{ {
this.widget.setAttribute("disabled", true); this.widget.setAttribute("disabled", true);
} }
this.widget.appendChild(opt);
} }
this.widget.onchange = this._combobox_changeHandler.bindAsEventListener(this); this.widget.onchange = this._combobox_changeHandler.bindAsEventListener(this);
attach_point.appendChild(this.domNode);
}, },
/** */ /** */
@@ -2844,16 +2843,9 @@ alfresco.xforms.VGroup = alfresco.xforms.AbstractGroup.extend({
var contentDivWidth = "100%"; var contentDivWidth = "100%";
// the following does avoid devision by zero ... in contentDiv.offsetLeft / child.domContainer.offsetWidth // the following does avoid devision by zero ... in contentDiv.offsetLeft / child.domContainer.offsetWidth
var ow = child.domContainer.offsetWidth; var ow = child.domContainer.offsetWidth;
if (!(child instanceof alfresco.xforms.AbstractGroup)) if (!(child instanceof alfresco.xforms.AbstractGroup) && ow != 0)
{ {
if (ow != 0) contentDivWidth = ((1 - (contentDiv.offsetLeft / ow)) * 100) + "%";
{
contentDivWidth = ((1 - (contentDiv.offsetLeft / ow)) * 100) + "%";
}
else
{
contentDivWidth = "70%";
}
} }
contentDiv.style.width = contentDivWidth; contentDiv.style.width = contentDivWidth;
@@ -2879,26 +2871,7 @@ alfresco.xforms.VGroup = alfresco.xforms.AbstractGroup.extend({
// (.5 * contentDiv.labelNode.offsetHeight))) + "px"; // (.5 * contentDiv.labelNode.offsetHeight))) + "px";
contentDiv.labelNode.style.position = "relative"; contentDiv.labelNode.style.position = "relative";
contentDiv.labelNode.style.top = "0px"; contentDiv.labelNode.style.top = "0px";
if (oh) contentDiv.labelNode.style.height = oh + "px";
{
contentDiv.labelNode.style.height = oh + "px";
}
else
{
var defaultHeight = 20;
if (child instanceof alfresco.xforms.RichTextEditor)
{
defaultHeight = 200;
}
contentDiv.labelNode.style.height = defaultHeight + "px";
contentDiv.style.top = "-" + defaultHeight + "px";
child.domContainer.style.height = defaultHeight + "px";
}
if (!contentDiv.labelNode.scrollWidth)
{
contentDiv.labelNode.style.width = "30%";
}
contentDiv.labelNode.style.lineHeight = contentDiv.labelNode.style.height; contentDiv.labelNode.style.lineHeight = contentDiv.labelNode.style.height;
} }
@@ -2946,6 +2919,7 @@ alfresco.xforms.VGroup = alfresco.xforms.AbstractGroup.extend({
"id": this.id + "-groupHeaderNode", "id": this.id + "-groupHeaderNode",
"class": "xformsGroupHeader" "class": "xformsGroupHeader"
}); });
this.domNode.appendChild(this._groupHeaderNode);
this.toggleExpandedImage = new Element("img", this.toggleExpandedImage = new Element("img",
{ {
@@ -2953,19 +2927,17 @@ alfresco.xforms.VGroup = alfresco.xforms.AbstractGroup.extend({
"styles": { "margin": "0px 5px" }, "styles": { "margin": "0px 5px" },
"src": alfresco.xforms.constants.EXPANDED_IMAGE.src "src": alfresco.xforms.constants.EXPANDED_IMAGE.src
}); });
this.toggleExpandedImage.onclick = this._toggleExpanded_clickHandler.bindAsEventListener(this);
this._groupHeaderNode.appendChild(this.toggleExpandedImage); this._groupHeaderNode.appendChild(this.toggleExpandedImage);
this.toggleExpandedImage.onclick = this._toggleExpanded_clickHandler.bindAsEventListener(this);
this._groupHeaderNode.appendChild(document.createTextNode(this.getLabel())); this._groupHeaderNode.appendChild(document.createTextNode(this.getLabel()));
this.domNode.appendChild(this._groupHeaderNode);
} }
attach_point.appendChild(this.domNode);
this.domNode.childContainerNode = new Element("div", this.domNode.childContainerNode = new Element("div",
{ {
"id": this.id + "-childContainerNode", "id": this.id + "-childContainerNode",
"styles": { "position": "relative", "width": "100%" } "styles": { "position": "relative", "width": "100%" }
}); });
attach_point.appendChild(this.domNode);
return this.domNode; return this.domNode;
}, },
@@ -3385,8 +3357,6 @@ alfresco.xforms.ViewRoot = alfresco.xforms.VGroup.extend({
render: function(attach_point) render: function(attach_point)
{ {
this.domNode.widget = this; this.domNode.widget = this;
//if the domNode is not displayed, the browser doesn't waste time for repainting the page
this.domNode.style.display = 'none';
this.domNode.style.position = "relative"; this.domNode.style.position = "relative";
this.domNode.style.width = "100%"; this.domNode.style.width = "100%";
this.domNode.addClass("xformsViewRoot"); this.domNode.addClass("xformsViewRoot");
@@ -3396,21 +3366,21 @@ alfresco.xforms.ViewRoot = alfresco.xforms.VGroup.extend({
"id": this.id + "-groupHeaderNode", "id": this.id + "-groupHeaderNode",
"class": "xformsViewRootHeader" "class": "xformsViewRootHeader"
}); });
this.domNode.appendChild(this._groupHeaderNode);
var icon = document.createElement("img"); var icon = document.createElement("img");
this._groupHeaderNode.appendChild(icon);
icon.setAttribute("src", alfresco.constants.WEBAPP_CONTEXT + "/images/icons/file_large.gif"); icon.setAttribute("src", alfresco.constants.WEBAPP_CONTEXT + "/images/icons/file_large.gif");
icon.align = "absmiddle"; icon.align = "absmiddle";
icon.style.margin = "0px 5px"; icon.style.margin = "0px 5px";
this._groupHeaderNode.appendChild(icon);
this._groupHeaderNode.appendChild(document.createTextNode(this.getLabel())); this._groupHeaderNode.appendChild(document.createTextNode(this.getLabel()));
attach_point.appendChild(this.domNode);
this.domNode.childContainerNode = new Element("div", this.domNode.childContainerNode = new Element("div",
{ {
"id": this.id + "-childContainerNode", "id": this.id + "-childContainerNode",
"styles": {"position": "relative", "width": "100%"} "styles": {"position": "relative", "width": "100%"}
}); });
this.domNode.appendChild(this._groupHeaderNode);
attach_point.appendChild(this.domNode);
return this.domNode; return this.domNode;
}, },
@@ -4252,13 +4222,7 @@ alfresco.xforms.XForm = new Class({
this.rootWidget = new alfresco.xforms.ViewRoot(this, rootGroup); this.rootWidget = new alfresco.xforms.ViewRoot(this, rootGroup);
this.rootWidget.render(alfUI); this.rootWidget.render(alfUI);
//par variable is introduced for offline domNode editing, which improves performance
var par = this.rootWidget.domNode.parentNode;
par.removeChild(this.rootWidget.domNode);
this.loadWidgets(rootGroup, this.rootWidget); this.loadWidgets(rootGroup, this.rootWidget);
par.appendChild(this.rootWidget.domNode);
//the domNode is made invisible in this.rootWidget.render(alfUI);
this.rootWidget.domNode.style.display = 'block';
}, },
/** Creates the widget for the provided xforms node. */ /** Creates the widget for the provided xforms node. */
@@ -4295,11 +4259,7 @@ alfresco.xforms.XForm = new Class({
{ {
return null; return null;
} }
// the 'var cstr = eval(x.className);' construction was changed, var cstr = eval(x.className);
// because eval loads a new compiler, which reduces performance
var y = x.className;
var xcn = y.substr(y.lastIndexOf('.')+1);//find the last dot and take a substring
var cstr = window.alfresco.xforms[xcn];
if (!cstr) if (!cstr)
{ {
throw new Error("unable to load constructor " + x.className + throw new Error("unable to load constructor " + x.className +