templatization of preferences

This commit is contained in:
angles 2001-05-11 17:19:20 +00:00
parent 274a2cb3e0
commit b63d389f34
7 changed files with 101 additions and 51 deletions

View File

@ -27,17 +27,17 @@
section_start(ucfirst($appname),$imgpath);
echo '<a href="' . $phpgw->link('/addressbook/preferences.php') . '">'
. lang('Preferences') . '</a><br>';
section_item($phpgw->link('/addressbook/preferences.php'),
lang('Preferences'));
echo '<a href="' . $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname) . '">'
. lang('Grant Access') . '</a><br>';
section_item($phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname),
lang('Grant Access'));
echo '<a href="' . $phpgw->link('/preferences/categories.php','cats_app='.$appname) . '">'
. lang('Edit Categories') . '</a><br>';
section_item($phpgw->link('/preferences/categories.php','cats_app='.$appname),
lang('Edit Categories'));
echo '<a href="' . $phpgw->link('/addressbook/fields.php') . '">'
. lang('Edit custom fields') . '</a>';
section_item($phpgw->link('/addressbook/fields.php'),
lang('Edit custom fields'));
section_end();
}

View File

@ -33,14 +33,14 @@
section_start(ucfirst($appname),$imgpath);
echo '<a href="' . $phpgw->link('/calendar/preferences.php') . '">' . lang('Calendar preferences')
. '</a><br>';
section_item($phpgw->link('/calendar/preferences.php'),
lang('Calendar preferences'));
echo '<a href="' . $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname) . '">'
. lang('Grant Calendar Access') . '</a><br>';
section_item($phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname),
lang('Grant Calendar Access'));
echo '<a href="' . $phpgw->link('/preferences/categories.php','cats_app='.$appname) . '">'
. lang('Edit Categories') . '</a>';
section_item($phpgw->link('/preferences/categories.php','cats_app='.$appname),
lang('Edit Categories'));
section_end();
}

View File

@ -14,29 +14,31 @@
{
echo "<p>\n";
$imgfile = $phpgw->common->get_image_dir("preferences")."/" . $appname .".gif";
if (file_exists($imgfile)) {
if (file_exists($imgfile))
{
$imgpath = $phpgw->common->get_image_path("preferences")."/" . $appname .".gif";
} else {
} else
{
$imgfile = $phpgw->common->get_image_dir("preferences")."/navbar.gif";
if (file_exists($imgfile)) {
if (file_exists($imgfile))
{
$imgpath = $phpgw->common->get_image_path("preferences")."/navbar.gif";
} else {
} else
{
$imgpath = "";
}
}
section_start("Account Preferences",$imgpath);
// Actual content
if ($phpgw->acl->check('changepassword',1)) {
echo "<a href=\"" . $phpgw->link('/preferences/changepassword.php') . "\">"
. lang("change your password") . "</a>";
if ($phpgw->acl->check('changepassword',1))
{
section_item($phpgw->link('/preferences/changepassword.php'), lang("change your password"));
}
echo "<br><a href=\"" . $phpgw->link('/preferences/settings.php') . "\">"
. lang("change your settings") . "</a>";
// echo "<br><a href=\"" . $phpgw->link("changeprofile.php") . "\">"
// . lang("change your profile") . "</a>";
section_item($phpgw->link('/preferences/settings.php'), lang('change your settings'));
section_end();
}

View File

@ -15,32 +15,61 @@
$phpgw_info['flags']['currentapp'] = 'preferences';
include('../header.inc.php');
$pref_tpl = new Template($phpgw->common->get_tpl_dir('preferences'));
$pref_tpl->set_file(array(
'T_icon_cell' => 'index_icon_cell.tpl',
'T_link_cell' => 'index_link_cell.tpl',
'index_out' => 'index.tpl',
));
// initialize
// This func called by the includes to dump a row header
function section_start($name='',$icon='')
{
global $phpgw,$phpgw_info;
//echo "<TABLE WIDTH=\"75%\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" BGCOLOR=\"".$phpgw_info["theme"]["navbar_bg"]."\">\n";
echo '<TABLE WIDTH="75%" BORDER="0" CELLSPACING="0" CELLPADDING="0">';
//echo "<TR BGCOLOR=\"".$phpgw_info["theme"]["navbar_bg"]."\">";
echo '<TR>';
global $phpgw,$phpgw_info, $loopnum, $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('app_name',lang($name));
$pref_tpl->set_var('app_icon',$icon);
if ($icon)
{
echo '<TD WIDTH="5%"><img src="' . $icon . '" ALT="[Icon]" align="middle"></TD>';
echo '<TD><fontsize="+2">' . lang($name) . '</font></TD>';
$pref_tpl->parse('V_icon_cell','T_icon_cell');
}
else
{
echo '<TD colspan="2"><font size="+2">' . $name . '</font></TD>';
$pref_tpl->set_var('V_icon_cell','&nbsp;');
}
echo '</TR>';
echo '<TR><TD colspan="2">';
// 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','');
}
$pref_tpl->set_var('pref_link',$pref_link);
$pref_tpl->set_var('pref_text',$pref_text);
$pref_tpl->parse('V_link_cell','T_link_cell',True);
$loopnum = $loopnum + 1;
}
function section_end()
{
echo '</TD></TR></TABLE>';
echo "\n\n";
global $phpgw,$phpgw_info, $pref_tpl;
$pref_tpl->pparse('out','index_out');
$pref_tpl->set_var('V_icon_cell','');
$pref_tpl->set_var('V_link_cell','');
}
$phpgw->common->hook();

View File

@ -0,0 +1,17 @@
<!-- begin preferences index.tpl -->
<table width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" valign="middle" bgcolor="{icon_backcolor}">
{V_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%">
{V_link_cell}
</td>
</tr>
</table>
<!-- end preferences index.tpl -->

View File

@ -0,0 +1 @@
<img src="{app_icon}" alt="[ {app_name} ]">

View File

@ -0,0 +1 @@
{insert_br} &nbsp;&#8226;&nbsp; <a href="{pref_link}">{pref_text}</a>