From: thomppj Date: Sun, 11 Nov 2001 00:09:18 +0000 (+0000) Subject: More work done on the options stuff. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=ce39317491517268fe421d95b7329bbe80a2fe8d More work done on the options stuff. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1719 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/constants.php b/functions/constants.php index 50daeecf..15756f8c 100644 --- a/functions/constants.php +++ b/functions/constants.php @@ -27,5 +27,7 @@ define('SMPREF_LOC_LEFT', ''); define('SMPREF_LOC_RIGHT', 'right'); + define('SMPREF_NONE', 'none'); + do_hook("loading_constants"); ?> diff --git a/src/left_main.php b/src/left_main.php index 30bd6694..87148242 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -158,7 +158,7 @@ echo '
'; echo _("Folders") . "
\n\n"; - if($date_format != 6) { + if ($date_format != 6) { /* First, display the clock. */ if ($hour_format == 1) { if ($date_format == 4) { diff --git a/src/options.php b/src/options.php index 5e333278..aa6b2c0d 100644 --- a/src/options.php +++ b/src/options.php @@ -66,30 +66,30 @@ echo '
'._("Successfully saved personal information!").'
'; } else if (isset($submit_display)) { - // Do checking to make sure $chosentheme is in the array - $in_ary = false; + /* Do checking to make sure $new_theme is in the array. */ + $theme_in_array = false; for ($i=0; $i < count($theme); $i++) { - if ($theme[$i]['PATH'] == $chosentheme) { - $in_ary = true; + if ($theme[$i]['PATH'] == $new_chosen_theme) { + $theme_in_array = true; break; } } - if (! $in_ary) { - $chosentheme = ''; + if (!$theme_in_array) { + $new_chosen_theme = ''; } /* Save display preferences. */ - setPref($data_dir, $username, 'chosen_theme', $chosentheme); - setPref($data_dir, $username, 'language', $language); - setPref($data_dir, $username, 'use_javascript_addr_book', $javascript_abook); + setPref($data_dir, $username, 'chosen_theme', $new_chosen_theme); + setPref($data_dir, $username, 'language', $new_language); + setPref($data_dir, $username, 'use_javascript_addr_book', $new_use_javascript_addr_book); setPref($data_dir, $username, 'javascript_setting', $new_javascript_setting); setPref($data_dir, $username, 'show_num', $new_show_num); setPref($data_dir, $username, 'wrap_at', $new_wrap_at); setPref($data_dir, $username, 'editor_size', $new_editor_size); - setPref($data_dir, $username, 'left_refresh', $leftrefresh); setPref($data_dir, $username, 'location_of_buttons', $new_location_of_buttons); setPref($data_dir, $username, 'location_of_bar', $new_location_of_bar); - setPref($data_dir, $username, 'left_size', $leftsize); + setPref($data_dir, $username, 'left_size', $new_left_size); + setPref($data_dir, $username, 'left_refresh', $new_left_refresh); if (isset($altIndexColors) && $altIndexColors == 1) { setPref($data_dir, $username, 'alt_index_colors', 1); diff --git a/src/options_display.php b/src/options_display.php index 540cbf71..f0aede33 100644 --- a/src/options_display.php +++ b/src/options_display.php @@ -18,7 +18,7 @@ require_once('../functions/options.php'); displayPageHeader($color, 'None'); - $chosen_language = getPref($data_dir, $username, 'language'); + $language = getPref($data_dir, $username, 'language'); ?>
@@ -32,24 +32,49 @@
_("JavaScript"), - '0' => _("HTML") ), - $use_javascript_addr_book ); - /*** BEGIN OPTIONS CLASS EXPERMINENTATION ***/ + /* Build a simple array into which we will build options. */ + $optvals = array(); - /* Build a simple array with which to start. */ - $optvals = array(); - + $theme_values = array(); + foreach ($theme as $theme_key => $theme_attributes) { + $theme_values[$theme_attributes['PATH']] = $theme_attributes['NAME']; + } + $optvals[] = array( + 'name' => 'chosen_theme', + 'caption' => _("Theme"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_ALL, + 'posvals' => $theme_values + ); + + $language_values = array(); + foreach ($languages as $lang_key => $lang_attributes) { + if (isset($lang_attributes['NAME'])) { + $language_values[$lang_key] = $lang_attributes['NAME']; + } + } + $optvals[] = array( + 'name' => 'language', + 'caption' => _("Language"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_ALL, + 'posvals' => $language_values + ); + + $optvals[] = array( + 'name' => 'use_javascript_addr_book', + 'caption' => _("Addressbook Display Format"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_NONE, + 'posvals' => array('1' => _("Javascript"), + '0' => _("HTML")) + ); /* Set values for the "use javascript" option. */ $optvals[] = array( 'name' => 'javascript_setting', - 'caption' =>_("Use Javascript"), + 'caption' => _("Use Javascript"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_ALL, 'posvals' => array(SMPREF_JS_AUTODETECT => _("Autodetect"), @@ -86,33 +111,57 @@ 'refresh' => SMOPT_REFRESH_NONE ); - OptionSelect( _("Location of buttons when composing"), - 'button_new_location', - array( 'top' => _("Before headers"), - 'between' => _("Between headers and message body"), - 'bottom' => _("After message body") ), - $location_of_buttons ); - $optvals[] = array( 'name' => 'location_of_buttons', - 'caption' =>_("Location of Buttons when Composing"), + 'caption' => _("Location of Buttons when Composing"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, - 'posvals' => array(SMPREF_LOC_TOP => _("Before headers"), - SMPREF_LOC_BETWEEN => _("Between headers and message body"), - SMPREF_LOC_BOTTOM => _("After message body")) + 'posvals' => array(SMPREF_LOC_TOP => _("Before headers"), + SMPREF_LOC_BETWEEN => _("Between headers and message body"), + SMPREF_LOC_BOTTOM => _("After message body")) ); $optvals[] = array( 'name' => 'location_of_bar', - 'caption' =>_("Location of Folder List"), + 'caption' => _("Location of Folder List"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_ALL, + 'posvals' => array(SMPREF_LOC_LEFT => _("Left"), + SMPREF_LOC_RIGHT => _("Right")) + ); + + $left_size_values = array(); + for ($lsv = 100; $lsv <= 300; $lsv += 10) { + $left_size_values[$lsv] = "$lsv " . _("pixels"); + } + $optvals[] = array( + 'name' => 'left_size', + 'caption' => _("Width of Folder List"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_ALL, - 'posvals' => array(SMPREF_LOC_LEFT => _("Left"), - SMPREF_LOC_RIGHT => _("Right")) + 'posvals' => $left_size_values ); - /* Now, build the complete options array. */ + $minute_str = _("Minutes"); + $left_refresh_values = array(SMPREF_NONE => _("Never")); + foreach (array(30,60,120,180,300,600) as $lr_val) { + if ($lr_val < 60) { + $left_refresh_values[$lr_val] = "$lr_val " . _("Seconds"); + } else if ($lr_val == 60) { + $left_refresh_values[$lr_val] = "1 " . _("Minute"); + } else { + $left_refresh_values[$lr_val] = ($lr_val/60) . " $minute_str"; + } + } + $optvals[] = array( + 'name' => 'left_refresh', + 'caption' => _("Auto Refresh Folder List"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_FOLDERLIST, + 'posvals' => $left_refresh_values + ); + + /* Build all these values into an array of SquirrelOptions objects. */ $options = createOptionArray($optvals); /* Print the row for each option. */ @@ -128,26 +177,8 @@ } } - /*** END OPTIONS CLASS EXPERMINENTATION ***/ - - for ($i = 100; $i <= 300; $i += 10) { - $res[$i] = $i . _("pixels"); - } - OptionSelect( _("Width of folder list"), - 'leftsize', - $res, - $left_size ); - $minutes_str = _("Minutes"); - OptionSelect( _("Auto refresh folder list"), - 'leftrefresh', - array( 'None' => _("Never"), - 30 => '30 '. _("Seconds"), - 60 => '1 ' . _("Minute"), - 120 => "2 $minutes_str", - 180 => "3 $minutes_str", - 300 => "5 $minutes_str", - 600 => "10 $minutes_str" ), - $left_refresh ); + /*** NOT YET CONVERTED TO OPTION OBJECTS ***/ + OptionRadio( _("Use alternating row colors?"), 'altIndexColors', array( 1 => _("Yes"),