Source for file compose.php

Documentation is available at compose.php

  1. <?php
  2.  
  3. /**
  4.  * options_compose.php
  5.  *
  6.  * Displays all options concerning composing of new messages
  7.  *
  8.  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  9.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.  * @version $Id: compose.php,v 1.9 2006/07/15 12:01:08 tokul Exp $
  11.  * @package squirrelmail
  12.  */
  13.  
  14. /** Define the group constants for this options page. */
  15. define('SMOPT_GRP_COMPOSE'0);
  16. define('SMOPT_GRP_COMPOSE_REPLY'1);
  17.  
  18. /**
  19.  * This function builds an array with all the information about
  20.  * the options available to the user, and returns it. The options
  21.  * are grouped by the groups in which they are displayed.
  22.  * For each option, the following information is stored:
  23.  * - name: the internal (variable) name
  24.  * - caption: the description of the option in the UI
  25.  * - type: one of SMOPT_TYPE_*
  26.  * - refresh: one of SMOPT_REFRESH_*
  27.  * - size: one of SMOPT_SIZE_*
  28.  * - save: the name of a function to call when saving this option
  29.  * @return array all option information
  30.  */
  31.  
  32.     /* Build a simple array into which we will build options. */
  33.     $optgrps array();
  34.     $optvals array();
  35.  
  36.     /******************************************************/
  37.     /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
  38.     /******************************************************/
  39.  
  40.     /*** Load the General Compose Options into the array ***/
  41.     $optgrps[SMOPT_GRP_COMPOSE_("General Message Composition");
  42.     $optvals[SMOPT_GRP_COMPOSEarray();
  43.  
  44.     $optvals[SMOPT_GRP_COMPOSE][array(
  45.         'name'    => 'editor_size',
  46.         'caption' => _("Width of Editor Window"),
  47.         'type'    => SMOPT_TYPE_INTEGER,
  48.         'refresh' => SMOPT_REFRESH_NONE,
  49.         'size'    => SMOPT_SIZE_TINY
  50.     );
  51.  
  52.     $optvals[SMOPT_GRP_COMPOSE][array(
  53.         'name'    => 'editor_height',
  54.         'caption' => _("Height of Editor Window"),
  55.         'type'    => SMOPT_TYPE_INTEGER,
  56.         'refresh' => SMOPT_REFRESH_NONE,
  57.         'size'    => SMOPT_SIZE_TINY
  58.     );
  59.  
  60.     $optvals[SMOPT_GRP_COMPOSE][array(
  61.         'name'    => 'location_of_buttons',
  62.         'caption' => _("Location of Buttons when Composing"),
  63.         'type'    => SMOPT_TYPE_STRLIST,
  64.         'refresh' => SMOPT_REFRESH_NONE,
  65.         'posvals' => array(SMPREF_LOC_TOP     => _("Before headers"),
  66.                            SMPREF_LOC_BETWEEN => _("Between headers and message body"),
  67.                            SMPREF_LOC_BOTTOM  => _("After message body"))
  68.     );
  69.  
  70.  
  71.     $optvals[SMOPT_GRP_COMPOSE][array(
  72.         'name'    => 'use_javascript_addr_book',
  73.         'caption' => _("Addressbook Display Format"),
  74.         'type'    => SMOPT_TYPE_STRLIST,
  75.         'refresh' => SMOPT_REFRESH_NONE,
  76.         'posvals' => array('1' => _("Javascript"),
  77.                            '0' => _("HTML"))
  78.     );
  79.  
  80.  
  81.     $optvals[SMOPT_GRP_COMPOSE][array(
  82.         'name'    => 'compose_new_win',
  83.         'caption' => _("Compose Messages in New Window"),
  84.         'type'    => SMOPT_TYPE_BOOLEAN,
  85.         'refresh' => SMOPT_REFRESH_ALL
  86.     );
  87.  
  88.     $optvals[SMOPT_GRP_COMPOSE][array(
  89.         'name'    => 'compose_width',
  90.         'caption' => _("Width of Compose Window"),
  91.         'type'    => SMOPT_TYPE_INTEGER,
  92.         'refresh' => SMOPT_REFRESH_ALL,
  93.         'size'    => SMOPT_SIZE_TINY
  94.     );
  95.  
  96.     $optvals[SMOPT_GRP_COMPOSE][array(
  97.         'name'    => 'compose_height',
  98.         'caption' => _("Height of Compose Window"),
  99.         'type'    => SMOPT_TYPE_INTEGER,
  100.         'refresh' => SMOPT_REFRESH_ALL,
  101.         'size'    => SMOPT_SIZE_TINY
  102.     );
  103.  
  104.  
  105.     /*** Load the General Options into the array ***/
  106.     $optgrps[SMOPT_GRP_COMPOSE_REPLY_("Replying and Forwarding Messages");
  107.     $optvals[SMOPT_GRP_COMPOSE_REPLYarray();
  108.  
  109.     $optvals[SMOPT_GRP_COMPOSE_REPLY][array(
  110.         'name'    => 'forward_cc',
  111.         'caption' => _("Include CCs when Forwarding Messages"),
  112.         'type'    => SMOPT_TYPE_BOOLEAN,
  113.         'refresh' => SMOPT_REFRESH_NONE
  114.     );
  115.  
  116.     $optvals[SMOPT_GRP_COMPOSE_REPLY][array(
  117.         'name'    => 'include_self_reply_all',
  118.         'caption' => _("Include Me in CC when I Reply All"),
  119.         'type'    => SMOPT_TYPE_BOOLEAN,
  120.         'refresh' => SMOPT_REFRESH_NONE
  121.     );
  122.  
  123.     $optvals[SMOPT_GRP_COMPOSE_REPLY][array(
  124.         'name'    => 'sig_first',
  125.         'caption' => _("Prepend Signature before Reply/Forward Text"),
  126.         'type'    => SMOPT_TYPE_BOOLEAN,
  127.         'refresh' => SMOPT_REFRESH_NONE
  128.     );
  129.  
  130.     $optvals[SMOPT_GRP_COMPOSE_REPLY][array(
  131.         'name'    => 'body_quote',
  132.         'caption' => _("Prefix for Original Message when Replying"),
  133.         'type'    => SMOPT_TYPE_STRING,
  134.         'refresh' => SMOPT_REFRESH_NONE,
  135.         'size'    => SMOPT_SIZE_TINY,
  136.         'save'    => 'save_option_reply_prefix'
  137.     );
  138.  
  139.     $optvals[SMOPT_GRP_COMPOSE_REPLY][array(
  140.         'name'    => 'reply_focus',
  141.         'caption' => _("Cursor Position when Replying"),
  142.         'type'    => SMOPT_TYPE_STRLIST,
  143.         'refresh' => SMOPT_REFRESH_NONE,
  144.         'posvals' => array('' => _("To: field"),
  145.                            'focus' => _("Focus in body"),
  146.                            'select' => _("Select body"),
  147.                            'none' => _("No focus"))
  148.     );
  149.  
  150.     $optvals[SMOPT_GRP_COMPOSE_REPLY][array(
  151.         'name'    => 'strip_sigs',
  152.         'caption' => _("Strip signature when replying"),
  153.         'type'    => SMOPT_TYPE_BOOLEAN,
  154.         'refresh' => SMOPT_REFRESH_NONE
  155.     );
  156.  
  157.     /* Assemble all this together and return it as our result. */
  158.     $result array(
  159.         'grps' => $optgrps,
  160.         'vals' => $optvals
  161.     );
  162.     return ($result);
  163. }
  164.  
  165. /******************************************************************/
  166. /** Define any specialized save functions for this option page. ***/
  167. /**                                                             ***/
  168. /** You must add every function that is set in save parameter   ***/
  169. /******************************************************************/
  170.  
  171. /**
  172.  * This function saves the reply prefix (body_quote) character(s)
  173.  * @param object $option 
  174.  */
  175. function save_option_reply_prefix($option{
  176.  
  177.     // save as "NONE" if it was blanked out
  178.     //
  179.     if (empty($option->new_value)) $option->new_value 'NONE';
  180.  
  181.  
  182.     // Save the option like normal.
  183.     //
  184.     save_option($option);
  185.  
  186. }

Documentation generated on Sat, 07 Oct 2006 16:09:42 +0300 by phpDocumentor 1.3.0RC6