From 775e90b953c73d46aac1657ea97bee801df898bc Mon Sep 17 00:00:00 2001 From: skeeter Date: Thu, 24 May 2001 01:13:09 +0000 Subject: [PATCH] This is a better design for admin/preference hooks. Can now be globally modified from each of the appropriate index files. --- addressbook/inc/hook_admin.inc.php | 32 +++--------- addressbook/inc/hook_preferences.inc.php | 38 ++++----------- admin/inc/hook_admin.inc.php | 27 ++++++----- admin/index.php | 14 +++++- calendar/inc/hook_admin.inc.php | 18 ++++--- calendar/inc/hook_preferences.inc.php | 41 ++++------------ filemanager/inc/hook_preferences.inc.php | 31 +++--------- phpgwapi/templates/idsociety/head.tpl | 13 +++-- preferences/inc/hook_preferences.inc.php | 28 ++--------- preferences/index.php | 62 +++++++++++++----------- preferences/templates/default/index.tpl | 49 +++++++++++-------- 11 files changed, 144 insertions(+), 209 deletions(-) diff --git a/addressbook/inc/hook_admin.inc.php b/addressbook/inc/hook_admin.inc.php index 194e6e26de..0f5c16dffc 100644 --- a/addressbook/inc/hook_admin.inc.php +++ b/addressbook/inc/hook_admin.inc.php @@ -12,30 +12,12 @@ /* $Id$ */ { - echo "

\n"; - $imgfile = $phpgw->common->get_image_dir($appname) . SEP . $appname . '.gif'; - if (file_exists($imgfile)) - { - $imgpath = $phpgw->common->get_image_path($appname) . SEP . $appname . '.gif'; - } - else - { - $imgfile = $phpgw->common->get_image_dir($appname) . SEP . 'navbar.gif'; - if (file_exists($imgfile)) - { - $imgpath = $phpgw->common->get_image_path($appname) . SEP . 'navbar.gif'; - } - else - { - $imgpath = ''; - } - } - - section_start(ucfirst($appname),$imgpath); - - section_item($phpgw->link('/addressbook/admin.php'), - lang('Countries')); - - section_end(); +// Only Modify the $file and $title variables..... + $title = $appname; + $file = Array( + 'Countries' => $phpgw->link('/addressbook/admin.php') + ); +//Do not modify below this line + display_section($appname,$title,$file); } ?> diff --git a/addressbook/inc/hook_preferences.inc.php b/addressbook/inc/hook_preferences.inc.php index d002a63c2e..f915ef2621 100644 --- a/addressbook/inc/hook_preferences.inc.php +++ b/addressbook/inc/hook_preferences.inc.php @@ -12,33 +12,15 @@ /* $Id$ */ { - echo "

\n"; - $imgfile = $phpgw->common->get_image_dir($appname) . SEP . $appname . '.gif'; - if (file_exists($imgfile)) { - $imgpath = $phpgw->common->get_image_path($appname) . SEP . $appname . '.gif'; - } else { - $imgfile = $phpgw->common->get_image_dir($appname) . SEP . 'navbar.gif'; - if (file_exists($imgfile)) { - $imgpath = $phpgw->common->get_image_path($appname) . SEP . 'navbar.gif'; - } else { - $imgpath = ''; - } - } - - section_start(ucfirst($appname),$imgpath); - - section_item($phpgw->link('/addressbook/preferences.php'), - lang('Preferences')); - - section_item($phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), - lang('Grant Access')); - - section_item($phpgw->link('/preferences/categories.php','cats_app='.$appname . '&cats_level=True&global_cats=True'), - lang('Edit Categories')); - - section_item($phpgw->link('/addressbook/fields.php'), - lang('Edit custom fields')); - - section_end(); +// Only Modify the $file and $title variables..... + $title = $appname; + $file = Array( + 'Preferences' => $phpgw->link('/addressbook/preferences.php'), + 'Grant Access' => $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), + 'Edit Categories' => $phpgw->link('/preferences/categories.php','cats_app='.$appname . '&cats_level=True&global_cats=True'), + 'Edit custom fields' => $phpgw->link('/addressbook/fields.php') + ); +//Do not modify below this line + display_section($appname,$title,$file); } ?> diff --git a/admin/inc/hook_admin.inc.php b/admin/inc/hook_admin.inc.php index 244f6ef5a1..12bb695caa 100644 --- a/admin/inc/hook_admin.inc.php +++ b/admin/inc/hook_admin.inc.php @@ -11,18 +11,19 @@ /* $Id$ */ -{ - $imgpath = $phpgw->common->image($appname,'navbar.gif'); - section_start(ucfirst($appname),$imgpath); - - section_item($phpgw->link('/admin/accounts.php'),lang('User accounts')); - section_item($phpgw->link('/admin/groups.php'),lang('User groups')); - section_item($phpgw->link('/admin/applications.php'),lang('Applications')); - section_item($phpgw->link('/admin/categories.php'),lang('Global Categories')); - section_item($phpgw->link('/admin/mainscreen_message.php'),lang('Change main screen message')); - section_item($phpgw->link('/admin/currentusers.php'),lang('View sessions')); - section_item($phpgw->link('/admin/accesslog.php'),lang('View Access Log')); - - section_end(); +{ +// Only Modify the $file and $title variables..... + $title = $appname; + $file = Array( + 'User Accounts' => $phpgw->link('/admin/accounts.php'), + 'User Groups' => $phpgw->link('/admin/groups.php'), + 'Applications' => $phpgw->link('/admin/applications.php'), + 'Global Categories' => $phpgw->link('/admin/categories.php'), + 'Change Main Screen Message' => $phpgw->link('/admin/mainscreen_message.php'), + 'View Sessions' => $phpgw->link('/admin/currentusers.php'), + 'View Access Log' => $phpgw->link('/admin/accesslog.php') + ); +//Do not modify below this line + display_section($appname,$title,$file); } ?> diff --git a/admin/index.php b/admin/index.php index b9590f28a9..2b3c6fb821 100755 --- a/admin/index.php +++ b/admin/index.php @@ -65,8 +65,20 @@ $admin_tpl->parse('rows','spacer_row',True); } + function display_section($appname,$title,$file) + { + global $phpgw; + section_start($title,$phpgw->common->image($appname,Array('navbar.gif',$appname.'.gif'))); + + while(list($text,$url) = each($file)) + { + section_item($url,lang($text)); + } + section_end(); + } + $phpgw->common->hook(); $admin_tpl->pparse('out','list'); $phpgw->common->phpgw_footer(); -?> \ No newline at end of file +?> diff --git a/calendar/inc/hook_admin.inc.php b/calendar/inc/hook_admin.inc.php index 4a61693a4f..5fcd039703 100755 --- a/calendar/inc/hook_admin.inc.php +++ b/calendar/inc/hook_admin.inc.php @@ -11,11 +11,13 @@ \**************************************************************************/ /* $Id$ */ - - $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(); -?> \ No newline at end of file +{ +// Only Modify the $file and $title variables..... + $title = $appname; + $file = Array( + 'Calendar Holiday Management' => $phpgw->link('/calendar/holiday_admin.php') + ); +//Do not modify below this line + display_section($appname,$title,$file); +} +?> diff --git a/calendar/inc/hook_preferences.inc.php b/calendar/inc/hook_preferences.inc.php index d46f18a572..d6a899094b 100644 --- a/calendar/inc/hook_preferences.inc.php +++ b/calendar/inc/hook_preferences.inc.php @@ -11,37 +11,14 @@ \**************************************************************************/ /* $Id$ */ { - - echo "

\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_item($phpgw->link('/calendar/preferences.php'), - lang('Calendar preferences')); - - section_item($phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), - lang('Grant Calendar Access')); - - section_item($phpgw->link('/preferences/categories.php','cats_app='.$appname.'&global_cats=True'), - lang('Edit Categories')); - - section_end(); +// Only Modify the $file and $title variables..... + $title = $appname; + $file = Array( + 'Calendar preferences' => $phpgw->link('/calendar/preferences.php'), + 'Grant Access' => $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), + 'Edit Categories' => $phpgw->link('/preferences/categories.php','cat_app='.$appname.'&global_cats=True') + ); +//Do not modify below this line + display_section($appname,$title,$file); } ?> diff --git a/filemanager/inc/hook_preferences.inc.php b/filemanager/inc/hook_preferences.inc.php index 9a777e4fd9..523aad700e 100644 --- a/filemanager/inc/hook_preferences.inc.php +++ b/filemanager/inc/hook_preferences.inc.php @@ -12,29 +12,12 @@ /* $Id$ */ { - echo "

