~bestpractical/rt/master

« back to all changes in this revision

Viewing changes to share/html/User/Prefs.html

  • Committer: sunnavy
  • Date: 2008-05-14 13:22:46 UTC
  • Revision ID: git-v1:0f0c8baef62a06a13d6fb54683d6c7d75d5f1283
source layout change! html now lives in share/html

git-svn-id: svn+ssh://svn.bestpractical.com/svn/bps-public/rt/branches/3.8-TESTING@12308 e417ac7c-1bcc-0310-8ffa-8f5827389a85

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%# BEGIN BPS TAGGED BLOCK {{{
 
2
%# 
 
3
%# COPYRIGHT:
 
4
%#  
 
5
%# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC 
 
6
%#                                          <jesse@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
<& /User/Elements/Tabs, 
 
50
    current_tab => 'User/Prefs.html', 
 
51
    Title=>loc("Preferences") &>
 
52
 
 
53
<& /Elements/ListActions, actions => \@results &>
 
54
 
 
55
<form action="<%RT->Config->Get('WebPath')%>/User/Prefs.html" method="post">
 
56
<input type="hidden" class="hidden" name="id" value="<%$UserObj->Id%>" />
 
57
 
 
58
<table width="100%" border="0">
 
59
<tr>
 
60
 
 
61
<td valign="top" class="boxcontainer">
 
62
<&| /Widgets/TitleBox, title => loc('Identity'), id => "user-prefs-identity" &>
 
63
 
 
64
<input type="hidden" class="hidden" name="Name" value="<%$UserObj->Name%>" />
 
65
<table cellspacing="0" cellpadding="0">
 
66
  <tr>
 
67
    <td class="label"><&|/l&>Email</&>: </td>
 
68
    <td class="value"><input name="EmailAddress" value="<%$UserObj->EmailAddress%>" /></td>
 
69
  </tr>
 
70
  <tr>
 
71
    <td class="label"><&|/l&>Real Name</&>:</td>
 
72
    <td class="value"><input name="RealName" value="<%$UserObj->RealName%>" /></td>  </tr>
 
73
  <tr>
 
74
    <td class="label"><&|/l&>Nickname</&>:</td>
 
75
    <td class="value"><input name="NickName" value="<%$UserObj->NickName || ''%>" /></td>
 
76
  </tr>
 
77
  <tr>
 
78
    <td class="label"><&|/l&>Language</&>:</td>
 
79
    <td class="value"><& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &></td>
 
80
  </tr>
 
81
  <tr>
 
82
    <td class="label"><&|/l&>Timezone</&>:</td>
 
83
    <td class="value"><& /Elements/SelectTimezone, Name => 'Timezone', Default => $UserObj->Timezone &></td>
 
84
  </tr>
 
85
</table>
 
86
</&>
 
87
<&| /Widgets/TitleBox, title => loc('Phone numbers'), id => "user-prefs-phone" &>
 
88
<table cellspacing="0" cellpadding="0">
 
89
  <tr>
 
90
    <td class="label"><&|/l&>Residence</&>:</td>
 
91
    <td class="value"><input name="HomePhone" value="<%$UserObj->HomePhone || ''%>" size="13" /></td>
 
92
  </tr>
 
93
  <tr>
 
94
    <td class="label"><&|/l&>Work</&>:</td>
 
95
    <td class="value"><input name="WorkPhone" value="<%$UserObj->WorkPhone || ''%>" size="13" /></td>
 
96
  </tr>
 
97
  <tr>
 
98
    <td class="label"><&|/l&>Mobile</&>:</td>
 
99
    <td class="value"><input name="MobilePhone" value="<%$UserObj->MobilePhone || ''%>" size="13" /></td>
 
100
  </tr>
 
101
  <tr>
 
102
    <td class="label"><&|/l&>Pager</&>:</td>
 
103
    <td class="value"><input name="PagerPhone" value="<%$UserObj->PagerPhone || ''%>" size="13" /></td>
 
104
  </tr>
 
105
</table>
 
106
</&>
 
107
% $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormLeftColumn' );
 
