mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 11:23:54 +01:00
Converted admin hooks over to templates
This commit is contained in:
parent
7c2172852a
commit
e4de7df1b1
@ -1,68 +1,27 @@
|
|||||||
<?php
|
<?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$ */
|
||||||
|
|
||||||
{
|
{
|
||||||
|
$imgpath = $phpgw->common->image($appname,'navbar.gif');
|
||||||
/*
|
|
||||||
// This block of code is included by the main Administration page
|
|
||||||
// it points to the user, application and other global config
|
|
||||||
// pages.
|
|
||||||
// $appname is defined in the included file, (=="admin" for this file)
|
|
||||||
// $phpgw and $phpgwinfo are also in scope
|
|
||||||
|
|
||||||
// Find the icon to display
|
|
||||||
echo "<p>\n";
|
|
||||||
$imgfile = $phpgw->common->get_image_dir("admin")."/" . $appname .".gif";
|
|
||||||
if (file_exists($imgfile)) {
|
|
||||||
$imgpath = $phpgw->common->get_image_path("admin")."/" . $appname .".gif";
|
|
||||||
} else {
|
|
||||||
$imgfile = $phpgw->common->get_image_dir("admin")."/navbar.gif";
|
|
||||||
if (file_exists($imgfile)) {
|
|
||||||
$imgpath = $phpgw->common->get_image_path("admin")."/navbar.gif";
|
|
||||||
} else {
|
|
||||||
$imgpath = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show the header for the section
|
|
||||||
section_start("Administration",$imgpath);
|
|
||||||
*/
|
|
||||||
|
|
||||||
echo "<p>\n";
|
|
||||||
$imgfile = $phpgw->common->get_image_dir($appname) . '/' . $appname . '.gif';
|
|
||||||
if (file_exists($imgfile))
|
|
||||||
{
|
|
||||||
$imgpath = $phpgw->common->get_image_path($appname) . '/' . $appname . '.gif';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$imgfile = $phpgw->common->get_image_dir($appname) . '/navbar.gif';
|
|
||||||
if (file_exists($imgfile))
|
|
||||||
{
|
|
||||||
$imgpath = $phpgw->common->get_image_path($appname) . '/navbar.gif';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$imgpath = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
section_start(ucfirst($appname),$imgpath);
|
section_start(ucfirst($appname),$imgpath);
|
||||||
|
|
||||||
// actual items in this section
|
section_item($phpgw->link('/admin/accounts.php'),lang('User accounts'));
|
||||||
echo '<a href="' . $phpgw->link('/admin/accounts.php') . '">' . lang('User accounts')."</a><br>\n";
|
section_item($phpgw->link('/admin/groups.php'),lang('User groups'));
|
||||||
echo '<a href="' . $phpgw->link('/admin/groups.php') . '">' . lang('User groups')."</a><br>\n";
|
section_item($phpgw->link('/admin/applications.php'),lang('Applications'));
|
||||||
echo "<p>\n";
|
section_item($phpgw->link('/admin/categories.php'),lang('Global Categories'));
|
||||||
|
section_item($phpgw->link('/admin/mainscreen_message.php'),lang('Change main screen message'));
|
||||||
echo '<a href="' . $phpgw->link('/admin/applications.php') . '">' . lang('Applications')."</a><br>\n";
|
section_item($phpgw->link('/admin/currentusers.php'),lang('View sessions'));
|
||||||
echo "<p>\n";
|
section_item($phpgw->link('/admin/accesslog.php'),lang('View Access Log'));
|
||||||
|
|
||||||
echo '<a href="' . $phpgw->link('/admin/categories.php') . '">' . lang('Global Categories')."</a><br>\n";
|
|
||||||
echo "<p>\n";
|
|
||||||
|
|
||||||
echo '<a href="' . $phpgw->link('/admin/mainscreen_message.php') . '">' . lang('Change main screen message') . "</a><br>\n";
|
|
||||||
echo "<p>\n";
|
|
||||||
|
|
||||||
echo '<a href="' . $phpgw->link('/admin/currentusers.php') . '">' . lang('View sessions') . "</a><br>\n";
|
|
||||||
echo '<a href="' . $phpgw->link('/admin/accesslog.php') . '">' . lang('View Access Log') . "</a><br>\n";
|
|
||||||
|
|
||||||
section_end();
|
section_end();
|
||||||
}
|
}
|
||||||
|
@ -17,64 +17,56 @@
|
|||||||
$phpgw_info['flags']['currentapp'] = 'admin';
|
$phpgw_info['flags']['currentapp'] = 'admin';
|
||||||
include('../header.inc.php');
|
include('../header.inc.php');
|
||||||
|
|
||||||
check_code($cd);
|
$admin_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||||
|
$admin_tpl->set_file(array(
|
||||||
|
'admin' => 'index.tpl',
|
||||||
|
));
|
||||||
|
|
||||||
|
$admin_tpl->set_block('admin','list');
|
||||||
|
$admin_tpl->set_block('admin','app_row');
|
||||||
|
$admin_tpl->set_block('admin','app_row_noicon');
|
||||||
|
$admin_tpl->set_block('admin','link_row');
|
||||||
|
$admin_tpl->set_block('admin','spacer_row');
|
||||||
|
|
||||||
|
$admin_tpl->set_var('title',lang('Administration'));
|
||||||
|
|
||||||
// This func called by the includes to dump a row header
|
// This func called by the includes to dump a row header
|
||||||
function section_start($name='',$icon='')
|
function section_start($name='',$icon='')
|
||||||
{
|
{
|
||||||
global $phpgw,$phpgw_info;
|
global $phpgw, $phpgw_info, $admin_tpl;
|
||||||
echo '<table width="75%" border="0" cellspacing="0" cellpadding="0"><tr>';
|
|
||||||
|
$admin_tpl->set_var('icon_backcolor',$phpgw_info['theme']['row_off']);
|
||||||
|
$admin_tpl->set_var('link_backcolor',$phpgw_info['theme']['row_off']);
|
||||||
|
$admin_tpl->set_var('app_name',lang($name));
|
||||||
|
$admin_tpl->set_var('app_icon',$icon);
|
||||||
if ($icon)
|
if ($icon)
|
||||||
{
|
{
|
||||||
echo '<td width="5%"><img src="' . $icon . '" alt="[Icon]" align="middle"></td>';
|
$admin_tpl->parse('rows','app_row',True);
|
||||||
echo '<td><fontsize="+2">' . lang($name) . '</font></td>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '<td colspan="2"><font size="+2">' . $name . '</font></td>';
|
$admin_tpl->parse('rows','app_row_noicon',True);
|
||||||
}
|
}
|
||||||
echo '</tr>';
|
}
|
||||||
echo '<tr><td colspan="2">';
|
|
||||||
|
function section_item($pref_link='',$pref_text='')
|
||||||
|
{
|
||||||
|
global $phpgw, $phpgw_info, $admin_tpl;
|
||||||
|
|
||||||
|
$admin_tpl->set_var('pref_link',$pref_link);
|
||||||
|
$admin_tpl->set_var('pref_text',$pref_text);
|
||||||
|
$admin_tpl->parse('rows','link_row',True);
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_end()
|
function section_end()
|
||||||
{
|
{
|
||||||
echo '</td></tr></table>';
|
global $phpgw, $phpgw_info, $admin_tpl;
|
||||||
|
|
||||||
|
$admin_tpl->parse('rows','spacer_row',True);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We only want to list applications that are enabled, even if hidden from navbar, plus the common stuff
|
$phpgw->common->hook();
|
||||||
// (if they can get to the admin page, the admin app is enabled, hence it is shown)
|
$admin_tpl->pparse('out','list');
|
||||||
|
|
||||||
$phpgw->db->query("SELECT app_name FROM phpgw_applications WHERE app_enabled=1 OR app_enabled=2 ORDER BY app_title",__LINE__,__FILE__);
|
|
||||||
|
|
||||||
// Stuff it in an array in the off chance the admin includes need the db
|
|
||||||
while ($phpgw->db->next_record())
|
|
||||||
{
|
|
||||||
$apps[] = $phpgw->db->f('app_name');
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($i =0; $i < sizeof($apps); $i++)
|
|
||||||
{
|
|
||||||
$appname = $apps[$i];
|
|
||||||
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_admin.inc.php';
|
|
||||||
|
|
||||||
if (file_exists($f))
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
echo "<p>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($SHOW_INFO > 0)
|
|
||||||
{
|
|
||||||
echo '<p><a href="' . $phpgw->link('/admin/index.php', 'SHOW_INFO=0'). '">' . lang('Hide PHP Information') . '</a>';
|
|
||||||
echo "<hr>\n";
|
|
||||||
phpinfo();
|
|
||||||
echo "<hr>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '<p><a href="' . $phpgw->link('/admin/index.php', 'SHOW_INFO=1'). '">' . lang('PHP Information') . '</a>';
|
|
||||||
}
|
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
?>
|
?>
|
33
admin/templates/default/index.tpl
Executable file
33
admin/templates/default/index.tpl
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
<!-- BEGIN list -->
|
||||||
|
<b>{title}</b>
|
||||||
|
<hr><p>
|
||||||
|
|
||||||
|
<table width="75%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
{rows}
|
||||||
|
</table>
|
||||||
|
<!-- END list -->
|
||||||
|
|
||||||
|
<!-- BEGIN app_row -->
|
||||||
|
<tr bgcolor="{icon_backcolor}">
|
||||||
|
<td width="5%" valign="middle"><img src="{app_icon}" alt="[ {app_name} ]"></td>
|
||||||
|
<td width="95%" valign="middle"><strong> {app_name}</strong></td>
|
||||||
|
</tr>
|
||||||
|
<!-- END app_row -->
|
||||||
|
|
||||||
|
<!-- BEGIN app_row_noicon -->
|
||||||
|
<tr bgcolor="{icon_backcolor}">
|
||||||
|
<td colspan="2" width="95%" valign="middle"><strong> {app_name}</strong></td>
|
||||||
|
</tr>
|
||||||
|
<!-- END app_row_noicon -->
|
||||||
|
|
||||||
|
<!-- BEGIN link_row -->
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"> • <a href="{pref_link}">{pref_text}</a></td>
|
||||||
|
</tr>
|
||||||
|
<!-- END link_row -->
|
||||||
|
|
||||||
|
<!-- BEGIN spacer_row -->
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<!-- END spacer_row -->
|
@ -1,22 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* phpGroupWare *
|
* phpGroupWare *
|
||||||
* http://www.phpgroupware.org *
|
* http://www.phpgroupware.org *
|
||||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||||
* -------------------------------------------- *
|
* -------------------------------------------- *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||||
* option) any later version. *
|
* option) any later version. *
|
||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
/* $Id$ */
|
|
||||||
{
|
|
||||||
echo "<p>";
|
|
||||||
$imgpath = $phpgw->common->image($appname,'navbar.gif');
|
|
||||||
section_start(ucfirst($appname),$imgpath);
|
|
||||||
|
|
||||||
echo '<a href="' . $phpgw->link('/calendar/holiday_admin.php') . '">' . lang('Calendar Holiday Management') . '</a>';
|
/* $Id$ */
|
||||||
|
|
||||||
section_end();
|
$imgpath = $phpgw->common->image($appname,'navbar.gif');
|
||||||
}
|
section_start(ucfirst($appname),$imgpath);
|
||||||
|
|
||||||
|
section_item($phpgw->link('/calendar/holiday_admin.php'),lang('Calendar Holiday Management'));
|
||||||
|
|
||||||
|
section_end();
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user