42543265a7963353ad8042791d1b1ef59b272fad
[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;
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},
56       "Username:",
57     td {-width  => 290},
58       $userid,
59     td {-class  => "notetext"},
60       "Specify a username to log into MAPS"
61   ]) . "\n";
62   print Tr ([
63     td {-class  => "label"},
64       "Full name:",
65     td (
66       textfield {-class => "inputfield",
67                  -size  => 50,
68                  -name  => "fullname",
69                  -value => "$fullname"}),
70     td {-class  => "notetext"},
71       "Specify your full name"
72   ]) . "\n";
73   print Tr [
74     td {-class  => "label"},
75       "Email:",
76     td (
77       textfield {-class => "inputfield",
78                  -size  => 50,
79                  -name  => "email",
80                  -value => $email}),
81     td {-class  => "notetext"},
82       "Your email address is used if you are a " .
83     i ("Tag & Forward") .
84       " 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."
85   ];
86   print Tr [
87     td {-class  => "label"},
88       "Old Password:",
89     td (
90       password_field {-class    => "inputfield",
91                       -size     => 20,
92                       -name     => "old_password"}),
93     td {-class  => "notetext"},
94       "Enter your old password"
95   ];
96   print Tr [
97     td {-class  => "label"},
98       "New Password:",
99     td (
100       password_field {-class    => "inputfield",
101                       -size     => 20,
102                       -name     => "new_password",
103                       -value    => ""}),
104     td {-class  => "notetext"},
105       "Choose a new password greater than 6 characters."
106   ];
107   print Tr [
108     td {-class  => "label"},
109       "Repeat Password:",
110     td (
111       password_field {-class    => "inputfield",
112                       -size     => 20,
113                       -name     => "repeated_password",
114                       -value    => ""}),
115     td {-class  => "notetext"},
116       "Re-enter your password so we can be sure you typed it correctly."
117   ];
118   print Tr [
119     td {-class  => "label"},
120       "MAPSPOP user:",
121     td (
122       font ({-class => "label"},
123       radio_group {-name        => "MAPSPOP",
124                    -values      => ["yes", "no"],
125                    -default     => "no",
126                    -labels      => {"yes"       => "Yes",
127                                     "no"        => "No"}})),
128     td {-class  => "notetext"},
129       "MAPSPOP users need to download " .
130     a ({-href => "/maps/bin/MAPSPOP.exe"}, "MAPSPOP") .
131       ". See " .
132     a ({-href => "/maps/doc/UsingMAPSPOP.html"}, "Using MAPSPOP") .
133       " for more information."
134   ];
135   print Tr [
136     td {-class  => "label"},
137       "Keep history for:",
138     td (
139       font ({-class => "label"},
140       popup_menu {-class        => "inputfield",
141                   -name         => "history",
142                   -values       => ["7", "14", "30", "60", "90"],
143                   -default      => $options{"History"}}),
144       font ({-class => "label"}, " days")),
145     td {-class  => "notetext"},
146       "This specifies how many days of history that MAPS will keep before discarding returned messages."
147   ];
148   print Tr [
149     td {-class  => "label"},
150       "Dates in Stats Page:",
151     td (
152       font ({-class => "label"},
153       popup_menu {-class        => "inputfield",
154                   -name         => "dates",
155                   -values       => ["7", "14", "21", "30"],
156                   -default      => $options{"Dates"}})),
157     td {-class  => "notetext"},
158       "This specifies how many days are displayed in the MAPS Stats Page."
159   ];
160   print Tr [
161     td {-class  => "label"},
162       "Entries per page:",
163     td (
164       font ({-class => "label"},
165       popup_menu {-class        => "inputfield",
166                   -name         => "days",
167                   -values       => ["10", "20", "30", "40", "50"],
168                   -default      => $options{"Page"}})),
169     td {-class  => "notetext"},
170       "This specifies how many entries are displayed per page in the online MAPS Reports."
171   ];
172   print Tr [
173     td {-class  => "label"},
174       i ("Tag & Forward:"),
175     td (
176       font ({-class => "label"},
177       radio_group {-name        => "tag_and_forward",
178                    -values      => ["yes", "no"],
179                    -default     => "no",
180                    -labels      => {"yes"       => "Yes",
181                                     "no"        => "No"}})),
182     td {-class  => "notetext"},
183     i ("Tag and Forward") .
184       " 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."
185   ];
186   print end_table;
187   print br (div {-align => "center"},
188     submit (-name       => "submit",
189             -value      => "Update Profile"));
190   print end_form;
191 } # Body
192
193 # Main
194 my @scripts = ("MAPSUtils.js", "CheckEditProfile.js");
195
196 $userid = Heading (
197   "getcookie",
198   "",
199   "Edit Profile",
200   "Spam Elimination System",
201   "",
202   $table_name,
203   @scripts
204 );
205
206 SetContext $userid;
207 NavigationBar $userid;
208
209 Body;
210
211 Footing $table_name;
212
213 exit;