diff --git a/addressbook/inc/hook_preferences.inc.php b/addressbook/inc/hook_preferences.inc.php index 25fa152422..843dff0e87 100644 --- a/addressbook/inc/hook_preferences.inc.php +++ b/addressbook/inc/hook_preferences.inc.php @@ -27,17 +27,17 @@ section_start(ucfirst($appname),$imgpath); - echo '' - . lang('Preferences') . '
'; + section_item($phpgw->link('/addressbook/preferences.php'), + lang('Preferences')); - echo '' - . lang('Grant Access') . '
'; + section_item($phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), + lang('Grant Access')); - echo '' - . lang('Edit Categories') . '
'; + section_item($phpgw->link('/preferences/categories.php','cats_app='.$appname), + lang('Edit Categories')); - echo '' - . lang('Edit custom fields') . ''; + section_item($phpgw->link('/addressbook/fields.php'), + lang('Edit custom fields')); section_end(); } diff --git a/calendar/inc/hook_preferences.inc.php b/calendar/inc/hook_preferences.inc.php index 5d1806323b..a22085c0aa 100644 --- a/calendar/inc/hook_preferences.inc.php +++ b/calendar/inc/hook_preferences.inc.php @@ -33,14 +33,14 @@ section_start(ucfirst($appname),$imgpath); - echo '' . lang('Calendar preferences') - . '
'; + section_item($phpgw->link('/calendar/preferences.php'), + lang('Calendar preferences')); - echo '' - . lang('Grant Calendar Access') . '
'; + section_item($phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), + lang('Grant Calendar Access')); - echo '' - . lang('Edit Categories') . ''; + section_item($phpgw->link('/preferences/categories.php','cats_app='.$appname), + lang('Edit Categories')); section_end(); } diff --git a/preferences/inc/hook_preferences.inc.php b/preferences/inc/hook_preferences.inc.php index 72014c74d0..39c2b02383 100644 --- a/preferences/inc/hook_preferences.inc.php +++ b/preferences/inc/hook_preferences.inc.php @@ -12,32 +12,34 @@ /* $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); - - - // Actual content - if ($phpgw->acl->check('changepassword',1)) { - echo "link('/preferences/changepassword.php') . "\">" - . lang("change your password") . ""; + 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 = ""; + } } - echo "
link('/preferences/settings.php') . "\">" - . lang("change your settings") . ""; -// echo "
link("changeprofile.php") . "\">" -// . lang("change your profile") . ""; + + section_start("Account Preferences",$imgpath); - section_end(); + // Actual content + if ($phpgw->acl->check('changepassword',1)) + { + section_item($phpgw->link('/preferences/changepassword.php'), lang("change your password")); + } + + section_item($phpgw->link('/preferences/settings.php'), lang('change your settings')); + + section_end(); } ?> diff --git a/preferences/index.php b/preferences/index.php index cdd59f799f..3513f40485 100755 --- a/preferences/index.php +++ b/preferences/index.php @@ -14,33 +14,62 @@ $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 "\n"; - echo '
'; - //echo ""; - echo ''; - + 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 ''; - echo ''; + $pref_tpl->parse('V_icon_cell','T_icon_cell'); } else { - echo ''; + $pref_tpl->set_var('V_icon_cell',' '); } - echo ''; - echo '
[Icon]' . lang($name) . '' . $name . '
'; + + // 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',''); + } + + $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 '
'; - 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(); diff --git a/preferences/templates/default/index.tpl b/preferences/templates/default/index.tpl new file mode 100644 index 0000000000..3e94f0d012 --- /dev/null +++ b/preferences/templates/default/index.tpl @@ -0,0 +1,17 @@ + + + + + + + + + +
+ {V_icon_cell} + +   {app_name} +
+ {V_link_cell} +
+ \ No newline at end of file diff --git a/preferences/templates/default/index_icon_cell.tpl b/preferences/templates/default/index_icon_cell.tpl new file mode 100644 index 0000000000..dd59fa5fa3 --- /dev/null +++ b/preferences/templates/default/index_icon_cell.tpl @@ -0,0 +1 @@ +[ {app_name} ] \ No newline at end of file diff --git a/preferences/templates/default/index_link_cell.tpl b/preferences/templates/default/index_link_cell.tpl new file mode 100644 index 0000000000..0f3cff005a --- /dev/null +++ b/preferences/templates/default/index_link_cell.tpl @@ -0,0 +1 @@ +{insert_br}  •  {pref_text} \ No newline at end of file