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, {
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() {
this._super.apply(this, arguments);
@ -89,6 +97,7 @@ var et2_inputWidget = et2_valueWidget.extend(et2_IInput, {
node.removeAttribute("required");
}
}
},
get_value: function() {

View File

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

View File

@ -395,8 +395,12 @@ var et2_widget = Class.extend({
// Check whether the widget is marked as readonly and whether a special
// readonly type (suffixed with "_ro") is registered
var readonly = this.getArrayMgr("readonlys").isReadOnly(
_node.getAttribute("id"), _node.getAttribute("readonly"), this.readonly);
var mgr = this.getArrayMgr("readonlys");
var readonly = false;
if(mgr != null) {
readonly = mgr.isReadOnly(
_node.getAttribute("id"), _node.getAttribute("readonly"), this.readonly);
}
if (readonly && typeof et2_registry[_nodeName + "_ro"] != "undefined")
{
constructor = et2_registry[_nodeName + "_ro"];
@ -471,7 +475,8 @@ var et2_widget = Class.extend({
var attrName = _attrs[i].name;
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];
@ -479,12 +484,11 @@ var et2_widget = Class.extend({
// expression as bool expression.
if (attr.type == "boolean")
{
attrValue = this.getArrayMgr("content")
.parseBoolExpression(attrValue);
attrValue = mgr.parseBoolExpression(attrValue);
}
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);
// store the id to submit it back to server
this.etemplate_exec_id = _data.etemplate_exec_id;
if(_data) {
this.etemplate_exec_id = _data.etemplate_exec_id;
}
// set app_header
if (window.opener) { // popup