108
</td>
 
109
<td valign="top" class="boxcontainer">
 
110
% unless (RT->Config->Get('WebExternalAuth') and !RT->Config->Get('WebFallbackToInternalAuth')) {
 
111
<&| /Widgets/TitleBox, title => loc('Password'), id => "user-prefs-password" &>
 
112
<table>
 
113
<tr>
 
114
<td class="label">
 
115
<&|/l&>New Password</&>:
 
116
</td>
 
117
<td class="value">
 
118
<input type="password" name="Pass1" autocomplete="off"/>
 
119
</td>
 
120
</tr>
 
121
<tr><td class="label">
 
122
<&|/l&>Retype Password</&>:
 
123
</td>
 
124
<td class="value">
 
125
<input type="password" name="Pass2" autocomplete="off" />
 
126
</td>
 
127
</tr>
 
128
</table>
 
129
</&>
 
130
% }
 
131
 
 
132
<&| /Widgets/TitleBox, title => loc('Location'), id => "user-prefs-location" &>
 
133
<table cellspacing="0" cellpadding="0">
 
134
  <tr>
 
135
    <td class="label"><&|/l&>Organization</&>:</td>
 
136
    <td class="value"><input name="Organization" value="<%$UserObj->Organization || ''%>" /></td>
 
137
  </tr>
 
138
  <tr>
 
139
    <td class="label"><&|/l&>Address1</&>:</td>
 
140
    <td class="value"><input name="Address1" value="<%$UserObj->Address1 || ''%>" /></td>
 
141
  </tr>
 
142
  <tr>
 
143
    <td class="label"><&|/l&>Address2</&>:</td>
 
144
    <td class="value"><input name="Address2" value="<%$UserObj->Address2 || ''%>" /></td>
 
145
  </tr>
 
146
  <tr>
 
147
    <td class="label"><&|/l&>City</&>:</td>
 
148
    <td><input name="City" value="<%$UserObj->City || ''%>" size="14" /></td>
 
149
  </tr>
 
150
  <tr>
 
151
    <td class="label"><&|/l&>State</&>:</td>
 
152
    <td class="value"><input name="State" value="<%$UserObj->State || ''%>" size="3" /></td>
 
153
  </tr>
 
154
  <tr>
 
155
    <td class="label"><&|/l&>Zip</&>:</td>
 
156
    <td class="value"><input name="Zip" value="<%$UserObj->Zip || ''%>" size="9" /></td>
 
157
  </tr>
 
158
  <tr>
 
159
    <td class="label"><&|/l&>Country</&>:</td>
 
160
    <td class="value"><input name="Country" value="<%$UserObj->Country || ''%>" /></td>
 
161
  </tr>
 
162
</table>
 
163
</&>
 
164
% $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormRightColumn' );
 
165
</td>
 
166
</tr>
 
167
 
 
168
 
 
169
<tr><td colspan="2" valign="top" class="boxcontainer">
 
170
%if ($UserObj->Privileged) {
 
171
<br />
 
172
<&| /Widgets/TitleBox, title => loc('Signature') &>
 
173
<textarea cols="80" rows="5" name="Signature" class="signature" wrap="hard">
 
174
<%$UserObj->Signature || ''%></textarea>
 
175
</&>
 
176
% }
 
177
</td></tr>
 
178
 
 
179
<tr><td colspan="2" valign="top" class="boxcontainer">
 
180
<&| /Widgets/TitleBox, title => loc('Secret authentication token'), id => "user-prefs-feeds" &>
 
181
 
 
182
<p>All iCal feeds embed a secret token which authorizes you.  If the
 
183
URL one of your iCal feeds got exposed to the outside world, you can
 
184
get a new secret, <b>breaking all existing iCal feeds</b> below.</p>
 
185
 
 
186
<& /Elements/Submit, Label => loc('Reset secret authentication token'), Name => "ResetAuthToken" &>
 
187
</&>
 
188
</td></tr>
 
189
 
 
190
</table>
 
191
 
 
192
% $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormEnd' );
 
193
 
 
194
<& /Elements/Submit, Label => loc('Save Preferences') &>
 
