Bugfix of long strings
[squirrelmail.git] / src / options_display.php
index 540cbf71aed377b9b562ad908e7ad93bd481b438..edaaf3c4ea123e33cdd26ab7b8dca75d2910de48 100644 (file)
@@ -18,7 +18,7 @@
    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">
    <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 with which to start. */
+    /* Build a simple array into which we will build options. */
+    $optgrps = array();
     $optvals = array();
+
+    /******************************************************/
+    /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
+    /******************************************************/
+    define('SMOPT_GRP_GENERAL', 0);
+    define('SMOPT_GRP_MAILBOX', 1);
+    define('SMOPT_GRP_MESSAGE', 2);
+
+    /*** Load the General Options into the array ***/
+    $optgrps[SMOPT_GRP_GENERAL] = _("General Display Options");
+    $optvals[SMOPT_GRP_GENERAL] = array();
+
+    /* Load the theme option. */
+    $theme_values = array();
+    foreach ($theme as $theme_key => $theme_attributes) {
+        $theme_values[$theme_attributes['PATH']] = $theme_attributes['NAME'];
+    }
+    $optvals[SMOPT_GRP_GENERAL][] = 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[SMOPT_GRP_GENERAL][] = array(
+        'name'    => 'language',
+        'caption' => _("Language"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_ALL,
+        'posvals' => $language_values
+    );
 
     /* Set values for the "use javascript" option. */
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_GENERAL][] = array(
         'name'    => 'javascript_setting',
-        'caption' =>_("Use Javascript"),
+        'caption' => _("Use Javascript"),
         'type'    => SMOPT_TYPE_STRLIST,
         'refresh' => SMOPT_REFRESH_ALL,
         'posvals' => array(SMPREF_JS_AUTODETECT => _("Autodetect"),
     );
 
     $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
     );
 
-    $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,
+        'size'    => SMOPT_SIZE_TINY
+    );
+
+    $optvals[SMOPT_GRP_MAILBOX][] = array(
+        'name'    => 'alt_index_colors',
+        'caption' => _("Enable Alternating Row Colors"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    $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,
+        'size'    => SMOPT_SIZE_TINY
+    );
+
+    /*** 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
     );
 
-    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(
+    $optvals[SMOPT_GRP_MESSAGE][] = 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,
-        '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',
-        'caption' =>_("Location of Folder List"),
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
+        'name'    => 'use_javascript_addr_book',
+        'caption' => _("Addressbook Display Format"),
         'type'    => SMOPT_TYPE_STRLIST,
-        'refresh' => SMOPT_REFRESH_ALL,
-        'posvals' => array(SMPREF_LOC_LEFT   => _("Left"),
-                           SMPREF_LOC_RIGHT  => _("Right"))
-    );
-
-    /* Now, build the complete options array. */
-    $options = createOptionArray($optvals);
-
-    /* Print the row for each option. */
-    foreach ($options as $option) {
-        if ($option->type != SMOPT_TYPE_HIDDEN) {
-            echo "<TR>\n";
-            echo '  <TD ALIGN="RIGHT" VALIGN="MIDDLE" NOWRAP><font color=red><b>'
-               . $option->caption . "</b></font>:</TD>\n";
-            echo '  <TD>' . $option->createHTMLWidget() . "</TD>\n";
-            echo "</TR>\n";
-        } else {
-            echo $option->createHTMLWidget();
-        }
-    }
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => array('1' => _("Javascript"),
+                           '0' => _("HTML"))
+    );
+
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
+        'name'    => 'show_html_default',
+        'caption' => _("Show HTML Version by Default"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
+        'name'    => 'include_self_reply_all',
+        'caption' => _("Include Me in CC when I Reply All"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
+        'name'    => 'show_xmailer_default',
+        'caption' => _("Enable Mailer Display"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
+        'name'    => 'attachment_common_show_images',
+        'caption' => _("Enable display of images with email, below attachment box"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    /* Build and output the option groups. */
+    $option_groups = createOptionGroups($optgrps, $optvals);
+    printOptionGroups($option_groups);
+    
+    do_hook('options_display_inside');
+    echo "<TR><TD>&nbsp;</TD></TR>\n";
 
-    /*** 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 );
-   OptionRadio( _("Use alternating row colors?"),
-                'altIndexColors',
-                array( 1 => _("Yes"),
-                       0 => _("No") ),
-                $alt_index_colors );
-   OptionCheck( _("Show HTML version by default"),
-                'showhtmldefault',
-                $show_html_default,
-                _("Yes, show me the HTML version of a mail message, if it is available.") );
-   OptionCheck( _("Include Self"),
-                'includeselfreplyall',
-                getPref($data_dir, $username, 'include_self_reply_all', FALSE ),
-                _("Don't remove me from the CC addresses when I use \"Reply All\"") );
-   $psw = getPref($data_dir, $username, 'page_selector_max', 10 );
-   OptionCheck( _("Page Selector"),
-                'pageselector',
-                !getPref($data_dir, $username, 'page_selector', FALSE ),
-                _("Show page selector") .
-                " <input name=pageselectormax size=3  value=\"$psw\"> &nbsp;" .
-                _("pages max") );
-
-   echo '<tr><td colspan=2><hr noshade></td></tr>';
-   do_hook('options_display_inside');
-   OptionSubmit( 'submit_display' );
+    OptionSubmit( 'submit_display' );
 ?>
 
       </table>