From e5b4bcfe7ffbdb1b150d6d32ac6ffd16c2bc8c35 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 14 Mar 2012 19:02:28 +0000 Subject: [PATCH] Add selectAccount_ro to handle ajax user names --- etemplate/js/et2_widget_selectAccount.js | 49 ++++++++++++++++++++++++ etemplate/js/et2_widget_selectbox.js | 2 +- etemplate/js/etemplate2.js | 1 + 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 etemplate/js/et2_widget_selectAccount.js diff --git a/etemplate/js/et2_widget_selectAccount.js b/etemplate/js/et2_widget_selectAccount.js new file mode 100644 index 0000000000..b1066892b7 --- /dev/null +++ b/etemplate/js/et2_widget_selectAccount.js @@ -0,0 +1,49 @@ +/** + * eGroupWare eTemplate2 - JS Select account widget + * + * Selecting accounts needs special UI, and displaying needs special consideration + * to avoid sending the entire user list to the client. + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package etemplate + * @subpackage api + * @link http://www.egroupware.org + * @author Nathan Gray + * @copyright Nathan Gray 2011 + * @version $Id$ + */ + +"use strict"; + +/*egw:uses + et2_widget_link; +*/ + +/** + * et2_selectAccount_ro is the readonly implementation of select account + * It extends et2_link to avoid needing the whole user list on the client. + * Instead, it just asks for the names of the ones needed, as needed. + */ +var et2_selectAccount_ro = et2_link.extend([et2_IDetachedDOM], { + + init: function(_parent, options) { + /** + Resolve some circular dependency problems here + selectAccount extends link, link is in a file that needs select, + select has menulist wrapper, which needs to know about selectAccount before it allows it + */ + if(_parent.supportedWidgetClasses.indexOf(et2_selectAccount_ro) < 0) + { + _parent.supportedWidgetClasses.push(et2_selectAccount_ro); + } + + this._super.apply(this, arguments); + + this.options.application = 'home-accounts'; + + // Don't make it look like a link though + this.link.removeClass("et2_link"); + } +}); +et2_register_widget(et2_selectAccount_ro, ["select-account_ro"]); + diff --git a/etemplate/js/et2_widget_selectbox.js b/etemplate/js/et2_widget_selectbox.js index d4d7199d42..64a5622ec6 100644 --- a/etemplate/js/et2_widget_selectbox.js +++ b/etemplate/js/et2_widget_selectbox.js @@ -335,7 +335,7 @@ var et2_selectbox_ro = et2_selectbox.extend([et2_IDetachedDOM], { }); et2_register_widget(et2_selectbox_ro, ["menupopup_ro", "listbox_ro", "select_ro", "select-cat_ro", - "select-account_ro", "select-percent_ro", 'select-priority_ro', 'select-access_ro', + "select-percent_ro", 'select-priority_ro', 'select-access_ro', 'select-country_ro', 'select-state_ro', 'select-year_ro', 'select-month_ro', 'select-day_ro', 'select-dow_ro', 'select-hour_ro', 'select-number_ro', 'select-app_ro', 'select-lang_ro', 'select-bool_ro', 'select-timezone_ro' ]); diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 645cb60cbf..b6bdc5da57 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -34,6 +34,7 @@ et2_widget_file; et2_widget_link; et2_widget_progress; + et2_widget_selectAccount; et2_extension_nextmatch; et2_extension_customfields;