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