3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %# General Public License for more details.
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
24 <& /Elements/Header, Title => loc("User view") &>
26 <& /Elements/ViewUser, User=>$u &>
28 <h2 class="title"><%loc("User view")%></h2>
30 %if ($session{CurrentUser} && ($session{CurrentUser}->Id == $id)) {
31 <& /Elements/TitleBoxStart, title => loc('Signature') &>
33 <input type="hidden" name="id" value=<%$id%>>
34 <TEXTAREA COLS=72 ROWS=4 WRAP=HARD NAME="Signature"><% $u->Signature %></TEXTAREA><br><br>
35 <input type="submit" value="<&|/l&>Update signature</&>">
37 <& /Elements/TitleBoxEnd &>
39 <&|/l&>Open tickets (from listing) in another window</&>: <input type="checkbox" name="NewWindowOption" <%exists $session{NewWindowOption} && "CHECKED"%>><br>
40 <&|/l&>Open tickets (from listing) in a new window</&>: <input type="checkbox" name="AlwaysNewWindowOption" <%exists $session{AlwaysNewWindowOption} && "CHECKED"%>><br>
41 <input type="submit" name="NewWindowSetting" value="<&|/l&>New window setting</&>">
45 <& /Elements/TitleBoxStart, title => loc('Email') &>
47 <input type="hidden" name="id" value="<%$id%>">
48 <input name="Email" value="<% $u->EmailAddress %>"><input type="submit" value="<&|/l&>Update email</&>">
50 <& /Elements/TitleBoxEnd &>
51 <& /Elements/TitleBoxStart, title => loc('Real Name') &>
53 <input type="hidden" name="id" value="<%$id%>">
54 <input name="RealName" value="<% $u->RealName %>"><input type="submit" value="<&|/l&>Update name</&>">
56 <& /Elements/TitleBoxEnd &>
58 <& /Elements/TitleBoxStart, title => loc('User ID') &>
60 <input type="hidden" name="id" value="<%$id%>">
61 <input name="Name" value="<% $u->Name %>"><input type="submit" value="<&|/l&>Update ID</&>">
63 <& /Elements/TitleBoxEnd &>
65 %# TODO: alternative email addresses + merging users
68 $id => $session{CurrentUser} ? $session{CurrentUser}->Id : 0
77 my $u=RT::User->new($session{CurrentUser});
78 $u->Load($id) || die loc("Couldn't load that user ([_1])", $id);
80 my ($val, $msg)=$u->SetSignature($Signature);
81 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
85 my ($val, $msg)=$u->SetEmailAddress($Email);
86 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
90 my ($val, $msg)=$u->SetRealName($RealName);
91 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
95 my ($val, $msg)=$u->SetName($Name);
96 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
99 if ($ARGS{NewWindowSetting}) {
100 if ($ARGS{NewWindowOption}) {
101 $session{NewWindowOption}=1;
103 delete $session{NewWindowOption};
105 if ($ARGS{AlwaysNewWindowOption}) {
106 $session{NewWindowOption}=1;
107 $session{AlwaysNewWindowOption}=1;
109 delete $session{AlwaysNewWindowOption};