Removed /usr/local from CDPATH
[clearscm.git] / maps / bin / editprofile.cgi
1 #!/usr/bin/perl
2 ################################################################################
3 #
4 # File:         $RCSfile: editprofile.cgi,v $
5 # Revision:     $Revision: 1.1 $
6 # Description:  Edit the user's profile
7 # Author:       Andrew@DeFaria.com
8 # Created:      Mon Jan 16 20:25:32 PST 2006
9 # Modified:     $Date: 2013/06/12 14:05:47 $
10 # Language:     perl
11 #
12 # (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
13 #
14 ################################################################################
15 use strict;
16 use warnings;
17
18 use FindBin;
19 local $0 = $FindBin::Script;
20
21 use lib "$FindBin::Bin/../lib";
22 use lib "$FindBin::Bin/../../lib";
23
24 use MAPS;
25 use MAPSWeb;
26
27 use CGI qw(:standard *table);
28
29 my $userid;
30 my $table_name = 'profile';
31
32 sub Body() {
33   FindUser(userid => $userid);
34
35   my $rec = GetUser;
36
37   my %options = GetUserOptions($userid);
38
39   print start_form {
40     -method   => 'post',
41     -action   => 'updateprofile.cgi',
42     -onSubmit => 'return validate (this);'
43   };
44   print start_table {
45     -align       => 'center',
46     -bgcolor     => 'white',
47     -id          => $table_name,
48     -border      => 1,
49     -cellspacing => 0,
50     -cellpadding => 2,
51     -width       => '100%'};
52   print Tr ([
53     td {-class  => 'label',
54         -width  => 134}, 'Username:',
55     td {-width  => 290}, $userid,
56     td {-class  => 'notetext'}, 'Specify a username to log into MAPS'
57   ]) . "\n";
58   print Tr ([
59     td {-class  => 'label'}, 'Full name:',
60     td (
61       textfield {-class => 'inputfield',
62                  -size  => 50,
63                  -name  => 'fullname',
64                  -value => $rec->{name}}),
65     td {-class  => 'notetext'},'Specify your full name'
66   ]) . "\n";
67   print Tr [
68     td {-class  => 'label'}, 'Email:',
69     td (
70       textfield {-class => 'inputfield',
71                  -size  => 50,
72                  -name  => 'email',
73                  -value => $rec->{email}}),
74     td {-class  => 'notetext'},'Your email address is used if you are a ' .
75     i ("Tag & Forward") .
76       ' user. This is the email address that MAPS will forward your email to after it tags it. This email address is also used in case you forget your password so that we can email you your password.'
77   ];
78   print Tr [
79     td {-class  => 'label'}, 'Old Password:',
80     td (
81       password_field {-class => 'inputfield',
82                       -size  => 20,
83                       -name  => 'old_password'}),
84     td {-class  => 'notetext'}, 'Enter your old password'
85   ];
86   print Tr [
87     td {-class  => 'label'}, 'New Password:',
88     td (
89       password_field {-class => 'inputfield',
90                       -size  => 20,
91                       -name  => 'new_password',
92                       -value => ''}),
93     td {-class  => 'notetext'}, 'Choose a new password greater than 6 characters.'
94   ];
95   print Tr [
96     td {-class  => 'label'},'Repeat Password:',
97     td (
98       password_field {-class => 'inputfield',
99                       -size  => 20,
100                       -name  => 'repeated_password',
101                       -value => ''}),
102     td {-class  => 'notetext'}, 'Re-enter your password so we can be sure you typed it correctly.'
103   ];
104   print Tr [
105     td {-class  => 'label'}, 'MAPSPOP user:',
106     td (
107       font ({-class         => 'label'},
108       radio_group {-name    => 'MAPSPOP',
109                    -values  => ['yes', 'no'],
110                    -default => 'no',
111                    -labels  => {'yes'  => 'Yes',
112                    'no'     => 'No'}})),
113     td {-class  => 'notetext'}, 'MAPSPOP users need to download ' .
114     a ({-href => '/maps/bin/MAPSPOP.exe'}, 'MAPSPOP') .
115       '. See ' .
116     a ({-href => '/maps/doc/UsingMAPSPOP.html'}, 'Using MAPSPOP') .
117       ' for more information.'
118   ];
119   print Tr [
120     td {-class  => 'label'}, 'Keep history for:',
121     td (
122       font ({-class        => 'label'},
123       popup_menu {-class   => 'inputfield',
124                   -name    => 'history',
125                   -values  => ['7', '14', '30', '60', '90'],
126                   -default => $options{'History'}}),
127       font ({-class => 'label'}, ' days')),
128     td {-class  => 'notetext'}, 'This specifies how many days of history that MAPS will keep before discarding returned messages.'
129   ];
130   print Tr [
131     td {-class  => 'label'}, 'Dates in Stats Page:',
132     td (
133       font ({-class        => 'label'},
134       popup_menu {-class   => 'inputfield',
135                   -name    => 'dates',
136                   -values  => ['7', '14', '21', '30'],
137                   -default => $options{'Dates'}})),
138     td {-class  => 'notetext'}, 'This specifies how many days are displayed in the MAPS Stats Page.'
139   ];
140   print Tr [
141     td {-class  => 'label'}, 'Entries per page:',
142     td (
143       font ({-class        => 'label'},
144       popup_menu {-class   => 'inputfield',
145                   -name    => 'days',
146                   -values  => ['10', '20', '30', '40', '50'],
147                   -default => $options{'Page'}})),
148     td {-class  => 'notetext'}, 'This specifies how many entries are displayed per page in the online MAPS Reports.'
149   ];
150   print Tr [
151     td {-class  => 'label'}, i ('Tag & Forward:'),
152     td (
153       font ({-class => 'label'},
154       radio_group {-name    => 'tag_and_forward',
155                    -values  => ['yes', 'no'],
156                    -default => 'no',
157                    -labels  => {'yes'  => 'Yes',
158                    'no'     => 'No'}})),
159     td {-class  => 'notetext'},
160     i ('Tag and Forward') . ' means that MAPS will not filter or save any email for you. Instead it will simply add an X-MAPS header to your email indicating what MAPS would have done with the email. This allows you to filter your email in your local email client.'
161   ];
162   print end_table;
163   print br (div {-align => 'center'},
164     submit (-name       => 'submit',
165             -value      => 'Update Profile'));
166   print end_form;
167
168   return;
169 } # Body
170
171 # Main
172 my @scripts = ('MAPSUtils.js', 'CheckEditProfile.js');
173
174 $userid = Heading(
175   'getcookie',
176   '',
177   'Edit Profile',
178   'Spam Elimination System',
179   '',
180   $table_name,
181   @scripts
182 );
183
184 $userid //= $ENV{USER};
185
186 SetContext $userid;
187 NavigationBar $userid;
188
189 Body;
190
191 Footing $table_name;
192
193 exit;