forked from extern/egroupware
started updating to xslt and rework accounts classes
This commit is contained in:
parent
3227a5dd8b
commit
60079f0e17
@ -1,35 +1,38 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - account administration *
|
||||
* phpGroupWare - Account Administration *
|
||||
* http://www.phpgroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* Written by coreteam <phpgroupware-developers@gnu.org> *
|
||||
* ----------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class boaccounts
|
||||
{
|
||||
var $so;
|
||||
var $public_functions = array(
|
||||
'add_group' => True,
|
||||
'add_user' => True,
|
||||
'delete_group' => True,
|
||||
'delete_user' => True,
|
||||
'edit_group' => True,
|
||||
'edit_user' => True,
|
||||
var $public_functions = array
|
||||
(
|
||||
'add_group' => True,
|
||||
'add_user' => True,
|
||||
'delete_group' => True,
|
||||
'delete_user' => True,
|
||||
'edit_group' => True,
|
||||
'edit_user' => True,
|
||||
'set_group_managers' => True
|
||||
);
|
||||
|
||||
var $xml_functions = array();
|
||||
|
||||
var $soap_functions = array(
|
||||
'add_user' => array(
|
||||
'in' => array('int', 'struct'),
|
||||
'out' => array()
|
||||
var $soap_functions = array
|
||||
(
|
||||
'add_user' => array
|
||||
(
|
||||
'in' => array('int','struct'),
|
||||
'out' => array()
|
||||
)
|
||||
);
|
||||
|
||||
@ -75,18 +78,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
function delete_group()
|
||||
function delete_group($account_id)
|
||||
{
|
||||
if (!@isset($GLOBALS['HTTP_POST_VARS']['account_id']) || !@$GLOBALS['HTTP_POST_VARS']['account_id'] || $GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
|
||||
{
|
||||
ExecMethod('admin.uiaccounts.list_groups');
|
||||
return False;
|
||||
}
|
||||
|
||||
$account_id = intval($GLOBALS['HTTP_POST_VARS']['account_id']);
|
||||
|
||||
$GLOBALS['phpgw']->db->lock(
|
||||
Array(
|
||||
$GLOBALS['phpgw']->db->lock(array
|
||||
(
|
||||
'phpgw_accounts',
|
||||
'phpgw_acl'
|
||||
)
|
||||
@ -113,12 +113,7 @@
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->accounts->delete($account_id);
|
||||
|
||||
$GLOBALS['phpgw']->db->unlock();
|
||||
|
||||
Header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
|
||||
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
|
||||
exit;
|
||||
}
|
||||
|
||||
function delete_user()
|
||||
@ -171,15 +166,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
function add_group()
|
||||
function add_group($values)
|
||||
{
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',4,'admin'))
|
||||
{
|
||||
ExecMethod('admin.uiaccounts.list_groups');
|
||||
return False;
|
||||
}
|
||||
|
||||
$temp_users = ($GLOBALS['HTTP_POST_VARS']['account_user']?$GLOBALS['HTTP_POST_VARS']['account_user']:Array());
|
||||
$temp_users = ($values['account_user']?$values['account_user']:Array());
|
||||
$account_user = Array();
|
||||
@reset($temp_users);
|
||||
while(list($key,$user_id) = each($temp_users))
|
||||
@ -188,7 +177,7 @@
|
||||
}
|
||||
@reset($account_user);
|
||||
|
||||
$group_permissions = ($GLOBALS['HTTP_POST_VARS']['account_apps']?$GLOBALS['HTTP_POST_VARS']['account_apps']:Array());
|
||||
$group_permissions = ($values['account_apps']?$values['account_apps']:Array());
|
||||
$account_apps = Array();
|
||||
@reset($group_permissions);
|
||||
while(list($key,$value) = each($group_permissions))
|
||||
@ -200,31 +189,30 @@
|
||||
}
|
||||
@reset($account_apps);
|
||||
|
||||
$group_info = Array(
|
||||
'account_id' => ($GLOBALS['HTTP_POST_VARS']['account_id']?intval($GLOBALS['HTTP_POST_VARS']['account_id']):0),
|
||||
'account_name' => ($GLOBALS['HTTP_POST_VARS']['account_name']?$GLOBALS['HTTP_POST_VARS']['account_name']:''),
|
||||
$group_info = Array
|
||||
(
|
||||
'account_id' => ($values['account_id']?intval($values['account_id']):0),
|
||||
'account_name' => ($values['account_name']?$values['account_name']:''),
|
||||
'account_user' => $account_user,
|
||||
'account_apps' => $account_apps
|
||||
);
|
||||
|
||||
$this->validate_group($group_info);
|
||||
|
||||
$GLOBALS['phpgw']->db->lock(
|
||||
Array(
|
||||
'phpgw_accounts',
|
||||
'phpgw_nextid',
|
||||
'phpgw_preferences',
|
||||
'phpgw_sessions',
|
||||
'phpgw_acl',
|
||||
'phpgw_applications',
|
||||
'phpgw_app_sessions',
|
||||
'phpgw_hooks'
|
||||
)
|
||||
);
|
||||
$GLOBALS['phpgw']->db->lock(array
|
||||
(
|
||||
'phpgw_accounts',
|
||||
'phpgw_nextid',
|
||||
'phpgw_preferences',
|
||||
'phpgw_sessions',
|
||||
'phpgw_acl',
|
||||
'phpgw_applications',
|
||||
'phpgw_app_sessions',
|
||||
'phpgw_hooks'
|
||||
));
|
||||
|
||||
$group = CreateObject('phpgwapi.accounts',$group_info['account_id'],'g');
|
||||
$group->acct_type = 'g';
|
||||
$account_info = array(
|
||||
$account_info = array
|
||||
(
|
||||
'account_type' => 'g',
|
||||
'account_lid' => $group_info['account_name'],
|
||||
'account_passwd' => '',
|
||||
@ -286,11 +274,7 @@
|
||||
{
|
||||
$cd = 37;
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->db->unlock();
|
||||
|
||||
ExecMethod('admin.uiaccounts.list_groups');
|
||||
return False;
|
||||
}
|
||||
|
||||
function add_user()
|
||||
@ -348,15 +332,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function edit_group()
|
||||
function edit_group($values)
|
||||
{
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
|
||||
{
|
||||
ExecMethod('admin.uiaccounts.list_groups');
|
||||
return False;
|
||||
$error[] = lang('no permission to create groups');
|
||||
}
|
||||
|
||||
$temp_users = ($GLOBALS['HTTP_POST_VARS']['account_user']?$GLOBALS['HTTP_POST_VARS']['account_user']:Array());
|
||||
$temp_users = ($values['account_user']?$values['account_user']:Array());
|
||||
$account_user = Array();
|
||||
@reset($temp_users);
|
||||
while($temp_users && list($key,$user_id) = each($temp_users))
|
||||
@ -365,7 +348,7 @@
|
||||
}
|
||||
@reset($account_user);
|
||||
|
||||
$group_permissions = ($GLOBALS['HTTP_POST_VARS']['account_apps']?$GLOBALS['HTTP_POST_VARS']['account_apps']:Array());
|
||||
$group_permissions = ($values['account_apps']?$values['account_apps']:Array());
|
||||
$account_apps = Array();
|
||||
@reset($group_permissions);
|
||||
while(list($key,$value) = each($group_permissions))
|
||||
@ -378,14 +361,12 @@
|
||||
@reset($account_apps);
|
||||
|
||||
$group_info = Array(
|
||||
'account_id' => ($GLOBALS['HTTP_POST_VARS']['account_id']?intval($GLOBALS['HTTP_POST_VARS']['account_id']):0),
|
||||
'account_name' => ($GLOBALS['HTTP_POST_VARS']['account_name']?$GLOBALS['HTTP_POST_VARS']['account_name']:''),
|
||||
'account_id' => ($values['account_id']?intval($values['account_id']):0),
|
||||
'account_name' => ($values['account_name']?$values['account_name']:''),
|
||||
'account_user' => $account_user,
|
||||
'account_apps' => $account_apps
|
||||
);
|
||||
|
||||
$this->validate_group($group_info);
|
||||
|
||||
// Lock tables
|
||||
$GLOBALS['phpgw']->db->lock(
|
||||
Array(
|
||||
@ -514,9 +495,6 @@
|
||||
*/
|
||||
|
||||
$GLOBALS['phpgw']->db->unlock();
|
||||
|
||||
ExecMethod('admin.uiaccounts.list_groups');
|
||||
return False;
|
||||
}
|
||||
|
||||
function edit_user()
|
||||
@ -605,38 +583,38 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
function validate_group($group_info)
|
||||
function validate_group($values)
|
||||
{
|
||||
$errors = Array();
|
||||
|
||||
$group = CreateObject('phpgwapi.accounts',$group_info['account_id'],'g');
|
||||
$group = CreateObject('phpgwapi.accounts',$values['account_id'],'g');
|
||||
$group->read_repository();
|
||||
|
||||
if(!$group_info['account_name'])
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',4,'admin'))
|
||||
{
|
||||
$errors[] = lang('You must enter a group name.');
|
||||
$error[] = lang('no permission to create groups');
|
||||
}
|
||||
|
||||
if($group_info['account_name'] != $group->id2name($group_info['account_id']))
|
||||
if(!$values['account_name'])
|
||||
{
|
||||
if ($group->exists($group_info['account_name']))
|
||||
$error[] = lang('You must enter a group name.');
|
||||
}
|
||||
|
||||
if($values['account_name'] != $group->id2name($values['account_id']))
|
||||
{
|
||||
if ($group->exists($values['account_name']))
|
||||
{
|
||||
$errors[] = lang('Sorry, that group name has already been taken.');
|
||||
$error[] = lang('Sorry, that group name has already been taken.');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (preg_match ("/\D/", $account_file_space_number))
|
||||
{
|
||||
$errors[] = lang ('File space must be an integer');
|
||||
$error[] = lang ('File space must be an integer');
|
||||
}
|
||||
*/
|
||||
if(count($errors))
|
||||
if(is_array($error))
|
||||
{
|
||||
$ui = createobject('admin.uiaccounts');
|
||||
$ui->create_edit_group($group_info,$errors);
|
||||
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
|
||||
exit;
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,27 +2,28 @@
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - account administration *
|
||||
* http://www.phpgroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* Written by coreteam <phpgroupware-developers@gnu.org> *
|
||||
* ----------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class uiaccounts
|
||||
{
|
||||
var $public_functions = array(
|
||||
'list_groups' => True,
|
||||
'list_users' => True,
|
||||
'add_group' => True,
|
||||
'add_user' => True,
|
||||
'delete_group' => True,
|
||||
'delete_user' => True,
|
||||
'edit_user' => True,
|
||||
'edit_group' => True,
|
||||
'view_user' => True,
|
||||
var $public_functions = array
|
||||
(
|
||||
'list_groups' => True,
|
||||
'list_users' => True,
|
||||
'add_group' => True,
|
||||
'add_user' => True,
|
||||
'delete_group' => True,
|
||||
'delete_user' => True,
|
||||
'edit_user' => True,
|
||||
'edit_group' => True,
|
||||
'view_user' => True,
|
||||
'group_manager' => True
|
||||
);
|
||||
|
||||
@ -31,8 +32,11 @@
|
||||
|
||||
function uiaccounts()
|
||||
{
|
||||
$this->bo = createobject('admin.boaccounts');
|
||||
$this->nextmatchs = createobject('phpgwapi.nextmatchs');
|
||||
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
|
||||
|
||||
$this->bo = createobject('admin.boaccounts');
|
||||
$this->nextmatchs = createobject('phpgwapi.nextmatchs');
|
||||
|
||||
@set_time_limit(300);
|
||||
}
|
||||
|
||||
@ -48,26 +52,18 @@
|
||||
{
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',1,'admin'))
|
||||
{
|
||||
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php'));
|
||||
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.mainscreen'));
|
||||
}
|
||||
|
||||
$query = (isset($_POST['query'])?$_POST['query']:'');
|
||||
|
||||
$GLOBALS['cd'] = ($_GET['cd']?$_GET['cd']:0);
|
||||
|
||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('administration') . ': ' . lang('list groups');
|
||||
|
||||
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$p->set_file(
|
||||
array(
|
||||
'groups' => 'groups.tpl'
|
||||
)
|
||||
);
|
||||
$p->set_block('groups','list','list');
|
||||
$p->set_block('groups','row','row');
|
||||
$p->set_block('groups','row_empty','row_empty');
|
||||
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data','groups',
|
||||
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'search_field',
|
||||
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'nextmatchs'));
|
||||
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',2,'admin'))
|
||||
{
|
||||
@ -80,99 +76,98 @@
|
||||
$total = $GLOBALS['phpgw']->accounts->total;
|
||||
}
|
||||
|
||||
$url = $GLOBALS['phpgw']->link('/index.php');
|
||||
|
||||
$var = Array(
|
||||
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
||||
'left_next_matchs' => $this->nextmatchs->left('/index.php',$start,$total,'menuaction=admin.uiaccounts.list_groups'),
|
||||
'right_next_matchs' => $this->nextmatchs->right('/admin/groups.php',$start,$total,'menuaction=admin.uiaccounts.list_groups'),
|
||||
'lang_groups' => lang('user groups'),
|
||||
'sort_name' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('name'),'menuaction=admin.uiaccounts.list_groups'),
|
||||
'header_edit' => lang('Edit'),
|
||||
'header_delete' => lang('Delete'),
|
||||
'lang_done' => lang('Done'),
|
||||
'doneurl' => $GLOBALS['phpgw']->link('/admin/index.php')
|
||||
$group_header = array
|
||||
(
|
||||
'sort_name' => $this->nextmatchs->show_sort_order(array
|
||||
(
|
||||
'sort' => $sort,
|
||||
'var' => 'account_lid',
|
||||
'order' => $order,
|
||||
'extra' => 'menuaction=admin.uiaccounts.list_groups'
|
||||
)),
|
||||
'lang_name' => lang('name'),
|
||||
'lang_edit' => lang('edit'),
|
||||
'lang_delete' => lang('delete'),
|
||||
'lang_sort_statustext' => lang('sort the entries')
|
||||
);
|
||||
$p->set_var($var);
|
||||
|
||||
if (!count($account_info) || !$total)
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',8,'admin'))
|
||||
{
|
||||
$p->set_var('message',lang('No matches found'));
|
||||
$p->parse('rows','row_empty',True);
|
||||
$can_view = True;
|
||||
}
|
||||
else
|
||||
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
|
||||
{
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',8,'admin'))
|
||||
{
|
||||
$can_view = True;
|
||||
}
|
||||
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
|
||||
{
|
||||
$can_edit = True;
|
||||
}
|
||||
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
|
||||
{
|
||||
$can_delete = True;
|
||||
}
|
||||
|
||||
while (list($null,$account) = each($account_info))
|
||||
{
|
||||
$tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
||||
$var = Array(
|
||||
'tr_color' => $tr_color,
|
||||
'group_name' => (!$account['account_lid']?' ':$account['account_lid']),
|
||||
'delete_link' => $this->row_action('delete','group',$account['account_id'])
|
||||
);
|
||||
$p->set_var($var);
|
||||
|
||||
if ($can_edit)
|
||||
{
|
||||
$p->set_var('edit_link',$this->row_action('edit','group',$account['account_id']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$p->set_var('edit_link',' ');
|
||||
}
|
||||
|
||||
if ($can_delete)
|
||||
{
|
||||
$p->set_var('delete_link',$this->row_action('delete','group',$account['account_id']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$p->set_var('delete_link',' ');
|
||||
}
|
||||
|
||||
$p->fp('rows','row',True);
|
||||
|
||||
}
|
||||
$can_edit = True;
|
||||
}
|
||||
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
|
||||
{
|
||||
$can_delete = True;
|
||||
}
|
||||
|
||||
while (list($null,$account) = each($account_info))
|
||||
{
|
||||
$group_data[] = Array
|
||||
(
|
||||
'edit_url' => ($can_edit?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_group&account_id=' . $account['account_id']):''),
|
||||
'lang_edit' => ($can_edit?lang('edit'):''),
|
||||
'lang_edit_statustext' => ($can_edit?lang('edit this group'):''),
|
||||
'group_name' => (!$account['account_lid']?'':$account['account_lid']),
|
||||
'delete_url' => ($can_delete?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_group&account_id=' . $account['account_id']):''),
|
||||
'lang_delete_statustext' => ($can_delete?lang('delete this group'):''),
|
||||
'lang_delete' => ($can_delete?lang('delete'):'')
|
||||
);
|
||||
}
|
||||
$var = Array(
|
||||
'new_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.add_group'),
|
||||
'search_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')
|
||||
);
|
||||
$p->set_var($var);
|
||||
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',4,'admin'))
|
||||
{
|
||||
$p->set_var('input_add','<input type="submit" value="' . lang('Add') . '">');
|
||||
$add_access = 'yes';
|
||||
}
|
||||
|
||||
$group_add = array
|
||||
(
|
||||
'lang_add' => lang('add'),
|
||||
'lang_add_statustext' => lang('add a group'),
|
||||
'add_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_group'),
|
||||
'lang_done' => lang('done'),
|
||||
'lang_done_statustext' => lang('return to admin mainscreen'),
|
||||
'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.mainscreen'),
|
||||
'add_access' => $add_access,
|
||||
);
|
||||
|
||||
if (! $GLOBALS['phpgw']->acl->check('group_access',2,'admin'))
|
||||
{
|
||||
$p->set_var('input_search',lang('Search') . ' <input name="query">');
|
||||
$search_access = 'yes';
|
||||
}
|
||||
|
||||
$p->pfp('out','list');
|
||||
$data = array
|
||||
(
|
||||
'start_record' => $start,
|
||||
'record_limit' => $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
|
||||
'num_records' => count($account_info),
|
||||
'all_records' => $total,
|
||||
'nextmatchs_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
|
||||
'nextmatchs_img_path' => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
|
||||
'select_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
|
||||
'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' => $query,
|
||||
'lang_search' => lang('search'),
|
||||
'lang_groups' => lang('user groups'),
|
||||
'group_header' => $group_header,
|
||||
'group_data' => $group_data,
|
||||
'group_add' => $group_add,
|
||||
'search_access' => $search_access
|
||||
);
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('group_list' => $data));
|
||||
}
|
||||
|
||||
function list_users($param_cd='')
|
||||
{
|
||||
if ($GLOBALS['phpgw']->acl->check('account_access',1,'admin'))
|
||||
{
|
||||
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php'));
|
||||
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.mainscreen'));
|
||||
}
|
||||
|
||||
if($param_cd)
|
||||
@ -182,7 +177,7 @@
|
||||
|
||||
$GLOBALS['query'] = (isset($GLOBALS['HTTP_POST_VARS']['query'])?$GLOBALS['HTTP_POST_VARS']['query']:'');
|
||||
$start = (isset($GLOBALS['HTTP_POST_VARS']['start'])?intval($GLOBALS['HTTP_POST_VARS']['start']):'');
|
||||
=======
|
||||
|
||||
if(isset($_GET['order']))
|
||||
{
|
||||
$order = $_GET['order'];
|
||||
@ -324,23 +319,6 @@
|
||||
$p->pfp('out','list');
|
||||
}
|
||||
|
||||
function add_group()
|
||||
{
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',4,'admin'))
|
||||
{
|
||||
$this->list_groups();
|
||||
return False;
|
||||
}
|
||||
|
||||
$group_info = Array(
|
||||
'account_id' => $_GET['account_id'],
|
||||
'account_name' => '',
|
||||
'account_user' => Array(),
|
||||
'account_apps' => Array()
|
||||
);
|
||||
$this->create_edit_group($group_info);
|
||||
}
|
||||
|
||||
function add_user()
|
||||
{
|
||||
if ($GLOBALS['phpgw']->acl->check('account_access',4,'admin'))
|
||||
@ -355,81 +333,58 @@
|
||||
|
||||
function delete_group()
|
||||
{
|
||||
if ($_POST['no'] || $_POST['yes'] || !@isset($_GET['account_id']) || !@$_GET['account_id'] || $GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
|
||||
$account_id = get_var('account_id',array('POST','GET'));
|
||||
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
|
||||
{
|
||||
if ($_POST['yes'])
|
||||
{
|
||||
$this->bo->delete_group();
|
||||
}
|
||||
$this->list_groups();
|
||||
return False;
|
||||
}
|
||||
|
||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
if ($account_id && get_var('confirm',array('POST')))
|
||||
{
|
||||
$this->bo->delete_group($account_id);
|
||||
$this->list_groups();
|
||||
return False;
|
||||
}
|
||||
|
||||
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$p->set_file(
|
||||
Array(
|
||||
'body' => 'delete_common.tpl',
|
||||
'message_row' => 'message_row.tpl',
|
||||
'form_button' => 'form_button_script.tpl'
|
||||
)
|
||||
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'app_delete'));
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('administration') . ': ' . lang('delete group');
|
||||
|
||||
$data = array
|
||||
(
|
||||
'delete_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_group&account_id=' . $account_id),
|
||||
'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
|
||||
'lang_yes' => lang('Yes'),
|
||||
'lang_no' => lang('No'),
|
||||
'lang_yes_statustext' => lang('Delete the entry'),
|
||||
'lang_no_statustext' => lang('Back to the list'),
|
||||
'lang_error_msg' => lang('are you sure you want to delete this group ?')
|
||||
);
|
||||
|
||||
$p->set_var('message_display',lang('Are you sure you want to delete this group ?'));
|
||||
$p->parse('messages','message_row');
|
||||
|
||||
$old_group_list = $GLOBALS['phpgw']->acl->get_ids_for_location(intval($_GET['account_id']),1,'phpgw_group');
|
||||
$old_group_list = $GLOBALS['phpgw']->acl->get_ids_for_location(intval($account_id),1,'phpgw_group');
|
||||
|
||||
if($old_group_list)
|
||||
{
|
||||
$group_name = $GLOBALS['phpgw']->accounts->id2name($_GET['account_id']);
|
||||
|
||||
$p->set_var('message_display','<br>');
|
||||
$p->parse('messages','message_row',True);
|
||||
$group_name = $GLOBALS['phpgw']->accounts->id2name($account_id);
|
||||
|
||||
$user_list = '';
|
||||
while (list(,$id) = each($old_group_list))
|
||||
{
|
||||
$user_list .= '<a href="' . $GLOBALS['phpgw']->link('/index.php',
|
||||
Array(
|
||||
'menuaction' => 'admin.uiaccounts.edit_user',
|
||||
'account_id' => $id
|
||||
)
|
||||
) . '">' . $GLOBALS['phpgw']->common->grab_owner_name($id) . '</a><br>';
|
||||
$data['user_list'][] = array
|
||||
(
|
||||
'user_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_user&account_id=' . $id),
|
||||
'user_name' => $GLOBALS['phpgw']->common->grab_owner_name($id),
|
||||
'lang_user_url_statustext' => lang('edit user')
|
||||
);
|
||||
}
|
||||
$p->set_var('message_display',$user_list);
|
||||
$p->parse('messages','message_row',True);
|
||||
|
||||
$p->set_var('message_display',lang("Sorry, the above users are still a member of the group x",$group_name)
|
||||
. '.<br>' . lang('They must be removed before you can continue'). '.<br>' . lang('Remove all users from this group').'?');
|
||||
$p->parse('messages','message_row',True);
|
||||
$data['lang_confirm_msg'] = lang('the users bellow are still members of group %1',$group_name) . '. '
|
||||
. lang('they must be removed before you can continue');
|
||||
$data['lang_remove_user'] = lang('Remove all users from this group ?');
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'form_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_group'),
|
||||
'hidden_vars' => '<input type="hidden" name="account_id" value="'.$_GET['account_id'].'">',
|
||||
'yes' => lang('Yes'),
|
||||
'no' => lang('No')
|
||||
);
|
||||
$p->set_var($var);
|
||||
/*
|
||||
$p->parse('yes','form_button');
|
||||
|
||||
|
||||
$var = Array(
|
||||
'submit_button' => lang('Submit'),
|
||||
'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
|
||||
'action_text_button' => ' '.lang('No'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('no','form_button');
|
||||
*/
|
||||
$p->pparse('phpgw_body','body');
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
|
||||
}
|
||||
|
||||
function delete_user()
|
||||
@ -474,9 +429,53 @@
|
||||
$t->pparse('out','form');
|
||||
}
|
||||
|
||||
function edit_group($cd='',$account_id='')
|
||||
function edit_group()
|
||||
{
|
||||
if ($GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
|
||||
$account_id = get_var('account_id',array('POST','GET'));
|
||||
$values = get_var('values',array('POST'));
|
||||
$account_user = get_var('account_user',array('POST'));
|
||||
$account_apps = get_var('account_apps',array('POST'));
|
||||
|
||||
if ($values['save'])
|
||||
{
|
||||
$error = $this->bo->validate_group($values);
|
||||
|
||||
if (is_array($error))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_array($account_user))
|
||||
{
|
||||
$values['account_user'] = $account_user;
|
||||
}
|
||||
|
||||
if (is_array($account_apps))
|
||||
{
|
||||
$values['account_apps'] = $account_apps;
|
||||
}
|
||||
|
||||
if ($values['account_id'])
|
||||
{
|
||||
$this->bo->edit_group($values);
|
||||
$account_id = $values['account_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->bo->add_group($values);
|
||||
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$account_id && $GLOBALS['phpgw']->acl->check('group_access',4,'admin'))
|
||||
{
|
||||
$this->list_groups();
|
||||
return False;
|
||||
}
|
||||
|
||||
if ($account_id && $GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
|
||||
{
|
||||
$this->list_groups();
|
||||
return False;
|
||||
@ -486,27 +485,145 @@
|
||||
settype($cd,'integer');
|
||||
$cd = ($_GET['cd']?$_GET['cd']:intval($cdid));
|
||||
|
||||
$accountid = $account_id;
|
||||
settype($account_id,'integer');
|
||||
$account_id = ($_GET['account_id']?$_GET['account_id']:intval($accountid));
|
||||
|
||||
// todo
|
||||
// not needed if i use the same file for new groups too
|
||||
if (! $account_id)
|
||||
if ($account_id)
|
||||
{
|
||||
$this->list_groups();
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_info = Array(
|
||||
'account_id' => intval($_GET['account_id']),
|
||||
'account_name' => $GLOBALS['phpgw']->accounts->id2name($_GET['account_id']),
|
||||
'account_user' => $this->bo->load_group_users($_GET['account_id']),
|
||||
'account_apps' => $this->bo->load_group_apps($_GET['account_id'])
|
||||
$group_info = Array
|
||||
(
|
||||
'account_name' => $GLOBALS['phpgw']->accounts->id2name($account_id),
|
||||
'account_user' => $this->bo->load_group_users($account_id),
|
||||
'account_apps' => $this->bo->load_group_apps($account_id)
|
||||
);
|
||||
|
||||
$this->create_edit_group($group_info);
|
||||
}
|
||||
|
||||
$apps_with_acl = Array
|
||||
(
|
||||
'addressbook' => True,
|
||||
'bookmarks' => True,
|
||||
'calendar' => True,
|
||||
'filemanager' => True,
|
||||
'img' => True,
|
||||
'infolog' => True,
|
||||
'inv' => True,
|
||||
'netsaint' => True,
|
||||
'notes' => True,
|
||||
'phonelog' => True,
|
||||
'phpwebhosting' => True,
|
||||
'projects' => True,
|
||||
'todo' => True,
|
||||
'tts' => True
|
||||
);
|
||||
|
||||
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data','groups'));
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('administration') . ': ' . ((intval($account_id) > 0)?lang('edit group'):lang('add group'));
|
||||
|
||||
$accounts = CreateObject('phpgwapi.accounts',$account_id,'u');
|
||||
$account_list = $accounts->get_list('accounts');
|
||||
$account_num = count($account_list);
|
||||
|
||||
$user_list = '';
|
||||
while (list($key,$entry) = each($account_list))
|
||||
{
|
||||
$user_list[] = array
|
||||
(
|
||||
'account_id' => $entry['account_id'],
|
||||
'account_name' => $GLOBALS['phpgw']->common->display_fullname($entry['account_lid'],$entry['account_firstname'],
|
||||
$entry['account_lastname']),
|
||||
'selected' => $group_info['account_user'][intval($entry['account_id'])]
|
||||
);
|
||||
}
|
||||
|
||||
$group_repository = $accounts->read_repository();
|
||||
if (!$group_repository['file_space'])
|
||||
{
|
||||
$group_repository['file_space'] = $GLOBALS['phpgw_info']['server']['vfs_default_account_size_number'] . "-" . $GLOBALS['phpgw_info']['server']['vfs_default_account_size_type'];
|
||||
}
|
||||
/*
|
||||
$file_space_array = explode ('-', $group_repository['file_space']);
|
||||
$account_file_space_types = array ('gb', 'mb', 'kb', 'b');
|
||||
while (list ($num, $type) = each ($account_file_space_types))
|
||||
{
|
||||
$account_file_space_select .= '<option value="'.$type.'"'.($type==$file_space_array[1]?' selected':'').'>'.strtoupper ($type).'</option>'."\n";
|
||||
}
|
||||
$p->set_var ('lang_file_space', lang('File space'));
|
||||
$p->set_var ('account_file_space', '<input type=text name="account_file_space_number" value="'.trim($file_space_array[0]).'" size="7">');
|
||||
$p->set_var ('account_file_space_select','<select name="account_file_space_type">'."\n".$account_file_space_select.'</select>'."\n");
|
||||
*/
|
||||
|
||||
reset($GLOBALS['phpgw_info']['apps']);
|
||||
$sorted_apps = $GLOBALS['phpgw_info']['apps'];
|
||||
@asort($sorted_apps);
|
||||
@reset($sorted_apps);
|
||||
while ($permission = each($sorted_apps))
|
||||
{
|
||||
if ($permission[1]['enabled'] && $permission[1]['status'] != 3)
|
||||
{
|
||||
$perm_display[] = array
|
||||
(
|
||||
$permission[0],
|
||||
$permission[1]['title']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*$perm_html = '<td>'.lang('Application').'</td><td> </td><td>'.lang('ACL').'</td>';
|
||||
$perm_html = '<tr class="th">'.$perm_html.$perm_html."</tr>\n";*/
|
||||
|
||||
for ($i=0;$i < count($perm_display);$i++)
|
||||
{
|
||||
$app = $perm_display[$i][0];
|
||||
/*$perm_html .= '<td width="40%">' . $perm_display[$i][1] . '</td>'
|
||||
. '<td width="5%"><input type="checkbox" name="account_apps['
|
||||
. $perm_display[$i][0] . ']" value="True"'.($group_info['account_apps'][$app]?' checked':'').'></td><td width="5%" align="center">'
|
||||
. ($apps_with_acl[$app] && $group_info['account_id']?'<a href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$app.'&owner='.$group_info['account_id'])
|
||||
. '" target="_blank"><img src="'.$GLOBALS['phpgw']->common->image('admin','dot').'" border="0" hspace="3" align="absmiddle" alt="'
|
||||
. lang('Grant Access').'"></a>':' ').'</td>'.($i & 1?'</tr>':'')."\n";*/
|
||||
|
||||
$app_list[] = array
|
||||
(
|
||||
'app_name' => $perm_display[$i][1],
|
||||
'checkbox_name' => 'account_apps[' . $perm_display[$i][0] . ']',
|
||||
'checked' => ($group_info['account_apps'][$app]?'checked':''),
|
||||
'acl_url' => ($apps_with_acl[$app] && $account_id?$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$app.'&owner='.$account_id):''),
|
||||
'acl_img' => $GLOBALS['phpgw']->common->image('admin','dot'),
|
||||
'img_name' => lang('Grant Access')
|
||||
);
|
||||
}
|
||||
|
||||
/*if($i & 1)
|
||||
{
|
||||
$perm_html .= '<td colspan="4"> </td></tr>';
|
||||
}*/
|
||||
|
||||
$link_data = array
|
||||
(
|
||||
'menuaction' => 'admin.uiaccounts.edit_group',
|
||||
'account_id' => $account_id
|
||||
);
|
||||
|
||||
$data = array
|
||||
(
|
||||
'edit_url' => $GLOBALS['phpgw']->link('/index.php',$link_data),
|
||||
'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
|
||||
'account_id' => $group_info['account_id'],
|
||||
'lang_account_name' => lang('group name'),
|
||||
'value_account_name' => $group_info['account_name'],
|
||||
'lang_include_user' => lang('select users for inclusion'),
|
||||
'error' => (!$_errors?'':$GLOBALS['phpgw']->common->error_list($_errors)),
|
||||
'select_size' => ($account_num < 5?$account_num:5),
|
||||
'user_list' => $user_list,
|
||||
'lang_permissions' => lang('permissions this group has'),
|
||||
'lang_application' => lang('application'),
|
||||
'lang_acl' => lang('acl'),
|
||||
'lang_done' => lang('done'),
|
||||
'lang_save' => lang('save'),
|
||||
'app_list' => $app_list,
|
||||
'account_id' => $account_id
|
||||
);
|
||||
|
||||
/* create the menu on the left, if needed
|
||||
$p->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','group_manager')); */
|
||||
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('group_edit' => $data));
|
||||
}
|
||||
|
||||
function edit_user($cd='',$account_id='')
|
||||
@ -729,137 +846,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function create_edit_group($group_info,$_errors='')
|
||||
{
|
||||
$apps_with_acl = Array(
|
||||
'addressbook' => True,
|
||||
'todo' => True,
|
||||
'calendar' => True,
|
||||
'notes' => True,
|
||||
'projects' => True,
|
||||
'phonelog' => True,
|
||||
'infolog' => True,
|
||||
'filemanager' => True,
|
||||
'phpwebhosting' => True,
|
||||
'tts' => True,
|
||||
'bookmarks' => True,
|
||||
'img' => True,
|
||||
'netsaint' => True,
|
||||
'inv' => True
|
||||
);
|
||||
|
||||
$sbox = createobject('phpgwapi.sbox');
|
||||
|
||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
|
||||
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$p->set_file(
|
||||
Array(
|
||||
'form' => 'group_form.tpl'
|
||||
)
|
||||
);
|
||||
|
||||
$accounts = CreateObject('phpgwapi.accounts',$group_info['account_id'],'u');
|
||||
$account_list = $accounts->get_list('accounts');
|
||||
$account_num = count($account_list);
|
||||
|
||||
$user_list = '';
|
||||
while (list($key,$entry) = each($account_list))
|
||||
{
|
||||
$user_list .= '<option value="' . $entry['account_id'] . '"'
|
||||
. $group_info['account_user'][intval($entry['account_id'])] . '>'
|
||||
. $GLOBALS['phpgw']->common->display_fullname(
|
||||
$entry['account_lid'],
|
||||
$entry['account_firstname'],
|
||||
$entry['account_lastname'])
|
||||
. '</option>'."\n";
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'form_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.boaccounts.'.($group_info['account_id']?'edit':'add').'_group'),
|
||||
'cancel_action' => $GLOBALS['phpgw']->link('/admin/index.php'),
|
||||
'hidden_vars' => '<input type="hidden" name="account_id" value="' . $group_info['account_id'] . '">',
|
||||
'lang_group_name' => lang('group name'),
|
||||
'group_name_value' => $group_info['account_name'],
|
||||
'lang_include_user' => lang('Select users for inclusion'),
|
||||
'error' => (!$_errors?'':'<center>'.$GLOBALS['phpgw']->common->error_list($_errors).'</center>'),
|
||||
'select_size' => ($account_num < 5?$account_num:5),
|
||||
'user_list' => $user_list,
|
||||
'lang_permissions' => lang('Permissions this group has'),
|
||||
'lang_cancel' => lang('Cancel')
|
||||
);
|
||||
$p->set_var($var);
|
||||
|
||||
$group_repository = $accounts->read_repository ();
|
||||
if (!$group_repository['file_space'])
|
||||
{
|
||||
$group_repository['file_space'] = $GLOBALS['phpgw_info']['server']['vfs_default_account_size_number'] . "-" . $GLOBALS['phpgw_info']['server']['vfs_default_account_size_type'];
|
||||
}
|
||||
/*
|
||||
$file_space_array = explode ('-', $group_repository['file_space']);
|
||||
$account_file_space_types = array ('gb', 'mb', 'kb', 'b');
|
||||
while (list ($num, $type) = each ($account_file_space_types))
|
||||
{
|
||||
$account_file_space_select .= '<option value="'.$type.'"'.($type==$file_space_array[1]?' selected':'').'>'.strtoupper ($type).'</option>'."\n";
|
||||
}
|
||||
$p->set_var ('lang_file_space', lang('File space'));
|
||||
$p->set_var ('account_file_space', '<input type=text name="account_file_space_number" value="'.trim($file_space_array[0]).'" size="7">');
|
||||
$p->set_var ('account_file_space_select','<select name="account_file_space_type">'."\n".$account_file_space_select.'</select>'."\n");
|
||||
*/
|
||||
|
||||
reset($GLOBALS['phpgw_info']['apps']);
|
||||
$sorted_apps = $GLOBALS['phpgw_info']['apps'];
|
||||
@asort($sorted_apps);
|
||||
@reset($sorted_apps);
|
||||
while ($permission = each($sorted_apps))
|
||||
{
|
||||
if ($permission[1]['enabled'] && $permission[1]['status'] != 3)
|
||||
{
|
||||
$perm_display[] = Array(
|
||||
$permission[0],
|
||||
$permission[1]['title']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$perm_html = '<td>'.lang('Application').'</td><td> </td><td>'.lang('ACL').'</td>';
|
||||
$perm_html = '<tr class="th">'.$perm_html.$perm_html."</tr>\n";
|
||||
|
||||
$tr_color = $GLOBALS['phpgw_info']['theme']['row_off'];
|
||||
for ($i=0;$i < count($perm_display);$i++)
|
||||
{
|
||||
$app = $perm_display[$i][0];
|
||||
if(!($i & 1))
|
||||
{
|
||||
$tr_color = $this->nextmatchs->alternate_row_color();
|
||||
$perm_html .= '<tr class="'.$tr_color.'">';
|
||||
}
|
||||
$perm_html .= '<td width="40%">' . $perm_display[$i][1] . '</td>'
|
||||
. '<td width="5%"><input type="checkbox" name="account_apps['
|
||||
. $perm_display[$i][0] . ']" value="True"'.($group_info['account_apps'][$app]?' checked':'').'></td><td width="5%" align="center">'
|
||||
. ($apps_with_acl[$app] && $group_info['account_id']?'<a href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$app.'&owner='.$group_info['account_id'])
|
||||
. '" target="_blank"><img src="'.$GLOBALS['phpgw']->common->image('admin','dot').'" border="0" hspace="3" align="absmiddle" alt="'
|
||||
. lang('Grant Access').'"></a>':' ').'</td>'.($i & 1?'</tr>':'')."\n";
|
||||
}
|
||||
if($i & 1)
|
||||
{
|
||||
$perm_html .= '<td colspan="4"> </td></tr>';
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'permissions_list' => $perm_html,
|
||||
'lang_submit_button' => lang('submit changes')
|
||||
);
|
||||
$p->set_var($var);
|
||||
|
||||
// create the menu on the left, if needed
|
||||
$p->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','group_manager'));
|
||||
|
||||
$p->pfp('out','form');
|
||||
}
|
||||
|
||||
function create_edit_user($_account_id,$_userData='',$_errors='')
|
||||
{
|
||||
$sbox = createobject('phpgwapi.sbox');
|
||||
|
@ -15,7 +15,8 @@
|
||||
class uicategories
|
||||
{
|
||||
var $bo;
|
||||
var $template;
|
||||
var $nextmatchs;
|
||||
var $xslttpl;
|
||||
|
||||
var $start;
|
||||
var $query;
|
||||
@ -27,13 +28,14 @@
|
||||
var $public_functions = array
|
||||
(
|
||||
'index' => True,
|
||||
'add' => True,
|
||||
'edit' => True,
|
||||
'delete' => True
|
||||
);
|
||||
|
||||
function uicategories()
|
||||
{
|
||||
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
|
||||
|
||||
$this->bo = CreateObject('admin.bocategories');
|
||||
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
|
||||
@ -75,34 +77,13 @@
|
||||
$this->bo->save_sessiondata($data);
|
||||
}
|
||||
|
||||
function set_langs()
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
|
||||
$GLOBALS['phpgw']->template->set_var('lang_save',lang('Save'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_sub',lang('Add sub'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_parent',lang('Parent category'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_none',lang('None'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_name',lang('Name'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_descr',lang('Description'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_reset',lang('Clear Form'));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$global_cats = get_var('global_cats',array('POST','GET'));
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
|
||||
$GLOBALS['phpgw']->template->set_file(array('cat_list_t' => 'listcats.tpl'));
|
||||
$GLOBALS['phpgw']->template->set_block('cat_list_t','cat_list');
|
||||
$GLOBALS['phpgw']->template->set_block('cat_list_t','cat_row');
|
||||
|
||||
$this->set_langs();
|
||||
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data','cats',
|
||||
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'search_field',
|
||||
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'nextmatchs'));
|
||||
|
||||
$link_data = array
|
||||
(
|
||||
@ -111,19 +92,14 @@
|
||||
'global_cats' => $global_cats
|
||||
);
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Category list'));
|
||||
|
||||
if ($GLOBALS['appname'])
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang($GLOBALS['appname']) . ' ' . lang('global categories'));
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang($GLOBALS['appname']) . ' ' . lang('global categories') . ': ' . lang('category list');
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Global categories'));
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('global categories') . ': ' . lang('category list');
|
||||
}
|
||||
$GLOBALS['phpgw']->template->set_var('query',$this->query);
|
||||
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php'));
|
||||
|
||||
if (!$global_cats)
|
||||
{
|
||||
@ -132,41 +108,47 @@
|
||||
|
||||
$categories = $this->bo->get_list($global_cats);
|
||||
|
||||
$left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->cats->total_records,$link_data);
|
||||
$right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->cats->total_records,$link_data);
|
||||
$GLOBALS['phpgw']->template->set_var('left',$left);
|
||||
$GLOBALS['phpgw']->template->set_var('right',$right);
|
||||
$cat_header[] = array
|
||||
(
|
||||
'sort_name' => $this->nextmatchs->show_sort_order(array
|
||||
(
|
||||
'sort' => $this->sort,
|
||||
'var' => 'cat_name',
|
||||
'order' => $this->order,
|
||||
'extra' => $link_data
|
||||
)),
|
||||
'lang_add_sub' => lang('add sub'),
|
||||
'lang_name' => lang('name'),
|
||||
'lang_descr' => lang('description'),
|
||||
'lang_edit' => lang('edit'),
|
||||
'lang_delete' => lang('delete'),
|
||||
'lang_sort_statustext' => lang('sort the entries'),
|
||||
'sort_descr' => $this->nextmatchs->show_sort_order(array
|
||||
(
|
||||
'sort' => $this->sort,
|
||||
'var' => 'cat_description',
|
||||
'order' => $this->order,
|
||||
'extra' => $link_data
|
||||
))
|
||||
);
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->cats->total_records,$this->start));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('sort_name',$this->nextmatchs->show_sort_order($this->sort,'cat_name',$this->order,'/index.php',lang('Name'),$link_data));
|
||||
$GLOBALS['phpgw']->template->set_var('sort_description',$this->nextmatchs->show_sort_order($this->sort,'cat_description',$this->order,'/index.php',lang('Description'),$link_data));
|
||||
|
||||
for ($i=0;$i<count($categories);$i++)
|
||||
while (is_array($categories) && list(,$cat) = each($categories))
|
||||
{
|
||||
$tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
||||
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
||||
|
||||
$level = $categories[$i]['level'];
|
||||
$cat_name = $GLOBALS['phpgw']->strip_html($categories[$i]['name']);
|
||||
$level = $cat['level'];
|
||||
$cat_name = $GLOBALS['phpgw']->strip_html($cat['name']);
|
||||
|
||||
$main = 'yes';
|
||||
if ($level > 0)
|
||||
{
|
||||
$space = ' . ';
|
||||
$spaceset = str_repeat($space,$level);
|
||||
$cat_name = $spaceset . $cat_name;
|
||||
$main = 'no';
|
||||
}
|
||||
|
||||
$descr = $GLOBALS['phpgw']->strip_html($categories[$i]['descr']);
|
||||
if (!$descr) { $descr = ' '; }
|
||||
$descr = $GLOBALS['phpgw']->strip_html($cat['descr']);
|
||||
|
||||
if ($level == 0)
|
||||
{
|
||||
$cat_name = '<font color="FF0000"><b>' . $cat_name . '</b></font>';
|
||||
$descr = '<font color="FF0000"><b>' . $descr . '</b></font>';
|
||||
}
|
||||
|
||||
if ($GLOBALS['appname'] && $categories[$i]['app_name'] == 'phpgw')
|
||||
if ($GLOBALS['appname'] && $cat['app_name'] == 'phpgw')
|
||||
{
|
||||
$appendix = ' <' . lang('Global') . '>';
|
||||
}
|
||||
@ -175,22 +157,15 @@
|
||||
$appendix = '';
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var(array
|
||||
(
|
||||
'name' => $cat_name . $appendix,
|
||||
'descr' => $descr
|
||||
));
|
||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||
$link_data['parent'] = $cat['cat_id'];
|
||||
$add_sub_url = $GLOBALS['phpgw']->link('/index.php',$link_data);
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.add';
|
||||
$link_data['parent'] = $categories[$i]['cat_id'];
|
||||
$GLOBALS['phpgw']->template->set_var('add_sub',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_sub_entry',lang('Add sub'));
|
||||
|
||||
if ($GLOBALS['appname'] && $categories[$i]['app_name'] == $GLOBALS['appname'])
|
||||
if ($GLOBALS['appname'] && $cat['app_name'] == $GLOBALS['appname'])
|
||||
{
|
||||
$show_edit_del = True;
|
||||
}
|
||||
elseif(!$GLOBALS['appname'] && $categories[$i]['app_name'] == 'phpgw')
|
||||
elseif(!$GLOBALS['appname'] && $cat['app_name'] == 'phpgw')
|
||||
{
|
||||
$show_edit_del = True;
|
||||
}
|
||||
@ -201,136 +176,85 @@
|
||||
|
||||
if ($show_edit_del)
|
||||
{
|
||||
$link_data['cat_id'] = $categories[$i]['cat_id'];
|
||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||
$GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
|
||||
$link_data['cat_id'] = $cat['cat_id'];
|
||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||
$edit_url = $GLOBALS['phpgw']->link('/index.php',$link_data);
|
||||
$lang_edit = lang('edit');
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.delete';
|
||||
$GLOBALS['phpgw']->template->set_var('delete',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_delete_entry',lang('Delete'));
|
||||
$link_data['menuaction'] = 'admin.uicategories.delete';
|
||||
$delete_url = $GLOBALS['phpgw']->link('/index.php',$link_data);
|
||||
$lang_delete = lang('delete');
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('edit','');
|
||||
$GLOBALS['phpgw']->template->set_var('lang_edit_entry',' ');
|
||||
$GLOBALS['phpgw']->template->set_var('delete','');
|
||||
$GLOBALS['phpgw']->template->set_var('lang_delete_entry',' ');
|
||||
$edit_url = '';
|
||||
$lang_edit = '';
|
||||
$delete_url = '';
|
||||
$lang_delete = '';
|
||||
}
|
||||
$GLOBALS['phpgw']->template->fp('rows','cat_row',True);
|
||||
|
||||
$content[] = array
|
||||
(
|
||||
'name' => $cat_name . $appendix,
|
||||
'descr' => $descr,
|
||||
'date' => $note['date'],
|
||||
'main' => $main,
|
||||
'add_sub_url' => $add_sub_url,
|
||||
'edit_url' => $edit_url,
|
||||
'delete_url' => $delete_url,
|
||||
'lang_add_sub_statustext' => lang('add a subcategory'),
|
||||
'lang_edit_statustext' => lang('edit this category'),
|
||||
'lang_delete_statustext' => lang('delete this category'),
|
||||
'lang_add_sub' => lang('add sub'),
|
||||
'lang_edit' => $lang_edit,
|
||||
'lang_delete' => $lang_delete
|
||||
);
|
||||
}
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.add';
|
||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||
$link_data['parent'] = '';
|
||||
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
|
||||
$this->save_sessiondata();
|
||||
$GLOBALS['phpgw']->template->fp('phpgw_body','cat_list',True);
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$global_cats = get_var('global_cats',array('POST','GET'));
|
||||
$parent = get_var('parent',array('GET'));
|
||||
|
||||
$link_data = array
|
||||
$cat_add[] = array
|
||||
(
|
||||
'menuaction' => 'admin.uicategories.index',
|
||||
'appname' => $GLOBALS['appname'],
|
||||
'global_cats' => $global_cats
|
||||
'lang_add' => lang('add'),
|
||||
'lang_add_statustext' => lang('add a category'),
|
||||
'add_url' => $GLOBALS['phpgw']->link('/index.php',$link_data),
|
||||
'lang_done' => lang('done'),
|
||||
'lang_done_statustext' => lang('return to admin mainscreen'),
|
||||
'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.mainscreen')
|
||||
);
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
$link_data['menuaction'] = 'admin.uicategories.index';
|
||||
|
||||
$this->set_langs();
|
||||
$data = array
|
||||
(
|
||||
'start_record' => $this->start,
|
||||
'record_limit' => $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
|
||||
'num_records' => count($categoris),
|
||||
'all_records' => $this->bo->cats->total_records,
|
||||
'nextmatchs_url' => $GLOBALS['phpgw']->link('/index.php',$link_data),
|
||||
'nextmatchs_img_path' => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
|
||||
'select_url' => $GLOBALS['phpgw']->link('/index.php',$link_data),
|
||||
'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_search' => lang('search'),
|
||||
'cat_header' => $cat_header,
|
||||
'cat_data' => $content,
|
||||
'cat_add' => $cat_add
|
||||
);
|
||||
|
||||
$values = get_var('values',array('POST'));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl'));
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','add');
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','edit');
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','form');
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
|
||||
if ($GLOBALS['appname'])
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Add global category for x',lang($GLOBALS['appname'])));
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Add global category'));
|
||||
}
|
||||
|
||||
if (get_var('submit',array('POST')))
|
||||
{
|
||||
if(is_array($values))
|
||||
{
|
||||
$values['access'] = 'public';
|
||||
}
|
||||
|
||||
$error = $this->bo->check_values($values);
|
||||
if (is_array($error))
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->bo->save_cat($values);
|
||||
$GLOBALS['phpgw']->template->set_var('message',lang('Category %1 has been added !', $values['name']));
|
||||
}
|
||||
}
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.add';
|
||||
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
|
||||
if ($values['parent'])
|
||||
{
|
||||
$parent = $values['parent'];
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formatted_list(array('format' => 'select',
|
||||
'type' => 'all',
|
||||
'selected' => $parent,
|
||||
'globals' => $global_cats)));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('cat_name',$values['name']);
|
||||
$GLOBALS['phpgw']->template->set_var('cat_description',$values['descr']);
|
||||
|
||||
$GLOBALS['phpgw']->template->parse('buttons','add');
|
||||
$GLOBALS['phpgw']->template->fp('phpgw_body','form');
|
||||
$this->save_sessiondata();
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('cat_list' => $data));
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$global_cats = get_var('global_cats',array('POST','GET'));
|
||||
$global_cats = get_var('global_cats',array('POST','GET'));
|
||||
$parent = get_var('parent',array('GET'));
|
||||
$values = get_var('values',array('POST'));
|
||||
|
||||
$link_data = array
|
||||
(
|
||||
'menuaction' => 'admin.uicategories.index',
|
||||
'appname' => $GLOBALS['appname'],
|
||||
'global_cats' => $global_cats
|
||||
);
|
||||
|
||||
if (!$this->cat_id)
|
||||
{
|
||||
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
|
||||
$this->set_langs();
|
||||
|
||||
$values = get_var('values',array('POST'));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl'));
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','add');
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','edit');
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','form');
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
|
||||
if (get_var('submit',array('POST')))
|
||||
if ($values['save'])
|
||||
{
|
||||
if (is_array($values))
|
||||
{
|
||||
@ -341,49 +265,104 @@
|
||||
$error = $this->bo->check_values($values);
|
||||
if (is_array($error))
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
$message = $GLOBALS['phpgw']->common->error_list($error);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->cat_id = $this->bo->save_cat($values);
|
||||
$GLOBALS['phpgw']->template->set_var('message',lang('Category %1 has been updated !',$values['name']));
|
||||
$message = lang('Category %1 has been saved !',$values['name']);
|
||||
}
|
||||
}
|
||||
|
||||
$cats = $this->bo->cats->return_single($this->cat_id);
|
||||
if (!$this->cat_id)
|
||||
{
|
||||
$function = lang('add category');
|
||||
$action = 'add';
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = 'edit';
|
||||
$function = lang('edit category');
|
||||
$cats = $this->bo->cats->return_single($this->cat_id);
|
||||
|
||||
$parent = $cats['parent'];
|
||||
}
|
||||
|
||||
if ($GLOBALS['appname'])
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global category for x',lang($GLOBALS['appname'])));
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang($GLOBALS['appname']) . ' ' . lang('global categories') . ': ' . $function;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('global categories') . ': ' . $function;
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data','cats'));
|
||||
|
||||
if ($GLOBALS['appname'])
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global category for %1',lang($GLOBALS['appname'])));
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global category'));
|
||||
}
|
||||
|
||||
$link_data = array
|
||||
(
|
||||
'menuaction' => 'admin.uicategories.index',
|
||||
'appname' => $GLOBALS['appname'],
|
||||
'global_cats' => $global_cats
|
||||
);
|
||||
|
||||
$data = array
|
||||
(
|
||||
'action' => $action,
|
||||
'done_url' => $GLOBALS['phpgw']->link('/index.php',$link_data),
|
||||
'lang_name' => lang('name'),
|
||||
'lang_descr' => lang('description'),
|
||||
'lang_parent' => lang('parent category'),
|
||||
'old_parent' => $cats['parent'],
|
||||
'lang_save' => lang('save'),
|
||||
'lang_done' => lang('done'),
|
||||
'lang_delete' => lang('delete'),
|
||||
'lang_reset' => lang('reset'),
|
||||
'value_name' => $GLOBALS['phpgw']->strip_html($cats['name']),
|
||||
'value_descr' => $GLOBALS['phpgw']->strip_html($cats['descr']),
|
||||
'message' => $message,
|
||||
'lang_content_statustext' => lang('Enter a description for the category'),
|
||||
'lang_done_statustext' => lang('Back to the list'),
|
||||
'lang_save_statustext' => lang('Save the category'),
|
||||
'lang_no_cat' => lang('no category'),
|
||||
'lang_cat_statustext' => lang('Select the parent category. If this is a main category select NO CATEGORY'),
|
||||
'select_name' => 'values[parent]',
|
||||
'cat_list' => $this->bo->cats->formatted_xslt_list(array('format' => 'select','selected' => $parent,'globals' => $global_cats))
|
||||
);
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||
$link_data['cat_id'] = $this->cat_id;
|
||||
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
if ($this->cat_id)
|
||||
{
|
||||
$link_data['cat_id'] = $this->cat_id;
|
||||
}
|
||||
$data['edit_url'] = $GLOBALS['phpgw']->link('/index.php',$link_data);
|
||||
$data['delete_url'] = $GLOBALS['phpgw']->link('/index.php',$link_data);
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.delete';
|
||||
$GLOBALS['phpgw']->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('old_parent',$cats['parent']);
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats['name']));
|
||||
$GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats['descr']));
|
||||
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formatted_list(array('format' => 'select',
|
||||
'type' => 'all',
|
||||
'selected' => $cats['parent'],
|
||||
'globals' => $global_cats)));
|
||||
$GLOBALS['phpgw']->template->parse('buttons','edit');
|
||||
$GLOBALS['phpgw']->template->fp('phpgw_body','form');
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('cat_edit' => $data));
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
$global_cats = get_var('global_cats',array('POST','GET'));
|
||||
|
||||
if ($GLOBALS['appname'])
|
||||
{
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang($GLOBALS['appname']) . ' ' . lang('global categories') . ': ' . lang('delete category');
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('global categories') . ': ' . lang('delete category');
|
||||
}
|
||||
|
||||
$link_data = array
|
||||
(
|
||||
'menuaction' => 'admin.uicategories.index',
|
||||
@ -396,11 +375,11 @@
|
||||
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
}
|
||||
|
||||
if ($GLOBALS['HTTP_POST_VARS']['confirm'])
|
||||
if (get_var('confirm',array('POST')))
|
||||
{
|
||||
if ($GLOBALS['HTTP_POST_VARS']['subs'])
|
||||
if (get_var('subs',array('POST')))
|
||||
{
|
||||
switch ($GLOBALS['HTTP_POST_VARS']['subs'])
|
||||
switch (get_var('subs',array('POST')))
|
||||
{
|
||||
case 'move':
|
||||
$this->bo->delete(array('cat_id' => $this->cat_id, 'modify_subs' => True));
|
||||
@ -422,10 +401,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->template->set_file(array('category_delete' => 'delete_cat.tpl'));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('error_msg',$error_msg);
|
||||
$nolink = $GLOBALS['phpgw']->link('/index.php',$link_data);
|
||||
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'app_delete'));
|
||||
|
||||
if ($GLOBALS['appname'])
|
||||
{
|
||||
@ -436,31 +412,19 @@
|
||||
$type = 'noglobal';
|
||||
}
|
||||
|
||||
$apps_cats = $this->bo->exists(array
|
||||
(
|
||||
'type' => $type,
|
||||
'cat_name' => '',
|
||||
'cat_id' => $this->cat_id
|
||||
));
|
||||
$apps_cats = $this->bo->exists(array('type' => $type,
|
||||
'cat_name' => '',
|
||||
'cat_id' => $this->cat_id));
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
|
||||
if ($apps_cats)
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('delete_msg',lang('This category is currently being used by applications as a parent category') . '<br>'
|
||||
. lang('You will need to reassign these subcategories before you can delete this category'));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('lang_subs','');
|
||||
$GLOBALS['phpgw']->template->set_var('subs','');
|
||||
$GLOBALS['phpgw']->template->set_var('nolink',$nolink);
|
||||
$GLOBALS['phpgw']->template->set_var('deletehandle','');
|
||||
$GLOBALS['phpgw']->template->set_var('donehandle','');
|
||||
$GLOBALS['phpgw']->template->pfp('out','category_delete');
|
||||
$GLOBALS['phpgw']->template->pfp('donehandle','done');
|
||||
$lang_confirm_msg = lang('This category is currently being used by applications as a parent category. ')
|
||||
. lang('You will need to reassign these subcategories before you can delete this category');
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('delete_msg',lang('Are you sure you want to delete this global category ?'));
|
||||
$lang_confirm_msg = lang('Are you sure you want to delete this global category ?');
|
||||
|
||||
$exists = $this->bo->exists(array
|
||||
(
|
||||
@ -471,21 +435,31 @@
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$sub_select = '<input type="radio" name="subs" value="move">' . lang('Do you want to move all global subcategories one level down ?') . '<br>';
|
||||
$sub_select .= '<input type="radio" name="subs" value="drop">' . lang('Do you want to delete all global subcategories ?');
|
||||
$GLOBALS['phpgw']->template->set_var('sub_select',$sub_select);
|
||||
$subs = 'yes';
|
||||
$lang_sub_select_move = lang('Do you want to move all global subcategories one level down ?');
|
||||
$lang_sub_select_drop = lang('Do you want to delete all global subcategories ?');
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('nolink',$nolink);
|
||||
$GLOBALS['phpgw']->template->set_var('lang_no',lang('No'));
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.delete';
|
||||
$link_data['cat_id'] = $this->cat_id;
|
||||
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
$GLOBALS['phpgw']->template->set_var('lang_yes',lang('Yes'));
|
||||
|
||||
$GLOBALS['phpgw']->template->fp('phpgw_body','category_delete');
|
||||
}
|
||||
|
||||
$data = array
|
||||
(
|
||||
'done_url' => $GLOBALS['phpgw']->link('/index.php',$link_data),
|
||||
'lang_confirm_msg' => $lang_confirm_msg,
|
||||
'lang_yes' => lang('yes'),
|
||||
'subs' => $subs,
|
||||
'lang_sub_select_move' => $lang_sub_select_move,
|
||||
'lang_sub_select_drop' => $lang_sub_select_drop,
|
||||
'lang_yes_statustext' => lang('Delete the entry'),
|
||||
'lang_no_statustext' => lang('Back to the list'),
|
||||
'lang_no' => lang('no'),
|
||||
'lang_error_msg' => $error_msg
|
||||
);
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.delete';
|
||||
$link_data['cat_id'] = $this->cat_id;
|
||||
$data['delete_url'] = $GLOBALS['phpgw']->link('/index.php',$link_data);
|
||||
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,25 +1,38 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - administration *
|
||||
* http://www.phpgroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Administration *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by coreteam <phpgroupware-developers@gnu.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
class uimainscreen
|
||||
{
|
||||
var $public_functions = array('index' => True);
|
||||
var $public_functions = array
|
||||
(
|
||||
'index' => True,
|
||||
'mainscreen' => True
|
||||
);
|
||||
|
||||
function uimainscreen()
|
||||
{
|
||||
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
|
||||
$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
}
|
||||
|
||||
function mainscreen()
|
||||
{
|
||||
$GLOBALS['phpgw']->xslttpl->add_file('app_data');
|
||||
$GLOBALS['phpgw']->hooks->process('admin');
|
||||
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $GLOBALS['phpgw']->common->output));
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
if ($GLOBALS['HTTP_POST_VARS']['cancel'])
|
||||
|
@ -233,7 +233,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('message',lang('Server %1 has been added',$GLOBALS['HTTP_POST_VARS']['server_name']));
|
||||
$GLOBALS['phpgw']->template->set_var('message',lang('Server x has been added',$GLOBALS['HTTP_POST_VARS']['server_name']));
|
||||
}
|
||||
}
|
||||
if ((!$GLOBALS['HTTP_POST_VARS']['submit']) && (!$error) && (!$errorcount))
|
||||
|
@ -72,5 +72,6 @@
|
||||
}
|
||||
|
||||
/* Do not modify below this line */
|
||||
display_section('admin',$file);
|
||||
|
||||
$GLOBALS['phpgw']->common->display_mainscreen('admin',$file);
|
||||
?>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* phpGroupWare - administration *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by coreteam <phpgroupware-developers@gnu.org> *
|
||||
* & Stephen Brown <steve@dataclarity.net> *
|
||||
* & Stephen Brown <steve@dataclarity.net> *
|
||||
* to distribute admin across the application directories *
|
||||
* ------------------------------------------------------ *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
@ -13,71 +13,12 @@
|
||||
\**************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
$GLOBALS['phpgw_info'] = array();
|
||||
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'admin';
|
||||
$GLOBALS['phpgw_info']['flags'] = array
|
||||
(
|
||||
'currentapp' => 'admin'
|
||||
);
|
||||
include('../header.inc.php');
|
||||
|
||||
$GLOBALS['phpgw']->template->set_file(Array('admin' => 'index.tpl'));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_block('admin','list');
|
||||
$GLOBALS['phpgw']->template->set_block('admin','app_row');
|
||||
$GLOBALS['phpgw']->template->set_block('admin','app_row_noicon');
|
||||
$GLOBALS['phpgw']->template->set_block('admin','link_row');
|
||||
$GLOBALS['phpgw']->template->set_block('admin','spacer_row');
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('title',lang('Administration'));
|
||||
|
||||
// This func called by the includes to dump a row header
|
||||
function section_start($appname='',$icon='')
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('app_title',$GLOBALS['phpgw_info']['apps'][$appname]['title']);
|
||||
$GLOBALS['phpgw']->template->set_var('app_name',$appname);
|
||||
$GLOBALS['phpgw']->template->set_var('app_icon',$icon);
|
||||
if ($icon)
|
||||
{
|
||||
$GLOBALS['phpgw']->template->parse('rows','app_row',True);
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->parse('rows','app_row_noicon',True);
|
||||
}
|
||||
}
|
||||
|
||||
function section_item($pref_link='',$pref_text='')
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('pref_link',$pref_link);
|
||||
$GLOBALS['phpgw']->template->set_var('pref_text',$pref_text);
|
||||
$GLOBALS['phpgw']->template->parse('rows','link_row',True);
|
||||
}
|
||||
|
||||
function section_end()
|
||||
{
|
||||
$GLOBALS['phpgw']->template->parse('rows','spacer_row',True);
|
||||
}
|
||||
|
||||
function display_section($appname,$file,$file2=False)
|
||||
{
|
||||
if ($file2)
|
||||
{
|
||||
$file = $file2;
|
||||
}
|
||||
if(is_array($file))
|
||||
{
|
||||
section_start($appname,
|
||||
$GLOBALS['phpgw']->common->image($appname,'navbar','',True)
|
||||
);
|
||||
|
||||
while(is_array($file) && list($text,$url) = each($file))
|
||||
{
|
||||
section_item($url,lang($text));
|
||||
}
|
||||
section_end();
|
||||
}
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->hooks->process('admin');
|
||||
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array
|
||||
(
|
||||
'body_data' => $GLOBALS['phpgw']->template->parse('out','list')
|
||||
));
|
||||
header('Location: '. $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.mainscreen'));
|
||||
exit;
|
||||
?>
|
||||
|
@ -17,6 +17,9 @@
|
||||
<xsl:when test="group_edit">
|
||||
<xsl:call-template name="groups"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="delete">
|
||||
<xsl:call-template name="app_delete"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="list"/>
|
||||
</xsl:otherwise>
|
||||
|
@ -124,20 +124,25 @@
|
||||
<!-- BEGIN group_edit -->
|
||||
|
||||
<xsl:template match="group_edit">
|
||||
<table border="0" cellpadding="2" cellspacing="2" align="center">
|
||||
<table border="0" cellpadding="2" cellspacing="2" align="center" width="79%">
|
||||
<tr>
|
||||
<td><xsl:value-of select="error"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
{rows}
|
||||
<!-- {rows} -->
|
||||
</td>
|
||||
<td valign="top">
|
||||
<table border="0" width="100%">
|
||||
<xsl:variable name="edit_url"><xsl:value-of select="edit_url"/></xsl:variable>
|
||||
<xsl:variable name="account_id" select="account_id"/>
|
||||
<xsl:variable name="select_size" select="select_size"/>
|
||||
<form action="{$edit_url}" method="POST">
|
||||
{hidden_vars}
|
||||
<input type="hidden" name="values[account_id]" value="{$account_id}"/>
|
||||
<tr>
|
||||
<td><xsl:value-of select="lang_account_name"/></td>
|
||||
<td><input name="account_name">
|
||||
<xsl:attribute name="onMouseover">
|
||||
<td><input name="values[account_name]">
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="value_account_name"/>
|
||||
</xsl:attribute>
|
||||
</input>
|
||||
@ -146,35 +151,40 @@
|
||||
<tr>
|
||||
<td><xsl:value-of select="lang_include_user"/></td>
|
||||
<td>
|
||||
<select name="account_user[]" multiple="multiple" size="{select_size}">
|
||||
{user_list}
|
||||
<select name="account_user[]" multiple="multiple" size="{$select_size}">
|
||||
<xsl:apply-templates select="user_list"/>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><xsl:value-of select="lang_file_space"/></td>
|
||||
<td>
|
||||
{account_file_space}{account_file_space_select}
|
||||
<!-- {account_file_space}{account_file_space_select} -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><xsl:value-of select="lang_permissions"/></td>
|
||||
<td valign="top"><xsl:value-of select="lang_permissions"/></td>
|
||||
<td>
|
||||
<table width="100%" border="0" cols="6">
|
||||
{permissions_list}
|
||||
<table width="100%" border="0" cellpadding="2" cellspacing="2">
|
||||
<tr class="th">
|
||||
<td><xsl:value-of select="lang_application"/></td>
|
||||
<td> </td>
|
||||
<td><xsl:value-of select="lang_acl"/></td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="app_list"/>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="left">
|
||||
<xsl:variable name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
|
||||
<input type="submit" name="submit" value="{$lang_save}"/>
|
||||
<input type="submit" name="values[save]" value="{$lang_save}"/>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
<tr>
|
||||
<xsl:variable name="done_url"><xsl:value-of select="done_url"/></xsl:variable>
|
||||
<xsl:variable name="langdone"><xsl:value-of select="lang_done"/></xsl:variable>
|
||||
<xsl:variable name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
|
||||
<form method="POST" action="{$done_url}">
|
||||
<td align="left">
|
||||
<input type="submit" name="done" value="{$lang_done}"/>
|
||||
@ -186,3 +196,55 @@
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="user_list">
|
||||
<xsl:variable name="account_id" select="account_id"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="selected != ''">
|
||||
<option value="{$account_id}" selected="selected"><xsl:value-of select="account_name"/></option>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<option value="{$account_id}"><xsl:value-of select="account_name"/></option>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="app_list">
|
||||
<xsl:variable name="checkbox_name" select="checkbox_name"/>
|
||||
<tr>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@class">
|
||||
<xsl:value-of select="@class"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="position() mod 2 = 0">
|
||||
<xsl:text>row_off</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>row_on</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<td width="40%"><xsl:value-of select="app_name"/></td>
|
||||
<td width="5%" align="center">
|
||||
<xsl:choose>
|
||||
<xsl:when test="checked != ''">
|
||||
<input type="checkbox" name="{$checkbox_name}" value="True" checked="checked"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<input type="checkbox" name="{$checkbox_name}" value="True"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
<td width="5%" align="center">
|
||||
<xsl:choose>
|
||||
<xsl:when test="acl_url != ''">
|
||||
<xsl:variable name="acl_url" select="acl_url"/>
|
||||
<xsl:variable name="acl_img" select="acl_img"/>
|
||||
<xsl:variable name="img_name" select="img_name"/>
|
||||
<a href="{$acl_url}"><img src="{$acl_img}" border="0" hspace="3" align="absmiddle" alt="{$img_name}" name="{$img_name}"/></a>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
Loading…
Reference in New Issue
Block a user