fixed select-accounts show only part of users, caused by previously trying to extend now used array

This commit is contained in:
Ralf Becker 2014-05-07 15:51:45 +00:00
parent 354c030520
commit b111f5005b
2 changed files with 26 additions and 6 deletions

View File

@ -113,12 +113,32 @@ var et2_selectAccount = et2_selectbox.extend(
case 'selectbox': case 'selectbox':
case 'groupmembers': case 'groupmembers':
default: default:
this.options.select_options = jQuery.extend({}, this.options.select_options, this.egw().accounts(this.options.account_type)); if (!jQuery.isArray(this.options.select_options))
{
var options = jQuery.extend({}, this.options.select_options);
this.options.select_options = [];
for(var key in options)
{
if (typeof options[key] == 'object')
{
if (typeof(options[key].key) == 'undefined')
{
options[key].value = key;
}
this.options.select_options.push(options[key]);
}
else
{
this.options.select_options.push({value: key, label: options});
}
}
}
this.options.select_options = this.options.select_options.concat(this.egw().accounts(this.options.account_type));
break; break;
} }
this._super.apply(this, arguments); this._super.apply(this, arguments);
// Add search button // Add search button
if(type == 'primary_group') if(type == 'primary_group')
{ {

View File

@ -81,13 +81,13 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
* The list is filtered by type, one of 'accounts','groups','both', 'owngroups' * The list is filtered by type, one of 'accounts','groups','both', 'owngroups'
* *
* @param {string} type * @param {string} type
* @returns {Object} * @returns {array}
*/ */
accounts: function(type) accounts: function(type)
{ {
if(typeof type == 'undefined') type = 'accounts'; if(typeof type == 'undefined') type = 'accounts';
var list = {}; var list = [];
if(jQuery.isEmptyObject(accountStore)) if(jQuery.isEmptyObject(accountStore))
{ {
// Synchronous // Synchronous
@ -97,11 +97,11 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
} }
if(type == 'both') if(type == 'both')
{ {
list = jQuery.extend(list, accountStore['accounts'],accountStore['groups']); list = list.concat(accountStore['accounts'], accountStore['groups']);
} }
else else
{ {
list = jQuery.extend(list, accountStore[type]); list = list.concat(accountStore[type]);
} }
return list; return list;
} }