[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.boadmin.inc.php,1.1,1.2 class
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.boadmin.inc.php,1.1,1.2 class.soadmin.inc.php,1.3,1.4 class.uiadmin.inc.php,1.2,1.3 hook_admin.inc.php,1.20,1.21 |
Date: |
Sat, 08 Mar 2003 11:51:52 -0500 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv8572/inc
Modified Files:
class.boadmin.inc.php class.soadmin.inc.php
class.uiadmin.inc.php hook_admin.inc.php
Log Message:
no message
Index: class.boadmin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boadmin.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.boadmin.inc.php 11 Dec 2002 19:31:22 -0000 1.1
--- class.boadmin.inc.php 8 Mar 2003 16:51:15 -0000 1.2
***************
*** 15,55 ****
var $order;
var $cat_id;
- var $submodule_id;
- var $permission;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- var $soap_functions = array(
- 'list' => array(
- 'in' =>
array('int','int','struct','string','int'),
- 'out' => array('array')
- ),
- 'read' => array(
- 'in' => array('int','struct'),
- 'out' => array('array')
- ),
- 'save' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- ),
- 'delete' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- )
- );
function boadmin($session='')
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! $this->so =
CreateObject($this->currentapp.'.soadmin');
! $this->socommon =
CreateObject($this->currentapp.'.socommon');
!
if ($session)
--- 15,26 ----
var $order;
var $cat_id;
function boadmin($session='')
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! $this->so =
CreateObject($this->currentapp.'.soadmin');
! $this->socommon =
CreateObject($this->currentapp.'.socommon');
! $this->acl2 =
CreateObject($this->currentapp.'.acl2',1,'##DEFAULT##');
! $this->right = array(1,2,4,8,16,32);
if ($session)
***************
*** 66,71 ****
$filter = get_var('filter',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
- $submodule_id =
get_var('submodule_id',array('POST','GET'));
$permission =
get_var('permission',array('POST','GET'));
if ($start)
--- 37,43 ----
$filter = get_var('filter',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
$permission =
get_var('permission',array('POST','GET'));
+ // $location =
get_var('location',array('POST','GET')); // don't work for some reason...
+ $module = get_var('module',array('POST','GET'));
if ($start)
***************
*** 98,108 ****
$this->cat_id = $cat_id;
}
! if(isset($submodule_id))
{
! $this->submodule_id = $submodule_id;
! }
! if(isset($permission))
! {
! $this->permission = $permission;
}
--- 70,76 ----
$this->cat_id = $cat_id;
}
! if(isset($module))
{
! $this->location = $module;
}
***************
*** 112,116 ****
function read_sessiondata()
{
! $data =
$GLOBALS['phpgw']->session->appsession('session_data','fm');
// _debug_array($data);
--- 80,84 ----
function read_sessiondata()
{
! $data =
$GLOBALS['phpgw']->session->appsession('session_data',$this->currentapp);
// _debug_array($data);
***************
*** 122,349 ****
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
! $this->submodule_id = $data['submodule_id'];
! $this->permission = $data['permission'];
}
- function select_submodule($format='',$selected='')
- {
! // $selected =
get_var('submodule_id',array('POST','GET'));
switch($format)
{
case 'select':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('select_submodule',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
break;
case 'filter':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_submodule',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
break;
}
! $submodules= $this->so->select_submodule();
! while (is_array($submodules) && list(,$sub) =
each($submodules))
{
! $sel_sub = '';
! if ($sub['id']==$selected)
{
! $sel_sub = 'selected';
}
! $submodule_list[] = array
(
! 'id' => $sub['id'],
! 'descr' => lang($sub['id']),
! 'selected' => $sel_sub
);
}
! for ($i=0;$i<count($submodule_list);$i++)
{
! if ($submodule_list[$i]['selected'] !=
'selected')
{
! unset($submodule_list[$i]['selected']);
}
}
! return $submodule_list;
}
! function select_permission($selected='',$sub_module='')
{
!
!
!
$GLOBALS['phpgw']->xslttpl->add_file(array('select_permission',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! //
$GLOBALS['phpgw']->xslttpl->add_file('select_permission');
!
! $permission[0]['id']= 'can_read';
! $permission[1]['id']= 'can_add';
! $permission[2]['id']= 'can_edit';
! $permission[3]['id']= 'can_delete';
! $permission[4]['id']= 'admin';
!
! if ($sub_module=='invoice')
! {
! $permission[5]['id']= 'janitor';
! $permission[6]['id']= 'supervisor';
! $permission[7]['id']= 'budget_responsible';
! $permission[8]['id']= 'transfer';
! }
!
!
! while (is_array($permission) && list(,$perm) =
each($permission))
! {
! $sel_perm = '';
! if ($perm['id']==$selected)
! {
! $sel_perm = 'selected';
! }
!
! $permission_list[] = array
! (
! 'id' => $perm['id'],
! 'descr' => lang($perm['id']),
! 'selected' => $sel_perm
! );
! }
!
! for ($i=0;$i<count($permission_list);$i++)
! {
! if ($permission_list[$i]['selected'] !=
'selected')
! {
! unset($permission_list[$i]['selected']);
! }
! }
!
! return $permission_list;
! }
!
!
! function read_permission()
! {
! $admins = $this->so->read_permission(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
!
'filter' => $this->filter,'cat_id' => $this->cat_id,'submodule_id' =>
$this->submodule_id));
! $this->total_records = $this->so->total_records;
!
! return $admins;
}
! function
select_users($format='',$submodule_id='',$permission='')
{
! switch($format)
! {
! case 'select':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('select_user',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! break;
! case 'filter':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_user',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! break;
! case 'select_multi':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('select_multi_user',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! break;
! }
!
! if (!$submodule_id || !$permission)
! {
! return false;
! }
!
!
! $is_admin =
$this->so->is_admin($submodule_id,$permission);
!
! //_debug_array($is_admin);
!
! $order='account_lastname';
! $allusers =
$GLOBALS['phpgw']->accounts->get_list('accounts', $this->start, ASC, $order,
$this->query);
!
! $j=0;
! while (list($null,$ad_account) = each($allusers))
{
! $users_list[$j]['key_id'] = $j;
! $users_list[$j]['account_id'] =
$ad_account['account_id'];
! $users_list[$j]['account_lid'] =
$ad_account['account_lid'];
! $users_list[$j]['account_firstname'] =
$ad_account['account_firstname'];
! $users_list[$j]['account_lastname'] =
$ad_account['account_lastname'];
!
! for ($i=0;$i<count($is_admin);$i++)
{
- if($is_admin[$i]['account_id'] ==
$ad_account['account_id'])
- {
- $users_list[$j]['checked'] =
'checked';
- }
- }
! $j++;
}
-
- //_debug_array($users_list);
-
- return $users_list;
}
!
! function
select_groups($format='',$submodule_id='',$permission='')
{
! if (!$submodule_id || !$permission)
! {
! return false;
! }
! /* switch($format)
! {
! case 'select':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('select_group',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! break;
! case 'filter':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_group',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! break;
! case 'select_multi':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('select_multi_group',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! break;
! }
! */ $is_group =
$this->so->is_group($submodule_id,$permission);
! //_debug_array($is_group);
! $order='account_lastname';
! $allgroups =
$GLOBALS['phpgw']->accounts->get_list('groups', $start, ASC, $order, $query);
! $j=0;
! while (list($null,$ad_group) = each($allgroups))
{
! $groups_list[$j]['key_id'] = $j;
! $groups_list[$j]['account_id'] =
$ad_group['account_id'];
! $groups_list[$j]['account_lid'] =
$ad_group['account_lid'];
! $groups_list[$j]['account_firstname'] =
$ad_group['account_firstname'];
! $groups_list[$j]['account_lastname'] =
$ad_group['account_lastname'];
!
! for ($i=0;$i<count($is_group);$i++)
{
! if($is_group[$i]['account_id'] ==
$ad_group['account_id'])
{
! $groups_list[$j]['checked'] =
'checked';
}
- }
! $j++;
}
! //_debug_array($groups_list);
!
! return $groups_list;
}
- function edit_perm($values='')
- {
-
- $message = $this->so->edit_perm($values);
- return $message;
-
- }
function read_fm_id()
--- 90,201 ----
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
! $this->location = $data['location'];
}
! function select_location($format='',$selected='')
! {
switch($format)
{
case 'select':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('select_location'));
break;
case 'filter':
!
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_location'));
break;
}
! $locations= $this->so->select_location();
! while (is_array($locations) && list(,$loc) =
each($locations))
{
! $sel_loc = '';
! if ($loc['id']==$selected)
{
! $sel_loc = 'selected';
}
! $location_list[] = array
(
! 'id' => $loc['id'],
! 'descr' => $loc['id'],
! 'selected' => $sel_loc
);
}
! for ($i=0;$i<count($location_list);$i++)
{
! if ($location_list[$i]['selected'] !=
'selected')
{
! unset($location_list[$i]['selected']);
}
}
! return $location_list;
}
! function set_permission($user_id,$rights)
{
! $this->acl2->set($this->location,$rights,$user_id,0);
! $message = lang('permissions are updated!');
}
! function remove_permission($user_delete)
{
! $right=$this->right;
! for ($i=0;$i<count($user_delete);$i++)
{
! for ($j=0;$j<count($right);$j++)
{
!
$this->acl2->remove($this->location,$right[$j],$user_delete[$i],0);
! }
}
}
! function get_user_list2()
{
! $allusers =
$GLOBALS['phpgw']->accounts->get_list('accounts', $this->start, ASC,
$this->order, $this->query);
! //_debug_array($allusers);
! $this->total_records = count($allusers);
! // $this->acl2->get_memberships();
! $right=$this->right;
! if(is_array($allusers))
{
! $j=0;
! while (list($null,$account) = each($allusers))
{
! $user_list[$j]['counter'] = $j;
! $user_list[$j]['account_id'] =
$account['account_id'];
! $user_list[$j]['account_lid'] =
$account['account_lid'];
! $user_list[$j]['account_firstname'] =
$account['account_firstname'];
! $user_list[$j]['account_lastname'] =
$account['account_lastname'];
!
! for ($i=0;$i<count($right);$i++)
{
!
if($this->acl2->check($this->location, $right[$i],$account['account_id']))
! {
!
$user_list[$j]['right'][$right[$i]] = 'checked';
! }
}
! $j++;
! }
}
! // echo 'rights_cache:<pre>'; print_r($this->acl2->rights_cache); echo
'</pre>';
! return $user_list;
}
function read_fm_id()
Index: class.soadmin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soadmin.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.soadmin.inc.php 21 Feb 2003 10:28:59 -0000 1.3
--- class.soadmin.inc.php 8 Mar 2003 16:51:15 -0000 1.4
***************
*** 31,59 ****
}
- function is_admin($sub_module='',$permission='')
- {
- $this->db->query("SELECT account_id from fm_admin WHERE
type='u' and sub_module ='$sub_module' and $permission='1'",__LINE__,__FILE__);
- $i = 0;
- while ($this->db->next_record())
- {
- $is_admin[] = array('account_id' =>
$this->db->f('account_id'));
- }
- return $is_admin;
- }
-
! function is_group($sub_module='',$permission='')
! {
! $this->db->query("SELECT account_id from fm_admin WHERE
type='g' and sub_module ='$sub_module' and $permission='1'",__LINE__,__FILE__);
! $i = 0;
! while ($this->db->next_record())
! {
! $is_group[] = array('account_id' =>
$this->db->f('account_id'));
! }
! return $is_group;
! }
!
!
! function select_submodule($submodule_id='')
{
--- 31,36 ----
}
! function select_location()
{
***************
*** 63,296 ****
while ($this->db->next_record())
{
! $submodule[$i]['id']
= $this->db->f('id');
! $submodule[$i]['descr']
= stripslashes($this->db->f('descr'));
$i++;
}
! return $submodule;
}
-
- function read_permission($data)
- {
- if(is_array($data))
- {
- if ($data['start'])
- {
- $start=$data['start'];
- }
- else
- {
- $start=0;
- }
- $filter =
(isset($data['filter'])?$data['filter']:'none');
- $query =
(isset($data['query'])?$data['query']:'');
- $sort =
(isset($data['sort'])?$data['sort']:'DESC');
- $order =
(isset($data['order'])?$data['order']:'');
- $cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
- $submodule_id =
(isset($data['submodule_id'])?$data['submodule_id']:0);
- }
-
- if ($order)
- {
- $ordermethod = " order by $order $sort";
- }
- else
- {
- $ordermethod = ' order by account_lastname
DESC';
- }
-
- if ($filter == 'none')
- {
- $filtermethod = ' ( owner=' . $this->account;
- if (is_array($this->grants))
- {
- $grants = $this->grants;
- while (list($user) = each($grants))
- {
- $public_user_list[] = $user;
- }
- reset($public_user_list);
- $filtermethod .= " OR (access='public'
AND owner IN(" . implode(',',$public_user_list) . ")))";
- }
- else
- {
- $filtermethod .= ' )';
- }
- }
- elseif ($filter == 'yours')
- {
- $filtermethod = " owner='" . $this->account .
"'";
- }
- else
- {
- $filtermethod = " owner='" . $this->account .
"' AND access='private'";
- }
-
- if ($cat_id > 0)
- {
- $filtermethod .= " AND cat_id='$cat_id' ";
- }
-
- if($query)
- {
- $query = ereg_replace("'",'',$query);
- $query = ereg_replace('"','',$query);
-
- $querymethod = " AND property_id LIKE
'%$query%' or building_name LIKE '%$query%'";
- }
-
- $sql = "SELECT
janitor,supervisor,budget_responsible,transfer,fm_admin.account_id,account_lid,account_firstname,account_lastname,
account_type, can_read,can_add,can_edit,can_delete,admin from fm_admin "
- . " $this->join phpgw_accounts on
fm_admin.account_id=phpgw_accounts.account_id WHERE sub_module='$submodule_id'
";// $querymethod ";
-
-
- //print_r($sql);
- $this->db2->query($sql,__LINE__,__FILE__);
- $this->total_records = $this->db2->num_rows();
- $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
-
- while ($this->db->next_record())
- {
- $admins[] = array('id' =>
$this->db->f('account_id'),
- 'lid' =>
$this->db->f('account_lid'),
- 'firstname' =>
$this->db->f('account_firstname'),
- 'lastname' =>
$this->db->f('account_lastname'),
- 'read' =>
$this->db->f('can_read'),
- 'add' =>
$this->db->f('can_add'),
- 'edit' =>
$this->db->f('can_edit'),
- 'delete' =>
$this->db->f('can_delete'),
- 'admin' =>
$this->db->f('admin'),
- 'janitor' =>
$this->db->f('janitor'),
- 'supervisor' =>
$this->db->f('supervisor'),
- 'budget_responsible' =>
$this->db->f('budget_responsible'),
- 'transfer' =>
$this->db->f('transfer'),
- 'account_type' =>
$this->db->f('account_type'));
- }
-
- return $admins;
- }
-
-
- function edit_perm($values='')
- {
-
- //_debug_array($values);
- $users = $values[users];
- $groups = $values[groups];
- $permission = $values[permission];
- $sub_module = $values[submodule_id];
-
- $this->db->query("update fm_admin set update_right =
NULL ",__LINE__,__FILE__);
- if (count($users) != 0)
- {
- while($activ=each($users))
- {
-
- $this->db->query("SELECT count(*) from
fm_admin WHERE type='u' and account_id ='$activ[1]' and
sub_module='$sub_module'",__LINE__,__FILE__);
- $this->db->next_record();
- if ($this->db->f(0) == 0)
- {
- $this->db->query("insert into
fm_admin (account_id,type, sub_module,update_right,$permission) values
('$activ[1]','u','$sub_module','$permission','1' )",__LINE__,__FILE__);
- }
- else
- {
-
- $this->db->query("update
fm_admin set update_right ='$permission', $permission='1' where
account_id='$activ[1]' and sub_module='$sub_module'",__LINE__,__FILE__);
-
- }
-
- }
- }
-
-
- if (count($groups) != 0)
- {
- while($activ=each($groups))
- {
- $this->db->query("SELECT count(*) from
fm_admin WHERE type='g' and account_id ='$activ[1]' and
sub_module='$sub_module'",__LINE__,__FILE__);
- $this->db->next_record();
- if ($this->db->f(0) == 0)
- {
- $this->db->query("insert into
fm_admin (account_id,type, sub_module,update_right, $permission) values
('$activ[1]','g','$sub_module','$permission','1' )",__LINE__,__FILE__);
- }
- else
- {
- $this->db->query("update
fm_admin set update_right ='$permission', $permission='1' where
account_id='$activ[1]'",__LINE__,__FILE__);
- }
- }
- }
-
-
- $this->db2->query("SELECT * from fm_admin WHERE
update_right is NULL and sub_module='$sub_module'",__LINE__,__FILE__);
- while ($this->db2->next_record())
- {
- if($this->db2->f($permission))
- {
- $to_update[] = array('account_id' =>
$this->db2->f('account_id'));
- }
- }
-
- if ($to_update)
- {
- $i = 0;
- while(each($to_update))
- {
-
$account_id=$to_update[$i]['account_id'];
- $this->db2->query("update fm_admin set
$permission = NULL WHERE account_id = '$account_id' and
sub_module='$sub_module'",__LINE__,__FILE__);
- $i++;
- }
- }
-
- $this->db2->query("SELECT * from fm_admin WHERE
update_right is NULL and sub_module='$sub_module'",__LINE__,__FILE__);
- while ($this->db2->next_record())
- {
-
- if(!$this->db2->f('can_read') &&
!$this->db2->f('can_add') && !$this->db2->f('can_edit') &&
!$this->db2->f('can_delete') && !$this->db2->f('janitor') &&
!$this->db2->f('supervisor') && !$this->db2->f('budget_responsible') &&
!$this->db2->f('transfer'))
- {
- $to_delete[] = array('account_id' =>
$this->db2->f('account_id'));
- }
- }
-
- if ($to_delete)
- {
- $i = 0;
- while(each($to_delete))
- {
-
$account_id=$to_delete[$i]['account_id'];
- $this->db2->query("DELETE from fm_admin
WHERE account_id = '$account_id' and
sub_module='$sub_module'",__LINE__,__FILE__);
- $i++;
- }
-
- }
-
- $message=lang('Permission updated');
-
- return $message;
- }
-
- function read_single($property_id,$building_id)
- {
- $sql = "SELECT * FROM fm_building where
property_id='$property_id' and building_id='$building_id'";
-
- $this->db->query($sql,__LINE__,__FILE__);
-
- if ($this->db->next_record())
- {
- $building['property_id'] =
(int)$this->db->f('property_id');
- $building['building_id'] =
(int)$this->db->f('building_id');
- $building['owner']
= $this->db->f('owner');
- $building['name']
= stripslashes($this->db->f('building_name'));
- $building['general_address'] =
stripslashes($this->db->f('general_address'));
- $building['access']
= $this->db->f('access');
- $building['date']
= $this->db->f('entry_date');
- $building['cat_id']
= (int)$this->db->f('cat_id');
- $building['district_id']
= $this->db->f('district_id');
- $building['part_of_town'] =
$this->db->f('bydel');
- $building['building_type_id'] =
$this->db->f('building_type_id');
- $building['location_code'] =
$this->db->f('location_code');
-
- return $building;
- }
- }
function read_fm_id()
--- 40,51 ----
while ($this->db->next_record())
{
! $location[$i]['id']
= $this->db->f('id');
! $location[$i]['descr']
= stripslashes($this->db->f('descr'));
$i++;
}
! return $location;
}
function read_fm_id()
Index: class.uiadmin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiadmin.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.uiadmin.inc.php 27 Jan 2003 10:40:31 -0000 1.2
--- class.uiadmin.inc.php 8 Mar 2003 16:51:15 -0000 1.3
***************
*** 23,30 ****
var $public_functions = array
(
! 'list_perm' => True,
! 'view' => True,
! 'edit_perm' => True,
! 'edit_id' => True
);
--- 23,28 ----
var $public_functions = array
(
! 'list_acl2' => True,
! 'edit_id' => True
);
***************
*** 32,37 ****
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->cats =
CreateObject('phpgwapi.categories');
- $this->cats->app_name = 'fm_admin';
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
--- 30,33 ----
***************
*** 48,53 ****
$this->filter =
$this->bo->filter;
$this->cat_id =
$this->bo->cat_id;
! $this->submodule_id =
$this->bo->submodule_id;
! $this->permission =
$this->bo->permission;
}
--- 44,48 ----
$this->filter =
$this->bo->filter;
$this->cat_id =
$this->bo->cat_id;
! $this->location =
$this->bo->location;
}
***************
*** 62,160 ****
'filter' => $this->filter,
'cat_id' => $this->cat_id,
! 'submodule_id' => $this->submodule_id,
! 'permission' => $this->permission
);
- // _debug_array($data);
$this->bocommon->save_sessiondata($data);
}
! function list_perm()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('admin','nextmatchs',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header',
-
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'filter_select',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'search_field'));
- //
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'nextmatchs'));
-
- // $sub = get_var('sub',array('POST','GET'));
! $admins = $this->bo->read_permission();
! //_debug_array($admins);
! for ($i=0;$i<count($admins);$i++)
{
! $lid = $admins[$i]['lid'];
!
! $rights = '';
! if ($admins[$i]['read'])
{
! $rights .= lang('read') .', ';
}
!
! if ($admins[$i]['add'])
{
! $rights .=lang(add) .', ';
}
!
! if ($admins[$i]['edit'])
{
- $rights .=lang('edit') .', ';
- }
! if ($admins[$i]['delete'])
! {
! $rights .=lang(delete) .', ';
! }
! if ($admins[$i]['admin'])
! {
! $rights .=lang(Admin) .', ';
}
! $roles = '';
! if ($admins[$i]['janitor'])
{
! $roles .= lang('Janitor') .', ';
}
! if ($admins[$i]['supervisor'])
! {
! $roles .=lang('Supervisor') .', ';
! }
! if ($admins[$i]['budget_responsible'])
! {
! $roles .=lang('Budget Responsible') .',
';
! }
! if ($admins[$i]['transfer'])
{
! $roles .=lang(Transfer) .', ';
}
! if ($admins[$i]['account_type']=='u')
{
! $firstname = $admins[$i]['firstname'];
! if (!$firstname) { $firstname = ''; }
! $lastname = $admins[$i]['lastname'];
! if (!$lastname) { $lastname = ''; }
}
! else
{
! $firstname = '';
! $lastname = '';
}
! $content[] = array
! (
! 'lid' => $lid,
! 'rights' => $rights,
! 'roles' => $roles,
! 'firstname' => $firstname,
! 'lastname' => $lastname
! );
!
}
$table_header[] = array
(
--- 57,148 ----
'filter' => $this->filter,
'cat_id' => $this->cat_id,
! 'location' => $this->location
);
$this->bocommon->save_sessiondata($data);
}
!
! function list_acl2()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('admin','nextmatchs',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'search_field'));
! $values = get_var('values',array('POST'));
! $r_processed = get_var('processed',array('POST'));
! $submit = get_var('submit',array('POST'));
! $r_processed=explode("_",$r_processed);
! if($submit)
{
! if(!$values)
{
! $values = array();
}
! @reset($values);
! $totalacl = array();
! while(list($rowinfo,$perm) = each($values))
{
! list($user_id,$rights) =
split('_',$rowinfo);
! $totalacl[$user_id] += $rights;
}
! @reset($totalacl);
! while(list($user_id,$rights) = @each($totalacl))
{
! $user_checked[]=$user_id;
! //echo 'user_id: ' . $user_id .'<br>';
! //echo 'rights: ' . $rights .'<br>';
!
$this->bo->set_permission($user_id,$rights);
}
! if(is_array($r_processed) &&
is_array($user_checked))
{
! $user_delete =
array_diff($r_processed, $user_checked);
}
! else
{
! $user_delete = $r_processed;
}
! if(is_array($user_delete) &&
count($user_delete)>0)
{
! $user_delete= explode("_",implode("_",
$user_delete));
!
!
$this->bo->remove_permission($user_delete);
}
!
! $message = lang('permissions are updated!');
! }
!
! if ($this->location)
! {
! $user_list = $this->bo->get_user_list2();
!
! while (is_array($user_list) && list(,$user) =
each($user_list))
{
! $processed[] = $user['account_id'];
! $content[] = array
! (
! 'account_id' =>
$user['account_id'],
! 'lid'
=> $user['account_lid'],
! 'firstname'
=> $user['account_firstname'],
! 'lastname'
=> $user['account_lastname'],
! 'read'
=> $user['right'][1],
! 'add'
=> $user['right'][2],
! 'edit'
=> $user['right'][4],
! 'delete'
=> $user['right'][8],
! 'manager'
=> $user['right'][16]
! );
}
! $processed=implode("_", $processed);
}
+
$table_header[] = array
(
***************
*** 164,168 ****
'var' => 'account_lid',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_perm',
'cat_id'
=>$this->cat_id,
'submodule_id'
=>$this->submodule_id)
--- 152,156 ----
'var' => 'account_lid',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
'cat_id'
=>$this->cat_id,
'submodule_id'
=>$this->submodule_id)
***************
*** 173,177 ****
'var' => 'account_lastname',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_perm',
'cat_id'
=>$this->cat_id,
'submodule_id'
=>$this->submodule_id)
--- 161,165 ----
'var' => 'account_lastname',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
'cat_id'
=>$this->cat_id,
'submodule_id'
=>$this->submodule_id)
***************
*** 182,186 ****
'var' => 'account_firstname',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_perm',
'cat_id'
=>$this->cat_id,
'submodule_id'
=>$this->submodule_id)
--- 170,174 ----
'var' => 'account_firstname',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
'cat_id'
=>$this->cat_id,
'submodule_id'
=>$this->submodule_id)
***************
*** 191,323 ****
'lang_lastname' => lang('Lastname'),
'lang_firstname' => lang('Firstname'),
! 'lang_rights' => lang('Rights'),
! 'lang_roles' => lang('Roles')
! );
!
!
! $hidden_vars[] = array('name' =>
'submodule_id', 'value' => $this->submodule_id);
! $hidden_vars[] = array('name' => 'permission',
'value' => $this->permission);
! $hidden_vars[] = array('name' => 'query',
'value' => $this->query);
! $table_add[] = array
(
! 'hidden_vars' => $hidden_vars,
! 'lang_no_permission' =>
lang('No Permission selected'),
! 'lang_permission_statustext' => lang('Select
Permission'),
! 'select_name_permission' =>
'permission',
! 'permission_list'
=> $this->bo->select_permission($this->permission,$this->submodule_id),
! 'lang_add' =>
lang('Edit'),
! 'lang_add_statustext' => lang('Edit
permissions'),
! 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.edit_perm'),
! 'lang_done' =>
lang('done'),
! 'lang_done_statustext' => lang('Back to
Admin'),
! 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
);
$data = array
(
! 'hidden_vars'
=> $hidden_vars,
'links'
=> $links,
! 'allow_allrows' =>
false,
'start_record'
=> $this->start,
'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
! 'num_records'
=> count($admins),
'all_records'
=> $this->bo->total_records,
! 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.list_perm'),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'appname'
=> lang($this->currentapp),
! 'function_msg'
=> lang('list permission'),
! 'lang_no_cat'
=> lang('no category'),
! 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
! 'select_name'
=> 'cat_id',
! 'cat_list'
=> $this->cats->formatted_xslt_list(array('selected' =>
$this->cat_id,'globals' => True)),
! 'select_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.list_perm'),
! 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
! 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_submit'
=> lang('submit'),
! 'table_header'
=> $table_header,
! 'values'
=> $content,
! 'lang_no_submodule'
=> lang('No submodule'),
! 'lang_submodule_statustext' =>
lang('Select submodule'),
! 'select_name_submodule' =>
'submodule_id',
! 'submodule_list'
=> $this->bo->select_submodule('filter',$this->submodule_id),
! 'table_add'
=> $table_add
);
!
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_perm' => $data));
$this->save_sessiondata();
- }
-
-
- function edit_perm()
- {
- $submodule_id =
get_var('submodule_id',array('POST','GET'));
- $permission = get_var('permission',array('POST','GET'));
- $values = get_var('values',array('POST'));
-
- //_debug_array($values);
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('admin',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
-
- if ($values['save'])
- {
- $message = $this->bo->edit_perm($values);
- }
-
- $function_msg = lang('edit permission');
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin.edit_perm',
- 'permission' => $this->permission,
- 'submodule_id' => $this->submodule_id
- );
-
- $user_list =
$this->bo->select_users('select_multi',$this->submodule_id,$this->permission);
-
- if (!$user_list)
- {
- $message = lang('please select both submodule
and permission to edit');
- }
-
- $group_list =
$this->bo->select_groups('select_multi',$this->submodule_id,$this->permission);
- if (!$group_list)
- {
- $message = lang('please select both submodule
and permission to edit');
- }
- // _debug_array($group_list);
-
-
- $data = array
- (
- 'appname'
=> lang($this->currentapp),
- 'permission'
=> $permission,
- 'submodule_id'
=> $submodule_id,
- 'function_msg'
=> $function_msg,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.list_perm'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'message'
=> $message,
-
- 'lang_user_list'
=> lang('User List'),
- 'user_list'
=> $user_list,
- 'lang_no_user'
=> lang('No User'),
- 'lang_user_statustext' =>
lang('Select the user to give the permission'),
- 'select_name_user'
=> 'values[user_id][]',
-
-
- 'lang_group_list'
=> lang('Group List'),
- 'group_list'
=> $group_list,
- 'lang_no_group'
=> lang('No group'),
- 'lang_group_statustext' =>
lang('Select the group to give the permission'),
- 'select_name_group'
=> 'values[group_id][]',
- );
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_perm' => $data));
}
--- 179,228 ----
'lang_lastname' => lang('Lastname'),
'lang_firstname' => lang('Firstname'),
! 'lang_read' =>
lang('Read'), //1
! 'lang_add' => lang('Add'),
//2
! 'lang_edit' =>
lang('Edit'), //4
! 'lang_delete' => lang('Delete'),
//8
! 'lang_manager' => lang('Manager')
//16
+ );
! $link_data = array
(
! 'menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
! 'module' => $this->location
);
$data = array
(
! 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
! 'done_action'
=> $GLOBALS['phpgw']->link('/admin/index.php'),
! 'lang_save'
=> lang('save'),
! 'lang_done'
=> lang('done'),
! 'message'
=> $message,
! 'processed'
=> $processed,
'links'
=> $links,
! 'allow_allrows'
=> false,
'start_record'
=> $this->start,
'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
! 'num_records'
=> count($user_list),
'all_records'
=> $this->bo->total_records,
! 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.list_acl2'),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'appname'
=> lang($this->currentapp),
! 'function_msg'
=> lang('set permission'),
'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_submit'
=> lang('submit'),
! 'table_header_acl2'
=> $table_header,
! 'values_acl2'
=> $content,
! 'lang_no_location'
=> lang('No location'),
! 'lang_location_statustext' =>
lang('Select submodule'),
! 'select_name_location' =>
'module',
! 'location_list'
=> $this->bo->select_location('filter',$this->location)
);
!
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_acl2' => $data));
$this->save_sessiondata();
}
Index: hook_admin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/hook_admin.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** hook_admin.inc.php 5 Mar 2003 14:31:49 -0000 1.20
--- hook_admin.inc.php 8 Mar 2003 16:51:15 -0000 1.21
***************
*** 35,39 ****
'Tender chapter'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=tender_chapter'),
'ID Controle'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.edit_id'),
! 'Permissions'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.list_perm'),
'Workorders status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=workorder_status'),
'Equipment status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=equipment_status'),
--- 35,39 ----
'Tender chapter'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=tender_chapter'),
'ID Controle'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.edit_id'),
! 'Permissions'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.list_acl2'),
'Workorders status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=workorder_status'),
'Equipment status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=equipment_status'),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.boadmin.inc.php,1.1,1.2 class.soadmin.inc.php,1.3,1.4 class.uiadmin.inc.php,1.2,1.3 hook_admin.inc.php,1.20,1.21,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: timetrack/setup phpgw_en.lang,1.3.2.4,1.3.2.5 phpgw_fr.lang,1.1.2.4,1.1.2.5
- Next by Date:
[Phpgroupware-cvs] CVS: property/setup default_records.inc.php,1.9,1.10
- Previous by thread:
[Phpgroupware-cvs] CVS: timetrack/setup phpgw_en.lang,1.3.2.4,1.3.2.5 phpgw_fr.lang,1.1.2.4,1.1.2.5
- Next by thread:
[Phpgroupware-cvs] CVS: property/setup default_records.inc.php,1.9,1.10
- Index(es):