[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] admin/inc/class.uiserver.inc.php, 1.9
From: |
nomail |
Subject: |
[Phpgroupware-cvs] admin/inc/class.uiserver.inc.php, 1.9 |
Date: |
Thu, 30 Dec 2004 08:38:14 +0100 |
Update of /admin/inc
Modified Files:
Branch:
class.uiserver.inc.php
date: 2004/12/30 07:38:14; author: skwashd; state: Exp; lines: +111 -62
Log Message:
new HEAD admin - sans GIFs
=====================================================================
Index: admin/inc/class.uiserver.inc.php
diff -u admin/inc/class.uiserver.inc.php:1.8
admin/inc/class.uiserver.inc.php:1.9
--- admin/inc/class.uiserver.inc.php:1.8 Tue Apr 29 21:58:12 2003
+++ admin/inc/class.uiserver.inc.php Thu Dec 30 07:38:14 2004
@@ -33,6 +33,16 @@
function uiserver()
{
+ if
($GLOBALS['phpgw']->acl->check('peer_server_access',1,'admin'))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php');
+ }
+ $this->acl_search =
!$GLOBALS['phpgw']->acl->check('peer_server_access',2,'admin');
+ $this->acl_add =
!$GLOBALS['phpgw']->acl->check('peer_server_access',4,'admin');
+ $this->acl_view =
!$GLOBALS['phpgw']->acl->check('peer_server_access',8,'admin');
+ $this->acl_edit =
!$GLOBALS['phpgw']->acl->check('peer_server_access',16,'admin');
+ $this->acl_delete =
!$GLOBALS['phpgw']->acl->check('peer_server_access',32,'admin');
+
$this->bo = createobject('admin.boserver',True);
$this->nextmatchs = createobject('phpgwapi.nextmatchs');
@@ -70,7 +80,7 @@
$this->bo->save_sessiondata($data);
}
- function
formatted_list($name,$list,$id='',$default=False,$java=False)
+ function formatted_list($name,$list,$id='',$default=False)
{
$select = "\n" .'<select name="' . $name . '"' . ">\n";
if($default)
@@ -94,18 +104,27 @@
function list_servers()
{
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Admin').' - '.lang('Peer Servers');
$GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
$GLOBALS['phpgw']->template->set_file(array('server_list_t' =>
'listservers.tpl'));
$GLOBALS['phpgw']->template->set_block('server_list_t','server_list','list');
+ if (!$this->acl_search)
+ {
+
$GLOBALS['phpgw']->template->set_block('server_list_t','search','searchhandle');
+ }
+ if (!$this->acl_add)
+ {
+
$GLOBALS['phpgw']->template->set_block('server_list_t','add','addhandle');
+ }
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Server List'));
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.edit'));
$GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
-
$GLOBALS['phpgw']->template->set_var('title_servers',lang('Peer Servers'));
$GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.list_servers'));
-
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
+
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Cancel'));
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php'));
if(!$this->start)
@@ -159,11 +178,18 @@
'server_mode' =>
strtoupper($server['server_mode'])
));
-
$GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.edit&server_id='
. $server_id));
-
$GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
-
-
$GLOBALS['phpgw']->template->set_var('delete',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.delete&server_id='
. $server_id));
-
$GLOBALS['phpgw']->template->set_var('lang_delete_entry',lang('Delete'));
+ $GLOBALS['phpgw']->template->set_var('edit','');
+
$GLOBALS['phpgw']->template->set_var('delete','');
+ if ($this->acl_edit)
+ {
+
$GLOBALS['phpgw']->template->set_var('edit','<a
href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.edit&server_id='
. $server_id).
+ '">'.lang('Edit').'</a>');
+ }
+ if ($this->acl_delete)
+ {
+
$GLOBALS['phpgw']->template->set_var('delete','<a
href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.delete&server_id='
. $server_id).
+ '">'.lang('Delete').'</a>');
+ }
$GLOBALS['phpgw']->template->parse('list','server_list',True);
}
@@ -174,26 +200,44 @@
/* This function handles add or edit */
function edit()
{
+ if ($_POST['done'])
+ {
+ return $this->list_servers();
+ }
+ if ($_POST['delete'])
+ {
+ return $this->delete();
+
+ }
+ $server_id = get_var('server_id',array('POST','GET'));
+
+ if (!$server_id && !$this->acl_add || $server_id &&
!$this->acl_edit)
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php');
+ }
$is = CreateObject('phpgwapi.interserver');
$GLOBALS['phpgw']->template->set_file(array('form' =>
'server_form.tpl'));
-
$GLOBALS['phpgw']->template->set_block('form','add','addhandle');
-
$GLOBALS['phpgw']->template->set_block('form','edit','edithandle');
- $server =
$this->bo->read($GLOBALS['HTTP_GET_VARS']['server_id']);
+ if (!$this->acl_delete || !$server_id)
+ {
+
$GLOBALS['phpgw']->template->set_block('form','delete','deletehandle');
+
$GLOBALS['phpgw']->template->set_var('deletehandle','');
+ }
+ $server = $this->bo->read($server_id);
- if ($GLOBALS['HTTP_POST_VARS']['submit'])
+ if ($_POST['save'])
{
$errorcount = 0;
- $tmp =
$is->name2id($GLOBALS['HTTP_POST_VARS']['server_name']);
+ $tmp = $is->name2id($_POST['server_name']);
- if($tmp &&
$GLOBALS['HTTP_POST_VARS']['server_id'])
+ if($tmp && $server_id != $tmp)
{
$error[$errorcount++] = lang('That
server name has been used already !');
}
- if (!$GLOBALS['HTTP_POST_VARS']['server_name'])
+ if (!$_POST['server_name'])
{
$error[$errorcount++] = lang('Please
enter a name for that server !');
}
@@ -201,20 +245,20 @@
if (!$error)
{
$server_info = array(
- 'server_name' =>
addslashes($GLOBALS['HTTP_POST_VARS']['server_name']),
- 'server_url' =>
addslashes($GLOBALS['HTTP_POST_VARS']['server_url']),
- 'trust_level' =>
intval($GLOBALS['HTTP_POST_VARS']['trust_level']),
- 'trust_rel' =>
intval($GLOBALS['HTTP_POST_VARS']['trust_rel']),
- 'username' =>
addslashes($GLOBALS['HTTP_POST_VARS']['server_username']),
- 'password' =>
$GLOBALS['HTTP_POST_VARS']['server_password'] ?
$GLOBALS['HTTP_POST_VARS']['server_password'] : $server['password'],
- 'server_mode' =>
addslashes($GLOBALS['HTTP_POST_VARS']['server_mode']),
- 'server_security' =>
addslashes($GLOBALS['HTTP_POST_VARS']['server_security']),
- 'admin_name' =>
addslashes($GLOBALS['HTTP_POST_VARS']['admin_name']),
- 'admin_email' =>
addslashes($GLOBALS['HTTP_POST_VARS']['admin_email'])
+ 'server_name' =>
addslashes($_POST['server_name']),
+ 'server_url' =>
addslashes($_POST['server_url']),
+ 'trust_level' =>
intval($_POST['trust_level']),
+ 'trust_rel' =>
intval($_POST['trust_rel']),
+ 'username' =>
addslashes($_POST['server_username']),
+ 'password' =>
$_POST['server_password'] ? $_POST['server_password'] : $server['password'],
+ 'server_mode' =>
addslashes($_POST['server_mode']),
+ 'server_security' =>
addslashes($_POST['server_security']),
+ 'admin_name' =>
addslashes($_POST['admin_name']),
+ 'admin_email' =>
addslashes($_POST['admin_email'])
);
-
if($GLOBALS['HTTP_GET_VARS']['server_id'])
+ if($server_id)
{
- $server_info['server_id'] =
$GLOBALS['HTTP_GET_VARS']['server_id'];
+ $server_info['server_id'] =
$server_id;
}
$newid = $this->bo->edit($server_info);
$server = $this->bo->read($newid ?
$newid : $server_info['server_id']);
@@ -225,28 +269,27 @@
{
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
}
- if (($GLOBALS['HTTP_POST_VARS']['submit']) && (!$error)
&& (!$errorcount))
+ if (($_POST['save']) && (!$error) && (!$errorcount))
{
- if($GLOBALS['HTTP_GET_VARS']['server_id'])
+ if($server_id)
{
-
$GLOBALS['phpgw']->template->set_var('message',lang('Server %1 has been
updated',$GLOBALS['HTTP_POST_VARS']['server_name']));
+
$GLOBALS['phpgw']->template->set_var('message',lang('Server %1 has been
updated',$_POST['server_name']));
}
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 %1 has been
added',$_POST['server_name']));
}
}
- if ((!$GLOBALS['HTTP_POST_VARS']['submit']) &&
(!$error) && (!$errorcount))
+ if ((!$_POST['save']) && (!$error) && (!$errorcount))
{
$GLOBALS['phpgw']->template->set_var('message','');
}
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Admin').' - '.($server_id ? lang('Edit Peer Server') : lang('Add Peer
Server'));
$GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
-
$GLOBALS['phpgw']->template->set_var('title_servers',$GLOBALS['HTTP_GET_VARS']['server_id']
? lang('Edit Peer Server') : lang('Add Peer Server'));
-
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.edit&server_id='
. $GLOBALS['HTTP_GET_VARS']['server_id']));
-
$GLOBALS['phpgw']->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.delete&server_id='
. $GLOBALS['HTTP_GET_VARS']['server_id']));
-
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.list_servers'));
+
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.edit'));
$GLOBALS['phpgw']->template->set_var('lang_name',lang('Server name'));
$GLOBALS['phpgw']->template->set_var('lang_url',lang('Server URL'));
@@ -258,10 +301,11 @@
$GLOBALS['phpgw']->template->set_var('lang_security',lang('Security'));
$GLOBALS['phpgw']->template->set_var('lang_admin_name',lang('Admin Name'));
$GLOBALS['phpgw']->template->set_var('lang_admin_email',lang('Admin Email'));
-
$GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit'));
+
$GLOBALS['phpgw']->template->set_var('lang_save',lang('Save'));
+
$GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
$GLOBALS['phpgw']->template->set_var('lang_default',lang('Default'));
$GLOBALS['phpgw']->template->set_var('lang_reset',lang('Clear Form'));
-
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
+
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Cancel'));
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
$GLOBALS['phpgw']->template->set_var('server_name',$server['server_name']);
@@ -270,46 +314,51 @@
$GLOBALS['phpgw']->template->set_var('server_mode',$this->formatted_list('server_mode',$is->server_modes,$server['server_mode']));
$GLOBALS['phpgw']->template->set_var('server_security',$this->formatted_list('server_security',$is->security_types,$server['server_security']));
$GLOBALS['phpgw']->template->set_var('ssl_note',
function_exists('curl_init') ? ' ' : lang('Note: SSL available only if PHP
is compiled with curl support'));
-
$GLOBALS['phpgw']->template->set_var('pass_note',lang('(Stored password will
not be shown here)'));
+
$GLOBALS['phpgw']->template->set_var('pass_note',$server_id ?
'<br>'.lang('(Stored password will not be shown here)') : '');
$GLOBALS['phpgw']->template->set_var('trust_level',$this->formatted_list('trust_level',$is->trust_levels,$server['trust_level']));
$GLOBALS['phpgw']->template->set_var('trust_relationship',$this->formatted_list('trust_rel',$is->trust_relationships,$server['trust_rel'],True));
$GLOBALS['phpgw']->template->set_var('admin_name',$GLOBALS['phpgw']->strip_html($server['admin_name']));
$GLOBALS['phpgw']->template->set_var('admin_email',$GLOBALS['phpgw']->strip_html($server['admin_email']));
-
$GLOBALS['phpgw']->template->set_var('server_id',$GLOBALS['HTTP_GET_VARS']['server_id']);
+
$GLOBALS['phpgw']->template->set_var('server_id',$server_id);
- $GLOBALS['phpgw']->template->set_var('edithandle','');
- $GLOBALS['phpgw']->template->set_var('addhandle','');
-
- $GLOBALS['phpgw']->template->pparse('out','form');
-
$GLOBALS['phpgw']->template->pparse('edithandle','edit');
+ $GLOBALS['phpgw']->template->set_var(array(
+ 'th' =>
$GLOBALS['phpgw_info']['theme']['th_bg'],
+ 'row_on' =>
$GLOBALS['phpgw_info']['theme']['row_on'],
+ 'row_off' =>
$GLOBALS['phpgw_info']['theme']['row_off']
+ ));
+
$GLOBALS['phpgw']->template->pparse('phpgw_body','form');
}
function delete()
{
- $server_id = $GLOBALS['HTTP_POST_VARS']['server_id'] ?
$GLOBALS['HTTP_POST_VARS']['server_id'] :
$GLOBALS['HTTP_GET_VARS']['server_id'];
- if ($GLOBALS['HTTP_POST_VARS']['confirm'])
+ if (!$this->acl_delete)
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php');
+ }
+ $server_id = get_var('server_id',array('POST','GET'));
+ if ($_POST['yes'] || $_POST['no'])
{
- $this->bo->delete($server_id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.list_servers'));
+ if ($_POST['yes'])
+ {
+ $this->bo->delete($server_id);
+ }
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiserver.list_servers');
}
else
{
$GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
$GLOBALS['phpgw']->template->set_file(array('server_delete' =>
'delete_common.tpl'));
- $nolink =
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.list_servers');
-
- $yeslink = '<form method="POST"
name="yesbutton" action="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.delete') . '">'
- . '<input type="hidden"
name="server_id" value="' . $server_id . '">'
- . '<input type="hidden" name="confirm"
value="True">'
- . '<input type="submit"
name="yesbutton" value=Yes>'
- .
'</form><script>document.yesbutton.yesbutton.focus()</script>';
-
-
$GLOBALS['phpgw']->template->set_var('messages',lang('Are you sure you want to
delete this server?'));
- $GLOBALS['phpgw']->template->set_var('no','<a
href="' . $nolink . '">' . lang('No') . '</a>');
-
$GLOBALS['phpgw']->template->set_var('yes',$yeslink);
-
$GLOBALS['phpgw']->template->pparse('out','server_delete');
+ $GLOBALS['phpgw']->template->set_var(array(
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.delete'),
+ 'hidden_vars' => '<input type="hidden"
name="server_id" value="' . $server_id .
'"><script>document.yesbutton.yesbutton.focus()</script>',
+ 'messages' => lang('Are you sure you
want to delete this server?'),
+ 'no' => lang('No'),
+ 'yes' => lang('Yes'),
+ ));
+
$GLOBALS['phpgw']->template->pparse('phpgw_body','server_delete');
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] admin/inc/class.uiserver.inc.php, 1.9,
nomail <=