This is a better design for admin/preference hooks. Can now be globally modified from each of the appropriate index files.

This commit is contained in:
skeeter 2001-05-24 01:13:09 +00:00
parent b7f318560d
commit 775e90b953
11 changed files with 144 additions and 209 deletions

View File

@ -12,30 +12,12 @@
/* $Id$ */ /* $Id$ */
{ {
echo "<p>\n"; // Only Modify the $file and $title variables.....
$imgfile = $phpgw->common->get_image_dir($appname) . SEP . $appname . '.gif'; $title = $appname;
if (file_exists($imgfile)) $file = Array(
{ 'Countries' => $phpgw->link('/addressbook/admin.php')
$imgpath = $phpgw->common->get_image_path($appname) . SEP . $appname . '.gif'; );
} //Do not modify below this line
else display_section($appname,$title,$file);
{
$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();
} }
?> ?>

View File

@ -12,33 +12,15 @@
/* $Id$ */ /* $Id$ */
{ {
echo "<p>\n"; // Only Modify the $file and $title variables.....
$imgfile = $phpgw->common->get_image_dir($appname) . SEP . $appname . '.gif'; $title = $appname;
if (file_exists($imgfile)) { $file = Array(
$imgpath = $phpgw->common->get_image_path($appname) . SEP . $appname . '.gif'; 'Preferences' => $phpgw->link('/addressbook/preferences.php'),
} else { 'Grant Access' => $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname),
$imgfile = $phpgw->common->get_image_dir($appname) . SEP . 'navbar.gif'; 'Edit Categories' => $phpgw->link('/preferences/categories.php','cats_app='.$appname . '&cats_level=True&global_cats=True'),
if (file_exists($imgfile)) { 'Edit custom fields' => $phpgw->link('/addressbook/fields.php')
$imgpath = $phpgw->common->get_image_path($appname) . SEP . 'navbar.gif'; );
} else { //Do not modify below this line
$imgpath = ''; display_section($appname,$title,$file);
}
}
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();
} }
?> ?>

View File

@ -11,18 +11,19 @@
/* $Id$ */ /* $Id$ */
{ {
$imgpath = $phpgw->common->image($appname,'navbar.gif'); // Only Modify the $file and $title variables.....
section_start(ucfirst($appname),$imgpath); $title = $appname;
$file = Array(
section_item($phpgw->link('/admin/accounts.php'),lang('User accounts')); 'User Accounts' => $phpgw->link('/admin/accounts.php'),
section_item($phpgw->link('/admin/groups.php'),lang('User groups')); 'User Groups' => $phpgw->link('/admin/groups.php'),
section_item($phpgw->link('/admin/applications.php'),lang('Applications')); 'Applications' => $phpgw->link('/admin/applications.php'),
section_item($phpgw->link('/admin/categories.php'),lang('Global Categories')); 'Global Categories' => $phpgw->link('/admin/categories.php'),
section_item($phpgw->link('/admin/mainscreen_message.php'),lang('Change main screen message')); 'Change Main Screen Message' => $phpgw->link('/admin/mainscreen_message.php'),
section_item($phpgw->link('/admin/currentusers.php'),lang('View sessions')); 'View Sessions' => $phpgw->link('/admin/currentusers.php'),
section_item($phpgw->link('/admin/accesslog.php'),lang('View Access Log')); 'View Access Log' => $phpgw->link('/admin/accesslog.php')
);
section_end(); //Do not modify below this line
display_section($appname,$title,$file);
} }
?> ?>

View File

@ -65,8 +65,20 @@
$admin_tpl->parse('rows','spacer_row',True); $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(); $phpgw->common->hook();
$admin_tpl->pparse('out','list'); $admin_tpl->pparse('out','list');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -11,11 +11,13 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
{
$imgpath = $phpgw->common->image($appname,'navbar.gif'); // Only Modify the $file and $title variables.....
section_start(ucfirst($appname),$imgpath); $title = $appname;
$file = Array(
section_item($phpgw->link('/calendar/holiday_admin.php'),lang('Calendar Holiday Management')); 'Calendar Holiday Management' => $phpgw->link('/calendar/holiday_admin.php')
);
section_end(); //Do not modify below this line
?> display_section($appname,$title,$file);
}
?>

View File

@ -11,37 +11,14 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
{ {
// Only Modify the $file and $title variables.....
echo "<p>\n"; $title = $appname;
$imgfile = $phpgw->common->get_image_dir($appname) . '/' . $appname . '.gif'; $file = Array(
if (file_exists($imgfile)) 'Calendar preferences' => $phpgw->link('/calendar/preferences.php'),
{ 'Grant Access' => $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname),
$imgpath = $phpgw->common->get_image_path($appname) . '/' . $appname . '.gif'; 'Edit Categories' => $phpgw->link('/preferences/categories.php','cat_app='.$appname.'&global_cats=True')
} );
else //Do not modify below this line
{ display_section($appname,$title,$file);
$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();
} }
?> ?>

View File

