mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:07 +01:00
templatization of preferences
This commit is contained in:
parent
274a2cb3e0
commit
b63d389f34
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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',' ');
|
||||
}
|
||||
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();
|
||||
|
17
preferences/templates/default/index.tpl
Normal file
17
preferences/templates/default/index.tpl
Normal 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> {app_name}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="100%">
|
||||
{V_link_cell}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- end preferences index.tpl -->
|
1
preferences/templates/default/index_icon_cell.tpl
Normal file
1
preferences/templates/default/index_icon_cell.tpl
Normal file
@ -0,0 +1 @@
|
||||
<img src="{app_icon}" alt="[ {app_name} ]">
|
1
preferences/templates/default/index_link_cell.tpl
Normal file
1
preferences/templates/default/index_link_cell.tpl
Normal file
@ -0,0 +1 @@
|
||||
{insert_br} • <a href="{pref_link}">{pref_text}</a>
|
Loading…
Reference in New Issue
Block a user