[LON-CAPA-cvs] cvs: modules /raeburn/register userupdate.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Sat, 04 Feb 2006 03:00:40 -0000


raeburn		Fri Feb  3 22:00:40 2006 EDT

  Modified files:              
    /modules/raeburn/register	userupdate.pm 
  Log:
  Changes to make this work in Apache2. Routines in processform.pm are now used to retrieve form parameters.
  
  
Index: modules/raeburn/register/userupdate.pm
diff -u modules/raeburn/register/userupdate.pm:1.1 modules/raeburn/register/userupdate.pm:1.2
--- modules/raeburn/register/userupdate.pm:1.1	Mon Nov  1 14:51:22 2004
+++ modules/raeburn/register/userupdate.pm	Fri Feb  3 22:00:40 2006
@@ -5,9 +5,10 @@
 use MD5;
 use Crypt::DES;
 use Crypt::PasswdMD5;
-use Apache::Constants qw(OK SERVER_ERROR);
+use Apache::Const qw(OK SERVER_ERROR);
 use DBI;
 use CGI::Cookie;
+use Apache::LON::processform;
 
 sub handler {
     my $r = shift;
@@ -17,17 +18,9 @@
     }
     my %params = ();
     my %qry_items = ();
-    my @query = split/&/,$r->args;
-    push @query, split/&/,$r->content;
-    foreach (@query) {
-        my ($name, $value) = split(/=/,$_);
-        $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
-        $value =~ tr/+/ /;
-        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
-        unless (grep/^$value$/,@{$qry_items{$name}}) {
-            push @{$qry_items{$name}}, $value;
-        }
-    }
+    &Apache::LON::processform::postitems($r,\%qry_items);
+    &Apache::LON::processform::getitems($r->args,\%qry_items);
+
     foreach (keys %qry_items) {
         if (@{$qry_items{$_}} > 1) {
             @{$params{$_}} = @{$qry_items{$_}};
@@ -77,7 +70,7 @@
         chomp($dbpwd);
     }
 
-    my $contact_email = "helpdesk\@msu.edu";
+    my $contact_email = "helpdesk\@lon-capa.org";
     my $contact_name = "LON-CAPA support team";
 
     my %attr = (
@@ -150,6 +143,8 @@
 </body>
 </html>
 END
+    $r->content_type('text/html');
+    $r->send_http_header;
     $r->print($output);
     return OK;
 }
@@ -663,6 +658,10 @@
 
 sub main_box {
     my ($output,$jscript,$metainfo,$loaditem,$forwardurl) = @_;
+    my $logoutportal = $forwardurl;
+    if ($logoutportal eq '/update') {
+        $logoutportal = '/register';
+    }
     $$output .= <<"END";
 <style type="text/css">
 <!--
@@ -732,7 +731,7 @@
         <td align="right" valign="top">
          <img border="0" src="/images/login/logout_red.gif" width="90" height="23" align="right" usemap="#event_header">
          <map name = 'event_header'>
-          <area shape='rect' coords=10,2,80,18' href="/logout?portal=$forwardurl">
+          <area shape='rect' coords=10,2,80,18' href="/logout?portal=$logoutportal">
           <area shape = 'default' nohref>
          </map>
         </td>