From b111f5005b501f061e0dca5f3d93e7a8b11ba2c5 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 7 May 2014 15:51:45 +0000 Subject: [PATCH] fixed select-accounts show only part of users, caused by previously trying to extend now used array --- etemplate/js/et2_widget_selectAccount.js | 24 ++++++++++++++++++++++-- phpgwapi/js/jsapi/egw_user.js | 8 ++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/etemplate/js/et2_widget_selectAccount.js b/etemplate/js/et2_widget_selectAccount.js index 5366c28c08..a4755b9776 100644 --- a/etemplate/js/et2_widget_selectAccount.js +++ b/etemplate/js/et2_widget_selectAccount.js @@ -113,12 +113,32 @@ var et2_selectAccount = et2_selectbox.extend( case 'selectbox': case 'groupmembers': 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; } this._super.apply(this, arguments); - + // Add search button if(type == 'primary_group') { diff --git a/phpgwapi/js/jsapi/egw_user.js b/phpgwapi/js/jsapi/egw_user.js index 9c8ceb66f9..c1b77b9ad9 100644 --- a/phpgwapi/js/jsapi/egw_user.js +++ b/phpgwapi/js/jsapi/egw_user.js @@ -81,13 +81,13 @@ egw.extend('user', egw.MODULE_GLOBAL, function() * The list is filtered by type, one of 'accounts','groups','both', 'owngroups' * * @param {string} type - * @returns {Object} + * @returns {array} */ accounts: function(type) { if(typeof type == 'undefined') type = 'accounts'; - var list = {}; + var list = []; if(jQuery.isEmptyObject(accountStore)) { // Synchronous @@ -97,11 +97,11 @@ egw.extend('user', egw.MODULE_GLOBAL, function() } if(type == 'both') { - list = jQuery.extend(list, accountStore['accounts'],accountStore['groups']); + list = list.concat(accountStore['accounts'], accountStore['groups']); } else { - list = jQuery.extend(list, accountStore[type]); + list = list.concat(accountStore[type]); } return list; }