Add getPath() to core widget so widgets can override it

This commit is contained in:
Nathan Gray 2011-10-06 16:33:55 +00:00
parent cc01eda69f
commit c9e4d6801d
2 changed files with 17 additions and 1 deletions

View File

@ -562,6 +562,13 @@ var et2_widget = Class.extend({
var modifications = this.getArrayMgr("modifications");
if(modifications && _node.getAttribute("id")) {
var entry = modifications.getEntry(_node.getAttribute("id"));
if(entry == null)
{
// Try again, but skip the fancy stuff
// TODO: Figure out why the getEntry() call doesn't always work
var entry = modifications.data[_node.getAttribute("id")];
if(entry) et2_debug("warn", "getEntry("+_node.getAttribute("id")+") failed, but the data is there.", modifications, entry);
}
if(entry && entry.type)
{
_nodeName = attributes["type"] = entry.type
@ -794,6 +801,14 @@ var et2_widget = Class.extend({
var app = egw.getAppName() == 'egroupware' ? 'phpgwapi' : egw.getAppName();
//console.warn("Unable to find template application, using %s", app);
return app;
},
/**
* Returns the path into the data array. By default, array manager takes care of
* this, but some extensions need to override this
*/
getPath: function() {
return this.getArrayManager("content").getPath();
}
});

View File

@ -35,6 +35,7 @@
et2_widget_progress;
et2_extension_nextmatch;
et2_extension_customfields;
// Requirements for the etemplate2 object
et2_core_common;
@ -241,7 +242,7 @@ etemplate2.prototype.getValues = function(_root)
}
// Get the path to the node we have to store the value at
var path = _widget.getArrayMgr("content").getPath();
var path = _widget.getPath();
// check if id contains a hierachical name, eg. "button[save]"
var id = _widget.id;