moved admin, preferences hook to one class, added a sidebox-menu

This commit is contained in:
Ralf Becker 2003-10-16 09:36:46 +00:00
parent 8b188b06f9
commit 420cf9ad1d
4 changed files with 83 additions and 35 deletions

View File

@ -0,0 +1,74 @@
<?php
/**************************************************************************\
* phpGroupWare - InfoLog Admin-, Preferences- and SideboxMenu-Hooks *
* http://www.phpgroupware.org *
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
* ------------------------------------------------------- *
* 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 admin_prefs_sidebox_hooks
{
function all_hooks($args)
{
$appname = 'infolog';
$location = is_array($args) ? $args['location'] : $args;
//echo "<p>admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'</p>\n";
if ($location == 'sidebox_menu')
{
$file = array(
'add' => $GLOBALS['phpgw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.edit' ))
);
display_sidebox($appname,$GLOBALS['phpgw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file);
}
if ($GLOBALS['phpgw_info']['user']['apps']['preferences'] && $location != 'admin')
{
$file = array(
'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname),
'Grant Access' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
);
if ($location == 'preferences')
{
display_section($appname,$file);
}
else
{
display_sidebox($appname,lang('Preferences'),$file);
}
}
if ($GLOBALS['phpgw_info']['user']['apps']['admin'] && $location != 'preferences')
{
$file = Array(
'Site configuration' => $GLOBALS['phpgw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.admin' )),
'Global Categories' => $GLOBALS['phpgw']->link('/index.php',array(
'menuaction' => 'admin.uicategories.index',
'appname' => $appname,
'global_cats'=> True)),
'Custom fields, typ and status' => $GLOBALS['phpgw']->link('/index.php',array(
'menuaction' => 'infolog.uicustomfields.edit')),
'CSV-Import' => $GLOBALS['phpgw']->link('/infolog/csv_import.php')
);
if ($location == 'admin')
{
display_section($appname,$file);
}
else
{
display_sidebox($appname,lang('Admin'),$file);
}
}
}
}
?>

View File

@ -10,28 +10,8 @@
\**************************************************************************/
/* $Id$ */
{
$file = Array
(
'Site configuration' => $GLOBALS['phpgw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.admin' )),
'Global Categories' => $GLOBALS['phpgw']->link('/index.php',array(
'menuaction' => 'admin.uicategories.index',
'appname' => $appname,
'global_cats'=> True)),
'Custom fields, typ and status' => $GLOBALS['phpgw']->link('/index.php',array(
'menuaction' => 'infolog.uicustomfields.edit')),
'CSV-Import' => $GLOBALS['phpgw']->link('/infolog/csv_import.php')
);
//Do not modify below this line
if ($GLOBALS['phpgw']->common->public_functions['display_mainscreen'])
{
$GLOBALS['phpgw']->common->display_mainscreen($appname,$file);
}
else
{
display_section($appname,lang($appname),$file); // for .14/6
}
}
{
// for compatibility and convinience, can go soon
ExecMethod('infolog.admin_prefs_sidebox_hooks.all_hooks','admin');
}
?>

View File

@ -13,14 +13,8 @@
/* $Id$ */
{
// Only Modify the $file and $title variables.....
$file = array(
'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname),
'Grant Access' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
);
//Do not modify below this line
display_section($appname,lang($appname),$file); // leave 2. $appname for compatibilty with .14
// for compatibility and convinience, can go soon
ExecMethod('infolog.admin_prefs_sidebox_hooks.all_hooks','preferences');
}
?>

View File

@ -47,11 +47,10 @@
<a href="http://www.egroupware.org/wiki/InfoLog" target="_blank">InfoLog page in our Wiki</a>.';
/* The hooks this app includes, needed for hooks registration */
$setup_info['infolog']['hooks'][] = 'preferences';
$setup_info['infolog']['hooks']['preferences'] = 'infolog.admin_prefs_sidebox_hooks.all_hooks';
$setup_info['infolog']['hooks'][] = 'settings';
$setup_info['infolog']['hooks'][] = 'admin';
$setup_info['infolog']['hooks']['admin'] = 'infolog.admin_prefs_sidebox_hooks.all_hooks';
$setup_info['infolog']['hooks'][] = 'deleteaccount';
$setup_info['infolog']['hooks'][] = 'about';
$setup_info['infolog']['hooks'][] = 'home';
$setup_info['infolog']['hooks']['addressbook_view'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['projects_view'] = 'infolog.uiinfolog.hook_view';
@ -59,6 +58,7 @@
$setup_info['infolog']['hooks']['infolog'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['calendar_include_events'] = 'infolog.boinfolog.cal_to_include';
$setup_info['infolog']['hooks']['calendar_include_todos'] = 'infolog.boinfolog.cal_to_include';
$setup_info['infolog']['hooks']['sidebox_menu'] = 'infolog.admin_prefs_sidebox_hooks.all_hooks';
/* Dependencies for this app to work */
$setup_info['infolog']['depends'][] = array(