Another big chunk of changes to options pages.
authorthomppj <thomppj@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 12 Nov 2001 05:30:52 +0000 (05:30 +0000)
committerthomppj <thomppj@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 12 Nov 2001 05:30:52 +0000 (05:30 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1731 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/options.php
src/options.php
src/options_display.php
src/options_folder.php
src/options_personal.php
src/read_body.php

index 72674ca4faf602eba82f0b80db5ec5c09575b2dc..959b92f1e581ddbfe9046dfc70bb208cb63719b3 100644 (file)
@@ -22,12 +22,20 @@ define('SMOPT_TYPE_INTEGER', 3);
 define('SMOPT_TYPE_FLOAT', 4);
 define('SMOPT_TYPE_BOOLEAN', 5);
 define('SMOPT_TYPE_HIDDEN', 6);
+define('SMOPT_TYPE_COMMENT', 7);
 
 /* Define constants for the options refresh levels. */
 define('SMOPT_REFRESH_NONE', 0);
 define('SMOPT_REFRESH_FOLDERLIST', 1);
 define('SMOPT_REFRESH_ALL', 2);
 
+/* Define constants for the options size. */
+define('SMOPT_SIZE_TINY', 0);
+define('SMOPT_SIZE_SMALL', 1);
+define('SMOPT_SIZE_MEDIUM', 2);
+define('SMOPT_SIZE_LARGE', 3);
+define('SMOPT_SIZE_HUGE', 4);
+
 /**
  * SquirrelOption: An option for Squirrelmail.
  *
@@ -45,6 +53,8 @@ class SquirrelOption {
     var $caption;
     var $type;
     var $refresh_level;
+    var $size;
+    var $comment;
 
     /* The various 'values' for this options. */
     var $value;
@@ -64,6 +74,8 @@ class SquirrelOption {
         $this->type = $type;
         $this->refresh_level = $refresh_level;
         $this->possible_values = $possible_values;
+        $this->size = SMOPT_SIZE_MEDIUM;
+        $this->comment = '';
 
         /* Check for a current value. */
         if (isset($GLOBALS[$name])) {
@@ -82,6 +94,16 @@ class SquirrelOption {
         }
     }
 
+    /* Set the size for this option. */
+    function setSize($size) {
+        $this->size = $size;
+    }
+
+    /* Set the comment for this option. */
+    function setComment($comment) {
+        $this->comment = $comment;
+    }
+
     function createHTMLWidget() {
         switch ($this->type) {
             case SMOPT_TYPE_STRING:
@@ -105,6 +127,9 @@ class SquirrelOption {
             case SMOPT_TYPE_HIDDEN:
                 $result = $this->createWidget_Hidden();
                 break;
+            case SMOPT_TYPE_COMMENT:
+                $result = $this->createWidget_Comment();
+                break;
             default:
                $result = '<FONT COLOR=RED>'
                        . sprintf(_("Option Type '%s' Not Found"), $this->type)
@@ -116,7 +141,16 @@ class SquirrelOption {
     }
 
     function createWidget_String() {
-        $result = "<INPUT NAME=\"new_$this->name\" value=\"$this->value\" size=\"5\">";
+        switch ($this->size) {
+            case SMOPT_SIZE_TINY:  $width = 5; break;
+            case SMOPT_SIZE_SMALL: $width = 12; break;
+            case SMOPT_SIZE_LARGE: $width = 38; break;
+            case SMOPT_SIZE_HUGE:  $width = 50; break;
+            case SMOPT_SIZE_NORMAL:
+            default: $width = 25;
+        }
+
+        $result = "<INPUT NAME=\"new_$this->name\" VALUE=\"$this->value\" SIZE=\"$width\">";
         return ($result);
     }
 
@@ -147,6 +181,17 @@ class SquirrelOption {
     }
 
     function createWidget_TextArea() {
+        switch ($this->size) {
+            case SMOPT_SIZE_TINY:  $rows = 3; $cols =  10; break;
+            case SMOPT_SIZE_SMALL: $rows = 4; $cols =  30; break;
+            case SMOPT_SIZE_LARGE: $rows = 10; $cols =  60; break;
+            case SMOPT_SIZE_HUGE:  $rows = 20; $cols =  80; break;
+            case SMOPT_SIZE_NORMAL:
+            default: $rows = 5; $cols =  50;
+        }
+        $result = "<TEXTAREA NAME=\"new_$this->name\" ROWS=\"$rows\" "
+                . "COLS=\"$cols\">$this->value</TEXTAREA>";
+        return ($result);
     }
 
     function createWidget_Integer() {
@@ -188,34 +233,61 @@ class SquirrelOption {
         return ($result);
     }
 
+    function createWidget_Comment() {
+        $result = $this->comment;
+        return ($result);
+    }
+
     function hasChanged() {
         return ($this->changed);
     }
 }
 
-function createOptionArray($optvals) {
+function createOptionGroups($optgrps, $optvals) {
     /* Build a simple array with which to start. */
     $result = array();
 
+    /* Create option group for each option group name. */
+    foreach ($optgrps as $grpkey => $grpname) {
+        $result[$grpkey] = array();
+        $result[$grpkey]['name'] = $grpname;
+        $result[$grpkey]['options'] = array();
+    }
+
      /* Create a new SquirrelOption for each set of option values. */
-    foreach ($optvals as $optset) {
-        if (isset($optset['posvals'])) {
-            /* Create a new option with all values given. */
-            $result[] = new SquirrelOption(
-                $optset['name'],
-                $optset['caption'],
-                $optset['type'],
-                $optset['refresh'],
-                $optset['posvals']
-            );
-        } else {
-            /* Create a new option with all but possible values given. */
-            $result[] = new SquirrelOption(
-                $optset['name'],
-                $optset['caption'],
-                $optset['type'],
-                $optset['refresh']
-            );
+    foreach ($optvals as $grpkey => $grpopts) {
+        foreach ($grpopts as $optset) {
+            if (isset($optset['posvals'])) {
+                /* Create a new option with all values given. */
+                $next_option = new SquirrelOption(
+                    $optset['name'],
+                    $optset['caption'],
+                    $optset['type'],
+                    $optset['refresh'],
+                    $optset['posvals']
+                );
+            } else {
+                /* Create a new option with all but possible values given. */
+                $next_option = new SquirrelOption(
+                    $optset['name'],
+                    $optset['caption'],
+                    $optset['type'],
+                    $optset['refresh']
+                );
+            }
+
+            /* If provided, set the size for this option. */
+            if (isset($optset['size'])) {
+                $next_option->setSize($optset['size']);
+            }
+
+            /* If provided, set the comment for this option. */
+            if (isset($optset['comment'])) {
+                $next_option->setComment($optset['comment']);
+            }
+
+            /* Add this option to the option array. */
+            $result[$grpkey]['options'][] = $next_option;
         }
     }
 
@@ -223,6 +295,25 @@ function createOptionArray($optvals) {
     return ($result);
 }
 
+function printOptionGroups($option_groups) {
+    foreach ($option_groups as $next_optgrp) {
+        echo '<TR><TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2" NOWRAP><B>'
+           . $next_optgrp['name'] . "</B></TD></TR>\n";
+        foreach ($next_optgrp['options'] as $option) {
+            if ($option->type != SMOPT_TYPE_HIDDEN) {
+                echo "<TR>\n";
+                echo '  <TD ALIGN="RIGHT" VALIGN="MIDDLE">'
+                   . $option->caption . ":</TD>\n";
+                echo '  <TD>' . $option->createHTMLWidget() . "</TD>\n";
+                echo "</TR>\n";
+            } else {
+                echo $option->createHTMLWidget();
+            }
+        }
+        echo "<TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
+    }
+}
+
 function OptionSelect( $title, $name, $data, $default, $show = '', $store = '' ) {
 
     echo "<tr><td align=right valign=middle nowrap>$title: </td><td>" .
index 33eae5dac9fe1d6ff494e1722cfe26937a508302..1cc7cadd6e2919aca01555be67f7425b4bd0d1f8 100644 (file)
 <?php
     if (isset($submit_personal)) {
         /* Save personal information. */
-        if (isset($full_name)) {
-           setPref($data_dir, $username, 'full_name', $full_name);
-        }
-        if (isset($email_address)) {
-           setPref($data_dir, $username, 'email_address', $email_address);
-        }
-        if (isset($reply_to)) {
-           setPref($data_dir, $username, 'reply_to', $reply_to);
-        }
+        setPref($data_dir, $username, 'full_name', $new_full_name);
+        setPref($data_dir, $username, 'email_address', $new_email_address);
+        setPref($data_dir, $username, 'reply_to', $new_reply_to);
         setPref($data_dir, $username, 'reply_citation_style', $new_reply_citation_style);
         setPref($data_dir, $username, 'reply_citation_start', $new_reply_citation_start);
         setPref($data_dir, $username, 'reply_citation_end', $new_reply_citation_end);
-        if (! isset($usesignature))
-            $usesignature = 0;
-        setPref($data_dir, $username, 'use_signature', $usesignature);  
-        if (! isset($prefixsig)) {
-            $prefixsig = 0;
-        }
-        setPref($data_dir, $username, 'prefix_sig', $prefixsig);
-        if (isset($signature_edit)) {
-            setSig($data_dir, $username, $signature_edit);
-        }
+        setPref($data_dir, $username, 'use_signature', $new_use_signature);
+        setPref($data_dir, $username, 'prefix_sig', $new_prefix_sig);
+        setSig($data_dir, $username, $new_signature_abs);
       
         do_hook('options_personal_save');
       
index f92b017023ef39d13a0bb28b8a1259802e9d9b42..07899f0754f4f053f7e37b4952504648f29db885 100644 (file)
 <?php
 
     /* Build a simple array into which we will build options. */
-    $optvals = array(); 
+    $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[] = array(
+    $optvals[SMOPT_GRP_GENERAL][] = array(
         'name'    => 'chosen_theme',
         'caption' => _("Theme"),
         'type'    => SMOPT_TYPE_STRLIST,
@@ -54,7 +67,7 @@
             $language_values[$lang_key] = $lang_attributes['NAME'];
         }
     }
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_GENERAL][] = array(
         'name'    => 'language',
         'caption' => _("Language"),
         'type'    => SMOPT_TYPE_STRLIST,
@@ -63,7 +76,7 @@
     );
 
     /* Set values for the "use javascript" option. */
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_GENERAL][] = array(
         'name'    => 'javascript_setting',
         'caption' => _("Use Javascript"),
         'type'    => SMOPT_TYPE_STRLIST,
     );
 
     $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
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_TINY
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_MAILBOX][] = array(
         'name'    => 'alt_index_colors',
         'caption' => _("Enable Alternating Row Colors"),
         'type'    => SMOPT_TYPE_BOOLEAN,
         'refresh' => SMOPT_REFRESH_NONE
     );
 
-    $optvals[] = array(
+    $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
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_TINY
     );
 
-    $optvals[] = array(
+    /*** 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
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
         'name'    => 'location_of_buttons',
         'caption' => _("Location of Buttons when Composing"),
         'type'    => SMOPT_TYPE_STRLIST,
                            SMPREF_LOC_BOTTOM  => _("After message body"))
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
         'name'    => 'use_javascript_addr_book',
         'caption' => _("Addressbook Display Format"),
         'type'    => SMOPT_TYPE_STRLIST,
                            '0' => _("HTML"))
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
         'name'    => 'show_html_default',
         'caption' => _("Show HTML Version by Default"),
         'type'    => SMOPT_TYPE_BOOLEAN,
         'refresh' => SMOPT_REFRESH_NONE
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
         'name'    => 'include_self_reply_all',
-        'caption' => _("Remove Me from CC when I Reply All"),
+        'caption' => _("Include Me in CC when I Reply All"),
         'type'    => SMOPT_TYPE_BOOLEAN,
         'refresh' => SMOPT_REFRESH_NONE
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
         'name'    => 'show_xmailer_default',
         'caption' => _("Enable Mailer Display"),
         'type'    => SMOPT_TYPE_BOOLEAN,
         'refresh' => SMOPT_REFRESH_NONE
     );
 
-    /* Build all these values into an array of SquirrelOptions objects. */
-    $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>'
-               . $option->caption . ":</TD>\n";
-            echo '  <TD>' . $option->createHTMLWidget() . "</TD>\n";
-            echo "</TR>\n";
-        } else {
-            echo $option->createHTMLWidget();
-        }
-    }
+    /* 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";
 
-   echo '<tr><td colspan=2><hr noshade></td></tr>';
-   do_hook('options_display_inside');
-   OptionSubmit( 'submit_display' );
+    OptionSubmit( 'submit_display' );
 ?>
 
       </table>
index 442d5c26f42ff61b2a8a30dc5771b6681cfa7671..f986b91086c183442adbcd8d96d4d0f0c0345f89 100644 (file)
          </tr>
 <?php }          
 
+
     /* 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_SPCFOLDER', 0);
+    define('SMOPT_GRP_FOLDERLIST', 1);
+
+    /*** Load the General Options into the array ***/
+    $optgrps[SMOPT_GRP_SPCFOLDER] = _("Special Folder Options");
+    $optvals[SMOPT_GRP_SPCFOLDER] = array();
+
     $special_folder_values = array();
     foreach ($boxes as $folder) {
         if (strtolower($folder['unformatted']) != 'inbox') {
@@ -63,7 +75,7 @@
 
     $trash_none = array(SMPREF_NONE => _("Do not use Trash"));
     $trash_folder_values = array_merge($trash_none, $special_folder_values);
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_SPCFOLDER][] = array(
         'name'    => 'trash_folder',
         'caption' => _("Trash Folder"),
         'type'    => SMOPT_TYPE_STRLIST,
@@ -73,7 +85,7 @@
     
     $sent_none = array(SMPREF_NONE => _("Do not use Sent"));
     $sent_folder_values = array_merge($sent_none, $special_folder_values);
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_SPCFOLDER][] = array(
         'name'    => 'sent_folder',
         'caption' => _("Sent Folder"),
         'type'    => SMOPT_TYPE_STRLIST,
@@ -83,7 +95,7 @@
     
     $drafts_none = array(SMPREF_NONE => _("Do not use Drafts"));
     $draft_folder_values = array_merge($draft_none, $special_folder_values);
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_SPCFOLDER][] = array(
         'name'    => 'draft_folder',
         'caption' => _("Draft Folder"),
         'type'    => SMOPT_TYPE_STRLIST,
         'posvals' => $draft_folder_values
     );
 
-    $optvals[] = array(
+    /*** Load the General Options into the array ***/
+    $optgrps[SMOPT_GRP_FOLDERLIST] = _("Folder List Options");
+    $optvals[SMOPT_GRP_FOLDERLIST] = array();
+
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'location_of_bar',
         'caption' => _("Location of Folder List"),
         'type'    => SMOPT_TYPE_STRLIST,
     for ($lsv = 100; $lsv <= 300; $lsv += 10) {
         $left_size_values[$lsv] = "$lsv " . _("pixels");
     }
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'left_size',
         'caption' => _("Width of Folder List"),
         'type'    => SMOPT_TYPE_STRLIST,
             $left_refresh_values[$lr_val] = ($lr_val/60) . " $minute_str";
         }
     }
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'left_refresh',
         'caption' => _("Auto Refresh Folder List"),
         'type'    => SMOPT_TYPE_STRLIST,
         'posvals' => $left_refresh_values
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'unseen_notify',
         'caption' => _("Enable Unseen Message Notification"),
         'type'    => SMOPT_TYPE_STRLIST,
                            SMPREF_UNSEEN_ALL   => _("All Folders"))
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'unseen_type',
         'caption' => _("Unseen Message Notification Type"),
         'type'    => SMOPT_TYPE_STRLIST,
                            SMPREF_UNSEEN_TOTAL => _("Unseen and Total")) 
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'collapse_folders',
         'caption' => _("Enable Collapsable Folders"),
         'type'    => SMOPT_TYPE_BOOLEAN,
         'refresh' => SMOPT_REFRESH_FOLDERLIST
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'date_format',
         'caption' => _("Show Clock on Folders Panel"),
         'type'    => SMOPT_TYPE_STRLIST,
                             '6' => _("No Clock")),
     );
 
-    $optvals[] = array(
+    $optvals[SMOPT_GRP_FOLDERLIST][] = array(
         'name'    => 'hour_format',
         'caption' => _("Hour Format"),
         'type'    => SMOPT_TYPE_STRLIST,
     );
 
 
-    /* Build all these values into an array of SquirrelOptions objects. */
-    $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>'
-               . $option->caption . ":</TD>\n";
-            echo '  <TD>' . $option->createHTMLWidget() . "</TD>\n";
-            echo "</TR>\n";
-        } else {
-            echo $option->createHTMLWidget();
-        }
-    }
-
-   // if( $unseen_notify == '' )
-   //   $unseen_notify = '2';
-
+    /* Build and output the option groups. */
+    $option_groups = createOptionGroups($optgrps, $optvals);
+    printOptionGroups($option_groups);
                  
-   echo '<tr><td colspan=2><hr noshade></td></tr>';
-   do_hook("options_folders_inside");
-   OptionSubmit( 'submit_folder' );
+    echo '<TR><TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2" NOWRAP><B>'
+         . _("Plugin Options") . "</B></TD></TR>\n";
+    OptionSubmit( 'submit_folder' );
 ?>         
 
       </table>
index a2403528c47dd224b40e42b7eb527f74230873e0..a97f790efb6c4eb9c5b8a3495ca53c21dfecca34 100644 (file)
    require_once('../functions/imap.php');
    require_once('../functions/array.php');
    require_once('../functions/plugin.php');
+   require_once('../functions/options.php');
    
    displayPageHeader($color, 'None');
 
-   $fullname = getPref($data_dir, $username, 'full_name');
-   $replyto = getPref($data_dir, $username, 'reply_to');
+   $full_name = getPref($data_dir, $username, 'full_name');
+   $reply_to = getPref($data_dir, $username, 'reply_to');
    $email_address  = getPref($data_dir, $username, 'email_address'); 
 
 ?>
 
    <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 _("Full Name"); ?>:
-            </td><td>
-               <input size=50 type=text value="<?php echo $fullname ?>" name=full_name> 
-            </td>
-         </tr>
-         <tr>
-            <td align=right nowrap><?php echo _("E-Mail Address"); ?>:
-            </td><td>
-               <input size=50 type=text value="<?php echo $email_address ?>" name=email_address> 
-            </td>
-         </tr>
-         <tr>
-            <td align=right nowrap><?php echo _("Reply To"); ?>:
-            </td><td>
-               <input size=50 type=text value="<?php echo $replyto ?>" name=reply_to> 
-            </td>
-         </tr>
-         <tr>
-            <td align="right" nowrap><?PHP echo _("Reply Citation Style") ?>:</td>
-            <td><select name="new_reply_citation_style">
-                <option value="none"<?PHP
-                    if ($reply_citation_style == 'none') echo ' SELECTED';
-                    ?>>- <?PHP echo _("No Citation"); ?> -</option>
-                <option value="author_said"<?PHP
-                    if ($reply_citation_style == 'author_said') echo ' SELECTED';
-                    ?>><?PHP echo _("AUTHOR Said"); ?></option>
-                <option value="quote_who"<?PHP
-                    if ($reply_citation_style == 'quote_who') echo ' SELECTED';
-                    ?>><?PHP echo _("Quote Who XML"); ?></option>
-                <option value="user-defined"<?PHP
-                    if ($reply_citation_style == 'user-defined') echo ' SELECTED';
-                    ?>><?PHP echo _("User-Defined"); ?></option>
-                </select>
-            </td>
-         </tr>
-         <tr>
-            <td align="right" nowrap><?php echo _("User-Defined Reply Citation"); ?>:</td>
-            <td>
-               <tt><input type="text" size="20" name="new_reply_citation_start" value="<?php
-                  echo $reply_citation_start;
-               ?>"></tt> &lt;<?php
-                  echo _("Author's Name");
-               ?>&gt;
-               <tt><input type="text" size="20" name="new_reply_citation_end" value="<?php
-                  echo $reply_citation_end;
-               ?>"></tt>
-            </td>
-         </tr>
-        <tr>
-           <td align=right nowrap><?PHP echo _("Multiple Identities"); ?>:
-           </td><td>
-              <a href="options_identities.php"><?PHP 
-   echo _("Edit Advanced Identities") . '</a> ' . _("(discards changes made on this form so far)");
-           ?></td>
-        </tr>
-         <tr><td colspan=2><hr size=1 width=80%></td></tr>
-         <tr>
-            <td align=right nowrap valign=top><br><?php echo _("Signature"); ?>:
-            </td><td>
 <?php
-   echo '<input type=checkbox value="1" name=usesignature';
-   if ($use_signature)
-      echo ' checked';
-   echo '>&nbsp;&nbsp;' . _("Use a signature?") . '&nbsp;&nbsp;';
-   echo '<input type="checkbox" value="1" name="prefixsig"';
-   if ( $prefix_sig )
-     echo ' checked';
-   echo '>&nbsp;&nbsp;' .
-        _( "Prefix signature with '-- ' ?" ) . '<BR>';
-   echo "\n<textarea name=\"signature_edit\" rows=\"5\" cols=\"50\">$signature_abs</textarea><br>";
+
+    /* 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_CONTACT', 0);
+    define('SMOPT_GRP_SIGNATURE', 1);
+
+    /*** Load the General Options into the array ***/
+    $optgrps[SMOPT_GRP_CONTACT] = _("Name and Address Options");
+    $optvals[SMOPT_GRP_CONTACT] = array();
+
+    /* Build a simple array into which we will build options. */
+    $optvals = array();
+
+    $optvals[SMOPT_GRP_CONTACT][] = array(
+        'name'    => 'full_name',
+        'caption' => _("Full Name"),
+        'type'    => SMOPT_TYPE_STRING,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_HUGE
+    );
+
+    $optvals[SMOPT_GRP_CONTACT][] = array(
+        'name'    => 'email_address',
+        'caption' => _("Email Address"),
+        'type'    => SMOPT_TYPE_STRING,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_HUGE
+    );
+
+    $optvals[SMOPT_GRP_CONTACT][] = array(
+        'name'    => 'reply_to',
+        'caption' => _("Reply To"),
+        'type'    => SMOPT_TYPE_STRING,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_HUGE
+    );
+
+    /*** Load the General Options into the array ***/
+    $optgrps[SMOPT_GRP_REPLY] = _("Reply and Signature Options");
+    $optvals[SMOPT_GRP_REPLY] = array();
+
+    $optvals[SMOPT_GRP_REPLY][] = array(
+        'name'    => 'reply_citation_style',
+        'caption' => _("Reply Citation Style"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => array(SMPREF_NONE    => _("No Citation"),
+                           'author_said'  => _("AUTHOR Said"),
+                           'quote_who'    => _("Quote Who XML"),
+                           'user-defined' => _("User-Defined"))
+    );
+
+    $optvals[SMOPT_GRP_REPLY][] = array(
+        'name'    => 'reply_citation_start',
+        'caption' => _("User-Defined Citation Start"),
+        'type'    => SMOPT_TYPE_STRING,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_MEDIUM
+    );
+
+    $optvals[SMOPT_GRP_REPLY][] = array(
+        'name'    => 'reply_citation_end',
+        'caption' => _("User-Defined Citation End"),
+        'type'    => SMOPT_TYPE_STRING,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_MEDIUM
+    );
+
+    $identities_link_value = '<A HREF="options_identities.php">'
+                           . _("Edit Advanced Identities")
+                           . '</A> '
+                           . _("(discards changes made on this form so far)");
+    $optvals[SMOPT_GRP_REPLY][] = array(
+        'name'    => 'identities_link',
+        'caption' => _("Multiple Identities"),
+        'type'    => SMOPT_TYPE_COMMENT,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'comment' =>  $identities_link_value
+    );
+
+    $optvals[SMOPT_GRP_REPLY][] = array(
+        'name'    => 'use_signature',
+        'caption' => _("Use Signature"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    $optvals[SMOPT_GRP_REPLY][] = array(
+        'name'    => 'prefix_sig',
+        'caption' => _("Prefix Signature with '-- ' Line"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    $optvals[SMOPT_GRP_REPLY][] = array(
+        'name'    => 'signature_abs',
+        'caption' => _("Signature"),
+        'type'    => SMOPT_TYPE_TEXTAREA,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_MEDIUM
+    );
+
+    /* Build and output the option groups. */
+    $option_groups = createOptionGroups($optgrps, $optvals);
+    printOptionGroups($option_groups);
+
+    do_hook('options_personal_inside');
+    OptionSubmit( 'submit_personal' );
+
 ?>
-            </td>
-         </tr>
-         <?php do_hook("options_personal_inside"); ?>
-         <tr>
-            <td>&nbsp;
-            </td><td>
-               <input type="submit" value="<?php echo _("Submit"); ?>" name="submit_personal">
-            </td>
-         </tr>
       </table>   
 </form>
 
 
 </td></tr>
 </table>
-</body></html>
\ No newline at end of file
+</body></html>
index 8fda097212cbb40b3cfb36daa21fcd14c6eacafe..8b5ad4662d890ee80cc22d872e3fe63e820b3522 100644 (file)
    
    // 5) Remove the addresses we'll be sending the message 'to'
    $url_replytoall_avoid_addrs = '';
-   if (isset($message->header->replyto))
+   if (isset($message->header->replyto)) {
       $url_replytoall_avoid_addrs = $message->header->replyto;
+   }
+
    $url_replytoall_avoid_addrs = parseAddrs($url_replytoall_avoid_addrs);
-   foreach ($url_replytoall_avoid_addrs as $addr)
-   {
+   foreach ($url_replytoall_avoid_addrs as $addr) {
        RemoveAddress($url_replytoall_extra_addrs, $addr);
    }
    
    // 6) Remove our identities from the CC list (they still can be in the
-   // TO list) only if $include_self_reply_all isn't set or it is ''.
-   if (getPref($data_dir, $username, 'include_self_reply_all') == '')
-   {
+   // TO list) only if $include_self_reply_all is turned off
+   if (!$include_self_reply_all) {
        RemoveAddress($url_replytoall_extra_addrs, 
                      getPref($data_dir, $username, 'email_address'));
        $idents = getPref($data_dir, $username, 'identities');
-       if ($idents != '' && $idents > 1)
-       {
-           for ($i = 1; $i < $idents; $i ++)
-           {
+       if ($idents != '' && $idents > 1) {
+           for ($i = 1; $i < $idents; $i ++) {
                RemoveAddress($url_replytoall_extra_addrs, 
                             getPref($data_dir, $username, 'email_address' .
                                     $i));