added new save replies with original message option
[squirrelmail.git] / include / options / folder.php
index 0a7a81d0f15fc10005d72f48dd734568ab7f9d78..863fd607ff0529dbd0a99986a6828cb2a066bb7e 100644 (file)
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/imap_general.php');
 
-/* Define the group constants for the folder options page. */   
+/* Define the group constants for the folder options page. */
 define('SMOPT_GRP_SPCFOLDER', 0);
 define('SMOPT_GRP_FOLDERLIST', 1);
 define('SMOPT_GRP_FOLDERSELECT', 2);
 
-/* Define the optpage load function for the folder options page. */
+/**
+ * This function builds an array with all the information about
+ * the options available to the user, and returns it. The options
+ * are grouped by the groups in which they are displayed.
+ * For each option, the following information is stored:
+ * - name: the internal (variable) name
+ * - caption: the description of the option in the UI
+ * - type: one of SMOPT_TYPE_*
+ * - refresh: one of SMOPT_REFRESH_*
+ * - size: one of SMOPT_SIZE_*
+ * - save: the name of a function to call when saving this option
+ * @return array all option information
+ */
 function load_optpage_data_folder() {
     global $username, $key, $imapServerAddress, $imapPort;
     global $folder_prefix, $default_folder_prefix, $show_prefix_option;
@@ -64,7 +76,18 @@ function load_optpage_data_folder() {
         'posvals' => $trash_folder_values,
         'save'    => 'save_option_trash_folder'
     );
-    
+
+    $draft_folder_values = array(SMPREF_NONE => '[ '._("Do not use Drafts").' ]',
+                                 'whatever'  => $boxes);
+    $optvals[SMOPT_GRP_SPCFOLDER][] = array(
+        'name'    => 'draft_folder',
+        'caption' => _("Draft Folder"),
+        'type'    => SMOPT_TYPE_FLDRLIST,
+        'refresh' => SMOPT_REFRESH_FOLDERLIST,
+        'posvals' => $draft_folder_values,
+        'save'    => 'save_option_draft_folder'
+    );
+
     $sent_folder_values = array(SMPREF_NONE => '[ '._("Do not use Sent").' ]',
                                 'whatever'  => $boxes);
     $optvals[SMOPT_GRP_SPCFOLDER][] = array(
@@ -75,16 +98,12 @@ function load_optpage_data_folder() {
         'posvals' => $sent_folder_values,
         'save'    => 'save_option_sent_folder'
     );
-    
-    $draft_folder_values = array(SMPREF_NONE => '[ '._("Do not use Drafts").' ]',
-                                 'whatever'  => $boxes);
+
     $optvals[SMOPT_GRP_SPCFOLDER][] = array(
-        'name'    => 'draft_folder',
-        'caption' => _("Draft Folder"),
-        'type'    => SMOPT_TYPE_FLDRLIST,
-        'refresh' => SMOPT_REFRESH_FOLDERLIST,
-        'posvals' => $draft_folder_values,
-        'save'    => 'save_option_draft_folder'
+        'name'    => 'save_reply_with_orig',
+        'caption' => _("Save Replies with Original Message"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_FOLDERLIST
     );
 
     /*** Load the General Options into the array ***/
@@ -147,7 +166,7 @@ function load_optpage_data_folder() {
         'type'    => SMOPT_TYPE_STRLIST,
         'refresh' => SMOPT_REFRESH_FOLDERLIST,
         'posvals' => array(SMPREF_UNSEEN_ONLY  => _("Only Unseen"),
-                           SMPREF_UNSEEN_TOTAL => _("Unseen and Total")) 
+                           SMPREF_UNSEEN_TOTAL => _("Unseen and Total"))
     );
 
     $optvals[SMOPT_GRP_FOLDERLIST][] = array(
@@ -184,7 +203,7 @@ function load_optpage_data_folder() {
         'type'    => SMOPT_TYPE_STRLIST,
         'refresh' => SMOPT_REFRESH_FOLDERLIST,
         'posvals' => array(SMPREF_TIME_12HR => _("12-hour clock"),
-                           SMPREF_TIME_24HR => _("24-hour clock")) 
+                           SMPREF_TIME_24HR => _("24-hour clock"))
     );
 
     $optvals[SMOPT_GRP_FOLDERLIST][] = array(
@@ -232,6 +251,10 @@ function load_optpage_data_folder() {
 /******************************************************************/
 /** Define any specialized save functions for this option page. ***/
 /******************************************************************/
+
+/**
+ * Saves the trash folder option.
+ */
 function save_option_trash_folder($option) {
     global $data_dir, $username;
 
@@ -243,6 +266,9 @@ function save_option_trash_folder($option) {
     save_option($option);
 }
 
+/**
+ * Saves the sent folder option.
+ */
 function save_option_sent_folder($option) {
     global $data_dir, $username;
 
@@ -254,6 +280,9 @@ function save_option_sent_folder($option) {
     save_option($option);
 }
 
+/**
+ * Saves the draft folder option.
+ */
 function save_option_draft_folder($option) {
     global $data_dir, $username;