mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:04:53 +01:00
partially revert r52487: as it doublicates some options and changes value of empty label from "" to 0
This commit is contained in:
parent
72c7716b05
commit
0b07bccdca
@ -495,9 +495,7 @@ var et2_selectbox = et2_inputWidget.extend(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var debug_value = _value;
|
this.egw().debug("warn", "Tried to set value '%s' that isn't an option", _value, this);
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
@ -529,9 +527,7 @@ var et2_selectbox = et2_inputWidget.extend(
|
|||||||
{
|
{
|
||||||
if(jQuery("input[value='"+_value+"']", this.multiOptions).prop("checked", true).length == 0)
|
if(jQuery("input[value='"+_value+"']", this.multiOptions).prop("checked", true).length == 0)
|
||||||
{
|
{
|
||||||
var debug_value = _value;
|
this.egw().debug("warn", "Tried to set value that isn't an option", this, _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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -774,7 +770,6 @@ jQuery.extend(et2_selectbox,
|
|||||||
{
|
{
|
||||||
var name_parts = widget.id.replace(/[/g,'[').replace(/]|]/g,'').split('[');
|
var name_parts = widget.id.replace(/[/g,'[').replace(/]|]/g,'').split('[');
|
||||||
|
|
||||||
var type_options = [];
|
|
||||||
var content_options = {};
|
var content_options = {};
|
||||||
|
|
||||||
// First check type, there may be static options. There's some special handling
|
// First check type, there may be static options. There's some special handling
|
||||||
@ -790,12 +785,12 @@ jQuery.extend(et2_selectbox,
|
|||||||
attrs.other = attrs.other.split(',');
|
attrs.other = attrs.other.split(',');
|
||||||
}
|
}
|
||||||
// Copy, to avoid accidental modification
|
// Copy, to avoid accidental modification
|
||||||
jQuery.extend(true, type_options, this[type_function].call(this, widget, attrs));
|
content_options = this[type_function].call(this, widget, attrs);
|
||||||
widget._type = old_type;
|
widget._type = old_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find the options inside the "sel-options"
|
// Try to find the options inside the "sel-options"
|
||||||
if(widget.getArrayMgr("sel_options"))
|
if(jQuery.isEmptyObject(content_options) && widget.getArrayMgr("sel_options"))
|
||||||
{
|
{
|
||||||
// Try first according to ID
|
// Try first according to ID
|
||||||
content_options = widget.getArrayMgr("sel_options").getEntry(widget.id);
|
content_options = widget.getArrayMgr("sel_options").getEntry(widget.id);
|
||||||
@ -885,32 +880,6 @@ jQuery.extend(et2_selectbox,
|
|||||||
{
|
{
|
||||||
content_options = {};
|
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;
|
return content_options;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1099,10 +1068,10 @@ jQuery.extend(et2_selectbox,
|
|||||||
attrs.select_options = egw.window.et2_selectbox.type_cache[this.cache_id];
|
attrs.select_options = egw.window.et2_selectbox.type_cache[this.cache_id];
|
||||||
|
|
||||||
egw.window.setTimeout(jQuery.proxy(function() {
|
egw.window.setTimeout(jQuery.proxy(function() {
|
||||||
this.widget.set_select_options(et2_selectbox.find_select_options(this.widget,{}, this.widget.options));
|
this.widget.set_select_options(egw.window.et2_selectbox.type_cache[this.cache_id]||{});
|
||||||
},this),1);
|
},this),1);
|
||||||
},{widget:widget,cache_id:cache_id}));
|
},{widget:widget,cache_id:cache_id}));
|
||||||
return [];
|
return {};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user