From e216114aa4f3e1d94dc151f167cfd56ec0677a60 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 28 Mar 2003 02:20:53 +0000 Subject: [PATCH] added a function for check_boxes and merged the one for text_areas in from the .16 source --- preferences/preferences.php | 66 ++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/preferences/preferences.php b/preferences/preferences.php index 659142f25c..fd58f409fb 100755 --- a/preferences/preferences.php +++ b/preferences/preferences.php @@ -46,6 +46,10 @@ $t->set_block('_preferences','footer'); $t->set_block('_preferences','row_error'); + if ($GLOBALS['HTTP_GET_VARS']['appname'] != 'preverences') + { + $GLOBALS['phpgw']->translation->add_app('preferences'); // we need the prefs translations too + } /* Make things a little easier to follow */ /* Some places we will need to change this if there in common */ function check_app() @@ -102,6 +106,36 @@ $t->fp('rows','row',True); } + function create_check_box($label_name,$preference_name) + { + global $t; + + $_appname = check_app(); + $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t); + $t->set_var('row_name',lang($label_name)); + + if (is_forced_value($_appname,$preference_name)) + { + return True; + } + + switch ($GLOBALS['type']) + { + case 'user': + $s = ''; + break; + case 'default': + $s = 'data[$_appname][$preference_name] ? ' CHECKED' : '') . '">'; + break; + case 'forced': + $s = 'data[$_appname][$preference_name] ? ' CHECKED' : '') . '">'; + break; + } + $t->set_var('row_value',$s); + + $t->fp('rows','row',True); + } + function create_option_string($selected,$values) { while (is_array($values) && list($var,$value) = each($values)) @@ -151,6 +185,36 @@ $t->fp('rows','row',True); } + + function create_text_area($label_name,$preference_name,$rows,$cols) + { + global $t; + + $_appname = check_app(); + $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t); + $t->set_var('row_name',lang($label_name)); + + if (is_forced_value($_appname,$preference_name)) + { + return True; + } + + switch ($GLOBALS['type']) + { + case 'user': + $s = ''; + break; + case 'default': + $s = ''; + break; + case 'forced': + $s = ''; + break; + } + $t->set_var('row_value',$s); + + $t->fp('rows','row',True); + } function process_array(&$_p, $array) { @@ -291,7 +355,7 @@ } else { - $t->set_var('lang_title',lang('%1 - Preferences',$GLOBALS['phpgw_info']['navbar'][$GLOBALS['appname']]['title'])); + $t->set_var('lang_title',lang('%1 - Preferences',$GLOBALS['phpgw_info']['apps'][$GLOBALS['HTTP_GET_VARS']['appname']]['title'])); } $t->set_var('action_url',$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $GLOBALS['appname']));