1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
6 %# <jesse@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
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
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
28 %# CONTRIBUTION SUBMISSION POLICY:
30 %# (The following paragraph is not intended to limit the rights granted
31 %# to you to modify and distribute this software under the terms of
32 %# the GNU General Public License and is only of importance to you if
33 %# you choose to contribute your changes and enhancements to the
34 %# community by submitting them to Best Practical Solutions, LLC.)
36 %# By intentionally submitting any modifications, corrections or
37 %# derivatives to this work, or any other work intended for use with
38 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
39 %# you are the copyright holder for those contributions and you grant
40 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
41 %# royalty-free, perpetual, license to use, copy, create derivative
42 %# works based on those contributions, and sublicense and distribute
43 %# those contributions and any derivatives thereof.
45 %# END BPS TAGGED BLOCK }}}
46 <& /Elements/Header, Title=>loc("Preferences") &>
47 <& /User/Elements/Tabs,
48 current_tab => 'User/Prefs.html',
49 Title=>loc("Preferences") &>
51 <& /Elements/ListActions, actions => \@results &>
53 <FORM ACTION="<%$RT::WebPath%>/User/Prefs.html" METHOD=POST>
54 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>">
56 <TABLE WIDTH=100% BORDER=0>
59 <TD VALIGN=TOP class="boxcontainer">
60 <& /Elements/TitleBoxStart, title => loc('Identity') &>
62 <input type=hidden name="Name" value="<%$UserObj->Name%>">
63 <table callspacing=0 cellpadding=0>
65 <td class=label><&|/l&>Email</&>: </td>
66 <td class=value><input name="EmailAddress" value="<%$UserObj->EmailAddress%>"></td>
69 <td class=label><&|/l&>Real Name</&>:</td>
70 <td class=value><input name="RealName" value="<%$UserObj->RealName%>"></td> </tr>
72 <td class=label><&|/l&>Nickname</&>:</td>
73 <td class=value><input name="NickName" value="<%$UserObj->NickName%>"></td>
76 <td class=label><&|/l&>Language</&>:</td>
77 <td class=value><& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &></td>
80 <& /Elements/TitleBoxEnd &>
82 <& /Elements/TitleBoxStart, title => loc('Phone numbers') &>
83 <table callspacing=0 cellpadding=0>
85 <td class=label><&|/l&>Residence</&>:</td>
86 <td class=value><input name="HomePhone" value="<%$UserObj->HomePhone%>" size=13></td>
89 <td class=label><&|/l&>Work</&>:</td>
90 <td class=value><input name="WorkPhone" value="<%$UserObj->WorkPhone%>" size=13></td>
93 <td class=label><&|/l&>Mobile</&>:</td>
94 <td class=value><input name="MobilePhone" value="<%$UserObj->MobilePhone%>" size=13></td>
97 <td class=label><&|/l&>Pager</&>:</td>
98 <td class=value><input name="PagerPhone" value="<%$UserObj->PagerPhone%>" size=13></td>
101 <& /Elements/TitleBoxEnd &>
103 <TD VALIGN=TOP class="boxcontainer">
104 % unless ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth) {
105 <& /Elements/TitleBoxStart, title => loc('Password') &>
109 <&|/l&>New Password</&>:
112 <input type=password name="Pass1">
116 <&|/l&>Retype Password</&>:
119 <input type=password name="Pass2">
123 <& /Elements/TitleBoxEnd &>
126 <& /Elements/TitleBoxStart, title => loc('Location') &>
127 <table callspacing=0 cellpadding=0>
129 <td class=label><&|/l&>Organization</&>:</td>
130 <td class=value><input name="Organization" value="<%$UserObj->Organization%>"></td>
133 <td class=label><&|/l&>Address1</&>:</td>
134 <td class=value><input name="Address1" value="<%$UserObj->Address1%>"></td>
137 <td class=label><&|/l&>Address2</&>:</td>
138 <td class=value><input name="Address2" value="<%$UserObj->Address2%>"></td>
141 <td class=label><&|/l&>City</&>:</td>
142 <td><input name="City" value="<%$UserObj->City%>" size=14></td>
145 <td class=label><&|/l&>State</&>:</td>
146 <td class=value><input name="State" value="<%$UserObj->State%>" size=3></td>
149 <td class=label><&|/l&>Zip</&>:</td>
150 <td class=value><input name="Zip" value="<%$UserObj->Zip%>" size=9></td>
153 <td class=label><&|/l&>Country</&>:</td>
154 <td class=value><input name="Country" value="<%$UserObj->Country%>"></td>
157 <& /Elements/TitleBoxEnd &>
164 <TD COLSPAN=2 VALIGN=TOP class="boxcontainer">
165 %if ($UserObj->Privileged) {
167 <& /Elements/TitleBoxStart, title => loc('Signature') &>
168 <TEXTAREA COLS=80 ROWS=5 name="Signature" class="signature" WRAP=HARD>
169 <%$UserObj->Signature%></TEXTAREA>
170 <& /Elements/TitleBoxEnd &>
179 <& /Elements/Submit, Label => loc('Save Preferences') &>
185 my $UserObj = new RT::User($session{'CurrentUser'});
186 my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results);
191 $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'");
192 $val = $UserObj->Id();
199 # If we have a user to modify, lets try.
202 my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo
203 Organization RealName NickName Lang EmailEncoding WebEncoding
204 ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId
205 AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
206 Address2 City State Zip Country Lang
209 my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
213 $session{'CurrentUser'}->LanguageHandle($Lang);
214 $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
217 push (@results,@fieldresults);
220 # {{{ Deal with special fields: Privileged, Enabled and Password
221 if ( ($SetPrivileged) and ( $Privileged != $UserObj->Privileged) ) {
222 my ($code, $msg) = $UserObj->SetPrivileged($Privileged);
223 push @results, loc('Privileged status: [_1]', loc_fuzzy($msg));
228 #TODO: make this report errors properly
229 if ((defined $Pass1) and ($Pass1 ne '') and ($Pass1 eq $Pass2) and (!$UserObj->IsPassword($Pass1))) {
231 ($code, $msg) = $UserObj->SetPassword($Pass1);
232 push @results, loc('Password: [_1]', loc_fuzzy($msg));
233 } elsif ( $Pass1 && ($Pass1 ne $Pass2)) {
234 push @results, loc("Passwords do not match. Your password has not been changed");
245 $id => $session{'CurrentUser'}->Id
249 $EmailAddress => undef
250 $FreeformContactInfo => undef
251 $Organization => undef
255 $SetPrivileged => undef
259 $EmailEncoding => undef
260 $WebEncoding => undef
261 $ExternalContactInfoId => undef
262 $ContactInfoSystem => undef
264 $ExternalAuthId => undef
268 $MobilePhone => undef