5ed9d4fd |
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. */ |
e00d83de |
16 | define('SMOPT_GRP_COMPOSE', 0); |
17 | define('SMOPT_GRP_COMPOSE_REPLY', 1); |
5ed9d4fd |
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 | |
e00d83de |
42 | /*** Load the General Compose Options into the array ***/ |
43 | $optgrps[SMOPT_GRP_COMPOSE] = _("General Message Composition"); |
44 | $optvals[SMOPT_GRP_COMPOSE] = array(); |
5ed9d4fd |
45 | |
e00d83de |
46 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
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 | |
e00d83de |
54 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
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 | |
e00d83de |
62 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
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 | |
e00d83de |
73 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
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 | |
5ed9d4fd |
82 | |
e00d83de |
83 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
84 | 'name' => 'compose_new_win', |
85 | 'caption' => _("Compose Messages in New Window"), |
86 | 'type' => SMOPT_TYPE_BOOLEAN, |
87 | 'refresh' => SMOPT_REFRESH_ALL |
88 | ); |
89 | |
e00d83de |
90 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
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 | |
e00d83de |
98 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
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 | |
5bcd1b00 |
106 | |
107 | /*** Load the General Options into the array ***/ |
e00d83de |
108 | $optgrps[SMOPT_GRP_COMPOSE_REPLY] = _("Replying and Forwarding Messages"); |
109 | $optvals[SMOPT_GRP_COMPOSE_REPLY] = array(); |
5bcd1b00 |
110 | |
e00d83de |
111 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5bcd1b00 |
112 | 'name' => 'forward_cc', |
113 | 'caption' => _("Include CCs when Forwarding Messages"), |
114 | 'type' => SMOPT_TYPE_BOOLEAN, |
115 | 'refresh' => SMOPT_REFRESH_NONE |
116 | ); |
117 | |
e00d83de |
118 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5bcd1b00 |
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 | |
e00d83de |
125 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
126 | 'name' => 'sig_first', |
127 | 'caption' => _("Append Signature before Reply/Forward Text"), |
128 | 'type' => SMOPT_TYPE_BOOLEAN, |
129 | 'refresh' => SMOPT_REFRESH_NONE |
130 | ); |
131 | |
e00d83de |
132 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
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 | |
e00d83de |
141 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
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 | |
e00d83de |
152 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
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. ***/ |
240f05f5 |
169 | /** ***/ |
170 | /** You must add every function that is set in save parameter ***/ |
5ed9d4fd |
171 | /******************************************************************/ |
172 | |
240f05f5 |
173 | /** |
174 | * This function saves the reply prefix (body_quote) character(s) |
175 | * @param object $option |
176 | */ |
177 | function save_option_reply_prefix($option) { |
5ed9d4fd |
178 | |
240f05f5 |
179 | // save as "NONE" if it was blanked out |
180 | // |
181 | if (empty($option->new_value)) $option->new_value = 'NONE'; |
5ed9d4fd |
182 | |
240f05f5 |
183 | |
184 | // Save the option like normal. |
185 | // |
186 | save_option($option); |
187 | |
188 | } |
189 | ?> |