Stop errors from missing _data and missing array managers

This commit is contained in:
Nathan Gray 2011-08-16 21:18:26 +00:00
parent e981e7911f
commit e792130479
4 changed files with 28 additions and 11 deletions

View File

@ -45,6 +45,14 @@ var et2_IInput = new Interface({
*/ */
var et2_inputWidget = et2_valueWidget.extend(et2_IInput, { var et2_inputWidget = et2_valueWidget.extend(et2_IInput, {
attributes: {
"required": {
"name": "Required",
"default": false,
"type": "boolean",
"description": "If required, the user must enter a value before the form can be submitted"
}
},
init: function() { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
@ -89,6 +97,7 @@ var et2_inputWidget = et2_valueWidget.extend(et2_IInput, {
node.removeAttribute("required"); node.removeAttribute("required");
} }
} }
}, },
get_value: function() { get_value: function() {

View File

@ -40,6 +40,7 @@ var et2_valueWidget = et2_baseWidget.extend({
{ {
// Set the value for this element // Set the value for this element
var contentMgr = this.getArrayMgr("content"); var contentMgr = this.getArrayMgr("content");
if(contentMgr != null) {
var val = contentMgr.getValueForID(this.id); var val = contentMgr.getValueForID(this.id);
if (val !== null) if (val !== null)
{ {
@ -47,6 +48,7 @@ var et2_valueWidget = et2_baseWidget.extend({
} }
} }
} }
}
}); });

View File

@ -395,8 +395,12 @@ var et2_widget = Class.extend({
// Check whether the widget is marked as readonly and whether a special // Check whether the widget is marked as readonly and whether a special
// readonly type (suffixed with "_ro") is registered // readonly type (suffixed with "_ro") is registered
var readonly = this.getArrayMgr("readonlys").isReadOnly( var mgr = this.getArrayMgr("readonlys");
var readonly = false;
if(mgr != null) {
readonly = mgr.isReadOnly(
_node.getAttribute("id"), _node.getAttribute("readonly"), this.readonly); _node.getAttribute("id"), _node.getAttribute("readonly"), this.readonly);
}
if (readonly && typeof et2_registry[_nodeName + "_ro"] != "undefined") if (readonly && typeof et2_registry[_nodeName + "_ro"] != "undefined")
{ {
constructor = et2_registry[_nodeName + "_ro"]; constructor = et2_registry[_nodeName + "_ro"];
@ -471,7 +475,8 @@ var et2_widget = Class.extend({
var attrName = _attrs[i].name; var attrName = _attrs[i].name;
var attrValue = _attrs[i].value; var attrValue = _attrs[i].value;
if (typeof this.attributes[attrName] != "undefined") var mgr = this.getArrayMgr("content");
if (mgr != null && typeof this.attributes[attrName] != "undefined")
{ {
var attr = this.attributes[attrName]; var attr = this.attributes[attrName];
@ -479,12 +484,11 @@ var et2_widget = Class.extend({
// expression as bool expression. // expression as bool expression.
if (attr.type == "boolean") if (attr.type == "boolean")
{ {
attrValue = this.getArrayMgr("content") attrValue = mgr.parseBoolExpression(attrValue);
.parseBoolExpression(attrValue);
} }
else else
{ {
attrValue = this.getArrayMgr("content").expandName(attrValue); attrValue = mgr.expandName(attrValue);
} }
} }

View File

@ -131,7 +131,9 @@ etemplate2.prototype.load = function(_url, _data)
this.widgetContainer.setParentDOMNode(this.DOMContainer); this.widgetContainer.setParentDOMNode(this.DOMContainer);
// store the id to submit it back to server // store the id to submit it back to server
if(_data) {
this.etemplate_exec_id = _data.etemplate_exec_id; this.etemplate_exec_id = _data.etemplate_exec_id;
}
// set app_header // set app_header
if (window.opener) { // popup if (window.opener) { // popup