5ed9d4fd |
1 | <?php |
2 | |
3 | /** |
4 | * options_compose.php |
5 | * |
5ed9d4fd |
6 | * Displays all options concerning composing of new messages |
7 | * |
47ccfad4 |
8 | * @copyright © 1999-2006 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 |
15 | define('SMOPT_GRP_COMPOSE', 0); |
16 | define('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 | */ |
31 | function 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', |
74 | 'caption' => _("Addressbook Display Format"), |
75 | 'type' => SMOPT_TYPE_STRLIST, |
76 | 'refresh' => SMOPT_REFRESH_NONE, |
77 | 'posvals' => array('1' => _("Javascript"), |
78 | '0' => _("HTML")) |
79 | ); |
6c37fb32 |
80 | |
81 | |
e00d83de |
82 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
83 | 'name' => 'compose_new_win', |
84 | 'caption' => _("Compose Messages in New Window"), |
85 | 'type' => SMOPT_TYPE_BOOLEAN, |
86 | 'refresh' => SMOPT_REFRESH_ALL |
87 | ); |
88 | |
e00d83de |
89 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
90 | 'name' => 'compose_width', |
91 | 'caption' => _("Width of Compose Window"), |
92 | 'type' => SMOPT_TYPE_INTEGER, |
93 | 'refresh' => SMOPT_REFRESH_ALL, |
94 | 'size' => SMOPT_SIZE_TINY |
95 | ); |
96 | |
e00d83de |
97 | $optvals[SMOPT_GRP_COMPOSE][] = array( |
5ed9d4fd |
98 | 'name' => 'compose_height', |
99 | 'caption' => _("Height of Compose Window"), |
100 | 'type' => SMOPT_TYPE_INTEGER, |
101 | 'refresh' => SMOPT_REFRESH_ALL, |
102 | 'size' => SMOPT_SIZE_TINY |
103 | ); |
104 | |
6c37fb32 |
105 | |
5bcd1b00 |
106 | /*** Load the General Options into the array ***/ |
e00d83de |
107 | $optgrps[SMOPT_GRP_COMPOSE_REPLY] = _("Replying and Forwarding Messages"); |
108 | $optvals[SMOPT_GRP_COMPOSE_REPLY] = array(); |
6c37fb32 |
109 | |
e00d83de |
110 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5bcd1b00 |
111 | 'name' => 'forward_cc', |
112 | 'caption' => _("Include CCs when Forwarding Messages"), |
113 | 'type' => SMOPT_TYPE_BOOLEAN, |
114 | 'refresh' => SMOPT_REFRESH_NONE |
115 | ); |
116 | |
e00d83de |
117 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5bcd1b00 |
118 | 'name' => 'include_self_reply_all', |
119 | 'caption' => _("Include Me in CC when I Reply All"), |
120 | 'type' => SMOPT_TYPE_BOOLEAN, |
121 | 'refresh' => SMOPT_REFRESH_NONE |
122 | ); |
6c37fb32 |
123 | |
e00d83de |
124 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
125 | 'name' => 'sig_first', |
c8bd2d5a |
126 | 'caption' => _("Prepend Signature before Reply/Forward Text"), |
5ed9d4fd |
127 | 'type' => SMOPT_TYPE_BOOLEAN, |
128 | 'refresh' => SMOPT_REFRESH_NONE |
129 | ); |
130 | |
e00d83de |
131 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
132 | 'name' => 'body_quote', |
133 | 'caption' => _("Prefix for Original Message when Replying"), |
134 | 'type' => SMOPT_TYPE_STRING, |
135 | 'refresh' => SMOPT_REFRESH_NONE, |
136 | 'size' => SMOPT_SIZE_TINY, |
137 | 'save' => 'save_option_reply_prefix' |
138 | ); |
139 | |
e00d83de |
140 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
141 | 'name' => 'reply_focus', |
142 | 'caption' => _("Cursor Position when Replying"), |
143 | 'type' => SMOPT_TYPE_STRLIST, |
144 | 'refresh' => SMOPT_REFRESH_NONE, |
145 | 'posvals' => array('' => _("To: field"), |
146 | 'focus' => _("Focus in body"), |
147 | 'select' => _("Select body"), |
148 | 'none' => _("No focus")) |
149 | ); |
150 | |
e00d83de |
151 | $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array( |
5ed9d4fd |
152 | 'name' => 'strip_sigs', |
153 | 'caption' => _("Strip signature when replying"), |
154 | 'type' => SMOPT_TYPE_BOOLEAN, |
155 | 'refresh' => SMOPT_REFRESH_NONE |
156 | ); |
157 | |
158 | /* Assemble all this together and return it as our result. */ |
159 | $result = array( |
160 | 'grps' => $optgrps, |
161 | 'vals' => $optvals |
162 | ); |
163 | return ($result); |
164 | } |
165 | |
166 | /******************************************************************/ |
167 | /** Define any specialized save functions for this option page. ***/ |
240f05f5 |
168 | /** ***/ |
169 | /** You must add every function that is set in save parameter ***/ |
5ed9d4fd |
170 | /******************************************************************/ |
171 | |
240f05f5 |
172 | /** |
173 | * This function saves the reply prefix (body_quote) character(s) |
174 | * @param object $option |
175 | */ |
176 | function save_option_reply_prefix($option) { |
5ed9d4fd |
177 | |
240f05f5 |
178 | // save as "NONE" if it was blanked out |
179 | // |
180 | if (empty($option->new_value)) $option->new_value = 'NONE'; |
5ed9d4fd |
181 | |
240f05f5 |
182 | |
183 | // Save the option like normal. |
184 | // |
185 | save_option($option); |
186 | |
187 | } |