Parsing the 'modifications' array

This commit is contained in:
Andreas Stöckel 2011-08-23 15:27:34 +00:00
parent b382dc570f
commit f00d5aba60
5 changed files with 27 additions and 6 deletions

View File

@ -34,7 +34,7 @@ var et2_valueWidget = et2_baseWidget.extend({
},
transformAttributes: function(_attrs) {
this._super.call(this, arguments);
this._super.apply(this, arguments);
if (this.id != "")
{

View File

@ -483,12 +483,22 @@ var et2_widget = Class.extend({
}
},
transformAttributes: function() {
/**
* Apply the "modifications" to the element
*/
transformAttributes: function(_attrs) {
var data = this.getArrayMgr("modifications").getValueForID(this.id);
if (data instanceof Object)
{
for (var key in data)
{
_attrs[key] = data[key];
}
}
},
createElementFromNode: function(_node) {
// Fetch all attributes for this element from the XML node
var attributes = {};
// Parse the "readonly" and "type" flag for this element here, as they

View File

@ -85,12 +85,14 @@ etemplate2.prototype._createArrayManagers = function(_data)
}
// Create all neccessary _data entries
var neededEntries = ["content", "sel_options", "readonlys", "modifications", "validation_errors"];
var neededEntries = ["content", "sel_options", "readonlys", "modifications",
"validation_errors"];
for (var i = 0; i < neededEntries.length; i++)
{
if (typeof _data[neededEntries[i]] == "undefined")
{
et2_debug("log", "Created not passed entry '" + neededEntries[i] + "' in data array.");
et2_debug("log", "Created not passed entry '" + neededEntries[i] +
"' in data array.");
_data[neededEntries[i]] = {};
}
}

View File

@ -77,6 +77,12 @@ var timesheet_data = {
},
"validation_errors": {
"ts_title": "Please enter some meaningful title here!"
},
"modifications": {
"ts_quantity": {
"width": "200px",
"class": "blue"
}
}
}

View File

@ -205,6 +205,9 @@
.fullWidth select { widht: 100%; }
.fullWidth input { widht: 100%; }
.fullWidth textarea { widht: 100%; }
.blue {
background-color: #f0f0ff;
}
</styles>
</template>
</overlay>