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$ */
{
echo "<p>\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);
}
?>

View File

@ -12,33 +12,15 @@
/* $Id$ */
{
echo "<p>\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);
}
?>

View File

@ -12,17 +12,18 @@
/* $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);
}
?>

View File

@ -65,6 +65,18 @@
$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');

View File

@ -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();
{
// 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);
}
?>

View File

@ -11,37 +11,14 @@
\**************************************************************************/
/* $Id$ */
{
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_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);
}
?>

View File

@ -12,29 +12,12 @@
/* $Id$ */
{
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);
echo '<a href="' . $phpgw->link ('/phpwebhosting/preferences.php') . '">' . lang ('PHPWebHosting preferences') . '</a>';
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);
}
?>

View File

@ -17,20 +17,23 @@
.tablink { color: #000000; }
-->
</STYLE>
<script language="javascript">
<script language="JavaScript">
<!--
function MM_preloadImages() {
if (document.images) {
function MM_preloadImages()
{
if (document.images)
{
var imgFiles = MM_preloadImages.arguments;
if (document.preloadArray==null) document.preloadArray = new Array();
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++].src = imgFiles[j];
}
}
}
-->
//-->
</script>
<TITLE>{website_title}</TITLE>

View File

@ -12,34 +12,16 @@
/* $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
$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');
}
$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');
$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_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_file($templates);
$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','&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='')
{
global $phpgw,$phpgw_info, $loopnum, $pref_tpl;
if ($loopnum > 1)
{
$pref_tpl->set_var('insert_br','<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();
?>

View File

@ -1,23 +1,30 @@
<!-- BEGIN list -->
<table width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<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>
{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>&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 -->