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