More work done on the options stuff.
authorthomppj <thomppj@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 11 Nov 2001 00:09:18 +0000 (00:09 +0000)
committerthomppj <thomppj@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 11 Nov 2001 00:09:18 +0000 (00:09 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1719 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/constants.php
src/left_main.php
src/options.php
src/options_display.php

index 50daeecf959855d9cc43678fdf341ba91a4b6c8e..15756f8cf017801fd8191f2b8f54a3f65c796489 100644 (file)
@@ -27,5 +27,7 @@
     define('SMPREF_LOC_LEFT', '');
     define('SMPREF_LOC_RIGHT', 'right');
 
     define('SMPREF_LOC_LEFT', '');
     define('SMPREF_LOC_RIGHT', 'right');
 
+    define('SMPREF_NONE', 'none');
+
     do_hook("loading_constants");
 ?>
     do_hook("loading_constants");
 ?>
index 30bd66942a9b86ea13e9b68eb474f4acfd4c378a..871482426608e4f268e3cd8a23a884b59935f739 100644 (file)
     echo '<CENTER><FONT SIZE=4><B>';
     echo _("Folders") . "</B><BR></FONT>\n\n";
 
     echo '<CENTER><FONT SIZE=4><B>';
     echo _("Folders") . "</B><BR></FONT>\n\n";
 
-    if($date_format != 6) { 
+    if ($date_format != 6) { 
         /* First, display the clock. */
         if ($hour_format == 1) {
           if ($date_format == 4) {
         /* First, display the clock. */
         if ($hour_format == 1) {
           if ($date_format == 4) {
index 5e33327892e1e14cb468edbd658da444f870cc7f..aa6b2c0d67e29dd04eab386cc76f1fa6b6fd54b8 100644 (file)
       
         echo '<br><b>'._("Successfully saved personal information!").'</b><br>';
     } else if (isset($submit_display)) {
       
         echo '<br><b>'._("Successfully saved personal information!").'</b><br>';
     } 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++) {
         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;
             }
         }
                 break;
             }
         }
-        if (! $in_ary) {
-            $chosentheme = '';
+        if (!$theme_in_array) {
+            $new_chosen_theme = '';
         }
    
         /* Save display preferences. */
         }
    
         /* 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, '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, '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);
 
         if (isset($altIndexColors) && $altIndexColors == 1) {
             setPref($data_dir, $username, 'alt_index_colors', 1);
index 540cbf71aed377b9b562ad908e7ad93bd481b438..f0aede33a7e19e36e770bfae55234b2f400b2a59 100644 (file)
@@ -18,7 +18,7 @@
    require_once('../functions/options.php');
 
    displayPageHeader($color, 'None');
    require_once('../functions/options.php');
 
    displayPageHeader($color, 'None');
-   $chosen_language = getPref($data_dir, $username, 'language');
+   $language = getPref($data_dir, $username, 'language');
 ?>
    <br>
 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
 ?>
    <br>
 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
    <form name="f" action="options.php" method="post"><br>
       <table width="100%" cellpadding="2" cellspacing="0" border="0">
 <?php
    <form name="f" action="options.php" method="post"><br>
       <table width="100%" cellpadding="2" cellspacing="0" border="0">
 <?php
-    OptionSelect( _("Theme"), 'chosentheme', $theme, $chosen_theme, 'NAME', 'PATH' );
-    OptionSelect( _("Language"), 'language', $languages, $chosen_language, 'NAME' );
-    OptionRadio( _("Use Javascript or HTML addressbook?"),
-                 'javascript_abook',
-                 array( '1' => _("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',
 
     /* 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"),
         'type'    => SMOPT_TYPE_STRLIST,
         'refresh' => SMOPT_REFRESH_ALL,
         'posvals' => array(SMPREF_JS_AUTODETECT => _("Autodetect"),
         'refresh' => SMOPT_REFRESH_NONE
     );
 
         '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',
     $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,
         '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',
     );
 
     $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,
         '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. */
     $options = createOptionArray($optvals);
 
     /* Print the row for each option. */
         }
     }
 
         }
     }
 
-    /*** 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"),
    OptionRadio( _("Use alternating row colors?"),
                 'altIndexColors',
                 array( 1 => _("Yes"),