1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
6 %# <sales@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., 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.
30 %# CONTRIBUTION SUBMISSION POLICY:
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.)
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.
47 %# END BPS TAGGED BLOCK }}}
48 <& /Elements/Header, Title=>loc("Ticketing Preferences") &>
49 <& /User/Elements/Tabs,
50 current_tab => 'User/Prefs.html',
51 Title => loc("Preferences") &>
53 <& /Elements/ListActions, actions => \@results &>
55 <form action="<%RT->Config->Get('WebPath')%>/User/Prefs.html" method="post">
56 <input type="hidden" class="hidden" name="id" value="<%$UserObj->Id%>" />
58 <table width="100%" border="0">
61 <td valign="top" class="boxcontainer">
62 <&| /Widgets/TitleBox, title => loc('Identity'), id => "user-prefs-identity" &>
64 <input type="hidden" class="hidden" name="Name" value="<%$UserObj->Name%>" />
65 <table cellspacing="0" cellpadding="0">
67 <td class="label"><&|/l&>Email</&>: </td>
68 <td class="value"><input name="EmailAddress" value="<%$UserObj->EmailAddress%>" /></td>
71 <td class="label"><&|/l&>Real Name</&>:</td>
72 <td class="value"><input name="RealName" value="<%$UserObj->RealName%>" /></td> </tr>
74 <td class="label"><&|/l&>Nickname</&>:</td>
75 <td class="value"><input name="NickName" value="<%$UserObj->NickName || ''%>" /></td>
78 %# <td class="label"><&|/l&>Language</&>:</td>
79 %# <td class="value"><& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &></td>
82 <td class="label"><&|/l&>Timezone</&>:</td>
83 <td class="value"><& /Elements/SelectTimezone, Name => 'Timezone', Default => $UserObj->Timezone &></td>
87 <&| /Widgets/TitleBox, title => loc('Phone numbers'), id => "user-prefs-phone" &>
88 <table cellspacing="0" cellpadding="0">
90 <td class="label"><&|/l&>Residence</&>:</td>
91 <td class="value"><input name="HomePhone" value="<%$UserObj->HomePhone || ''%>" size="13" /></td>
94 <td class="label"><&|/l&>Work</&>:</td>
95 <td class="value"><input name="WorkPhone" value="<%$UserObj->WorkPhone || ''%>" size="13" /></td>
98 <td class="label"><&|/l&>Mobile</&>:</td>
99 <td class="value"><input name="MobilePhone" value="<%$UserObj->MobilePhone || ''%>" size="13" /></td>
102 <td class="label"><&|/l&>Pager</&>:</td>
103 <td class="value"><input name="PagerPhone" value="<%$UserObj->PagerPhone || ''%>" size="13" /></td>
107 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormLeftColumn' );
109 <td valign="top" class="boxcontainer">
111 <&| /Widgets/TitleBox, title => loc('Password'), id => "user-prefs-password" &>
112 <& /Elements/EditPassword,
114 Name => [qw(CurrentPass Pass1 Pass2)],
118 <&| /Widgets/TitleBox, title => loc('Location'), id => "user-prefs-location" &>
119 <table cellspacing="0" cellpadding="0">
121 <td class="label"><&|/l&>Organization</&>:</td>
122 <td class="value"><input name="Organization" value="<%$UserObj->Organization || ''%>" /></td>
125 <td class="label"><&|/l&>Address1</&>:</td>
126 <td class="value"><input name="Address1" value="<%$UserObj->Address1 || ''%>" /></td>
129 <td class="label"><&|/l&>Address2</&>:</td>
130 <td class="value"><input name="Address2" value="<%$UserObj->Address2 || ''%>" /></td>
133 <td class="label"><&|/l&>City</&>:</td>
134 <td><input name="City" value="<%$UserObj->City || ''%>" size="14" /></td>
137 <td class="label"><&|/l&>State</&>:</td>
138 <td class="value"><input name="State" value="<%$UserObj->State || ''%>" size="3" /></td>
141 <td class="label"><&|/l&>Zip</&>:</td>
142 <td class="value"><input name="Zip" value="<%$UserObj->Zip || ''%>" size="9" /></td>
145 <td class="label"><&|/l&>Country</&>:</td>
146 <td class="value"><input name="Country" value="<%$UserObj->Country || ''%>" /></td>
151 <&| /Widgets/TitleBox, title => loc('Custom Fields') &>
153 % my $CustomFields = $UserObj->CustomFields;
154 % while ( my $CF = $CustomFields->Next ) {
156 <td align="right"><% loc( $CF->Name ) %>:</td>
157 <td><& /Elements/EditCustomField,
158 %ARGS, Object => $UserObj, CustomField => $CF
164 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormRightColumn' );
169 <tr><td colspan="2" valign="top" class="boxcontainer">
170 %if ($UserObj->Privileged) {
172 <&| /Widgets/TitleBox, title => loc('Signature') &>
173 <textarea cols="80" rows="5" name="Signature" class="signature" wrap="hard">
174 <%$UserObj->Signature || ''%></textarea>
179 <tr><td colspan="2" valign="top" class="boxcontainer">
180 <&| /Widgets/TitleBox, title => loc('Secret authentication token'), id => "user-prefs-feeds" &>
182 <&|/l&><p>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.</p></&>
184 <& /Elements/Submit, Label => loc('Reset secret authentication token'), Name => "ResetAuthToken" &>
190 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormEnd' );
192 <& /Elements/Submit, Label => loc('Save Preferences') &>
198 my $UserObj = RT::User->new( $session{'CurrentUser'} );
199 $UserObj->Load($id) if $id;
200 $UserObj->Load($Name) if $Name && !$UserObj->id;
201 unless ( $UserObj->id ) {
202 Abort(loc("Couldn't load user #[_1] or user '[_2]'", $id, $Name))
204 Abort(loc("Couldn't load user #[_1]", $id))
206 Abort(loc("Couldn't load user '[_1]'", $Name))
208 Abort(loc("Couldn't load user"));
215 Name Comments Signature EmailAddress FreeformContactInfo
216 Organization RealName NickName Lang EmailEncoding WebEncoding
217 ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId
218 AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
219 Address2 City State Zip Country Lang Timezone
223 CallbackName => 'UpdateLogic',
225 results => \@results,
230 push @results, UpdateRecordObject (
231 AttributesRef => \@fields,
236 push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj );
239 $session{'CurrentUser'}->LanguageHandle($Lang);
240 $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
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));
249 my %password_cond = $UserObj->CurrentUserRequireToSetPassword;
250 if (defined $Pass1 && length $Pass1 ) {
251 my ($status, $msg) = $UserObj->SafeSetPassword(
252 Current => $CurrentPass,
254 Confirmation => $Pass2,
256 push @results, loc("Password: [_1]", $msg);
259 if ( $ARGS{'ResetAuthToken'} ) {
260 my ($status, $msg) = $UserObj->GenerateAuthToken;
268 $id => $session{'CurrentUser'}->Id
272 $EmailAddress => undef
273 $FreeformContactInfo => undef
274 $Organization => undef
278 $SetPrivileged => undef
282 $EmailEncoding => undef
283 $WebEncoding => undef
284 $ExternalContactInfoId => undef
285 $ContactInfoSystem => undef
287 $ExternalAuthId => undef
291 $MobilePhone => undef
299 $CurrentPass => undef