diff --git a/calendar/acl_preferences.php b/calendar/acl_preferences.php index d3da0df812..c5938390a7 100755 --- a/calendar/acl_preferences.php +++ b/calendar/acl_preferences.php @@ -86,6 +86,40 @@ $phpgw->common->phpgw_exit(); } + $groups = $phpgw->accounts->read_group_names($phpgw->info["user"]["account_id"]); + + $total = 0; + + if(!isset($start)) { + $start = 0; + } + + if(!$start) { + $s_groups = 0; + $s_users = 0; + } + + if(!isset($s_groups)) { + $s_groups = 0; + } + + if(!isset($s_users)) { + $s_users = 0; + } + + + if(!isset($maxm)) { + $maxm = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]; + } + + if(!isset($totalentries)) { + $totalentries = count($groups); + $db = $phpgw->db; + $db->query("SELECT count(*) FROM accounts"); + $db->next_record(); + $totalentries += $db->f(0); + } + $p = CreateObject('phpgwapi.Template',$phpgw_info["server"]["app_tpl"]); $p->set_file(array('preferences' => 'preference_acl.tpl', 'row_colspan' => 'preference_colspan.tpl', @@ -97,32 +131,74 @@ $p->set_var('action_url',$phpgw->link('')); $p->set_var('bg_color',$phpgw_info["theme"]["th_bg"]); $p->set_var('submit_lang',lang('submit')); - $p->set_var('string',lang('Groups')); - $p->set_var('read_lang',lang('Read')); - $p->set_var('add_lang',lang('Add')); - $p->set_var('edit_lang',lang('Edit')); - $p->set_var('delete_lang',lang('Delete')); - $p->parse('row','row_colspan',True); - $groups = $phpgw->accounts->read_group_names($phpgw->info["user"]["account_id"]); - while(list(,$group) = each($groups)) { - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - display_row($tr_color,'g_',$group[0],$group[1]); - } + $p->set_var(array('read_lang' => lang('Read'), + 'add_lang' => lang('Add'), + 'edit_lang' => lang('Edit'), + 'delete_lang' => lang('Delete'))); - $db = $phpgw->db; - - $db->query("select account_id from accounts ORDER BY account_lastname, account_firstname, account_lid",__LINE__,__FILE__); - if($db->num_rows()) { - $p->set_var('string',ucfirst(lang('Users'))); + if(intval($s_groups) <> count($groups)) { + $p->set_var('string',lang('Groups')); $p->parse('row','row_colspan',True); - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - while($db->next_record()) { + + while(list(,$group) = each($groups)) { $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - $id = $db->f("account_id"); - display_row($tr_color,'u_',$id,$phpgw->common->grab_owner_name($id)); + display_row($tr_color,'g_',$group[0],$group[1]); + $s_groups++; + $processed[] = ',g_'.$group[0]; + $total++; + if($total == $maxm) break; } } + + if($total <> $maxm) { + if(!is_object($db)) { + $db = $phpgw->db; + } + + $db->query("select account_id from accounts ORDER BY account_lastname, account_firstname, account_lid LIMIT ".$phpgw->nextmatchs->sql_limit(intval($s_users)),__LINE__,__FILE__); + $users = $db->num_rows(); + if($total <> $maxm) { + if($users) { + $p->set_var('string',ucfirst(lang('Users'))); + $p->parse('row','row_colspan',True); + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + while($db->next_record()) { + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $id = $db->f("account_id"); + display_row($tr_color,'u_',$id,$phpgw->common->grab_owner_name($id)); + $s_users++; + $processed[] = ',u_'.$id; + $total++; + if($total == $maxm) break; + } + } + } + } + + $extra_parms = "&s_users=".$s_users."&s_groups=".$s_groups."&maxm=".$maxm."&totalentries=".$totalentries."&total=".($start + $total); + + $p->set_var("nml",$phpgw->nextmatchs->left("",$start,$totalentries,$extra_parms)); + $p->set_var("nmr",$phpgw->nextmatchs->right("",$start,$totalentries,$extra_parms)); + + $start += $total; + $common_hidden_vars = ' '."\n" + . ' '."\n" + . ' '."\n" + . ' '."\n" + . ' '."\n"; + $p->set_var('common_hidden_vars_form',$common_hidden_vars); + + if(isset($query_result) && $query_result) + $common_hidden_vars .= "\n"; + + $p->set_var('common_hidden_vars',$common_hidden_vars); + $p->set_var("search_value",(isset($query) && $query?$query:"")); + $p->set_var("search",lang("search")); + $p->set_var("next",lang("next")); + + + $p->set_var('processed',urlencode(serialize($processed))); $p->pparse('out','preferences'); $phpgw->common->phpgw_footer(); ?> diff --git a/calendar/templates/default/preference_acl.tpl b/calendar/templates/default/preference_acl.tpl index 31d74f516b..8894ac9fe8 100755 --- a/calendar/templates/default/preference_acl.tpl +++ b/calendar/templates/default/preference_acl.tpl @@ -1,9 +1,27 @@ {errors} {title} + + + {nml} + + {nmr} + +
+
+
+{common_hidden_vars} + + + +
+
+
{row}
+{common_hidden_vars_form} +
diff --git a/calendar/templates/verdilak/preference_acl.tpl b/calendar/templates/verdilak/preference_acl.tpl index 31d74f516b..8894ac9fe8 100755 --- a/calendar/templates/verdilak/preference_acl.tpl +++ b/calendar/templates/verdilak/preference_acl.tpl @@ -1,9 +1,27 @@ {errors} {title} + + + {nml} + + {nmr} + +
+
+
+{common_hidden_vars} + + + +
+
+
{row}
+{common_hidden_vars_form} +