compose.php 6.2 KB

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