Tracker #2184. Add "select all" in the account selection popup.

This commit is contained in:
Hans-Jürgen Tappe 2010-07-31 08:07:21 +00:00
parent 83e867ef01
commit 86a32e2f8b
2 changed files with 48 additions and 2 deletions

View File

@ -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_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','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_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_other','other');
$GLOBALS['egw']->template->set_block('accounts_list_t','group_all','all'); $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','other_intro','iother');
$GLOBALS['egw']->template->set_block('accounts_list_t','all_intro','iall'); $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_block('accounts_list_t','accounts_list','list');
$GLOBALS['egw']->template->set_var('font',$GLOBALS['egw_info']['theme']['font']); $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_search',lang('search'));
$GLOBALS['egw']->template->set_var('lang_groups',lang('user groups')); $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_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('img',common::image('phpgwapi','select'));
$GLOBALS['egw']->template->set_var('lang_select_user',lang('Select user')); $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_firstname',lang('firstname'));
$GLOBALS['egw']->template->set_var('lang_lastname',lang('lastname')); $GLOBALS['egw']->template->set_var('lang_lastname',lang('lastname'));
if ($multiple)
{
$GLOBALS['egw']->template->fp('multipleGroups','groups_multiple',True);
}
if ($app) if ($app)
{ {
$app_groups = $this->accounts->split_accounts($app,'groups'); $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 if($use == 'both') // allow selection of groups
{ {
$GLOBALS['egw']->template->fp('cal','group_cal',True); $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 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_firstname', lang("firstname"));
$GLOBALS['egw']->template->set_var('lang_lastname', lang("lastname")); $GLOBALS['egw']->template->set_var('lang_lastname', lang("lastname"));
if ($multiple)
{
$GLOBALS['egw']->template->fp('multipleAccounts','accounts_multiple',True);
}
foreach($users as $user) foreach($users as $user)
{ {
$GLOBALS['egw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color,True)); $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()' : ''), (!$multiple ? '; window.close()' : ''),
)); ));
$GLOBALS['egw']->template->fp('list','accounts_list',True); $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')); $GLOBALS['egw']->template->set_var('accountsel_icon',html::image('phpgwapi','users-big'));

View File

@ -23,6 +23,20 @@
} }
} }
function addAllGroups()
{
<!-- BEGIN group_selectAll -->
{js_addAllGroups}
<!-- END group_selectAll -->
}
function addAllAccounts()
{
<!-- BEGIN accounts_selectAll -->
{js_addAllAccounts}
<!-- END accounts_selectAll -->
}
function removeSelectedOptions(id) function removeSelectedOptions(id)
{ {
openerSelectBox = opener.document.getElementById(id); openerSelectBox = opener.document.getElementById(id);
@ -134,7 +148,12 @@
</tr> </tr>
<!-- BEGIN bla_intro --> <!-- BEGIN bla_intro -->
<tr> <tr>
<td class="th" colspan="2">{lang_perm}</td> <td class="th">{lang_perm}</td>
<td class="th" align="center">
<!-- BEGIN groups_multiple -->
<input type="image" src="{img}" style="width: 16px;" onclick="addAllGroups(); return false;" title="{lang_all}">
<!-- END groups_multiple -->
</td>
</tr> </tr>
<!-- END bla_intro --> <!-- END bla_intro -->
@ -192,7 +211,11 @@
<td align="center">{sort_lid}</td> <td align="center">{sort_lid}</td>
<td align="center">{sort_firstname}</td> <td align="center">{sort_firstname}</td>
<td align="center">{sort_lastname}</td> <td align="center">{sort_lastname}</td>
<td width="10%">&nbsp;</td> <td align="center" width="10%">
<!-- BEGIN accounts_multiple -->
<input type="image" src="{img}" style="width: 16px;" onclick="addAllAccounts(); return false;" title="{lang_all}">
<!-- END accounts_multiple -->
</td>
</tr> </tr>
<!-- BEGIN accounts_list --> <!-- BEGIN accounts_list -->