Fix some bugs in selectAccount with rows not set, but multiple on

- Fix opening single select search dialog instead of multiple (cleared previous selection on OK)
- Fix double user / groups in selected list
This commit is contained in:
Nathan Gray 2014-03-24 20:20:25 +00:00
parent 06ea29a78c
commit 2e6dea62d6

View File

@ -113,7 +113,7 @@ var et2_selectAccount = et2_selectbox.extend(
{
var button = jQuery(document.createElement("span"))
.addClass("et2_clickable")
.click(this, this._open_search)
.click(this, this.options.multiple ? this._open_multi_search : this._open_search)
.attr("title", egw.lang("popup with search"))
.append('<span class="ui-icon ui-icon-search" style="display:inline-block"/>');
@ -308,10 +308,14 @@ var et2_selectAccount = et2_selectbox.extend(
ids.push(id);
// Make sure option is there
if(jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0)
if(!widget.options.multiple && jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0)
{
widget._appendMultiOption(id,jQuery('label',this).text());
}
else if (widget.options.multiple && jQuery('option[value="'+id+'"]',widget.node).length == 0)
{
widget._appendOptionElement(id,jQuery('label',this).text());
}
});
widget.set_value(ids);
@ -436,6 +440,9 @@ var et2_selectAccount = et2_selectbox.extend(
var node = null;
var self = this;
// Make sure value is numeric
if(item.value) item.value = parseInt(item.value);
// (containter of) Currently selected users / groups
var selected = jQuery('#'+this.getInstanceManager().uniqueId + "_selected", this.dialog);