@ -12,29 +12,12 @@
/* $Id$ */ /* $Id$ */
{ {
echo "<p>\n"; // Only Modify the $file and $title variables.....
$imgfile = $phpgw->common->get_image_dir ($appname) . '/' . $appname . '.gif'; $title = $appname;
if (file_exists ($imgfile)) $file = Array(
{ 'PHPWebHosting preferences' => $phpgw->link('/phpwebhosting/preferences.php')
$imgpath = $phpgw->common->get_image_path ($appname) . '/' . $appname . '.gif'; );
} //Do not modify below this line
else display_section($appname,$title,$file);
{
$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 '<a href="' . $phpgw->link ('/phpwebhosting/preferences.php') . '">' . lang ('PHPWebHosting preferences') . '</a>';
section_end ();
} }
?> ?>

View File

@ -17,20 +17,23 @@
.tablink { color: #000000; } .tablink { color: #000000; }
--> -->
</STYLE> </STYLE>
<script language="javascript"> <script language="JavaScript">
<!-- <!--
function MM_preloadImages() { function MM_preloadImages()
if (document.images) { {
if (document.images)
{
var imgFiles = MM_preloadImages.arguments; var imgFiles = MM_preloadImages.arguments;
if (document.preloadArray==null) document.preloadArray = new Array(); if (document.preloadArray==null) document.preloadArray = new Array();
var i = document.preloadArray.length; var i = document.preloadArray.length;
with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){ with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#")
{
preloadArray[i] = new Image; preloadArray[i] = new Image;
preloadArray[i++].src = imgFiles[j]; preloadArray[i++].src = imgFiles[j];
} }
} }
} }
--> //-->
</script> </script>
<TITLE>{website_title}</TITLE> <TITLE>{website_title}</TITLE>

View File

@ -12,34 +12,16 @@
/* $Id$ */ /* $Id$ */
{ {
echo "<p>\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 // Actual content
$title = $appname;
if ($phpgw->acl->check('changepassword',1)) 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');
} }
$file['change your settings'] = $phpgw->link('/preferences/settings.php');
section_item($phpgw->link('/preferences/settings.php'), lang('change your settings'));
section_end(); display_section($appname,$title,$file);
} }
?> ?>

View File

@ -16,62 +16,66 @@
include('../header.inc.php'); include('../header.inc.php');
$pref_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); $pref_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$pref_tpl->set_file(array( $templates = Array(
'T_index_out' => 'index.tpl', '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('pref','list');
$pref_tpl->set_block('T_index_out','B_link_cell','V_link_cell'); $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 // 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, $loopnum, $pref_tpl; global $phpgw_info, $pref_tpl;
$pref_tpl->set_var('icon_backcolor',$phpgw_info['theme']['row_off']); $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_name',lang($name));
$pref_tpl->set_var('app_icon',$icon); $pref_tpl->set_var('app_icon',$icon);
if ($icon) if ($icon)
{ {
$pref_tpl->parse('V_icon_cell','B_icon_cell'); $pref_tpl->parse('rows','app_row',True);
} }
else else
{ {
$pref_tpl->set_var('V_icon_cell','&nbsp;'); $pref_tpl->parse('rows','app_row_noicon',True);
} }
// prepare an iteration variable for section_item to know when to add a <br>
$loopnum = 1;
} }
function section_item($pref_link='',$pref_text='') function section_item($pref_link='',$pref_text='')
{ {
global $phpgw,$phpgw_info, $loopnum, $pref_tpl; global $pref_tpl;
if ($loopnum > 1)
{
$pref_tpl->set_var('insert_br','<br>');
}
else
{
$pref_tpl->set_var('insert_br','');
}
$pref_tpl->set_var('pref_link',$pref_link); $pref_tpl->set_var('pref_link',$pref_link);
$pref_tpl->set_var('pref_text',$pref_text); $pref_tpl->set_var('pref_text',$pref_text);
$pref_tpl->parse('V_link_cell','B_link_cell',True); $pref_tpl->parse('rows','link_row',True);
$loopnum = $loopnum + 1;
} }
function section_end() function section_end()
{ {
global $phpgw,$phpgw_info, $pref_tpl; global $pref_tpl;
$pref_tpl->pparse('out','T_index_out');
$pref_tpl->set_var('V_icon_cell',''); $pref_tpl->parse('rows','spacer_row',True);
$pref_tpl->set_var('V_link_cell',''); }
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(); $phpgw->common->hook();
$pref_tpl->pparse('out','list');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -1,23 +1,30 @@
<!-- BEGIN list -->
<table width="75%" border="0" cellspacing="0" cellpadding="0"> <table width="75%" border="0" cellspacing="0" cellpadding="0">
<tr> {rows}
<td width="5%" valign="middle" bgcolor="{icon_backcolor}">
<!-- BEGIN B_icon_cell -->
<img src="{app_icon}" alt="[ {app_name} ]">
<!-- END B_icon_cell -->
</td>
<td width="95%" valign="middle" bgcolor="{link_backcolor}">
<strong>&nbsp;&nbsp;{app_name}</strong>
</td>
</tr>
<tr>
<td colspan="2" width="100%">
<!-- BEGIN B_link_cell -->
{insert_br}&nbsp;&#8226;&nbsp;<a href="{pref_link}">{pref_text}</a>
<!-- END B_link_cell -->
</td>
</tr>
</table> </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>&nbsp;&nbsp;{app_name}</strong></td>
</tr>
<!-- END app_row -->
<!-- BEGIN app_row_noicon -->
<tr bgcolor="{icon_backcolor}">
<td colspan="2" width="95%" valign="middle"><strong>&nbsp;&nbsp;{app_name}</strong></td>
</tr>
<!-- END app_row_noicon -->
<!-- BEGIN link_row -->
<tr>
<td colspan="2">&nbsp;&#8226;&nbsp;<a href="{pref_link}">{pref_text}</a></td>
</tr>
<!-- END link_row -->
<!-- BEGIN spacer_row -->
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<!-- END spacer_row -->