Add option that allows users to have replies to their own messages sent to the recipi...
[squirrelmail.git] / include / options / compose.php
CommitLineData
5ed9d4fd 1<?php
2
3/**
4 * options_compose.php
5 *
5ed9d4fd 6 * Displays all options concerning composing of new messages
7 *
c0d96801 8 * @copyright 1999-2012 The SquirrelMail Project Team
4b4abf93 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
5ed9d4fd 10 * @version $Id$
11 * @package squirrelmail
12 */
13
14/** Define the group constants for this options page. */
e00d83de 15define('SMOPT_GRP_COMPOSE', 0);
16define('SMOPT_GRP_COMPOSE_REPLY', 1);
5ed9d4fd 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 */
31function load_optpage_data_compose() {
32
33 /* Build a simple array into which we will build options. */
34 $optgrps = array();
35 $optvals = array();
36
37 /******************************************************/
38 /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
39 /******************************************************/
6c37fb32 40
e00d83de 41 /*** Load the General Compose Options into the array ***/
42 $optgrps[SMOPT_GRP_COMPOSE] = _("General Message Composition");
43 $optvals[SMOPT_GRP_COMPOSE] = array();
5ed9d4fd 44
e00d83de 45 $optvals[SMOPT_GRP_COMPOSE][] = array(
5ed9d4fd 46 'name' => 'editor_size',
47 'caption' => _("Width of Editor Window"),
48 'type' => SMOPT_TYPE_INTEGER,
49 'refresh' => SMOPT_REFRESH_NONE,
50 'size' => SMOPT_SIZE_TINY
51 );
52
e00d83de 53 $optvals[SMOPT_GRP_COMPOSE][] = array(
5ed9d4fd 54 'name' => 'editor_height',
55 'caption' => _("Height of Editor Window"),
56 'type' => SMOPT_TYPE_INTEGER,
57 'refresh' => SMOPT_REFRESH_NONE,
58 'size' => SMOPT_SIZE_TINY
59 );
60
e00d83de 61 $optvals[SMOPT_GRP_COMPOSE][] = array(
5ed9d4fd 62 'name' => 'location_of_buttons',
63 'caption' => _("Location of Buttons when Composing"),
64 'type' => SMOPT_TYPE_STRLIST,
65 'refresh' => SMOPT_REFRESH_NONE,
66 'posvals' => array(SMPREF_LOC_TOP => _("Before headers"),
67 SMPREF_LOC_BETWEEN => _("Between headers and message body"),
68 SMPREF_LOC_BOTTOM => _("After message body"))
69 );
70
71
e00d83de 72 $optvals[SMOPT_GRP_COMPOSE][] = array(
5ed9d4fd 73 'name' => 'use_javascript_addr_book',
56196737 74 'caption' => _("Address Book Display Format"),
5ed9d4fd 75 'type' => SMOPT_TYPE_STRLIST,
76 'refresh' => SMOPT_REFRESH_NONE,
56196737 77 'posvals' => array('1' => _("Pop-up window"),
78 '0' => _("In-page"))
79 );
80
81
82 $optvals[SMOPT_GRP_COMPOSE][] = array(
83 'name' => 'addrsrch_fullname',
84 'caption' => _("Format of Addresses Added From Address Book"),
85 'type' => SMOPT_TYPE_STRLIST,
86 'refresh' => SMOPT_REFRESH_NONE,
87 'posvals' => array('noprefix' => _("No prefix/Address only"),
88 'nickname' => _("Nickname and address"),
89 'fullname' => _("Full name and address"))
5ed9d4fd 90 );
6c37fb32 91
92
e00d83de 93 $optvals[SMOPT_GRP_COMPOSE][] = array(
5ed9d4fd 94 'name' => 'compose_new_win',
95 'caption' => _("Compose Messages in New Window"),
96 'type' => SMOPT_TYPE_BOOLEAN,
97 'refresh' => SMOPT_REFRESH_ALL
98 );
99
e00d83de 100 $optvals[SMOPT_GRP_COMPOSE][] = array(
5ed9d4fd 101 'name' => 'compose_width',
102 'caption' => _("Width of Compose Window"),
103 'type' => SMOPT_TYPE_INTEGER,
104 'refresh' => SMOPT_REFRESH_ALL,
105 'size' => SMOPT_SIZE_TINY
106 );
107
e00d83de 108 $optvals[SMOPT_GRP_COMPOSE][] = array(
5ed9d4fd 109 'name' => 'compose_height',
110 'caption' => _("Height of Compose Window"),
111 'type' => SMOPT_TYPE_INTEGER,
112 'refresh' => SMOPT_REFRESH_ALL,
113 'size' => SMOPT_SIZE_TINY
114 );
115
6c37fb32 116
5bcd1b00 117 /*** Load the General Options into the array ***/
e00d83de 118 $optgrps[SMOPT_GRP_COMPOSE_REPLY] = _("Replying and Forwarding Messages");
119 $optvals[SMOPT_GRP_COMPOSE_REPLY] = array();
6c37fb32 120
ace75dcb 121 $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
122 'name' => 'do_not_reply_to_self',
123 'caption' => _("Send Replies To My Own Messages To Previous Recipient"),
124 'type' => SMOPT_TYPE_BOOLEAN,
125 'refresh' => SMOPT_REFRESH_NONE
126 );
127
e00d83de 128 $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
5bcd1b00 129 'name' => 'include_self_reply_all',
130 'caption' => _("Include Me in CC when I Reply All"),
131 'type' => SMOPT_TYPE_BOOLEAN,
132 'refresh' => SMOPT_REFRESH_NONE
133 );
6c37fb32 134
e00d83de 135 $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
5ed9d4fd 136 'name' => 'sig_first',
c8bd2d5a 137 'caption' => _("Prepend Signature before Reply/Forward Text"),
5ed9d4fd 138 'type' => SMOPT_TYPE_BOOLEAN,
139 'refresh' => SMOPT_REFRESH_NONE
140 );
141
e00d83de 142 $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
5ed9d4fd 143 'name' => 'body_quote',
144 'caption' => _("Prefix for Original Message when Replying"),
145 'type' => SMOPT_TYPE_STRING,
146 'refresh' => SMOPT_REFRESH_NONE,
147 'size' => SMOPT_SIZE_TINY,
148 'save' => 'save_option_reply_prefix'
149 );
150
e00d83de 151 $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
5ed9d4fd 152 'name' => 'reply_focus',
153 'caption' => _("Cursor Position when Replying"),
154 'type' => SMOPT_TYPE_STRLIST,
155 'refresh' => SMOPT_REFRESH_NONE,
156 'posvals' => array('' => _("To: field"),
157 'focus' => _("Focus in body"),
158 'select' => _("Select body"),
159 'none' => _("No focus"))
160 );
161
e00d83de 162 $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
5ed9d4fd 163 'name' => 'strip_sigs',
164 'caption' => _("Strip signature when replying"),
165 'type' => SMOPT_TYPE_BOOLEAN,
166 'refresh' => SMOPT_REFRESH_NONE
167 );
168
169 /* Assemble all this together and return it as our result. */
170 $result = array(
171 'grps' => $optgrps,
172 'vals' => $optvals
173 );
174 return ($result);
175}
176
177/******************************************************************/
178/** Define any specialized save functions for this option page. ***/
240f05f5 179/** ***/
180/** You must add every function that is set in save parameter ***/
5ed9d4fd 181/******************************************************************/
182
240f05f5 183/**
184 * This function saves the reply prefix (body_quote) character(s)
185 * @param object $option
186 */
187function save_option_reply_prefix($option) {
5ed9d4fd 188
240f05f5 189 // save as "NONE" if it was blanked out
190 //
191 if (empty($option->new_value)) $option->new_value = 'NONE';
5ed9d4fd 192
240f05f5 193
194 // Save the option like normal.
195 //
196 save_option($option);
197
198}