\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); - - echo '' . lang ('PHPWebHosting preferences') . ''; - - section_end (); +// Only Modify the $file and $title variables..... + $title = $appname; + $file = Array( + 'PHPWebHosting preferences' => $phpgw->link('/phpwebhosting/preferences.php') + ); +//Do not modify below this line + display_section($appname,$title,$file); } ?> diff --git a/phpgwapi/templates/idsociety/head.tpl b/phpgwapi/templates/idsociety/head.tpl index 75d27ccb7c..53026725de 100644 --- a/phpgwapi/templates/idsociety/head.tpl +++ b/phpgwapi/templates/idsociety/head.tpl @@ -17,20 +17,23 @@ .tablink { color: #000000; } --> - {website_title} diff --git a/preferences/inc/hook_preferences.inc.php b/preferences/inc/hook_preferences.inc.php index 39c2b02383..8cf6f9646a 100644 --- a/preferences/inc/hook_preferences.inc.php +++ b/preferences/inc/hook_preferences.inc.php @@ -12,34 +12,16 @@ /* $Id$ */ { - echo "

\n"; - $imgfile = $phpgw->common->get_image_dir("preferences")."/" . $appname .".gif"; - if (file_exists($imgfile)) - { - $imgpath = $phpgw->common->get_image_path("preferences")."/" . $appname .".gif"; - } else - { - $imgfile = $phpgw->common->get_image_dir("preferences")."/navbar.gif"; - if (file_exists($imgfile)) - { - $imgpath = $phpgw->common->get_image_path("preferences")."/navbar.gif"; - } else - { - $imgpath = ""; - } - } - - section_start("Account Preferences",$imgpath); - +//Do not modify below this line // Actual content + $title = $appname; if ($phpgw->acl->check('changepassword',1)) { - section_item($phpgw->link('/preferences/changepassword.php'), lang("change your password")); + $file['Change your Password'] = $phpgw->link('/preferences/changepassword.php'); } - - section_item($phpgw->link('/preferences/settings.php'), lang('change your settings')); + $file['change your settings'] = $phpgw->link('/preferences/settings.php'); - section_end(); + display_section($appname,$title,$file); } ?> diff --git a/preferences/index.php b/preferences/index.php index da4b8a4f41..dfad6cabbe 100755 --- a/preferences/index.php +++ b/preferences/index.php @@ -16,62 +16,66 @@ include('../header.inc.php'); $pref_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); - $pref_tpl->set_file(array( - 'T_index_out' => 'index.tpl', - )); + $templates = Array( + 'pref' => 'index.tpl' + ); + + $pref_tpl->set_file($templates); - $pref_tpl->set_block('T_index_out','B_icon_cell','V_icon_cell'); - $pref_tpl->set_block('T_index_out','B_link_cell','V_link_cell'); + $pref_tpl->set_block('pref','list'); + $pref_tpl->set_block('pref','app_row'); + $pref_tpl->set_block('pref','app_row_noicon'); + $pref_tpl->set_block('pref','link_row'); + $pref_tpl->set_block('pref','spacer_row'); // This func called by the includes to dump a row header function section_start($name='',$icon='') { - global $phpgw,$phpgw_info, $loopnum, $pref_tpl; + global $phpgw_info, $pref_tpl; $pref_tpl->set_var('icon_backcolor',$phpgw_info['theme']['row_off']); - $pref_tpl->set_var('link_backcolor',$phpgw_info['theme']['row_off']); +// $pref_tpl->set_var('link_backcolor',$phpgw_info['theme']['row_off']); $pref_tpl->set_var('app_name',lang($name)); $pref_tpl->set_var('app_icon',$icon); if ($icon) { - $pref_tpl->parse('V_icon_cell','B_icon_cell'); + $pref_tpl->parse('rows','app_row',True); } else { - $pref_tpl->set_var('V_icon_cell',' '); + $pref_tpl->parse('rows','app_row_noicon',True); } - - // prepare an iteration variable for section_item to know when to add a
- $loopnum = 1; } function section_item($pref_link='',$pref_text='') { - global $phpgw,$phpgw_info, $loopnum, $pref_tpl; - if ($loopnum > 1) - { - $pref_tpl->set_var('insert_br','
'); - } - else - { - $pref_tpl->set_var('insert_br',''); - } + global $pref_tpl; $pref_tpl->set_var('pref_link',$pref_link); $pref_tpl->set_var('pref_text',$pref_text); - $pref_tpl->parse('V_link_cell','B_link_cell',True); - $loopnum = $loopnum + 1; + $pref_tpl->parse('rows','link_row',True); } function section_end() { - global $phpgw,$phpgw_info, $pref_tpl; - $pref_tpl->pparse('out','T_index_out'); - $pref_tpl->set_var('V_icon_cell',''); - $pref_tpl->set_var('V_link_cell',''); + global $pref_tpl; + + $pref_tpl->parse('rows','spacer_row',True); + } + + function display_section($appname,$title,$file) + { + global $phpgw; + section_start($title,$phpgw->common->image($appname,Array('navbar.gif',$appname.'.gif'))); + + while(list($text,$url) = each($file)) + { + section_item($url,lang($text)); + } + section_end(); } $phpgw->common->hook(); - + $pref_tpl->pparse('out','list'); $phpgw->common->phpgw_footer(); -?> \ No newline at end of file +?> diff --git a/preferences/templates/default/index.tpl b/preferences/templates/default/index.tpl index 9c6f371590..c66c193553 100644 --- a/preferences/templates/default/index.tpl +++ b/preferences/templates/default/index.tpl @@ -1,23 +1,30 @@ + - - - - - - - + {rows}
- - -[ {app_name} ] - - - -   {app_name} -
- - -{insert_br} • {pref_text} - - -
+ + + + + [ {app_name} ] +   {app_name} + + + + + +   {app_name} + + + + + +  • {pref_text} + + + + + +   + +