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