2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses authentication_api.php
24 * @uses config_api.php
25 * @uses constant_inc.php
28 * @uses helper_api.php
33 * @uses user_pref_api.php
34 * @uses utility_api.php
37 require_api( 'authentication_api.php' );
38 require_api( 'config_api.php' );
39 require_api( 'constant_inc.php' );
40 require_api( 'event_api.php' );
41 require_api( 'form_api.php' );
42 require_api( 'helper_api.php' );
43 require_api( 'html_api.php' );
44 require_api( 'lang_api.php' );
45 require_api( 'print_api.php' );
46 require_api( 'user_api.php' );
47 require_api( 'user_pref_api.php' );
48 require_api( 'utility_api.php' );
50 function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '') {
51 if ( null === $p_user_id ) {
52 $p_user_id = auth_get_current_user_id();
55 $t_redirect_url = $p_redirect_url;
56 if ( is_blank( $t_redirect_url ) ) {
57 $t_redirect_url = 'account_prefs_page.php';
60 # protected account check
61 if ( user_is_protected( $p_user_id ) ) {
62 if ( $p_error_if_protected ) {
63 trigger_error( ERROR_PROTECTED_ACCOUNT
, ERROR
);
70 $t_pref = user_pref_get( $p_user_id );
72 # Account Preferences Form BEGIN
76 <form method
="post" action
="account_prefs_update.php">
77 <?php
echo form_security_field( 'account_prefs_update' ) ?
>
78 <input type
="hidden" name
="user_id" value
="<?php echo $p_user_id ?>" />
79 <input type
="hidden" name
="redirect_url" value
="<?php echo $t_redirect_url ?>" />
80 <table
class="width75" cellspacing
="1">
82 <td
class="form-title">
83 <?php
echo lang_get( 'default_account_preferences_title' ) ?
>
87 if ( $p_accounts_menu ) {
88 print_account_menu( 'account_prefs_page.php' );
93 <tr
<?php
echo helper_alternate_class() ?
>>
94 <td
class="category" width
="50%">
95 <?php
echo lang_get( 'default_project' ) ?
>
98 <select name
="default_project">
99 <?php
print_project_option_list( $t_pref->default_project
) ?
>
103 <tr
<?php
echo helper_alternate_class() ?
>>
104 <td
class="category">
105 <?php
echo lang_get( 'refresh_delay' ) ?
>
108 <input type
="text" name
="refresh_delay" size
="4" maxlength
="4" value
="<?php echo $t_pref->refresh_delay ?>" /> <?php
echo lang_get( 'minutes' ) ?
>
111 <tr
<?php
echo helper_alternate_class() ?
>>
112 <td
class="category">
113 <?php
echo lang_get( 'redirect_delay' ) ?
>
116 <input type
="text" name
="redirect_delay" size
="4" maxlength
="3" value
="<?php echo $t_pref->redirect_delay ?>" /> <?php
echo lang_get( 'seconds' ) ?
>
119 <tr
<?php
echo helper_alternate_class() ?
>>
120 <td
class="category">
121 <?php
echo lang_get( 'bugnote_order' ) ?
>
124 <label
><input type
="radio" name
="bugnote_order" value
="ASC" <?php
check_checked( $t_pref->bugnote_order
, 'ASC' ); ?
> /><?php
echo lang_get( 'bugnote_order_asc' ) ?
></label
>
125 <label
><input type
="radio" name
="bugnote_order" value
="DESC" <?php
check_checked( $t_pref->bugnote_order
, 'DESC' ); ?
> /><?php
echo lang_get( 'bugnote_order_desc' ) ?
></label
>
129 if ( ON
== config_get( 'enable_email_notification' ) ) {
131 <tr
<?php
echo helper_alternate_class() ?
>>
132 <td
class="category">
133 <?php
echo lang_get( 'email_on_new' ) ?
>
136 <input type
="checkbox" name
="email_on_new" <?php
check_checked( $t_pref->email_on_new
, ON
); ?
> />
137 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
138 <select name
="email_on_new_min_severity">
139 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
140 <option disabled
="disabled">-----</option
>
141 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_new_min_severity
) ?
>
145 <tr
<?php
echo helper_alternate_class() ?
>>
146 <td
class="category">
147 <?php
echo lang_get( 'email_on_assigned' ) ?
>
150 <input type
="checkbox" name
="email_on_assigned" <?php
check_checked( $t_pref->email_on_assigned
, ON
); ?
> />
151 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
152 <select name
="email_on_assigned_min_severity">
153 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
154 <option disabled
="disabled">-----</option
>
155 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_assigned_min_severity
) ?
>
159 <tr
<?php
echo helper_alternate_class() ?
>>
160 <td
class="category">
161 <?php
echo lang_get( 'email_on_feedback' ) ?
>
164 <input type
="checkbox" name
="email_on_feedback" <?php
check_checked( $t_pref->email_on_feedback
, ON
); ?
> />
165 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
166 <select name
="email_on_feedback_min_severity">
167 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
168 <option disabled
="disabled">-----</option
>
169 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_feedback_min_severity
) ?
>
173 <tr
<?php
echo helper_alternate_class() ?
>>
174 <td
class="category">
175 <?php
echo lang_get( 'email_on_resolved' ) ?
>
178 <input type
="checkbox" name
="email_on_resolved" <?php
check_checked( $t_pref->email_on_resolved
, ON
); ?
> />
179 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
180 <select name
="email_on_resolved_min_severity">
181 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
182 <option disabled
="disabled">-----</option
>
183 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_resolved_min_severity
) ?
>
187 <tr
<?php
echo helper_alternate_class() ?
>>
188 <td
class="category">
189 <?php
echo lang_get( 'email_on_closed' ) ?
>
192 <input type
="checkbox" name
="email_on_closed" <?php
check_checked( $t_pref->email_on_closed
, ON
); ?
> />
193 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
194 <select name
="email_on_closed_min_severity">
195 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
196 <option disabled
="disabled">-----</option
>
197 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_closed_min_severity
) ?
>
201 <tr
<?php
echo helper_alternate_class() ?
>>
202 <td
class="category">
203 <?php
echo lang_get( 'email_on_reopened' ) ?
>
206 <input type
="checkbox" name
="email_on_reopened" <?php
check_checked( $t_pref->email_on_reopened
, ON
); ?
> />
207 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
208 <select name
="email_on_reopened_min_severity">
209 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
210 <option disabled
="disabled">-----</option
>
211 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_reopened_min_severity
) ?
>
215 <tr
<?php
echo helper_alternate_class() ?
>>
216 <td
class="category">
217 <?php
echo lang_get( 'email_on_bugnote_added' ) ?
>
220 <input type
="checkbox" name
="email_on_bugnote" <?php
check_checked( $t_pref->email_on_bugnote
, ON
); ?
> />
221 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
222 <select name
="email_on_bugnote_min_severity">
223 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
224 <option disabled
="disabled">-----</option
>
225 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_bugnote_min_severity
) ?
>
229 <tr
<?php
echo helper_alternate_class() ?
>>
230 <td
class="category">
231 <?php
echo lang_get( 'email_on_status_change' ) ?
>
234 <input type
="checkbox" name
="email_on_status" <?php
check_checked( $t_pref->email_on_status
, ON
); ?
> />
235 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
236 <select name
="email_on_status_min_severity">
237 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
238 <option disabled
="disabled">-----</option
>
239 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_status_min_severity
) ?
>
243 <tr
<?php
echo helper_alternate_class() ?
>>
244 <td
class="category">
245 <?php
echo lang_get( 'email_on_priority_change' ) ?
>
248 <input type
="checkbox" name
="email_on_priority" <?php
check_checked( $t_pref->email_on_priority
, ON
); ?
> />
249 <?php
echo lang_get( 'with_minimum_severity' ) ?
>
250 <select name
="email_on_priority_min_severity">
251 <option value
="<?php echo OFF ?>"><?php
echo lang_get( 'any' ) ?
></option
>
252 <option disabled
="disabled">-----</option
>
253 <?php
print_enum_string_option_list( 'severity', $t_pref->email_on_priority_min_severity
) ?
>
257 <tr
<?php
echo helper_alternate_class() ?
>>
258 <td
class="category">
259 <?php
echo lang_get( 'email_bugnote_limit' ) ?
>
262 <input type
="text" name
="email_bugnote_limit" maxlength
="2" size
="2" value
="<?php echo $t_pref->email_bugnote_limit ?>" />
266 <input type
="hidden" name
="email_on_new" value
="<?php echo $t_pref->email_on_new ?>" />
267 <input type
="hidden" name
="email_on_assigned" value
="<?php echo $t_pref->email_on_assigned ?>" />
268 <input type
="hidden" name
="email_on_feedback" value
="<?php echo $t_pref->email_on_feedback ?>" />
269 <input type
="hidden" name
="email_on_resolved" value
="<?php echo $t_pref->email_on_resolved ?>" />
270 <input type
="hidden" name
="email_on_closed" value
="<?php echo $t_pref->email_on_closed ?>" />
271 <input type
="hidden" name
="email_on_reopened" value
="<?php echo $t_pref->email_on_reopened ?>" />
272 <input type
="hidden" name
="email_on_bugnote" value
="<?php echo $t_pref->email_on_bugnote ?>" />
273 <input type
="hidden" name
="email_on_status" value
="<?php echo $t_pref->email_on_status ?>" />
274 <input type
="hidden" name
="email_on_priority" value
="<?php echo $t_pref->email_on_priority ?>" />
275 <input type
="hidden" name
="email_on_new_min_severity" value
="<?php echo $t_pref->email_on_new_min_severity ?>" />
276 <input type
="hidden" name
="email_on_assigned_min_severity" value
="<?php echo $t_pref->email_on_assigned_min_severity ?>" />
277 <input type
="hidden" name
="email_on_feedback_min_severity" value
="<?php echo $t_pref->email_on_feedback_min_severity ?>" />
278 <input type
="hidden" name
="email_on_resolved_min_severity" value
="<?php echo $t_pref->email_on_resolved_min_severity ?>" />
279 <input type
="hidden" name
="email_on_closed_min_severity" value
="<?php echo $t_pref->email_on_closed_min_severity ?>" />
280 <input type
="hidden" name
="email_on_reopened_min_severity" value
="<?php echo $t_pref->email_on_reopened_min_severity ?>" />
281 <input type
="hidden" name
="email_on_bugnote_min_severity" value
="<?php echo $t_pref->email_on_bugnote_min_severity ?>" />
282 <input type
="hidden" name
="email_on_status_min_severity" value
="<?php echo $t_pref->email_on_status_min_severity ?>" />
283 <input type
="hidden" name
="email_on_priority_min_severity" value
="<?php echo $t_pref->email_on_priority_min_severity ?>" />
284 <input type
="hidden" name
="email_bugnote_limit" value
="<?php echo $t_pref->email_bugnote_limit ?>" />
286 <tr
<?php
echo helper_alternate_class() ?
>>
287 <td
class="category">
288 <?php
echo lang_get( 'timezone' ) ?
>
291 <select name
="timezone">
292 <?php
print_timezone_option_list( $t_pref->timezone ?
$t_pref->timezone
: config_get_global( 'default_timezone' ) ) ?
>
296 <tr
<?php
echo helper_alternate_class() ?
>>
297 <td
class="category">
298 <?php
echo lang_get( 'language' ) ?
>
301 <select name
="language">
302 <?php
print_language_option_list( $t_pref->language
) ?
>
306 <?php
event_signal( 'EVENT_ACCOUNT_PREF_UPDATE_FORM', array( $p_user_id ) ); ?
>
308 <td colspan
="2" class="center">
309 <input type
="submit" class="button" value
="<?php echo lang_get( 'update_prefs_button' ) ?>" />
318 <div
class="border center">
319 <form method
="post" action
="account_prefs_reset.php">
320 <?php
echo form_security_field( 'account_prefs_reset' ) ?
>
321 <input type
="hidden" name
="user_id" value
="<?php echo $p_user_id ?>" />
322 <input type
="hidden" name
="redirect_url" value
="<?php echo $t_redirect_url ?>" />
323 <input type
="submit" class="button" value
="<?php echo lang_get( 'reset_prefs_button' ) ?>" />
328 } # end of edit_account_prefs()