From 86a32e2f8bcd36f3edce79cdbb698e34acdd3816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Sat, 31 Jul 2010 08:07:21 +0000 Subject: [PATCH] Tracker #2184. Add "select all" in the account selection popup. --- phpgwapi/inc/class.uiaccountsel.inc.php | 23 ++++++++++++++++++ phpgwapi/templates/default/uiaccountsel.tpl | 27 +++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.uiaccountsel.inc.php b/phpgwapi/inc/class.uiaccountsel.inc.php index 228735b604..99c9788e90 100644 --- a/phpgwapi/inc/class.uiaccountsel.inc.php +++ b/phpgwapi/inc/class.uiaccountsel.inc.php @@ -346,6 +346,8 @@ function addOption(id,label,value,do_onchange) $GLOBALS['egw']->template->set_file(array('accounts_list_t' => 'uiaccountsel.tpl')); $GLOBALS['egw']->template->set_block('accounts_list_t','letter_search','letter_search_cells'); $GLOBALS['egw']->template->set_block('accounts_list_t','group_cal','cal'); + $GLOBALS['egw']->template->set_block('accounts_list_t','group_selectAll','selectAllGroups'); + $GLOBALS['egw']->template->set_block('accounts_list_t','groups_multiple','multipleGroups'); $GLOBALS['egw']->template->set_block('accounts_list_t','group_other','other'); $GLOBALS['egw']->template->set_block('accounts_list_t','group_all','all'); @@ -353,12 +355,15 @@ function addOption(id,label,value,do_onchange) $GLOBALS['egw']->template->set_block('accounts_list_t','other_intro','iother'); $GLOBALS['egw']->template->set_block('accounts_list_t','all_intro','iall'); + $GLOBALS['egw']->template->set_block('accounts_list_t','accounts_selectAll','selectAllAccounts'); + $GLOBALS['egw']->template->set_block('accounts_list_t','accounts_multiple','multipleAccounts'); $GLOBALS['egw']->template->set_block('accounts_list_t','accounts_list','list'); $GLOBALS['egw']->template->set_var('font',$GLOBALS['egw_info']['theme']['font']); $GLOBALS['egw']->template->set_var('lang_search',lang('search')); $GLOBALS['egw']->template->set_var('lang_groups',lang('user groups')); $GLOBALS['egw']->template->set_var('lang_accounts',lang('user accounts')); + $GLOBALS['egw']->template->set_var('lang_all',lang('all')); $GLOBALS['egw']->template->set_var('img',common::image('phpgwapi','select')); $GLOBALS['egw']->template->set_var('lang_select_user',lang('Select user')); @@ -418,6 +423,11 @@ function addOption(id,label,value,do_onchange) $GLOBALS['egw']->template->set_var('lang_firstname',lang('firstname')); $GLOBALS['egw']->template->set_var('lang_lastname',lang('lastname')); + if ($multiple) + { + $GLOBALS['egw']->template->fp('multipleGroups','groups_multiple',True); + } + if ($app) { $app_groups = $this->accounts->split_accounts($app,'groups'); @@ -442,6 +452,10 @@ function addOption(id,label,value,do_onchange) if($use == 'both') // allow selection of groups { $GLOBALS['egw']->template->fp('cal','group_cal',True); + $GLOBALS['egw']->template->set_var('js_addAllGroups',"addOption('$element_id','". + $GLOBALS['egw']->common->grab_owner_name($group['account_id'])."','$group[account_id]',".(int)($multiple==1).")". + (!$multiple ? '; window.close();' : ';')); + $GLOBALS['egw']->template->fp('selectAllGroups','group_selectAll',True); } else { @@ -485,6 +499,11 @@ function addOption(id,label,value,do_onchange) $GLOBALS['egw']->template->set_var('lang_firstname', lang("firstname")); $GLOBALS['egw']->template->set_var('lang_lastname', lang("lastname")); + if ($multiple) + { + $GLOBALS['egw']->template->fp('multipleAccounts','accounts_multiple',True); + } + foreach($users as $user) { $GLOBALS['egw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color,True)); @@ -500,6 +519,10 @@ function addOption(id,label,value,do_onchange) (!$multiple ? '; window.close()' : ''), )); $GLOBALS['egw']->template->fp('list','accounts_list',True); + $GLOBALS['egw']->template->set_var('js_addAllAccounts',"addOption('$element_id','". + $GLOBALS['egw']->common->grab_owner_name($user['account_id'])."','$user[account_id]',".(int)($multiple==1).")". + (!$multiple ? '; window.close()' : ';')); + $GLOBALS['egw']->template->fp('selectAllAccounts','accounts_selectAll',True); } $GLOBALS['egw']->template->set_var('accountsel_icon',html::image('phpgwapi','users-big')); diff --git a/phpgwapi/templates/default/uiaccountsel.tpl b/phpgwapi/templates/default/uiaccountsel.tpl index 03bc3ef537..c75147b404 100644 --- a/phpgwapi/templates/default/uiaccountsel.tpl +++ b/phpgwapi/templates/default/uiaccountsel.tpl @@ -23,6 +23,20 @@ } } + function addAllGroups() + { + + {js_addAllGroups} + + } + + function addAllAccounts() + { + + {js_addAllAccounts} + + } + function removeSelectedOptions(id) { openerSelectBox = opener.document.getElementById(id); @@ -134,7 +148,12 @@ - {lang_perm} + {lang_perm} + + + + + @@ -192,7 +211,11 @@ {sort_lid} {sort_firstname} {sort_lastname} -   + + + + +