X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Foptions_display.php;h=1ddaeb0cc58253c0e62b0ef079dac15c114d5bcd;hb=dbcc5ca308317d7444f1322e661a65f269a31ec3;hp=f92b017023ef39d13a0bb28b8a1259802e9d9b42;hpb=a440e68fce61ad2cd09fe0bc2bb89972b788a92f;p=squirrelmail.git diff --git a/src/options_display.php b/src/options_display.php index f92b0170..1ddaeb0c 100644 --- a/src/options_display.php +++ b/src/options_display.php @@ -1,60 +1,62 @@ -
- - -
-
+/** + * options_display.php + * + * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Displays all optinos about display preferences + * + * $Id$ + */ + +/* Define the group constants for the display options page. */ +define('SMOPT_GRP_GENERAL', 0); +define('SMOPT_GRP_MAILBOX', 1); +define('SMOPT_GRP_MESSAGE', 2); + +/* Define the optpage load function for the display options page. */ +function load_optpage_data_display() { + global $theme, $language, $languages, $js_autodetect_results; - - -
+ /* Build a simple array into which we will build options. */ + $optgrps = array(); + $optvals = array(); -

- - $theme_attributes) { - $theme_values[$theme_attributes['PATH']] = $theme_attributes['NAME']; + $theme_values[$theme_attributes['NAME']] = $theme_attributes['PATH']; } - $optvals[] = array( + ksort($theme_values); + $theme_values = array_flip($theme_values); + $optvals[SMOPT_GRP_GENERAL][] = array( 'name' => 'chosen_theme', 'caption' => _("Theme"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_ALL, - 'posvals' => $theme_values + 'posvals' => $theme_values, + 'save' => 'save_option_theme' ); + $language = (!isset($language) || ($language == '') ? 'en' : $language); $language_values = array(); foreach ($languages as $lang_key => $lang_attributes) { if (isset($lang_attributes['NAME'])) { $language_values[$lang_key] = $lang_attributes['NAME']; } } - $optvals[] = array( + asort($language_values); + $optvals[SMOPT_GRP_GENERAL][] = array( 'name' => 'language', 'caption' => _("Language"), 'type' => SMOPT_TYPE_STRLIST, @@ -63,7 +65,7 @@ ); /* Set values for the "use javascript" option. */ - $optvals[] = array( + $optvals[SMOPT_GRP_GENERAL][] = array( 'name' => 'javascript_setting', 'caption' => _("Use Javascript"), 'type' => SMOPT_TYPE_STRLIST, @@ -73,57 +75,75 @@ SMPREF_JS_OFF => _("Never")) ); + $js_autodetect_script = + "\n"; $js_autodetect_results = SMPREF_JS_OFF; - $optvals[] = array( + $optvals[SMOPT_GRP_GENERAL][] = array( 'name' => 'js_autodetect_results', 'caption' => '', 'type' => SMOPT_TYPE_HIDDEN, - 'refresh' => SMOPT_REFRESH_NONE + 'refresh' => SMOPT_REFRESH_NONE, + 'script' => $js_autodetect_script, + 'save' => 'save_option_javascript_autodetect' ); - $optvals[] = array( + /*** Load the General Options into the array ***/ + $optgrps[SMOPT_GRP_MAILBOX] = _("Mailbox Display Options"); + $optvals[SMOPT_GRP_MAILBOX] = array(); + + $optvals[SMOPT_GRP_MAILBOX][] = array( 'name' => 'show_num', 'caption' => _("Number of Messages to Index"), 'type' => SMOPT_TYPE_INTEGER, - 'refresh' => SMOPT_REFRESH_NONE + 'refresh' => SMOPT_REFRESH_NONE, + 'size' => SMOPT_SIZE_TINY ); - $optvals[] = array( + $optvals[SMOPT_GRP_MAILBOX][] = array( 'name' => 'alt_index_colors', 'caption' => _("Enable Alternating Row Colors"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE ); - $optvals[] = array( + $optvals[SMOPT_GRP_MAILBOX][] = array( 'name' => 'page_selector', 'caption' => _("Enable Page Selector"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE ); - $optvals[] = array( + $optvals[SMOPT_GRP_MAILBOX][] = array( 'name' => 'page_selector_max', 'caption' => _("Maximum Number of Pages to Show"), 'type' => SMOPT_TYPE_INTEGER, - 'refresh' => SMOPT_REFRESH_NONE + 'refresh' => SMOPT_REFRESH_NONE, + 'size' => SMOPT_SIZE_TINY ); - $optvals[] = array( + /*** Load the General Options into the array ***/ + $optgrps[SMOPT_GRP_MESSAGE] = _("Message Display and Composition"); + $optvals[SMOPT_GRP_MESSAGE] = array(); + + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'wrap_at', 'caption' => _("Wrap Incoming Text At"), 'type' => SMOPT_TYPE_INTEGER, - 'refresh' => SMOPT_REFRESH_NONE + 'refresh' => SMOPT_REFRESH_NONE, + 'size' => SMOPT_SIZE_TINY ); - $optvals[] = array( + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'editor_size', 'caption' => _("Size of Editor Window"), 'type' => SMOPT_TYPE_INTEGER, - 'refresh' => SMOPT_REFRESH_NONE + 'refresh' => SMOPT_REFRESH_NONE, + 'size' => SMOPT_SIZE_TINY ); - $optvals[] = array( + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'location_of_buttons', 'caption' => _("Location of Buttons when Composing"), 'type' => SMOPT_TYPE_STRLIST, @@ -133,7 +153,7 @@ SMPREF_LOC_BOTTOM => _("After message body")) ); - $optvals[] = array( + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'use_javascript_addr_book', 'caption' => _("Addressbook Display Format"), 'type' => SMOPT_TYPE_STRLIST, @@ -142,60 +162,93 @@ '0' => _("HTML")) ); - $optvals[] = array( + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'show_html_default', 'caption' => _("Show HTML Version by Default"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE ); - $optvals[] = array( + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'include_self_reply_all', - 'caption' => _("Remove Me from CC when I Reply All"), + 'caption' => _("Include Me in CC when I Reply All"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE ); - $optvals[] = array( + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'show_xmailer_default', 'caption' => _("Enable Mailer Display"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE ); - /* Build all these values into an array of SquirrelOptions objects. */ - $options = createOptionArray($optvals); + $optvals[SMOPT_GRP_MESSAGE][] = array( + 'name' => 'attachment_common_show_images', + 'caption' => _("Display Attached Images with Message"), + 'type' => SMOPT_TYPE_BOOLEAN, + 'refresh' => SMOPT_REFRESH_NONE + ); + + $optvals[SMOPT_GRP_MESSAGE][] = array( + 'name' => 'pf_subtle_link', + 'caption' => _("Enable Subtle Printer Friendly Link"), + 'type' => SMOPT_TYPE_BOOLEAN, + 'refresh' => SMOPT_REFRESH_NONE + ); - /* Print the row for each option. */ - foreach ($options as $option) { - if ($option->type != SMOPT_TYPE_HIDDEN) { - echo "\n"; - echo ' \n"; - echo ' \n"; - echo "\n"; - } else { - echo $option->createHTMLWidget(); + $optvals[SMOPT_GRP_MESSAGE][] = array( + 'name' => 'pf_cleandisplay', + 'caption' => _("Enable Printer Friendly Clean Display"), + 'type' => SMOPT_TYPE_BOOLEAN, + 'refresh' => SMOPT_REFRESH_NONE + ); + + /* Assemble all this together and return it as our result. */ + $result = array( + 'grps' => $optgrps, + 'vals' => $optvals + ); + return ($result); +} + +/******************************************************************/ +/** Define any specialized save functions for this option page. ***/ +/******************************************************************/ + +function save_option_theme($option) { + global $theme; + + /* 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'] == $option->new_value) { + $theme_in_array = true; + break; } } - echo ''; - do_hook('options_display_inside'); - OptionSubmit( 'submit_display' ); -?> - -
' - . $option->caption . ":' . $option->createHTMLWidget() . "

-
+ if (!$theme_in_array) { + $option->new_value = ''; + } - + /* Save the option like normal. */ + save_option($option); +} -
+function save_option_javascript_autodetect($option) { + global $data_dir, $username, $new_javascript_setting; - + /* Set javascript either on or off. */ + if ($new_javascript_setting == SMPREF_JS_AUTODETECT) { + if ($option->new_value == SMPREF_JS_ON) { + setPref($data_dir, $username, 'javascript_on', SMPREF_JS_ON); + } else { + setPref($data_dir, $username, 'javascript_on', SMPREF_JS_OFF); + } + } else { + setPref($data_dir, $username, 'javascript_on', $new_javascript_setting); + } +} -
- +?>