X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Foptions.php;h=8b78c4914c8b36611c715879359d1fbb648e3662;hb=fd87494d30afbfc69dafcaaaec43e287be4bc22c;hp=b80e70df7b998d8a0b4934c305ad222e7b27a18d;hpb=2848c63043510b5335e45c6186a4afd13807194e;p=squirrelmail.git diff --git a/src/options.php b/src/options.php index b80e70df..8b78c491 100644 --- a/src/options.php +++ b/src/options.php @@ -1,327 +1,306 @@ -\n"; - displayPageHeader($color, "None"); +?> - /** load up some of the values from the pref file **/ - $fullname = getPref($data_dir, $username, "full_name"); - $replyto = getPref($data_dir, $username, "reply_to"); - $email_address = getPref($data_dir, $username, "email_address"); - $chosen_language = getPref($data_dir, $username, "language"); +
+ + +
+
- echo "\n"; - echo " \n"; - echo "
\n"; - echo _("Options"); - echo "
\n"; + + +
- echo "
\n"; - echo "\n"; - // FULL NAME - echo " "; - echo " "; - echo " "; - echo " "; - // FROM-ADDRESS - echo " "; - echo " "; - echo " "; - echo " "; - // REPLY-TO - echo " "; - echo " "; - echo " "; - echo " "; - // THEME - echo " "; - echo " "; - echo " "; - echo " "; - // LANGUAGE - echo " "; - echo " "; - echo " "; - echo " "; - echo "
"; - echo _("Full Name:"); - echo " "; - echo "
"; - echo "
"; - echo _("E-mail address:"); - echo " "; - echo "
"; - echo "
"; - echo _("Reply-to:"); - echo " "; - echo "
"; - echo "
"; - echo _("Theme:"); - echo " "; +'._("Successfully saved personal information!").'
'; + } else if (isset($submit_display)) { + /* 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'] == $new_chosen_theme) { + $theme_in_array = true; + break; + } + } + if (!$theme_in_array) { + $new_chosen_theme = ''; + } + + /* Save display preferences. */ + 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, 'location_of_buttons', $new_location_of_buttons); + setPref($data_dir, $username, 'location_of_bar', $new_location_of_bar); + setPref($data_dir, $username, 'left_size', $new_left_size); + setPref($data_dir, $username, 'left_refresh', $new_left_refresh); + setPref($data_dir, $username, 'alt_index_colors', $new_alt_index_colors); + setPref($data_dir, $username, 'show_html_default', $new_show_html_default); + setPref($data_dir, $username, 'include_self_reply_all', $new_include_self_reply_all); + setPref($data_dir, $username, 'page_selector', $new_page_selector); + setPref($data_dir, $username, 'page_selector_max', $new_page_selector_max); - echo " "; - echo "
"; - echo _("Language:"); - echo " "; + $js_autodetect_results = (isset($new_js_autodetect_results) ? $new_js_autodetect_results : SMPREF_JS_OFF); + if ($new_javascript_setting == SMPREF_JS_AUTODETECT) { + if ($js_autodetect_results == 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); + } - echo " "; - echo "
"; + do_hook('options_display_save'); + echo '
'._("Successfully saved display preferences!").'
'; + echo '' . _("Refresh Page") . '
'; + } else if (isset($submit_folder)) { + /* Save folder preferences. */ + if ($trash != 'none') { + setPref($data_dir, $username, 'move_to_trash', true); + setPref($data_dir, $username, 'trash_folder', $trash); + } else { + setPref($data_dir, $username, 'move_to_trash', '0'); + setPref($data_dir, $username, 'trash_folder', 'none'); + } + if ($sent != 'none') { + setPref($data_dir, $username, 'move_to_sent', true); + setPref($data_dir, $username, 'sent_folder', $sent); + } else { + setPref($data_dir, $username, 'move_to_sent', '0'); + setPref($data_dir, $username, 'sent_folder', 'none'); + } + if ($draft != 'none') { + setPref($data_dir, $username, 'save_as_draft', true); + setPref($data_dir, $username, 'draft_folder', $draft); + } else { + setPref($data_dir, $username, 'save_as_draft', '0'); + setPref($data_dir, $username, 'draft_folder', 'none'); + } + if (isset($folderprefix)) { + setPref($data_dir, $username, 'folder_prefix', $folderprefix); + } else { + setPref($data_dir, $username, 'folder_prefix', ''); + } + setPref($data_dir, $username, 'unseen_notify', $unseennotify); + setPref($data_dir, $username, 'unseen_type', $unseentype); + if (isset($collapsefolders)) + setPref($data_dir, $username, 'collapse_folders', $collapsefolders); + else + removePref($data_dir, $username, 'collapse_folders'); + setPref($data_dir, $username, 'date_format', $dateformat); + setPref($data_dir, $username, 'hour_format', $hourformat); + do_hook('options_folders_save'); + echo '
'._("Successfully saved folder preferences!").'
'; + echo '' . _("Refresh Folder List") . '
'; + } else { + do_hook('options_save'); + } + /****************************************/ + /* Now build our array of option pages. */ + /****************************************/ - echo "\n"; - // MOVE_TO_TRASH - echo " "; - echo " "; - echo " "; - echo " "; + /* Build a section for Message Highlighting Options. */ + $optionpages[] = array( + 'name' =>_("Message Highlighting"), + 'url' => 'options_highlight.php', + 'desc' =>_("Based upon given criteria, incoming messages can have different background colors in the message list. This helps to easily distinguish who the messages are from, especially for mailing lists."), + 'js' => false + ); - // WRAP_AT - echo " "; - echo " "; - echo " "; - echo " "; + /* Build a section for Folder Options. */ + $optionpages[] = array( + 'name' => _("Folder Preferences"), + 'url' => 'options_folder.php', + 'desc' => _("These settings change the way your folders are displayed and manipulated."), + 'js' => false + ); - // EDITOR_SIZE - echo " "; - echo " "; - echo " "; - echo " "; + /* Build a section for Index Order Options. */ + $optionpages[] = array( + 'name' => _("Index Order"), + 'url' => 'options_order.php', + 'desc' => _("The order of the message index can be rearanged and changed to contain the headers in any order you want."), + 'js' => false + ); + /* Build a section for plugins wanting to register an optionpage. */ + do_hook('options_register'); - // LEFT_SIZE - echo " "; - echo " "; - echo " "; - echo " "; - - - // LEFT_REFRESH - echo " "; - echo " "; - echo " "; - echo " "; - echo "
"; - echo _("Move deleted messages to "); - echo "\"$trash_folder\"?"; - echo " "; - if ($move_to_trash == true) - echo "  True
"; - else - echo "  True
"; + /* Build a section for Personal Options. */ + $optionpages[] = array( + 'name' => _("Personal Information"), + 'url' => 'options_personal.php', + 'desc' => _("This contains personal information about yourself such as your name, your email address, etc."), + 'js' => false + ); - if ($move_to_trash == false) - echo "  False"; - else - echo "  False"; + /* Build a section for Display Options. */ + $optionpages[] = array( + 'name' => _("Display Preferences"), + 'url' => 'options_display.php', + 'desc' => _("You can change the way that SquirrelMail looks and displays information to you, such as the colors, the language, and other settings."), + 'js' => false + ); - echo "
"; - echo _("Wrap incoming text at:"); - echo " "; - if (isset($wrap_at)) - echo "
"; - else - echo "
"; - echo "
"; - echo _("Size of editor window (in characters):"); - echo " "; - if ($editor_size >= 5) - echo "
"; - else - echo "
"; - echo "
"; - echo _("Width of left folder list:"); - echo " \n"; - echo " "; - echo "
"; - echo _("Time between auto refresh of folder list:"); - echo " "; - echo " "; - echo "
"; + /********************************************/ + /* Now, print out each option page section. */ + /********************************************/ + $first_optpage = false; + foreach ($optionpages as $next_optpage) { + if ($first_optpage == false) { + $first_optpage = $next_optpage; + } else { + print_optionpages_row($first_optpage, $next_optpage); + $first_optpage = false; + } + } + + if ($first_optpage != false) { + print_optionpages_row($first_optpage); + } + + do_hook('options_link_and_description'); + +?> +
+ +
- // SIGNATURE - echo "
"; - if ($use_signature == true) - echo "  Use a signature?
"; - else - echo "  "; - echo _("Use a signature?"); - echo "
"; + - if ($editor_size < 5) - $sig_size = 76; - else - $sig_size = $editor_size; +Signature:

