compose.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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' => _("Address Book Display Format"),
  64. 'type' => SMOPT_TYPE_STRLIST,
  65. 'refresh' => SMOPT_REFRESH_NONE,
  66. 'posvals' => array('1' => _("Pop-up window"),
  67. '0' => _("In-page"))
  68. );
  69. $optvals[SMOPT_GRP_COMPOSE][] = array(
  70. 'name' => 'addrsrch_fullname',
  71. 'caption' => _("Format of Addresses Added From Address Book"),
  72. 'type' => SMOPT_TYPE_STRLIST,
  73. 'refresh' => SMOPT_REFRESH_NONE,
  74. 'posvals' => array('noprefix' => _("No prefix/Address only"),
  75. 'nickname' => _("Nickname and address"),
  76. 'fullname' => _("Full name and address"))
  77. );
  78. $optvals[SMOPT_GRP_COMPOSE][] = array(
  79. 'name' => 'compose_new_win',
  80. 'caption' => _("Compose Messages in New Window"),
  81. 'type' => SMOPT_TYPE_BOOLEAN,
  82. 'refresh' => SMOPT_REFRESH_ALL
  83. );
  84. $optvals[SMOPT_GRP_COMPOSE][] = array(
  85. 'name' => 'compose_width',
  86. 'caption' => _("Width of Compose Window"),
  87. 'type' => SMOPT_TYPE_INTEGER,
  88. 'refresh' => SMOPT_REFRESH_ALL,
  89. 'size' => SMOPT_SIZE_TINY
  90. );
  91. $optvals[SMOPT_GRP_COMPOSE][] = array(
  92. 'name' => 'compose_height',
  93. 'caption' => _("Height of Compose Window"),
  94. 'type' => SMOPT_TYPE_INTEGER,
  95. 'refresh' => SMOPT_REFRESH_ALL,
  96. 'size' => SMOPT_SIZE_TINY
  97. );
  98. /*** Load the General Options into the array ***/
  99. $optgrps[SMOPT_GRP_COMPOSE_REPLY] = _("Replying and Forwarding Messages");
  100. $optvals[SMOPT_GRP_COMPOSE_REPLY] = array();
  101. $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
  102. 'name' => 'include_self_reply_all',
  103. 'caption' => _("Include Me in CC when I Reply All"),
  104. 'type' => SMOPT_TYPE_BOOLEAN,
  105. 'refresh' => SMOPT_REFRESH_NONE
  106. );
  107. $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
  108. 'name' => 'sig_first',
  109. 'caption' => _("Prepend Signature before Reply/Forward Text"),
  110. 'type' => SMOPT_TYPE_BOOLEAN,
  111. 'refresh' => SMOPT_REFRESH_NONE
  112. );
  113. $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
  114. 'name' => 'body_quote',
  115. 'caption' => _("Prefix for Original Message when Replying"),
  116. 'type' => SMOPT_TYPE_STRING,
  117. 'refresh' => SMOPT_REFRESH_NONE,
  118. 'size' => SMOPT_SIZE_TINY,
  119. 'save' => 'save_option_reply_prefix'
  120. );
  121. $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
  122. 'name' => 'reply_focus',
  123. 'caption' => _("Cursor Position when Replying"),
  124. 'type' => SMOPT_TYPE_STRLIST,
  125. 'refresh' => SMOPT_REFRESH_NONE,
  126. 'posvals' => array('' => _("To: field"),
  127. 'focus' => _("Focus in body"),
  128. 'select' => _("Select body"),
  129. 'none' => _("No focus"))
  130. );
  131. $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
  132. 'name' => 'strip_sigs',
  133. 'caption' => _("Strip signature when replying"),
  134. 'type' => SMOPT_TYPE_BOOLEAN,
  135. 'refresh' => SMOPT_REFRESH_NONE
  136. );
  137. /* Assemble all this together and return it as our result. */
  138. $result = array(
  139. 'grps' => $optgrps,
  140. 'vals' => $optvals
  141. );
  142. return ($result);
  143. }
  144. /******************************************************************/
  145. /** Define any specialized save functions for this option page. ***/
  146. /** ***/
  147. /** You must add every function that is set in save parameter ***/
  148. /******************************************************************/
  149. /**
  150. * This function saves the reply prefix (body_quote) character(s)
  151. * @param object $option
  152. */
  153. function save_option_reply_prefix($option) {
  154. // save as "NONE" if it was blanked out
  155. //
  156. if (empty($option->new_value)) $option->new_value = 'NONE';
  157. // Save the option like normal.
  158. //
  159. save_option($option);
  160. }