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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 05 Apr 2005 00:03:37 -0000


This is a MIME encoded message

--raeburn1112659417
Content-Type: text/plain

raeburn		Mon Apr  4 20:03:37 2005 EDT

  Modified files:              
    /modules/raeburn/register	register.pm 
  Log:
  Complete generalisation of the code, so that entries described in event_formfields table for the event are identified based on database table, and are used whenever data are modified or added during registration. 
  
  
--raeburn1112659417
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20050404200337.txt"

Index: modules/raeburn/register/register.pm
diff -u modules/raeburn/register/register.pm:1.4 modules/raeburn/register/register.pm:1.5
--- modules/raeburn/register/register.pm:1.4	Mon Apr  4 11:35:26 2005
+++ modules/raeburn/register/register.pm	Mon Apr  4 20:03:37 2005
@@ -34,7 +34,7 @@
     if ($user eq '') {
         return SERVER_ERROR
     }
-    my $user_quoted = $dbh->quote( $user );
+    my $quoted_user = $dbh->quote( $user );
     my %params = ();
     my %qry_items = ();
     my @rowitems = ();
@@ -71,8 +71,13 @@
     my %items = ();
     my %form_elements = ();
     my @curr_workshops = ();
+    my @regitems = ();
+    my @workshop = ();
+    my @info = ();
     my @sponsors = ();
     my %sponsorinfo = ();