195
</form>
 
196
 
 
197
 
 
198
<%INIT>
 
199
 
 
200
my $UserObj = new RT::User($session{'CurrentUser'});
 
201
my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results);
 
202
 
 
203
my ($val, $msg);
 
204
 
 
205
 
 
206
        $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'");
 
207
        $val = $UserObj->Id();
 
208
    
 
209
 
 
210
 
 
211
 
 
212
 
 
213
 
 
214
# If we have a user to modify, lets try. 
 
215
if ($UserObj->Id) {
 
216
    
 
217
    my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo 
 
218
                    Organization RealName NickName Lang EmailEncoding WebEncoding 
 
219
                    ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId 
 
220
                    AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
 
221
                Address2 City State Zip Country Lang Timezone
 
222
                   );
 
223
 
 
224
    $m->callback(
 
225
        CallbackName => 'UpdateLogic',
 
226
        fields       => \@fields,
 
227
        results      => \@results,
 
228
        UserObj      => $UserObj,
 
229
        ARGSRef      => \%ARGS,
 
230
    );
 
231
    
 
232
    my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
 
233
                                            Object => $UserObj,
 
234
                                            ARGSRef => \%ARGS );
 
235
    if ($Lang) {
 
236
        $session{'CurrentUser'}->LanguageHandle($Lang);
 
237
        $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
 
238
    }
 
239
 
 
240
    push (@results,@fieldresults);
 
241
 
 
242
 
 
243
# Deal with special fields: Privileged, Enabled, and Password
 
244
if  ( ($SetPrivileged) and ( $Privileged != $UserObj->Privileged) ) {
 
245
my  ($code, $msg) = $UserObj->SetPrivileged($Privileged);
 
246
     push @results, loc('Privileged status: [_1]', loc_fuzzy($msg));
 
247
}
 
248
 
 
249
#TODO: make this report errors properly
 
250
if ((defined $Pass1) and ($Pass1 ne '') and ($Pass1 eq $Pass2) and (!$UserObj->IsPassword($Pass1))) {
 
251
    my ($code, $msg);
 
252
    ($code, $msg) = $UserObj->SetPassword($Pass1);
 
253
    push @results, loc('Password: [_1]', loc_fuzzy($msg));
 
254
} elsif ( $Pass1 && ($Pass1 ne $Pass2)) {
 
255
    push @results, loc("Passwords do not match. Your password has not been changed");
 
256
}
 
257
 
 
258
    if ( $ARGS{'ResetAuthToken'} ) {
 
259
        my ($status, $msg) = $UserObj->GenerateAuthToken;
 
260
        push @results, $msg;
 
261
    }
 
262
}
 
263
 
 
264
 
 
265
</%INIT>
 
266
 
 
267
 
 
268
<%ARGS>
 
269
$id => $session{'CurrentUser'}->Id
 
270
$Name  => undef
 
271
$Comments  => undef
 
272
$Signature  => undef
 
273
$EmailAddress  => undef
 
274
$FreeformContactInfo => undef
 
275
$Organization  => undef
 
276
$RealName  => undef
 
277
$NickName  => undef
 
278
$Privileged => undef
 
279
$SetPrivileged => undef
 
280
$Enabled => undef
 
281
$SetEnabled => undef
 
282
$Lang  => undef
 
283
$EmailEncoding  => undef
 
284
$WebEncoding => undef
 
285
$ExternalContactInfoId  => undef
 
286
$ContactInfoSystem  => undef
 
287
$Gecos => undef
 
288
$ExternalAuthId  => undef
 
289
$AuthSystem  => undef
 
290
$HomePhone => undef
 
291
$WorkPhone  => undef
 
292
$MobilePhone  => undef
 
293
$PagerPhone  => undef
 
294
$Address1 => undef
 
295
$Address2  => undef
 
296
$City  => undef
 
297
$State  => undef
 
298
$Zip  => undef
 
299
$Country => undef
 
300
$Pass1 => undef
 
301
$Pass2=> undef
 
302
$Create=> undef
 
303
</%ARGS>