]>
Commit | Line | Data |
---|---|---|
84fb5b46 MKG |
1 | %# BEGIN BPS TAGGED BLOCK {{{ |
2 | %# | |
3 | %# COPYRIGHT: | |
4 | %# | |
320f0092 | 5 | %# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC |
84fb5b46 MKG |
6 | %# <sales@bestpractical.com> |
7 | %# | |
8 | %# (Except where explicitly superseded by other copyright notices) | |
9 | %# | |
10 | %# | |
11 | %# LICENSE: | |
12 | %# | |
13 | %# This work is made available to you under the terms of Version 2 of | |
14 | %# the GNU General Public License. A copy of that license should have | |
15 | %# been provided with this software, but in any event can be snarfed | |
16 | %# from www.gnu.org. | |
17 | %# | |
18 | %# This work is distributed in the hope that it will be useful, but | |
19 | %# WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
21 | %# General Public License for more details. | |
22 | %# | |
23 | %# You should have received a copy of the GNU General Public License | |
24 | %# along with this program; if not, write to the Free Software | |
25 | %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
26 | %# 02110-1301 or visit their web page on the internet at | |
27 | %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. | |
28 | %# | |
29 | %# | |
30 | %# CONTRIBUTION SUBMISSION POLICY: | |
31 | %# | |
32 | %# (The following paragraph is not intended to limit the rights granted | |
33 | %# to you to modify and distribute this software under the terms of | |
34 | %# the GNU General Public License and is only of importance to you if | |
35 | %# you choose to contribute your changes and enhancements to the | |
36 | %# community by submitting them to Best Practical Solutions, LLC.) | |
37 | %# | |
38 | %# By intentionally submitting any modifications, corrections or | |
39 | %# derivatives to this work, or any other work intended for use with | |
40 | %# Request Tracker, to Best Practical Solutions, LLC, you confirm that | |
41 | %# you are the copyright holder for those contributions and you grant | |
42 | %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, | |
43 | %# royalty-free, perpetual, license to use, copy, create derivative | |
44 | %# works based on those contributions, and sublicense and distribute | |
45 | %# those contributions and any derivatives thereof. | |
46 | %# | |
47 | %# END BPS TAGGED BLOCK }}} | |
48 | <& /Elements/Header, Title=>loc("Preferences") &> | |
49 | <& /Elements/Tabs &> | |
50 | ||
51 | <& /Elements/ListActions, actions => \@results &> | |
52 | ||
53 | <form action="<%RT->Config->Get('WebPath')%>/User/Prefs.html" method="post"> | |
54 | <input type="hidden" class="hidden" name="id" value="<%$UserObj->Id%>" /> | |
55 | ||
56 | <table width="100%" border="0"> | |
57 | <tr> | |
58 | ||
59 | <td valign="top" class="boxcontainer"> | |
60 | <&| /Widgets/TitleBox, title => loc('Identity'), id => "user-prefs-identity" &> | |
61 | ||
62 | <input type="hidden" class="hidden" name="Name" value="<%$UserObj->Name%>" /> | |
63 | <table cellspacing="0" cellpadding="0"> | |
64 | <tr> | |
65 | <td class="label"><&|/l&>Email</&>: </td> | |
66 | <td class="value"><input name="EmailAddress" value="<%$UserObj->EmailAddress%>" /></td> | |
67 | </tr> | |
68 | <tr> | |
69 | <td class="label"><&|/l&>Real Name</&>:</td> | |
70 | <td class="value"><input name="RealName" value="<%$UserObj->RealName%>" /></td> </tr> | |
71 | <tr> | |
72 | <td class="label"><&|/l&>Nickname</&>:</td> | |
73 | <td class="value"><input name="NickName" value="<%$UserObj->NickName || ''%>" /></td> | |
74 | </tr> | |
75 | <tr> | |
76 | <td class="label"><&|/l&>Language</&>:</td> | |
77 | <td class="value"><& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &></td> | |
78 | </tr> | |
79 | <tr> | |
80 | <td class="label"><&|/l&>Timezone</&>:</td> | |
81 | <td class="value"><& /Elements/SelectTimezone, Name => 'Timezone', Default => $UserObj->Timezone &></td> | |
82 | </tr> | |
320f0092 | 83 | <& /Elements/EditCustomFields, Object => $UserObj, Grouping => 'Identity', InTable => 1 &> |
84fb5b46 MKG |
84 | </table> |
85 | </&> | |
86 | <&| /Widgets/TitleBox, title => loc('Phone numbers'), id => "user-prefs-phone" &> | |
87 | <table cellspacing="0" cellpadding="0"> | |
88 | <tr> | |
89 | <td class="label"><&|/l&>Residence</&>:</td> | |
90 | <td class="value"><input name="HomePhone" value="<%$UserObj->HomePhone || ''%>" size="13" /></td> | |
91 | </tr> | |
92 | <tr> | |
93 | <td class="label"><&|/l&>Work</&>:</td> | |
94 | <td class="value"><input name="WorkPhone" value="<%$UserObj->WorkPhone || ''%>" size="13" /></td> | |
95 | </tr> | |
96 | <tr> | |
97 | <td class="label"><&|/l&>Mobile</&>:</td> | |
98 | <td class="value"><input name="MobilePhone" value="<%$UserObj->MobilePhone || ''%>" size="13" /></td> | |
99 | </tr> | |
100 | <tr> | |
101 | <td class="label"><&|/l&>Pager</&>:</td> | |
102 | <td class="value"><input name="PagerPhone" value="<%$UserObj->PagerPhone || ''%>" size="13" /></td> | |
103 | </tr> | |
320f0092 | 104 | <& /Elements/EditCustomFields, Object => $UserObj, Grouping => 'Phones', InTable => 1 &> |
84fb5b46 MKG |
105 | </table> |
106 | </&> | |
403d7b0b MKG |
107 | |
108 | %if ($UserObj->Privileged) { | |
c33a4027 | 109 | <&| /Widgets/TitleBox, title => loc('Signature'), id => "user-prefs-signature" &> |
403d7b0b MKG |
110 | <textarea cols="80" rows="5" name="Signature" class="signature" wrap="hard"> |
111 | <%$UserObj->Signature || ''%></textarea> | |
112 | </&> | |
113 | % } | |
114 | ||
84fb5b46 MKG |
115 | % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormLeftColumn' ); |
116 | </td> | |
117 | <td valign="top" class="boxcontainer"> | |
118 | ||
119 | <&| /Widgets/TitleBox, title => loc('Password'), id => "user-prefs-password" &> | |
120 | <& /Elements/EditPassword, | |
121 | User => $UserObj, | |
122 | Name => [qw(CurrentPass Pass1 Pass2)], | |
123 | &> | |
320f0092 MKG |
124 | |
125 | <& /Elements/EditCustomFields, Object => $UserObj, Grouping => 'Access control' &> | |
126 | ||
84fb5b46 MKG |
127 | </&> |
128 | ||
129 | <&| /Widgets/TitleBox, title => loc('Location'), id => "user-prefs-location" &> | |
130 | <table cellspacing="0" cellpadding="0"> | |
131 | <tr> | |
132 | <td class="label"><&|/l&>Organization</&>:</td> | |
133 | <td class="value"><input name="Organization" value="<%$UserObj->Organization || ''%>" /></td> | |
134 | </tr> | |
135 | <tr> | |
136 | <td class="label"><&|/l&>Address1</&>:</td> | |
137 | <td class="value"><input name="Address1" value="<%$UserObj->Address1 || ''%>" /></td> | |
138 | </tr> | |
139 | <tr> | |
140 | <td class="label"><&|/l&>Address2</&>:</td> | |
141 | <td class="value"><input name="Address2" value="<%$UserObj->Address2 || ''%>" /></td> | |
142 | </tr> | |
143 | <tr> | |
144 | <td class="label"><&|/l&>City</&>:</td> | |
145 | <td><input name="City" value="<%$UserObj->City || ''%>" size="14" /></td> | |
146 | </tr> | |
147 | <tr> | |
148 | <td class="label"><&|/l&>State</&>:</td> | |
149 | <td class="value"><input name="State" value="<%$UserObj->State || ''%>" size="3" /></td> | |
150 | </tr> | |
151 | <tr> | |
152 | <td class="label"><&|/l&>Zip</&>:</td> | |
153 | <td class="value"><input name="Zip" value="<%$UserObj->Zip || ''%>" size="9" /></td> | |
154 | </tr> | |
155 | <tr> | |
156 | <td class="label"><&|/l&>Country</&>:</td> | |
157 | <td class="value"><input name="Country" value="<%$UserObj->Country || ''%>" /></td> | |
158 | </tr> | |
320f0092 | 159 | <& /Elements/EditCustomFields, Object => $UserObj, Grouping => 'Location', InTable => 1 &> |
84fb5b46 MKG |
160 | </table> |
161 | </&> | |
162 | ||
320f0092 MKG |
163 | |
164 | ||
165 | <& /Elements/EditCustomFieldCustomGroupings, Object => $UserObj &> | |
166 | ||
167 | ||
84fb5b46 | 168 | |
84fb5b46 MKG |
169 | <&| /Widgets/TitleBox, title => loc('Secret authentication token'), id => "user-prefs-feeds" &> |
170 | ||
c33a4027 | 171 | <&|/l&>All iCal feeds embed a secret token which authorizes you. If the URL for one of your iCal feeds was exposed to the outside world, you can get a new secret, <b>breaking all existing iCal feeds</b>, below.</&> |
84fb5b46 | 172 | |
403d7b0b MKG |
173 | <a href="#" id="ResetAuthTokenPrompt" style="display: none"> |
174 | <&|/l&>I want to reset my secret token.</&> | |
175 | </a> | |
176 | <& /Elements/Submit, | |
177 | Label => loc('Reset secret authentication token'), | |
178 | Name => "ResetAuthToken", | |
179 | id => "ResetAuthTokenContainer" &> | |
180 | <script> | |
181 | jQuery("#ResetAuthTokenContainer").hide(); | |
182 | jQuery("#ResetAuthTokenPrompt").show().click(function(ev){ | |
183 | jQuery(this).slideUp(); | |
184 | jQuery("#ResetAuthTokenContainer").slideDown(); | |
185 | ev.preventDefault(); | |
186 | }); | |
187 | </script> | |
84fb5b46 | 188 | </&> |
403d7b0b MKG |
189 | |
190 | % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormRightColumn' ); | |
191 | </td> | |
192 | </tr> | |
84fb5b46 MKG |
193 | |
194 | </table> | |
195 | ||
196 | % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormEnd' ); | |
197 | ||
198 | <& /Elements/Submit, Label => loc('Save Preferences') &> | |
199 | </form> | |
200 | ||
201 | ||
202 | <%INIT> | |
203 | ||
204 | my $UserObj = RT::User->new( $session{'CurrentUser'} ); | |
205 | $UserObj->Load($id) if $id; | |
206 | $UserObj->Load($Name) if $Name && !$UserObj->id; | |
207 | unless ( $UserObj->id ) { | |
208 | Abort(loc("Couldn't load user #[_1] or user '[_2]'", $id, $Name)) | |
209 | if $id && $Name; | |
210 | Abort(loc("Couldn't load user #[_1]", $id)) | |
211 | if $id; | |
212 | Abort(loc("Couldn't load user '[_1]'", $Name)) | |
213 | if $Name; | |
214 | Abort(loc("Couldn't load user")); | |
215 | } | |
216 | $id = $UserObj->id; | |
217 | ||
218 | my @results; | |
219 | ||
220 | if ( $ARGS{'ResetAuthToken'} ) { | |
221 | my ($status, $msg) = $UserObj->GenerateAuthToken; | |
222 | push @results, $msg; | |
223 | } | |
224 | else { | |
225 | my @fields = qw( | |
226 | Name Comments Signature EmailAddress FreeformContactInfo | |
227 | Organization RealName NickName Lang EmailEncoding WebEncoding | |
228 | ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId | |
229 | AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1 | |
230 | Address2 City State Zip Country Timezone | |
231 | ); | |
232 | ||
233 | $m->callback( | |
234 | CallbackName => 'UpdateLogic', | |
235 | fields => \@fields, | |
236 | results => \@results, | |
237 | UserObj => $UserObj, | |
238 | ARGSRef => \%ARGS, | |
239 | ); | |
240 | ||
241 | push @results, UpdateRecordObject ( | |
242 | AttributesRef => \@fields, | |
243 | Object => $UserObj, | |
244 | ARGSRef => \%ARGS, | |
245 | ); | |
246 | ||
247 | push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj ); | |
248 | ||
84fb5b46 MKG |
249 | # Deal with special fields: Privileged, Enabled, and Password |
250 | if ( $SetPrivileged and $Privileged != $UserObj->Privileged ) { | |
251 | my ($code, $msg) = $UserObj->SetPrivileged( $Privileged ); | |
252 | push @results, loc('Privileged status: [_1]', loc_fuzzy($msg)); | |
253 | } | |
254 | ||
255 | my %password_cond = $UserObj->CurrentUserRequireToSetPassword; | |
256 | if (defined $Pass1 && length $Pass1 ) { | |
257 | my ($status, $msg) = $UserObj->SafeSetPassword( | |
258 | Current => $CurrentPass, | |
259 | New => $Pass1, | |
260 | Confirmation => $Pass2, | |
261 | ); | |
262 | push @results, loc("Password: [_1]", $msg); | |
263 | } | |
264 | } | |
265 | ||
403d7b0b MKG |
266 | |
267 | MaybeRedirectForResults( | |
268 | Actions => \@results, | |
269 | ); | |
270 | ||
84fb5b46 MKG |
271 | </%INIT> |
272 | ||
273 | ||
274 | <%ARGS> | |
275 | $id => $session{'CurrentUser'}->Id | |
276 | $Name => undef | |
277 | $Comments => undef | |
278 | $Signature => undef | |
279 | $EmailAddress => undef | |
280 | $FreeformContactInfo => undef | |
281 | $Organization => undef | |
282 | $RealName => undef | |
283 | $NickName => undef | |
284 | $Privileged => undef | |
285 | $SetPrivileged => undef | |
286 | $Enabled => undef | |
287 | $SetEnabled => undef | |
288 | $Lang => undef | |
289 | $EmailEncoding => undef | |
290 | $WebEncoding => undef | |
291 | $ExternalContactInfoId => undef | |
292 | $ContactInfoSystem => undef | |
293 | $Gecos => undef | |
294 | $ExternalAuthId => undef | |
295 | $AuthSystem => undef | |
296 | $HomePhone => undef | |
297 | $WorkPhone => undef | |
298 | $MobilePhone => undef | |
299 | $PagerPhone => undef | |
300 | $Address1 => undef | |
301 | $Address2 => undef | |
302 | $City => undef | |
303 | $State => undef | |
304 | $Zip => undef | |
305 | $Country => undef | |
306 | $CurrentPass => undef | |
307 | $Pass1 => undef | |
308 | $Pass2 => undef | |
309 | $Create=> undef | |
310 | </%ARGS> |