mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-31 02:21:28 +01:00
newest version
This commit is contained in:
parent
18e2eaa767
commit
1dc8dcb19b
@ -12,22 +12,17 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True, "noappheader" => True, "noappfooter" => True);
|
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True, "noappheader" => True, "noappfooter" => True);
|
||||||
|
|
||||||
// if(isset($submit) && $submit) {
|
|
||||||
// $phpgw_info["flags"]["noheader"] = True;
|
|
||||||
// $phpgw_info["flags"]["nonavbar"] = True;
|
|
||||||
// }
|
|
||||||
|
|
||||||
include("../header.inc.php");
|
include("../header.inc.php");
|
||||||
|
|
||||||
function display_row($bg_color,$label,$id,$name) {
|
function display_row($bg_color,$label,$id,$name) {
|
||||||
global $p;
|
global $p;
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
|
global $acl;
|
||||||
|
|
||||||
$p->set_var('row_color',$bg_color);
|
$p->set_var('row_color',$bg_color);
|
||||||
$p->set_var('user',$name);
|
$p->set_var('user',$name);
|
||||||
$rights = $phpgw->acl->get_rights($label.$id,$phpgw_info["flags"]["currentapp"]);
|
$rights = $acl->get_rights($label.$id,$phpgw_info["flags"]["currentapp"]);
|
||||||
$p->set_var('read',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_READ.']');
|
$p->set_var('read',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_READ.']');
|
||||||
if ($rights & PHPGW_ACL_READ) {
|
if ($rights & PHPGW_ACL_READ) {
|
||||||
$p->set_var('read_selected',' checked');
|
$p->set_var('read_selected',' checked');
|
||||||
@ -55,11 +50,17 @@
|
|||||||
$p->parse('row','acl_row',True);
|
$p->parse('row','acl_row',True);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($submit) {
|
if(!isset($owner) || !$phpgw_info["user"]["apps"]["admin"]) {
|
||||||
|
$owner = $phpgw_info["user"]["account_id"];
|
||||||
|
}
|
||||||
|
$groups = $phpgw->accounts->memberships($owner);
|
||||||
|
$acl = CreateObject('phpgwapi.acl',intval($owner));
|
||||||
|
$acl->read_repository();
|
||||||
|
|
||||||
|
if ($submit) {
|
||||||
$to_remove = unserialize(urldecode($processed));
|
$to_remove = unserialize(urldecode($processed));
|
||||||
for($i=0;$i<count($to_remove);$i++) {
|
for($i=0;$i<count($to_remove);$i++) {
|
||||||
$phpgw->acl->delete($phpgw_info["flags"]["currentapp"],$to_remove[$i],$phpgw_info["user"]["account_id"],'u');
|
$acl->delete($phpgw_info["flags"]["currentapp"],$to_remove[$i]);
|
||||||
}
|
}
|
||||||
// Group records
|
// Group records
|
||||||
$group_variable = 'g_'.$phpgw_info["flags"]["currentapp"];
|
$group_variable = 'g_'.$phpgw_info["flags"]["currentapp"];
|
||||||
@ -67,10 +68,10 @@
|
|||||||
@reset($$group_variable);
|
@reset($$group_variable);
|
||||||
while(list($group_id,$acllist) = each($$group_variable)) {
|
while(list($group_id,$acllist) = each($$group_variable)) {
|
||||||
$totalacl = 0;
|
$totalacl = 0;
|
||||||
while(list($acl,$permission) = each($acllist)) {
|
while(list($right,$permission) = each($acllist)) {
|
||||||
$totalacl += $acl;
|
$totalacl += $right;
|
||||||
}
|
}
|
||||||
$phpgw->acl->add($phpgw_info["flags"]["currentapp"],'g_'.$group_id,$phpgw_info["user"]["account_id"],'u',$totalacl);
|
$acl->add($phpgw_info["flags"]["currentapp"],'g_'.$group_id,$totalacl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// User records
|
// User records
|
||||||
@ -79,17 +80,13 @@
|
|||||||
@reset($$user_variable);
|
@reset($$user_variable);
|
||||||
while(list($user_id,$acllist) = each($$user_variable)) {
|
while(list($user_id,$acllist) = each($$user_variable)) {
|
||||||
$totalacl = 0;
|
$totalacl = 0;
|
||||||
while(list($acl,$permission) = each($acllist)) {
|
while(list($right,$permission) = each($acllist)) {
|
||||||
$totalacl += $acl;
|
$totalacl += $right;
|
||||||
|
}
|
||||||
|
$acl->add($phpgw_info["flags"]["currentapp"],'u_'.$user_id,$totalacl);
|
||||||
}
|
}
|
||||||
$phpgw->acl->add($phpgw_info["flags"]["currentapp"],'u_'.$user_id,$phpgw_info["user"]["account_id"],'u',$totalacl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// header("Location: ".$phpgw->link($phpgw_info["server"]["webserver_url"]."/preferences/index.php"));
|
|
||||||
// $phpgw->common->phpgw_exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$groups = $phpgw->accounts->read_group_names($phpgw->info["user"]["account_id"]);
|
|
||||||
$processed = Array();
|
$processed = Array();
|
||||||
|
|
||||||
$total = 0;
|
$total = 0;
|
||||||
@ -122,9 +119,9 @@
|
|||||||
if(!isset($totalentries)) {
|
if(!isset($totalentries)) {
|
||||||
$totalentries = count($groups);
|
$totalentries = count($groups);
|
||||||
$db = $phpgw->db;
|
$db = $phpgw->db;
|
||||||
$db->query("SELECT count(*) FROM accounts");
|
$db->query("SELECT count(*) FROM phpgw_accounts WHERE account_type='u'");
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
$totalentries += $db->f(0);
|
$totalentries += intval($db->f(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',$phpgw_info["server"]["app_tpl"]);
|
$p = CreateObject('phpgwapi.Template',$phpgw_info["server"]["app_tpl"]);
|
||||||
@ -132,7 +129,8 @@
|
|||||||
'row_colspan' => 'preference_colspan.tpl',
|
'row_colspan' => 'preference_colspan.tpl',
|
||||||
'acl_row' => 'preference_acl_row.tpl'));
|
'acl_row' => 'preference_acl_row.tpl'));
|
||||||
|
|
||||||
$p->set_var('errors','<p><center><b>This does nothing at this time!<br>Strictly as a template for use!</b></center>');
|
// $p->set_var('errors','<p><center><b>This does nothing at this time!<br>Strictly as a template for use!</b></center>');
|
||||||
|
$p->set_var('errors','');
|
||||||
$p->set_var('title','<p><b>'.lang($phpgw_info["flags"]["currentapp"]." preferences").' - '.lang("acl").':</b><hr><p>');
|
$p->set_var('title','<p><b>'.lang($phpgw_info["flags"]["currentapp"]." preferences").' - '.lang("acl").':</b><hr><p>');
|
||||||
|
|
||||||
$p->set_var('action_url',$phpgw->link(''));
|
$p->set_var('action_url',$phpgw->link(''));
|
||||||
@ -144,7 +142,8 @@
|
|||||||
. ' <input type="hidden" name="maxm" value="'.$maxm.'">'."\n"
|
. ' <input type="hidden" name="maxm" value="'.$maxm.'">'."\n"
|
||||||
. ' <input type="hidden" name="totalentries" value="'.$totalentries.'">'."\n"
|
. ' <input type="hidden" name="totalentries" value="'.$totalentries.'">'."\n"
|
||||||
. ' <input type="hidden" name="start" value="'.$start.'">'."\n"
|
. ' <input type="hidden" name="start" value="'.$start.'">'."\n"
|
||||||
. ' <input type="hidden" name="query" value="'.$query.'">'."\n";
|
. ' <input type="hidden" name="query" value="'.$query.'">'."\n"
|
||||||
|
. ' <input type="hidden" name="owner" value="'.$owner.'">'."\n";
|
||||||
$p->set_var('common_hidden_vars_form',$common_hidden_vars);
|
$p->set_var('common_hidden_vars_form',$common_hidden_vars);
|
||||||
|
|
||||||
if(isset($query_result) && $query_result)
|
if(isset($query_result) && $query_result)
|
||||||
@ -160,18 +159,20 @@
|
|||||||
$p->set_var('string',lang('Groups'));
|
$p->set_var('string',lang('Groups'));
|
||||||
$p->parse('row','row_colspan',True);
|
$p->parse('row','row_colspan',True);
|
||||||
|
|
||||||
while(list(,$group) = each($groups)) {
|
reset($groups);
|
||||||
|
for($k=0;$k<count($groups);$k++) {
|
||||||
|
$group = $groups[$k];
|
||||||
$go = True;
|
$go = True;
|
||||||
if($query) {
|
if($query) {
|
||||||
if(!strpos(' '.$group[1].' ',$query)) {
|
if(!strpos(' '.$group["account_id"].' ',$query)) {
|
||||||
$go = False;
|
$go = False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($go) {
|
if($go) {
|
||||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||||
display_row($tr_color,'g_',$group[0],$group[1]);
|
display_row($tr_color,'g_',$group["account_id"],$group["account_name"]);
|
||||||
$s_groups++;
|
$s_groups++;
|
||||||
$processed[] = 'g_'.$group[0];
|
$processed[] = 'g_'.$group["account_id"];
|
||||||
$total++;
|
$total++;
|
||||||
if($total == $maxm) break;
|
if($total == $maxm) break;
|
||||||
}
|
}
|
||||||
@ -183,7 +184,7 @@
|
|||||||
$db = $phpgw->db;
|
$db = $phpgw->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->query("select account_id, account_firstname, account_lastname, account_lid from accounts ORDER BY account_lastname, account_firstname, account_lid ".$db->limit(intval($s_users),$maxm),__LINE__,__FILE__);
|
$db->query("select account_id, account_firstname, account_lastname, account_lid FROM phpgw_accounts WHERE account_type='u' ORDER BY account_lastname, account_firstname, account_lid ".$db->limit(intval($s_users),$maxm),__LINE__,__FILE__);
|
||||||
$users = $db->num_rows();
|
$users = $db->num_rows();
|
||||||
if($total <> $maxm) {
|
if($total <> $maxm) {
|
||||||
if($users) {
|
if($users) {
|
||||||
@ -212,7 +213,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_parms = "&s_users=".$s_users."&s_groups=".$s_groups."&maxm=".$maxm."&totalentries=".$totalentries."&total=".($start + $total);
|
$extra_parms = "&s_users=".$s_users."&s_groups=".$s_groups."&maxm=".$maxm."&totalentries=".$totalentries."&total=".($start + $total)."&owner=".$owner;
|
||||||
|
|
||||||
$p->set_var("nml",$phpgw->nextmatchs->left("",$start,$totalentries,$extra_parms));
|
$p->set_var("nml",$phpgw->nextmatchs->left("",$start,$totalentries,$extra_parms));
|
||||||
$p->set_var("nmr",$phpgw->nextmatchs->right("",$start,$totalentries,$extra_parms));
|
$p->set_var("nmr",$phpgw->nextmatchs->right("",$start,$totalentries,$extra_parms));
|
||||||
|
Loading…
Reference in New Issue
Block a user