mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
reverting previous commit, as it breaks in other places
This commit is contained in:
parent
0b07bccdca
commit
c6bfc44d08
@ -495,7 +495,9 @@ var et2_selectbox = et2_inputWidget.extend(
|
||||
}
|
||||
else
|
||||
{
|
||||
this.egw().debug("warn", "Tried to set value '%s' that isn't an option", _value, this);
|
||||
var debug_value = _value;
|
||||
if(debug_value === null) debug_value == 'NULL';
|
||||
this.egw().debug("warn", "Tried to set value '%s' that isn't an option", debug_value, this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -527,7 +529,9 @@ var et2_selectbox = et2_inputWidget.extend(
|
||||
{
|
||||
if(jQuery("input[value='"+_value+"']", this.multiOptions).prop("checked", true).length == 0)
|
||||
{
|
||||
this.egw().debug("warn", "Tried to set value that isn't an option", this, _value);
|
||||
var debug_value = _value;
|
||||
if(debug_value === null) debug_value == 'NULL';
|
||||
this.egw().debug("warn", "Tried to set value '%s' that isn't an option", debug_value, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -770,6 +774,7 @@ jQuery.extend(et2_selectbox,
|
||||
{
|
||||
var name_parts = widget.id.replace(/[/g,'[').replace(/]|]/g,'').split('[');
|
||||
|
||||
var type_options = [];
|
||||
var content_options = {};
|
||||
|
||||
// First check type, there may be static options. There's some special handling
|
||||
@ -785,12 +790,12 @@ jQuery.extend(et2_selectbox,
|
||||
attrs.other = attrs.other.split(',');
|
||||
}
|
||||
// Copy, to avoid accidental modification
|
||||
content_options = this[type_function].call(this, widget, attrs);
|
||||
jQuery.extend(true, type_options, this[type_function].call(this, widget, attrs));
|
||||
widget._type = old_type;
|
||||
}
|
||||
|
||||
// Try to find the options inside the "sel-options"
|
||||
if(jQuery.isEmptyObject(content_options) && widget.getArrayMgr("sel_options"))
|
||||
if(widget.getArrayMgr("sel_options"))
|
||||
{
|
||||
// Try first according to ID
|
||||
content_options = widget.getArrayMgr("sel_options").getEntry(widget.id);
|
||||
@ -880,6 +885,32 @@ jQuery.extend(et2_selectbox,
|
||||
{
|
||||
content_options = {};
|
||||
}
|
||||
|
||||
// Include type options, preferring any content options
|
||||
if(type_options.length || !jQuery.isEmptyObject(type_options))
|
||||
{
|
||||
for(var i in content_options)
|
||||
{
|
||||
var value = typeof content_options[i] == 'object' && typeof content_options[i].value !== 'undefined' ? content_options[i].value : i;
|
||||
var added = false;
|
||||
|
||||
// Override any existing
|
||||
for(var j in type_options)
|
||||
{
|
||||
if(type_options[j].value === value)
|
||||
{
|
||||
added = true;
|
||||
type_options[j] = content_options[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!added)
|
||||
{
|
||||
type_options.splice(i,0,content_options[i]);
|
||||
}
|
||||
}
|
||||
content_options = type_options;
|
||||
}
|
||||
return content_options;
|
||||
},
|
||||
|
||||
@ -1068,10 +1099,10 @@ jQuery.extend(et2_selectbox,
|
||||
attrs.select_options = egw.window.et2_selectbox.type_cache[this.cache_id];
|
||||
|
||||
egw.window.setTimeout(jQuery.proxy(function() {
|
||||
this.widget.set_select_options(egw.window.et2_selectbox.type_cache[this.cache_id]||{});
|
||||
this.widget.set_select_options(et2_selectbox.find_select_options(this.widget,{}, this.widget.options));
|
||||
},this),1);
|
||||
},{widget:widget,cache_id:cache_id}));
|
||||
return {};
|
||||
return [];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user