X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=include%2Foptions%2Fdisplay.php;h=92359e509ab267cb7e58409b479d524f9a3094d3;hb=ceee04976336b7b26273a1fa979482c4450e7a3d;hp=9d9397fb46808191a6fff3d51b6746008592eb72;hpb=3cb80c8cd51244ba10d9bd6a934a1b6b941d065f;p=squirrelmail.git diff --git a/include/options/display.php b/include/options/display.php index 9d9397fb..92359e50 100644 --- a/include/options/display.php +++ b/include/options/display.php @@ -3,12 +3,12 @@ /** * options_display.php * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 1999-2004 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * Displays all optinos about display preferences * - * $Id$ + * @version $Id$ * @package squirrelmail */ @@ -17,6 +17,22 @@ define('SMOPT_GRP_GENERAL', 0); define('SMOPT_GRP_MAILBOX', 1); define('SMOPT_GRP_MESSAGE', 2); +// load icon themes if in use +global $use_icons; +if ($use_icons) { + global $icon_themes; + $dirName = SM_PATH . 'images/themes'; + if (is_readable($dirName) && is_dir($dirName)) { + $d = dir($dirName); + while($dir = $d->read()) { + if ($dir != "." && $dir != "..") { + if (is_dir($dirName."/".$dir) && file_exists("$dirName/$dir/theme.php")) + include("$dirName/$dir/theme.php"); + } + } + } +} + /** * This function builds an array with all the information about * the options available to the user, and returns it. The options @@ -31,9 +47,9 @@ define('SMOPT_GRP_MESSAGE', 2); * @return array all option information */ function load_optpage_data_display() { - global $theme, $language, $languages, $js_autodetect_results, + global $theme, $language, $languages, $js_autodetect_results, $javascript_setting, $compose_new_win, $default_use_mdn, $squirrelmail_language, $allow_thread_sort, - $optmode, $show_alternative_names, $available_languages; + $optmode, $show_alternative_names, $available_languages, $use_icons; /* Build a simple array into which we will build options. */ $optgrps = array(); @@ -62,18 +78,21 @@ function load_optpage_data_display() { 'posvals' => $theme_values, 'save' => 'save_option_theme' ); - + $css_values = array( 'none' => _("Default" ) ); - $handle=opendir('../themes/css/'); - while ($file = readdir($handle) ) { - if ( substr( $file, -4 ) == '.css' ) { - $css_values[$file] = substr( $file, 0, strlen( $file ) - 4 ); + + if (is_readable(SM_PATH . 'themes/css') && is_dir(SM_PATH . 'themes/css')) { + $handle=opendir(SM_PATH . 'themes/css'); + while ($file = readdir($handle) ) { + if ( substr( $file, -4 ) == '.css' ) { + $css_values[$file] = substr( $file, 0, strlen( $file ) - 4 ); + } } + closedir($handle); } - closedir($handle); - + if ( count( $css_values ) > 1 ) { - + $optvals[SMOPT_GRP_GENERAL][] = array( 'name' => 'custom_css', 'caption' => _("Custom Stylesheet"), @@ -81,13 +100,13 @@ function load_optpage_data_display() { 'refresh' => SMOPT_REFRESH_ALL, 'posvals' => $css_values ); - + } // config.php can be unupdated. if (! isset($available_languages) || $available_languages=="" ) { $available_languages="ALL"; } - + $language_values = array(); if ( strtoupper($available_languages)=='ALL') { foreach ($languages as $lang_key => $lang_attributes) { @@ -111,7 +130,7 @@ function load_optpage_data_display() { isset($languages[$lang_key]['ALTNAME']) ) { $language_values[$lang_key] .= " / " . $languages[$lang_key]['ALTNAME']; } - } + } } } asort($language_values); @@ -137,22 +156,17 @@ function load_optpage_data_display() { 'refresh' => SMOPT_REFRESH_ALL, 'posvals' => array(SMPREF_JS_AUTODETECT => _("Autodetect"), SMPREF_JS_ON => _("Always"), - SMPREF_JS_OFF => _("Never")) + SMPREF_JS_OFF => _("Never")), + 'save' => 'save_option_javascript_autodetect', + 'script' => 'onclick="document.forms[0].new_js_autodetect_results.value = \'' . SMPREF_JS_ON . '\';"' ); - - if ($optmode != 'submit') - $onLoadScript = 'document.forms[0].new_js_autodetect_results.value = \'' . SMPREF_JS_ON . '\''; - else - $onLoadScript = ''; - $optvals[SMOPT_GRP_GENERAL][] = array( 'name' => 'js_autodetect_results', 'caption' => '', 'type' => SMOPT_TYPE_HIDDEN, - 'refresh' => SMOPT_REFRESH_NONE, + 'refresh' => SMOPT_REFRESH_NONE //'post_script' => $js_autodetect_script, - 'save' => 'save_option_javascript_autodetect' ); /*** Load the General Options into the array ***/ @@ -174,6 +188,34 @@ function load_optpage_data_display() { 'refresh' => SMOPT_REFRESH_NONE ); + if ($use_icons) { + global $icon_themes, $icon_theme; + $temp = array(); + for ($count = 0; $count < sizeof($icon_themes); $count++) { + $temp[$count] = $icon_themes[$count]['NAME']; + if ($icon_theme == $icon_themes[$count]['PATH']) + $value = $count; + } + if (sizeof($icon_themes) > 0) { + $optvals[SMOPT_GRP_MAILBOX][] = array( + 'name' => 'icon_theme', + 'caption' => _("Message Flags Icon Theme"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_NONE, + 'posvals' => $temp, + 'initial_value' => $value, + 'save' => 'icon_theme_save' + ); + } + } + + $optvals[SMOPT_GRP_MAILBOX][] = array( + 'name' => 'show_flag_buttons', + 'caption' => _("Show Flag / Unflag Buttons"), + 'type' => SMOPT_TYPE_BOOLEAN, + 'refresh' => SMOPT_REFRESH_NONE + ); + $optvals[SMOPT_GRP_MAILBOX][] = array( 'name' => 'page_selector', 'caption' => _("Enable Page Selector"), @@ -357,6 +399,15 @@ function load_optpage_data_display() { 'refresh' => SMOPT_REFRESH_NONE ); + $optvals[SMOPT_GRP_MESSAGE][] = array( + 'name' => 'body_quote', + 'caption' => _("Prefix for Original Message when Replying"), + 'type' => SMOPT_TYPE_STRING, + 'refresh' => SMOPT_REFRESH_NONE, + 'size' => SMOPT_SIZE_TINY, + 'save' => 'save_option_reply_prefix' + ); + $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'reply_focus', 'caption' => _("Cursor Position when Replying"), @@ -364,7 +415,8 @@ function load_optpage_data_display() { 'refresh' => SMOPT_REFRESH_NONE, 'posvals' => array('' => _("To: field"), 'focus' => _("Focus in body"), - 'select' => _("Select body")) + 'select' => _("Select body"), + 'none' => _("No focus")) ); $optvals[SMOPT_GRP_MESSAGE][] = array( @@ -376,7 +428,7 @@ function load_optpage_data_display() { $optvals[SMOPT_GRP_MESSAGE][] = array( 'name' => 'internal_date_sort', - 'caption' => _("Enable Sort by of Receive Date"), + 'caption' => _("Sort by Receive Date"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_ALL ); @@ -393,13 +445,12 @@ function load_optpage_data_display() { 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_ALL ); - + } /* Assemble all this together and return it as our result. */ $result = array( 'grps' => $optgrps, - 'vals' => $optvals, - 'xtra' => $onLoadScript + 'vals' => $optvals ); return ($result); } @@ -408,13 +459,15 @@ function load_optpage_data_display() { /** Define any specialized save functions for this option page. ***/ /******************************************************************/ +function save_option_header($option) { +} + /** * This function saves a new theme setting. * It updates the theme array. */ 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) { @@ -436,18 +489,45 @@ function save_option_theme($option) { * This function saves the javascript detection option. */ function save_option_javascript_autodetect($option) { + global $data_dir, $username; + + save_option($option); + checkForJavascript(TRUE); +} + +/** + * This function saves the user's icon theme setting + */ +function icon_theme_save($option) { + + global $icon_themes, $data_dir, $username; + + + // Don't assume the new value is there, double check + // and only save if found + // + if (isset($icon_themes[$option->new_value]['PATH'])) + setPref($data_dir, $username, 'icon_theme', $icon_themes[$option->new_value]['PATH']); + else + setPref($data_dir, $username, 'icon_theme', 'none'); + +} + +/** + * This function saves the reply prefix (body_quote) character(s) + */ +function save_option_reply_prefix($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); - } + // save as "NONE" if it was blanked out + // + if (empty($option->new_value)) $option->new_value = 'NONE'; + + + // Save the option like normal. + // + save_option($option); + } ?>