Added Deep Ocean 2 theme from M.J. Prinsen from May 22, 2001
[squirrelmail.git] / src / options_display.php
index fb8ef97cfbdc01cb3a4c1ad60d2d76c4758ce634..88b8c265083c316dd7b9850fcc0633d0d56e386e 100644 (file)
     **  $Id$
     **/
 
-   session_start();
-
-   if (!isset($strings_php))
-      include('../functions/strings.php');
-   if (!isset($config_php))
-      include('../config/config.php');
-   if (!isset($page_header_php))
-      include('../functions/page_header.php');
-   if (!isset($display_messages_php))
-      include('../functions/display_messages.php');
-   if (!isset($imap_php))
-      include('../functions/imap.php');
-   if (!isset($array_php))
-      include('../functions/array.php');
-   if (!isset($i18n_php))
-      include('../functions/i18n.php');
-   if (!isset($plugin_php))
-      include('../functins/plugin.php');
-
-   include('../src/load_prefs.php');
+   include('../src/validate.php');
+   include('../functions/display_messages.php');
+   include('../functions/imap.php');
+   include('../functions/array.php');
+   include('../functions/plugin.php');
+   
    displayPageHeader($color, 'None');
    $chosen_language = getPref($data_dir, $username, 'language');  
 ?>
    <br>
-   <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0"><tr><td bgcolor="<?php echo $color[0] ?>">
-      <center><b><?php echo _("Options") . ' - ' . _("Display Preferences"); ?></b></center>
-   </td></tr></table>
+<table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
+<tr><td bgcolor="<?php echo $color[0] ?>" align="center">
+
+      <b><?php echo _("Options") . ' - ' . _("Display Preferences"); ?></b><br>
 
-   <form name="f" action="options.php" method="post">
-      <table width="100%" cellpadding="0" cellspacing="2" border="0">
+    <table width="100%" border="0" cellpadding="1" cellspacing="1">
+    <tr><td bgcolor="<?php echo $color[4] ?>" align="center">
+
+   <form name="f" action="options.php" method="post"><br>
+      <table width="100%" cellpadding="2" cellspacing="0" border="0">
          <tr>
             <td align="right" nowrap><?php echo _("Theme"); ?>:
             </td><td>
             </td>
          </tr>
          <tr>
-            <td valign="top" align="right" nowrap><?php echo _("Language"); ?>:
+            <td align="right" nowrap><?php echo _("Language"); ?>:
             </td><td>
 <?php
    echo '         <tt><select name="language">' . "\n";
    foreach ($languages as $code => $name) {
-      if ($code==$chosen_language)
-         echo '         <OPTION SELECTED VALUE="'.$code.'">'.$languages[$code]['NAME']."\n";
-      else
-         echo '         <OPTION VALUE=\"".$code.'">'.$languages[$code]['NAME']."\n";
+      if (! isset($name['ALIAS'])) {
+         if ($code==$chosen_language)
+            echo '         <OPTION SELECTED VALUE="'.$code.'">'.$name['NAME']."\n";
+         else
+            echo '         <OPTION VALUE="'.$code.'">'.$name['NAME']."\n";
+      }
    }
    echo '         </select></tt>';  
    if (! $use_gettext)
-      echo '<br><small>This system doesn't support multiple languages</small>';
+      echo '<br><small>This system doesn\'t support multiple languages</small>';
       
 ?>
             </td>
             </td><td>
 <?php
    echo '         <select name="leftsize">' . "\n";
-   if ($left_size == 100)
-      echo "<option value=100 selected>100 pixels\n";
-   else
-      echo "<option value=100>100 pixels\n";
-   if ($left_size == 125)
-      echo "<option value=125 selected>125 pixels\n";
-   else
-      echo "<option value=125>125 pixels\n";
-   if ($left_size == 150)
-      echo "<option value=150 selected>150 pixels\n";
-   else
-      echo "<option value=150>150 pixels\n";
-   if ($left_size == 175)
-      echo "<option value=175 selected>175 pixels\n";
-   else
-      echo "<option value=175>175 pixels\n";
-   if (($left_size == 200) || ($left_size == ""))
-      echo "<option value=200 selected>200 pixels\n";
-   else
-      echo "<option value=200>200 pixels\n";
-   if (($left_size == 225))
-      echo "<option value=225 selected>225 pixels\n";
-   else
-      echo "<option value=225>225 pixels\n";
-   if (($left_size == 250))
-      echo "<option value=250 selected>250 pixels\n";
-   else
-      echo "<option value=250>250 pixels\n";
-   if ($left_size == 275)
-      echo "<option value=275 selected>275 pixels\n";
-   else
-      echo "<option value=275>275 pixels\n";
-   if (($left_size == 300))
-      echo "<option value=300 selected>300 pixels\n";
-   else
-      echo "<option value=300>300 pixels\n";
-   echo "         </select>";  
+   for ($i = 100; $i <= 300; $i += 10)
+   {
+       if ($left_size >= $i && $left_size < $i + 10)
+          echo "<option value=\"$i\" selected>$i pixels\n";
+       else
+          echo "<option value=\"$i\">$i pixels\n";
+   }
+   echo '         </select>';  
 ?>
             </td>
          </tr>
          <tr>
-            <td align=right nowrap><?php echo _("Auto refresh folder list"); ?>:
+            <td align="right" nowrap><?php echo _("Auto refresh folder list"); ?>:
             </td><td>
 <?php
    $seconds_str = _("Seconds");
    $minute_str = _("Minute");
    $minutes_str = _("Minutes");
 