+    my $domain = $params{domain};
+
     my ($page,$year,$event,$portal,$returnpage,$event_id,$webpath,$year_quoted,$event_quoted);
     if (exists $params{'return'}) {
         $returnpage = $params{'return'};
@@ -99,12 +104,39 @@
         ($event_id,$webpath) = $dbh->selectrow_array("SELECT event_id,webpath FROM event_config WHERE year=$year_quoted AND event=$event_quoted");
         $portal = $webpath.$returnpage;
         if ($event_id eq '') {
-            &invalid_event($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,\@sponsors,\%sponsorinfo);
+            &invalid_event($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,\@sponsors,\%sponsorinfo,$domain);
             return OK;
-        } else { 
-            my $sth = $dbh->prepare("SELECT name,type,multivalued,contents,v_position,h_position,required,title,rowtitle,preamble,preamblerow,text_position,alignment,size FROM event_formfields WHERE event_id = '$event_id'");
+        } else {
+# get items that should appear in event_registration table
+            my $sth = $dbh->prepare("SELECT name FROM event_formfields WHERE event_id = '$event_id' AND tablename = 'event_registration'");
+            $sth->execute;
+            while (my $name = $sth->fetchrow_array) {
+                push @regitems, $name;
+            }
+            $sth->finish;
+
+# get items that should appear in support_user table
+            $sth = $dbh->prepare("SELECT name FROM event_formfields WHERE event_id = '$event_id' AND tablename = 'support_user'");
+            $sth->execute;
+            while (my $name = $sth->fetchrow_array) {
+                push @info, $name;
+            }
+            $sth->finish;
+            if (!grep/^created$/,@info) {
+                push @info, 'created';
+            }
+
+# get items that should appear in workshop_registration table
+            $sth = $dbh->prepare("SELECT name FROM event_formfields WHERE event_id = '$event_id' AND tablename = 'workshop_registration'");
+            $sth->execute;
+            while (my $name = $sth->fetchrow_array) {
+                push @workshop, $name;
+            }
+            $sth->finish;
+# get formfield values
+            $sth = $dbh->prepare("SELECT name,type,multivalued,contents,v_position,h_position,required,title,rowtitle,preamble,preamblerow,text_position,alignment,size,tablename FROM event_formfields WHERE event_id = '$event_id'");
             $sth->execute();
-            while (my ($name,$type,$multivalued,$contents,$v_position,$h_position,$required,$title,$rowtitle,$preamble,$preamblerow,$text_position,$alignment,$size) = $sth->fetchrow_array) {
+            while (my ($name,$type,$multivalued,$contents,$v_position,$h_position,$required,$title,$rowtitle,$preamble,$preamblerow,$text_position,$alignment,$size,$tablename) = $sth->fetchrow_array) {
                 $form_elements{$name}{'multivalued'} = $multivalued;
                 $form_elements{$name}{'contents'} = $contents;
                 $form_elements{$name}{'v_position'} = $v_position;
@@ -118,6 +150,7 @@
                 $form_elements{$name}{'text_position'} = $text_position;
                 $form_elements{$name}{'alignment'} = $alignment;
                 $form_elements{$name}{'size'} = $size;
+                $form_elements{$name}{'tablename'} = $tablename;
                 push @{$items{$type}}, $name;
                 my $vpos = $v_position-1;
                 my $hpos = $h_position-1;
@@ -128,18 +161,18 @@
                 $rowitems[$vpos][$hpos] = $name;
             }
             $sth->finish;
-            $sth= $dbh->prepare("SELECT name FROM workshop_registration WHERE user_id = $user_quoted AND event_id = '$event_id'");
+# get existing workshop registration data for this user and event
+            $sth= $dbh->prepare("SELECT name FROM workshop_registration WHERE user_id = $quoted_user AND event_id = '$event_id'");
             $sth->execute();
             while (my $name = $sth->fetchrow_array) {
                 push @curr_workshops, $name;
             }
+            $sth->finish;
         }
     } else {
-        &invalid_event($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,\@sponsors,\%sponsorinfo);
+        &invalid_event($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,\@sponsors,\%sponsorinfo,$domain);
         return OK;
     }
-    my @workshop = ('workshop');
-    my @info=('lastname','firstname','middlename','generation','title','dept','institution','email','streetaddress','citystate','zip','phone');
     my $contact_email = "helpdesk\@msu.edu";
     my $contact_name = "LON-CAPA support team";
 
@@ -148,9 +181,9 @@
     my $command = $params{'go'};
     my $current_page = &calculate_page($page,$command); 
     if ($current_page == 2) {
-        &display_two($r,$event_id,\%params,$user,$portal,$returnpage,$exitpage,\%items,\@info,\@workshop,$dbh,$current_page,$contact_email,$contact_name,\@sponsors,\%sponsorinfo);
+        &display_two($r,$event_id,\%params,$user,$domain,$portal,$returnpage,$exitpage,\%items,\@info,\@workshop,$dbh,$current_page,$contact_email,$contact_name,\%form_elements,\@rowitems,\@rowtitles,\@sponsors,\%sponsorinfo);
     } else {
-        &display_one($r,$event_id,\%params,$user,$portal,$returnpage,$exitpage,\%items,\@info,\@workshop,$dbh,$current_page,$contact_email,$contact_name,\%form_elements,\@rowitems,\@rowtitles,\@sponsors,\%sponsorinfo);
+        &display_one($r,$event_id,\%params,$user,\$domain,$portal,$returnpage,$exitpage,\%items,\@info,\@workshop,$dbh,$current_page,$contact_email,$contact_name,\%form_elements,\@rowitems,\@rowtitles,\@sponsors,\%sponsorinfo);
     }
     return OK;
 }
