import rt 3.4.4
[freeside.git] / rt / html / Admin / Users / Prefs.html
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
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
10 %# from www.gnu.org.
11 %# 
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.
16 %# 
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.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <& /Elements/Header, Title => loc("User view") &>
25
26 <& /Elements/ViewUser, User=>$u &>
27
28 <h2 class="title"><%loc("User view")%></h2>
29
30 %if ($session{CurrentUser} && ($session{CurrentUser}->Id == $id)) {
31         <& /Elements/TitleBoxStart, title => loc('Signature')  &>
32 <form method=post>
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</&>">
36 </form>
37           <& /Elements/TitleBoxEnd &>
38           <form method=post>
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</&>">
42           </form>
43 %}
44
45         <& /Elements/TitleBoxStart, title => loc('Email')  &>
46 <form method=post>
47 <input type="hidden" name="id" value="<%$id%>">
48 <input name="Email" value="<% $u->EmailAddress %>"><input type="submit" value="<&|/l&>Update email</&>">
49 </form>
50           <& /Elements/TitleBoxEnd &>
51         <& /Elements/TitleBoxStart, title => loc('Real Name')  &>
52 <form method=post>
53 <input type="hidden" name="id" value="<%$id%>">
54 <input name="RealName" value="<% $u->RealName %>"><input type="submit" value="<&|/l&>Update name</&>">
55 </form>
56           <& /Elements/TitleBoxEnd &>
57
58         <& /Elements/TitleBoxStart, title => loc('User ID')  &>
59 <form method=post>
60 <input type="hidden" name="id" value="<%$id%>">
61 <input name="Name" value="<% $u->Name %>"><input type="submit" value="<&|/l&>Update ID</&>">
62 </form>
63           <& /Elements/TitleBoxEnd &>
64
65 %# TODO: alternative email addresses + merging users
66
67 <%ARGS>
68 $id => $session{CurrentUser} ? $session{CurrentUser}->Id : 0
69 $Signature => undef
70 $Email => undef
71 $RealName => undef
72 $Name => undef
73 </%ARGS>
74
75 <%INIT>
76 require RT::User;
77 my $u=RT::User->new($session{CurrentUser});
78 $u->Load($id) || die loc("Couldn't load that user ([_1])", $id);
79 if ($Signature) {
80 my ($val, $msg)=$u->SetSignature($Signature);
81 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
82 }
83
84 if ($Email) {
85 my ($val, $msg)=$u->SetEmailAddress($Email);
86 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
87 }
88
89 if ($RealName) {
90 my ($val, $msg)=$u->SetRealName($RealName);
91 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
92 }
93
94 if ($Name) {
95 my ($val, $msg)=$u->SetName($Name);
96 $RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
97 }
98
99 if ($ARGS{NewWindowSetting}) {
100 if ($ARGS{NewWindowOption}) {
101 $session{NewWindowOption}=1;
102 } else {
103 delete $session{NewWindowOption};
104 }
105 if ($ARGS{AlwaysNewWindowOption}) {
106 $session{NewWindowOption}=1;
107 $session{AlwaysNewWindowOption}=1;
108 } else {
109 delete $session{AlwaysNewWindowOption};
110 }
111 }
112
113 </%INIT>
114
115
116
117
118
119
120
121
122