"; - echo "
"; + /*******************************************************************/ + /* Please be warned. The code below this point sucks. This is just */ + /* my first implementation to make the option rows work for both */ + /* Javascript and non-Javascript option chunks. */ + /* */ + /* Please, someone make these better for me. All three functions */ + /* below REALLY do close to the same thing. */ + /* */ + /* This code would be GREATLY improved by a templating system. */ + /* Don't try to implement that now, however. That will come later. */ + /*******************************************************************/ + /*******************************************************************/ + /* Actually, now that I think about it, don't do anything with */ + /* this code yet. There is ACTUALLY supposed to be a difference */ + /* between the three functions that write the option rows. I just */ + /* have not yet gotten to integrating that yet. */ + /*******************************************************************/ - // SUBMIT BUTTON - echo "
\n"; - echo ""; + /** + * This function prints out an option page row. + */ + function print_optionpages_row($leftopt, $rightopt = false) { + global $color; + + echo "" . + '' . + "
' . + '' . + '' . + "'. + ""; + if( $rightopt ) { + echo "'; + } else { + echo ""; + } + + echo '' . + '' . + "' . + ""; + if( $rightopt ) { + echo "'; + }else { + echo ""; + } + + echo '' . + '
" . + '' . $leftopt['name'] . ''. + ' " . + '' . $rightopt['name'] . '' . + ' 
" . + $leftopt['desc'] . + ' " . + $rightopt['desc'] . + ' 
' . + '
\n"; + } - echo ""; ?>