Get customfield-type working again

This commit is contained in:
Nathan Gray 2012-05-07 17:40:59 +00:00
parent 019bfb1c93
commit 1049474cd9
3 changed files with 15 additions and 4 deletions

View File

@ -40,14 +40,14 @@ var et2_arrayMgr = Class.extend({
}
// Expand sub-arrays that have been shmushed together, so further perspectives work
// Shmushed keys look like: ${row}[info_cat]
// Shmushed keys look like: ${row}[info_cat]
// Expanded: ${row}: Object{info_cat: ..value}
if (this.splitIds)
{
// For each index, we need a key: {..} sub array
for(var key in _data) {
// Split up indexes
var indexes = key.split('[');
var indexes = key.replace('[','[').split('[');
// Put data in the proper place
if(indexes.length > 1)
@ -55,7 +55,7 @@ var et2_arrayMgr = Class.extend({
var value = _data[key];
var target = _data;
for(var i = 0; i < indexes.length; i++) {
indexes[i] = indexes[i].replace('&#x5D;','');
indexes[i] = indexes[i].replace('&#x5D;','').replace(']','');
if(typeof target[indexes[i]] == "undefined") {
target[indexes[i]] = i == indexes.length-1 ? value : {};
}

View File

@ -124,8 +124,16 @@ var et2_selectbox = et2_inputWidget.extend({
content_options = this.getArrayMgr("sel_options").getRoot().getEntry(name_parts[name_parts.length-1]);
}
// Try in correct namespace (inside a grid or something)
if(!content_options || content_options.length == 0)
{
content_options = this.getArrayMgr("sel_options").getEntry(name_parts[name_parts.length-1]);
}
// Maybe in a row, and options got stuck in ${row} instead of top level
if((!content_options || content_options.length == 0) && this.getArrayMgr("sel_options").perspectiveData.row)
if((!content_options || content_options.length == 0) && (
// perspectiveData.row in nm, data["${row}"] in an auto-repeat grid
this.getArrayMgr("sel_options").perspectiveData.row || this.getArrayMgr("sel_options").data["${row}"]))
{
var row_id = this.id.replace(/[0-9]+/,'${row}');
content_options = this.getArrayMgr("sel_options").getEntry(row_id);

View File

@ -162,6 +162,9 @@ etemplate2.prototype._createArrayManagers = function(_data)
*/
etemplate2.prototype.load = function(_name, _url, _data)
{
egw().debug("info", "Loaded data", _data);
// Appname should be first part of the template name
var split = _name.split('.');
var appname = split[0];