From 84821bef957a3f1ec2df6aead373228fd8314af1 Mon Sep 17 00:00:00 2001 From: Nathan Gray <nathangray.bsc@gmail.com> Date: Mon, 29 Sep 2014 20:37:23 +0000 Subject: [PATCH] - Apply 'none' user selection preference (with admin consideration) - Avoid potential infinite loop with no select options --- etemplate/js/et2_widget_selectAccount.js | 10 ++++++++-- etemplate/js/et2_widget_selectbox.js | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/etemplate/js/et2_widget_selectAccount.js b/etemplate/js/et2_widget_selectAccount.js index a6d88c39c2..e37a7859f1 100644 --- a/etemplate/js/et2_widget_selectAccount.js +++ b/etemplate/js/et2_widget_selectAccount.js @@ -111,6 +111,11 @@ var et2_selectAccount = et2_selectbox.extend( switch(type) { case 'none': + if(typeof egw.user('apps').admin == 'undefined') + { + this.options.select_options = {}; + break; + } case 'selectbox': case 'groupmembers': default: @@ -164,9 +169,10 @@ var et2_selectAccount = et2_selectbox.extend( */ createMultiSelect: function() { - this._super.apply(this, arguments); - var type = this.egw().preference('account_selection', 'common'); + if(type == 'none' && typeof egw.user('apps').admin == 'undefined') return; + + this._super.apply(this, arguments); this.options.select_options = this._get_accounts(); diff --git a/etemplate/js/et2_widget_selectbox.js b/etemplate/js/et2_widget_selectbox.js index 01f48c0b8b..1869cbb7a8 100644 --- a/etemplate/js/et2_widget_selectbox.js +++ b/etemplate/js/et2_widget_selectbox.js @@ -440,7 +440,9 @@ var et2_selectbox = et2_inputWidget.extend( { _value = _value.split(','); } - if(this.input !== null && this.options.select_options && this.input.children().length == 0) + if(this.input !== null && this.options.select_options && ( + !jQuery.isEmptyObject(this.options.select_options) || this.options.select_options.length > 0 + ) && this.input.children().length == 0) { // No options set yet this.set_select_options(this.options.select_options);