]> git.uio.no Git - usit-rt.git/blob - share/html/User/Prefs.html
Upgrade to 4.0.10.
[usit-rt.git] / share / html / User / Prefs.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
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>
83 </table>
84 </&>
85 <&| /Widgets/TitleBox, title => loc('Phone numbers'), id => "user-prefs-phone" &>
86 <table cellspacing="0" cellpadding="0">
87   <tr>
88     <td class="label"><&|/l&>Residence</&>:</td>
89     <td class="value"><input name="HomePhone" value="<%$UserObj->HomePhone || ''%>" size="13" /></td>
90   </tr>
91   <tr>
92     <td class="label"><&|/l&>Work</&>:</td>
93     <td class="value"><input name="WorkPhone" value="<%$UserObj->WorkPhone || ''%>" size="13" /></td>
94   </tr>
95   <tr>
96     <td class="label"><&|/l&>Mobile</&>:</td>
97     <td class="value"><input name="MobilePhone" value="<%$UserObj->MobilePhone || ''%>" size="13" /></td>
98   </tr>
99   <tr>
100     <td class="label"><&|/l&>Pager</&>:</td>
101     <td class="value"><input name="PagerPhone" value="<%$UserObj->PagerPhone || ''%>" size="13" /></td>
102   </tr>
103 </table>
104 </&>
105
106 %if ($UserObj->Privileged) {
107 <&| /Widgets/TitleBox, title => loc('Signature') &>
108 <textarea cols="80" rows="5" name="Signature" class="signature" wrap="hard">
109 <%$UserObj->Signature || ''%></textarea>
110 </&>
111 % }
112
113 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormLeftColumn' );
114 </td>
115 <td valign="top" class="boxcontainer">
116
117 <&| /Widgets/TitleBox, title => loc('Password'), id => "user-prefs-password" &>
118 <& /Elements/EditPassword,
119     User => $UserObj,
120     Name => [qw(CurrentPass Pass1 Pass2)],
121 &>
122 </&>
123
124 <&| /Widgets/TitleBox, title => loc('Location'), id => "user-prefs-location" &>
125 <table cellspacing="0" cellpadding="0">
126   <tr>
127     <td class="label"><&|/l&>Organization</&>:</td>
128     <td class="value"><input name="Organization" value="<%$UserObj->Organization || ''%>" /></td>
129   </tr>
130   <tr>
131     <td class="label"><&|/l&>Address1</&>:</td>
132     <td class="value"><input name="Address1" value="<%$UserObj->Address1 || ''%>" /></td>
133   </tr>
134   <tr>
135     <td class="label"><&|/l&>Address2</&>:</td>
136     <td class="value"><input name="Address2" value="<%$UserObj->Address2 || ''%>" /></td>
137   </tr>
138   <tr>
139     <td class="label"><&|/l&>City</&>:</td>
140     <td><input name="City" value="<%$UserObj->City || ''%>" size="14" /></td>
141   </tr>
142   <tr>
143     <td class="label"><&|/l&>State</&>:</td>
144     <td class="value"><input name="State" value="<%$UserObj->State || ''%>" size="3" /></td>
145   </tr>
146   <tr>
147     <td class="label"><&|/l&>Zip</&>:</td>
148     <td class="value"><input name="Zip" value="<%$UserObj->Zip || ''%>" size="9" /></td>
149   </tr>
150   <tr>
151     <td class="label"><&|/l&>Country</&>:</td>
152     <td class="value"><input name="Country" value="<%$UserObj->Country || ''%>" /></td>
153   </tr>
154 </table>
155 </&>
156
157 <&| /Widgets/TitleBox, title => loc('Custom Fields') &>
158 <table>
159 % my $CustomFields = $UserObj->CustomFields;
160 % while ( my $CF = $CustomFields->Next ) {
161 <tr valign="top">
162 <td align="right"><% loc( $CF->Name ) %>:</td>
163 <td><& /Elements/EditCustomField,
164     %ARGS, Object => $UserObj, CustomField => $CF
165 &></td></tr>
166 % }
167 </table>
168 </&>
169
170 <&| /Widgets/TitleBox, title => loc('Secret authentication token'), id => "user-prefs-feeds" &>
171
172 <&|/l&>All iCal feeds embed a secret token which authorizes you.  If the URL one of your iCal feeds got exposed to the outside world, you can get a new secret, <b>breaking all existing iCal feeds</b> below.</&>
173
174 <a href="#" id="ResetAuthTokenPrompt" style="display: none">
175   <&|/l&>I want to reset my secret token.</&>
176 </a>
177 <& /Elements/Submit,
178     Label       => loc('Reset secret authentication token'),
179     Name        => "ResetAuthToken",
180     id          => "ResetAuthTokenContainer" &>
181 <script>
182     jQuery("#ResetAuthTokenContainer").hide();
183     jQuery("#ResetAuthTokenPrompt").show().click(function(ev){
184         jQuery(this).slideUp();
185         jQuery("#ResetAuthTokenContainer").slideDown();
186         ev.preventDefault();
187     });
188 </script>
189 </&>
190
191 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormRightColumn' );
192 </td>
193 </tr>
194
195 </table>
196
197 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormEnd' );
198
199 <& /Elements/Submit, Label => loc('Save Preferences') &>
200 </form>
201
202
203 <%INIT>
204
205 my $UserObj = RT::User->new( $session{'CurrentUser'} );
206 $UserObj->Load($id) if $id;
207 $UserObj->Load($Name) if $Name && !$UserObj->id;
208 unless ( $UserObj->id ) {
209     Abort(loc("Couldn't load user #[_1] or user '[_2]'", $id, $Name))
210         if $id && $Name;
211     Abort(loc("Couldn't load user #[_1]", $id))
212         if $id;
213     Abort(loc("Couldn't load user '[_1]'", $Name))
214         if $Name;
215     Abort(loc("Couldn't load user"));
216 }
217 $id = $UserObj->id;
218
219 my @results;
220
221 if ( $ARGS{'ResetAuthToken'} ) {
222     my ($status, $msg) = $UserObj->GenerateAuthToken;
223     push @results, $msg;
224 }
225 else {
226     my @fields = qw(
227         Name Comments Signature EmailAddress FreeformContactInfo 
228         Organization RealName NickName Lang EmailEncoding WebEncoding 
229         ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId 
230         AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
231         Address2 City State Zip Country Timezone
232     );
233
234     $m->callback(
235         CallbackName => 'UpdateLogic',
236         fields       => \@fields,
237         results      => \@results,
238         UserObj      => $UserObj,
239         ARGSRef      => \%ARGS,
240     );
241
242     push @results, UpdateRecordObject (
243         AttributesRef => \@fields,
244         Object => $UserObj,
245         ARGSRef => \%ARGS,
246     );
247
248     push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj );
249
250     # Deal with special fields: Privileged, Enabled, and Password
251     if  ( $SetPrivileged and $Privileged != $UserObj->Privileged ) {
252         my ($code, $msg) = $UserObj->SetPrivileged( $Privileged );
253         push @results, loc('Privileged status: [_1]', loc_fuzzy($msg));
254     }
255
256     my %password_cond = $UserObj->CurrentUserRequireToSetPassword;
257     if (defined $Pass1 && length $Pass1 ) {
258         my ($status, $msg) = $UserObj->SafeSetPassword(
259             Current      => $CurrentPass,
260             New          => $Pass1,
261             Confirmation => $Pass2,
262         );
263         push @results, loc("Password: [_1]", $msg);
264     }
265 }
266
267
268 MaybeRedirectForResults(
269     Actions   => \@results,
270 );
271
272 </%INIT>
273
274
275 <%ARGS>
276 $id => $session{'CurrentUser'}->Id
277 $Name  => undef
278 $Comments  => undef
279 $Signature  => undef
280 $EmailAddress  => undef
281 $FreeformContactInfo => undef
282 $Organization  => undef
283 $RealName  => undef
284 $NickName  => undef
285 $Privileged => undef
286 $SetPrivileged => undef
287 $Enabled => undef
288 $SetEnabled => undef
289 $Lang  => undef
290 $EmailEncoding  => undef
291 $WebEncoding => undef
292 $ExternalContactInfoId  => undef
293 $ContactInfoSystem  => undef
294 $Gecos => undef
295 $ExternalAuthId  => undef
296 $AuthSystem  => undef
297 $HomePhone => undef
298 $WorkPhone  => undef
299 $MobilePhone  => undef
300 $PagerPhone  => undef
301 $Address1 => undef
302 $Address2  => undef
303 $City  => undef
304 $State  => undef
305 $Zip  => undef
306 $Country => undef
307 $CurrentPass => undef
308 $Pass1 => undef
309 $Pass2 => undef
310 $Create=> undef
311 </%ARGS>