@@ -163,7 +196,7 @@
 }
 
 sub invalid_event {
-    my ($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,$sponsors,$sponsorinfo) = @_;
+    my ($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,$sponsors,$sponsorinfo,$domain) = @_;
     if ($portal eq '') {
         $portal = $exitpage;
     }
@@ -224,14 +257,14 @@
       </tr>
     </table><br />
 END_OF_C
-    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo);
+    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo,$domain);
 }
 
 sub display_one() {
-    my ($r,$event_id,$params,$user,$portal,$returnpage,$exitpage,$items,$info,$workshop,$dbh,$page,$contact_email,$contact_name,$form_elements,$rowitems,$rowtitles,$sponsors,$sponsorinfo) = @_;
+    my ($r,$event_id,$params,$user,$domain,$portal,$returnpage,$exitpage,$items,$info,$workshop,$dbh,$page,$contact_email,$contact_name,$form_elements,$rowitems,$rowtitles,$sponsors,$sponsorinfo) = @_;
     my $year = $$params{'year'};
     my $event = $$params{'event'};
-    my $user_quoted = $dbh->quote( $user );
+    my $quoted_user = $dbh->quote( $user );
 
     my %curr=();
     my @workshops=();
@@ -242,15 +275,16 @@
     my @curr_info = ();
     my @curr_workshops = ();
     my %userinfo = ();
+    my $username;
 
 # Is there LON-CAPA user data or MSU user data?
     if ($user =~ /[^\@]:[^\@]/) {
-        my ($username,$domain) = split/:/,$user;
+        ($username,$$domain) = split/:/,$user;
         unless ($domain eq '') {
             my $response = &getdomaininfo($domain,\%userinfo);
         }           
-        unless ($domain eq '' || $username eq '') {
-            my $response = &getnames($domain,$username,\%userinfo);
+        unless ($$domain eq '' || $username eq '') {
+            my $response = &getnames($$domain,$username,\%userinfo);
         }
     } elsif ($user =~ /\@/) {
         $userinfo{'email'} = $user;
@@ -259,31 +293,30 @@
         $userinfo{'institution'} = 'Michigan State University';
         $userinfo{'citystate'} = 'East Lansing, MI';
         $userinfo{'zip'} = '48824';
+        $$domain = 'msu';
 #        my $response = &checkmsu($user,\%userinfo);
     }
 
 # Is there already conference data for this user?
-    my $status = $dbh->selectrow_array("SELECT status FROM event_registration WHERE user_id = $user_quoted AND event_id = '$event_id'");
+    my $status = $dbh->selectrow_array("SELECT status FROM event_registration WHERE user_id = $quoted_user AND event_id = '$event_id'");
 # Get existing values
     if ($status eq 'enroll' || $status eq 'cancel') {
         my $statement = "SELECT ";
-        foreach (keys %{$items}) {
-            foreach my $field (@{$$items{$_}}) {
-                unless ((grep/^$field$/,@{$info}) || (grep/^$field$/,@{$workshop})) {
-                    $statement .= "$field,";
-                    push @curr_values, $field;
-                }
+        foreach my $name (keys %{$form_elements}) {
+            if ($$form_elements{$name}{tablename} eq 'event_registration') {
+                $statement .= "$name,";
+                push @curr_values, $name;
             }
         }
         chop($statement);
-        $statement .= " FROM event_registration WHERE user_id = $user_quoted AND event_id = '$event_id'";
+        $statement .= " FROM event_registration WHERE user_id = $quoted_user AND event_id = '$event_id'";
         my @row = $dbh->selectrow_array("$statement");
         for (my $i=0; $i<@curr_values; $i++) {
             $curr{$curr_values[$i]} = $row[$i];
         }
 
 # Is there workshop data for this user?
-        my $statement .= "SELECT name FROM workshop_registration WHERE user_id = $user_quoted AND event_id = '$event_id'";
+        $statement = "SELECT name FROM workshop_registration WHERE user_id = $quoted_user AND event_id = '$event_id'";
         my $sth = $dbh->prepare("$statement");
         $sth->execute();
         while (my @row = $sth->fetchrow_array) {
@@ -298,14 +331,14 @@
     }
 
 # Is there already user data?
-    my $userstatus = $dbh->selectrow_array("SELECT count(user_id) FROM support_user WHERE user_id = $user_quoted");
+    my $userstatus = $dbh->selectrow_array("SELECT count(user_id) FROM support_user WHERE user_id = $quoted_user");
     if ($userstatus == 1) {
         my $statement = "SELECT ";
         foreach (@{$info}) {
             $statement .= "$_,";
         }
         chop($statement);
-        $statement .= " FROM support_user WHERE user_id = $user_quoted";
+        $statement .= " FROM support_user WHERE user_id = $quoted_user";
         my @row = $dbh->selectrow_array("$statement");
         for (my $i=0; $i<@{$info}; $i++) {
             $curr{$$info[$i]} = $row[$i];
@@ -683,9 +716,6 @@
                     </td>
                    </tr>');
         }
-#                        Thursday Reception:&nbsp;<input type="radio" size="30" name="reception" value="Y">Yes&nbsp;<input type="radio" size="30" name="reception" value="N">No</nobr></td>
-#                       <td align="right"><nobr>Friday Dinner:&nbsp;<input type="radio" size="30" name="dinner" value="Y">Yes&nbsp;<input type="radio" size="30" name="dinner" value="N">No</nobr></td>
-#                         <option value="none">No poster
     }
     $r->print(<<"ENDBLOCK");
                   </table>
@@ -721,19 +751,21 @@
     </tr>
    </table>
     |);
-    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo);
+    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo,$$domain);
 }
 
 
 sub display_two() {
-    my ($r,$event_id,$params,$user,$portal,$returnpage,$exitpage,$items,$info,$workshop,$dbh,$page,$contact_email,$contact_name,$sponsors,$sponsorinfo) = @_;
+    my ($r,$event_id,$params,$user,$domain,$portal,$returnpage,$exitpage,$items,$info,$workshop,$dbh,$page,$contact_email,$contact_name,$form_elements,$rowitems,$rowtitles,$sponsors,$sponsorinfo) = @_;
     my $year = $$params{'year'};
     my $event = $$params{'event'};
     my $enc_event = &HTML::Entities::encode($event);
     $enc_event =~ tr/ /+/;
     my $action = $$params{'nextaction'};
     my $quoted_user = $dbh->quote( $user );
+    my $quoted_domain = $dbh->quote( $domain );
     my %quoted_params = ();
+    my %table_items = (); 
     foreach (%{$params}) {
         unless (ref($$params{$_}) eq 'ARRAY') {
             $quoted_params{$_} = $dbh->quote( $$params{$_} );
@@ -744,7 +776,6 @@
     my $mailflag = 0;
     my $status;
     my $register;
-    my ($arrival,$departure,$reception,$dinner,$vegetarian,$poster);
     my @workshops = ();
     my %curr = ();
     my %userdata = ();
@@ -771,10 +802,27 @@
     }
 # Get existing values
     if ($status eq 'enroll' || $status eq 'cancel') {
-        ($curr{'arrival'},$curr{'departure'},$curr{'reception'},$curr{'dinner'},$curr{'vegetarian'},$curr{'poster'}) = $dbh->selectrow_array("SELECT arrival,departure,reception,dinner,vegetarian,poster FROM event_registration WHERE user_id = $quoted_user AND event_id = '$event_id'");
+        my @curr_values = ();
+        my $statement = "SELECT ";
+        foreach (keys %{$items}) {
+            foreach my $field (@{$$items{$_}}) {
+                if ($$form_elements{$field}{tablename} eq 'event_registration') {
+                    $statement .= "$field,";
+                    push @curr_values, $field;
+                }
+            }
+        }
+        chop($statement);
+        $statement .= " FROM event_registration WHERE user_id = $quoted_user AND event_id = '$event_id'";
+        my @row = $dbh->selectrow_array("$statement");
+        for (my $i=0; $i<@curr_values; $i++) {
+            $curr{$curr_values[$i]} = $row[$i];
+        }
+            
         foreach my $type (keys %{$items}) {
             foreach my $field (@{$$items{$type}}) {
-                unless ((grep/^$field$/,@{$info}) || (grep/^$field$/,@{$workshop})) {
+                if ($$form_elements{$field}{tablename} eq 'event_registration')
+{
                     if ($$params{$field} ne $curr{$field}) {
                         push @changes, $field;
                     }
@@ -782,7 +830,7 @@
             }
         }
 
-        my $statement = "SELECT name from workshop_registration WHERE user_id = $quoted_user AND event_id = '$event_id'";
+        $statement = "SELECT name from workshop_registration WHERE user_id = $quoted_user AND event_id = '$event_id'";
         my $sth = $dbh->prepare("$statement");
         $sth->execute();
         while (my @row = $sth->fetchrow_array) {
@@ -806,12 +854,23 @@
     my $addstr = join(':',@additions);
 
 # Is there any user data for this user?
-    ($userdata{'created'},$userdata{'domain'},$userdata{'lastname'},$userdata{'firstname'},$userdata{'middlename'},$userdata{'generation'},$userdata{'title'},$userdata{'dept'},$userdata{'institution'},$userdata{'email'},$userdata{'streetaddress'},$userdata{'citystate'},$userdata{'zip'},$userdata{'phone'}) =  $dbh->selectrow_array("SELECT created,domain,lastname,firstname,middlename,generation,title,dept,institution,email,streetaddress,citystate,zip,phone FROM support_user WHERE user_id = $quoted_user");
+    my $statement = "SELECT ";
+    foreach (@{$info}) {
+        $statement .= "$_,";
+    }
+    chop($statement);
+    $statement .= " FROM support_user WHERE user_id = $quoted_user";
+    my @row = $dbh->selectrow_array("$statement");
+    for (my $i=0; $i<@{$info}; $i++) {
+        $userdata{$$info[$i]} = $row[$i];
+    }
 
     if ($userdata{'created'}) {
         foreach (@{$info}) {
-            if ($$params{$_} ne $userdata{$_}) {
-                push @infochanges, $_;
+            unless ($_ eq 'created') {
+                if ($$params{$_} ne $userdata{$_}) {
+                    push @infochanges, $_;
+                }
             }
         }
         if (@infochanges > 0) {
@@ -823,7 +882,17 @@
             $dbh->do($statement);
         }
     } else {
-        my $statement = "INSERT INTO support_user (user_id,created,domain,lastname,firstname,middlename,generation,title,dept,institution,email,streetaddress,citystate,zip,phone) VALUES ($quoted_user,NOW(),'northwood5',$quoted_params{'lastname'},$quoted_params{'firstname'},$quoted_params{'middlename'},$quoted_params{'generation'},$quoted_params{'title'},$quoted_params{'dept'},$quoted_params{'institution'},$quoted_params{'email'},$quoted_params{'streetaddress'},$quoted_params{'citystate'},$quoted_params{'zip'},$quoted_params{'phone'})";
+        my $insertpart = '"INSERT INTO support_user (user_id,created,domain';
+        my $valuespart = "VALUES($quoted_user,NOW(),$quoted_domain";
+        foreach my $name (sort keys %quoted_params) {
+            if ($$form_elements{$name}{tablename} eq 'support_user') {
+                $insertpart .= ','.$name;
+                $valuespart .= ','.$quoted_params{$name};
+            }
+        }
+        $insertpart .= ')';
+        $valuespart .= ')';
+        my $statement = "$insertpart $valuespart";
         $dbh->do($statement);
     }
     
@@ -847,8 +916,24 @@
             $webmsg .= "<li>".$newmsg."</li>";
             $mailflag = 1;
         } elsif ($register == 0) {
-            my $statement = "INSERT INTO event_registration (user_id,modified,arrival,departure,reception,dinner,vegetarian,poster,status,event_id) VALUES ($quoted_user,NOW(),$quoted_params{'arrival'},$quoted_params{'departure'},$quoted_params{'reception'},$quoted_params{'dinner'},$quoted_params{'vegetarian'},$quoted_params{'poster'},'$newstatus','$event_id') ";
-            $dbh->do($statement);
+            my $sth = $dbh->prepare("SELECT name,tablename FROM event_formfields WHERE event_id = '$event_id'");
+            $sth->execute;
+            while (my ($name,$tablename) = $sth->fetchrow_array) {
+                push @{$table_items{$tablename}}, $name;
+            }
+            $sth->finish;
+            my $insertpart = "INSERT INTO event_registration (user_id,modified,status,event_id";
+            my $valuespart = "VALUES ($quoted_user,NOW(),'$newstatus','$event_id'";
+            if (@{$table_items{'event_registration'}} > 0) {
+                foreach (@{$table_items{'event_registration'}}) {
+                    $insertpart .= ','.$_;
+                    $valuespart .= ','.$quoted_params{$_};
+                }
+                $insertpart .= ')';
+                $valuespart .= ')';
+                my $statement = "$insertpart $valuespart";
+                $dbh->do($statement);
+            }
             foreach (@additions) {
                 $dbh->do("INSERT INTO workshop_registration (user_id,event_id,name) VALUES ($quoted_user,'$event_id','$_')"); 
             }
@@ -870,7 +955,13 @@
             $webmsg .= "<li>".$newmsg."</li>";
         }
     } elsif ($action eq 'modify') {
-        $dbh->do("UPDATE event_registration SET status = '$status' WHERE user_id = $quoted_user AND event_id = '$event_id'");
+        my $statement = "UPDATE event_registration SET modified=NOW(),status='$status'";
+        foreach (@changes) {
+            $statement .= ", $_ = '$$params{$_}'";
+        }
+        $statement .= " WHERE user_id=$quoted_user AND event_id = '$event_id'";
+        $dbh->do($statement);
+
         my $newmsg .= "Your registration for the $year LON-CAPA $event has been updated.";
         $msg .= $newmsg."\n";
         $webmsg .= "<li>".$newmsg."</li>";
@@ -892,11 +983,40 @@
         $webmsg .= "<br />An e-mail message has been sent to $$params{'email'} with a record of your changes.";
     }
 
-# Get final status
-    my %finalregdat = ();
-    ($finalregdat{'arrival'},$finalregdat{'departure'},$finalregdat{'reception'},$finalregdat{'dinner'},$finalregdat{'vegetarian'},$finalregdat{'poster'}) = $dbh->selectrow_array("SELECT arrival,departure,reception,dinner,vegetarian,poster FROM event_registration WHERE user_id = $quoted_user AND event_id = '$event_id'");
-    my %finalusrdat = ();
-    ($finalusrdat{'created'},$finalusrdat{'domain'},$finalusrdat{'lastname'},$finalusrdat{'firstname'},$finalusrdat{'middlename'},$finalusrdat{'generation'},$finalusrdat{'title'},$finalusrdat{'dept'},$finalusrdat{'institution'},$finalusrdat{'email'},$finalusrdat{'streetaddress'},$finalusrdat{'citystate'},$finalusrdat{'zip'},$finalusrdat{'phone'}) =  $dbh->selectrow_array("SELECT created,domain,lastname,firstname,middlename,generation,title,dept,institution,email,streetaddress,citystate,zip,phone FROM support_user WHERE user_id = $quoted_user");
+# Get final registration status
+    my %finaldispdat = ();
+    my @final_values = ();
+    $statement = "SELECT ";
+    foreach my $name (keys %{$form_elements}) {
+        if ($$form_elements{$name}{tablename} eq 'event_registration') {
+            $statement .= "$name,";
+            push @final_values, $name;
+        }
+    }
+    chop($statement);
+    $statement .= " FROM event_registration WHERE user_id = $quoted_user AND event_id = '$event_id'";
+    my @row = $dbh->selectrow_array("$statement");
+    for (my $i=0; $i<@final_values; $i++) {
+        $finaldispdat{$final_values[$i]} = $row[$i];
+    }
+
+# Get final user data
+    my @final_uservals = ();
+    $statement = "SELECT ";
+    foreach my $name (keys %{$form_elements}) {
+        if ($$form_elements{$name}{tablename} eq 'support_user') {
+            $statement .= "$name,";
+            push @final_uservals, $name;
+        }
+    }
+    chop($statement);
+    $statement .= " FROM support_user WHERE user_id = $quoted_user";
+    @row = $dbh->selectrow_array("$statement");
+    for (my $i=0; $i<@final_uservals; $i++) {
+        $finaldispdat{$final_uservals[$i]} = $row[$i];
+    }
+
+# Get final workshop status
     my @finalworkshops = ();
     my $statement = "SELECT name from workshop_registration WHERE user_id = $quoted_user AND event_id = '$event_id'";
     my $sth = $dbh->prepare("$statement");
@@ -905,11 +1025,10 @@
         push @finalworkshops, @row;
     }
     $sth->finish;
-    my $finalworkshopstr;
     if (@finalworkshops) {
-        $finalworkshopstr = join(", ",@finalworkshops);
+        $finaldispdat{'workshop'} = join(", ",@finalworkshops);
     } else {
-        $finalworkshopstr = 'None';
+        $finaldispdat{'workshop'} = 'None';
     }
 
     my %statusmsg = (
@@ -921,21 +1040,23 @@
                        mail => "\n",
                        web => "<br />\n"
                        );
-        foreach (keys %statusmsg) {
-            $statusmsg{$_} .= $linefeed{$_}. 
-"Current registration details: ".$linefeed{$_}.
-"Name: $finalusrdat{firstname} $finalusrdat{middlename} $finalusrdat{lastname} $finalusrdat{generation}".$linefeed{$_}.
-"Title: $finalusrdat{title}".$linefeed{$_}.
-"Department: $finalusrdat{dept}".$linefeed{$_}.
-"Institution: $finalusrdat{institution}".$linefeed{$_}.
-"E-mail address: $finalusrdat{email}".$linefeed{$_}.
-"Mailing address: $finalusrdat{streetaddress} $finalusrdat{citystate} $finalusrdat{zip}".$linefeed{$_}.
-"Phone: $finalusrdat{phone}".$linefeed{$_}.
-"Days of attendance: $finalregdat{arrival} - $finalregdat{departure}".$linefeed{$_}.
-"Catered events: Thursday reception: $finalregdat{reception}, Friday dinner: $finalregdat{dinner}".$linefeed{$_}.
-"Vegetarian meals: $finalregdat{vegetarian}".$linefeed{$_}.
-"Poster Session: $finalregdat{poster}".$linefeed{$_}.
-"Workshop attendance: $finalworkshopstr".$linefeed{$_};
+        foreach my $target (keys %statusmsg) {
+            $statusmsg{$target} .= $linefeed{$target};
+            if ($target eq 'web') {
+                $statusmsg{$target} .= '<b>';
+            }
+            $statusmsg{$target} .=  
+"Current registration details: ".$linefeed{$target};
+            if ($target eq 'web') {
+                $statusmsg{$target} .= '</b>';
+            }
+            for (my $i=0; $i<@{$rowitems}; $i++) {
+                $statusmsg{$target} .= $$rowtitles[$i].': ';
+                foreach (@{$$rowitems[$i]}) {
+                    $statusmsg{$target} .= "$finaldispdat{$_} ";
+                }
+                $statusmsg{$target} .= "$linefeed{$target}";
+            }
         }
     }
     if ($mailflag) {
@@ -951,7 +1072,7 @@
             print MAIL $requestmail;
             close(MAIL);
         } else {
-            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email,$sponsors,$sponsorinfo);
+            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email,$sponsors,$sponsorinfo,$domain);
             return;
         }
         my $mailcopy = "To: helen\@lon-capa.org\n".
@@ -963,7 +1084,7 @@
             print MAIL $mailcopy;
             close(MAIL);
         } else {
-            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email,$sponsors,$sponsorinfo);
+            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email,$sponsors,$sponsorinfo,$domain);
             return;
         }
     }