-   echo "               <SELECT name=leftrefresh>";
-   if (($left_refresh == "None") || ($left_refresh == ""))
-      echo "                  <OPTION VALUE=None SELECTED>$none_str";
-   else
-      echo "                  <OPTION VALUE=None>$none_str";
-   if (($left_refresh == "10"))
-      echo "                  <OPTION VALUE=10 SELECTED>10 $seconds_str";
-   else
-      echo "                  <OPTION VALUE=10>10 $seconds_str";
-   if (($left_refresh == "20"))
-      echo "                  <OPTION VALUE=20 SELECTED>20 $seconds_str";
-   else
-      echo "                  <OPTION VALUE=20>20 $seconds_str";
-   if (($left_refresh == "30"))
-      echo "                  <OPTION VALUE=30 SELECTED>30 $seconds_str";
-   else
-      echo "                  <OPTION VALUE=30>30 $seconds_str";
-   if (($left_refresh == "60"))
-      echo "                  <OPTION VALUE=60 SELECTED>1 $minute_str";
-   else
-      echo "                  <OPTION VALUE=60>1 $minute_str";
-   if (($left_refresh == "120"))
-      echo "                  <OPTION VALUE=120 SELECTED>2 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=120>2 $minutes_str";
-   if (($left_refresh == "180"))
-      echo "                  <OPTION VALUE=180 SELECTED>3 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=180>3 $minutes_str";
-   if (($left_refresh == "240"))
-      echo "                  <OPTION VALUE=240 SELECTED>4 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=240>4 $minutes_str";
-   if (($left_refresh == "300"))
-      echo "                  <OPTION VALUE=300 SELECTED>5 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=300>5 $minutes_str";
-   if (($left_refresh == "420"))
-      echo "                  <OPTION VALUE=420 SELECTED>7 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=420>7 $minutes_str";
+   echo '               <SELECT name="leftrefresh">';
+   
+   if ($left_refresh == '')
+      $left_refresh = 'None';
+   if ($left_refresh > 600)
+      $left_refresh = 600;
+   RefreshOption($left_refresh, '', 'None', _("None"));
+   RefreshOption($left_refresh, 30);
+   RefreshOption($left_refresh, 60);
+   RefreshOption($left_refresh, 120);
+   RefreshOption($left_refresh, 180);
+   RefreshOption($left_refresh, 300);
+   RefreshOption($left_refresh, 600);
+   // Refreshes after the session auto-timeout (default 15 min) is pointless
 
-   if (($left_refresh == "600"))
-      echo "                  <OPTION VALUE=600 SELECTED>10 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=600>10 $minutes_str";
-   if (($left_refresh == "720"))
-      echo "                  <OPTION VALUE=720 SELECTED>12 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=720>12 $minutes_str";
-   if (($left_refresh == "900"))
-      echo "                  <OPTION VALUE=900 SELECTED>15 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=900>15 $minutes_str";
-   if (($left_refresh == "1200"))
-      echo "                  <OPTION VALUE=1200 SELECTED>20 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=1200>20 $minutes_str";
-   if (($left_refresh == "1500"))
-      echo "                  <OPTION VALUE=1500 SELECTED>25 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=1500>25 $minutes_str";
-   if (($left_refresh == "1800"))
-      echo "                  <OPTION VALUE=1800 SELECTED>30 $minutes_str";
-   else
-      echo "                  <OPTION VALUE=1800>30 $minutes_str";
+function RefreshOption(&$current, $val, $str = '') {
+   static $lastVal = 0;
+   
+   if (is_int($val) && is_int($current)) {
+      if ($current > $lastVal && $current <= $val)
+         $current = $val;
+   }
+   
+   if ($str == '') {
+      if ($val > 60) {
+         $str = ($val / 60) . ' ' . _("Minutes");
+      } elseif ($val == 60) {
+         $str = '1 ' . _("Minute");
+      } else {
+         $str = $val . ' ' . _("Seconds");
+      }
+   }
+   
+   echo '<option value="' . $val . '"';
+   if ($val == $current)
+      echo ' SELECTED';
+   echo '>' . $str . "\n";
+}
       echo '               </SELECT>'; 
 ?>
             </td>
          </tr>
+         <tr>
+            <td align="right">
+                <?php echo _("Use alternating row colors?") ?>
+            </td><td>
+<?php
+    if (isset($alt_index_colors) && $alt_index_colors == 1) {
+        $a = " checked";
+        $b = "";
+    } else {
+        $a = "";
+        $b = " checked";
+    }
+?>
+                <input type="radio" name="altIndexColors" value="1"<?php echo $a ?>> <?php echo _("Yes") ?> &nbsp;&nbsp; 
+                <input type="radio" name="altIndexColors" value="0"<?php echo $b ?>> <?php echo _("No") ?><br>
+            </td>
+         </tr>
+         <tr>
+            <td align=right>
+               <?php echo _("Show HTML version by default"); ?>:
+            </td>
+            <td>
+               <input type=checkbox name=showhtmldefault <?php 
+              if (isset($show_html_default) && $show_html_default) 
+              echo " checked"; ?>>
+                <?php 
+echo _("Yes, show me the HTML version of a mail message, if it is available."); 
+                 ?>
+            </td>
+         </tr>
          <?php do_hook('options_display_inside'); ?>
          <tr>
             <td>&nbsp;
                <input type="submit" value="<?php echo _("Submit"); ?>"name="submit_display">
             </td>
          </tr>
-      </table>   
+      </table>
    </form>
+
    <?php do_hook('options_display_bottom'); ?>
+
+    </td></tr>
+    </table>
+
+</td></tr>
+</table>
 </body></html>