@@ -1044,11 +1165,11 @@
     </table>
 END_OF_B
 
-    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo);
+    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo,$domain);
 }
 
 sub error_exit() {
-    my ($r,$page,$year,$event,$error_msg,$contact_name,$contact_email,$sponsors,$sponsorinfo) = @_;
+    my ($r,$page,$year,$event,$error_msg,$contact_name,$contact_email,$sponsors,$sponsorinfo,$domain) = @_;
     $r->print(<<"END_OF_TOP");
 <HTML>
 <HEAD>
@@ -1100,7 +1221,7 @@
      </tr> 
     </table>
 END_OF_CRUMBS
-    &main_footer($r,$page,$year,$event,undef,$sponsors,$sponsorinfo);
+    &main_footer($r,$page,$year,$event,undef,$sponsors,$sponsorinfo,$domain);
     return $error_msg;
 }
 
@@ -1130,7 +1251,7 @@
 }
 
 sub main_footer() {
-    my ($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo) = @_;
+    my ($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo,$domain) = @_;
     $r->print(<<"START_OF_FOOT");
    </td>
    <td bgcolor="#FFFF99" width="8">&nbsp;</td>
@@ -1156,6 +1277,7 @@
 </tr>
 </table>
 <input type="hidden" name="go" value="">
+<input type="hidden" name="domain" value="$domain">
 <input type="hidden" name="page" value="$page">
 <input type="hidden" name="year" value="$year">
 <input type="hidden" name="event" value="$event">

--raeburn1112659417--