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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 04 Apr 2005 15:35:26 -0000


This is a MIME encoded message

--raeburn1112628926
Content-Type: text/plain

raeburn		Mon Apr  4 11:35:26 2005 EDT

  Modified files:              
    /modules/raeburn/register	register.pm 
  Log:
  Completing switch from hard-coded form elements to dynamically generated form elelements based on content of event_formfields table in loncapasupport db, for specific event_id. Start on making sponsor logos configurable based on content of event_sponsors table for event_id.
  
  
--raeburn1112628926
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20050404113526.txt"

Index: modules/raeburn/register/register.pm
diff -u modules/raeburn/register/register.pm:1.3 modules/raeburn/register/register.pm:1.4
--- modules/raeburn/register/register.pm:1.3	Sat Dec  4 16:12:26 2004
+++ modules/raeburn/register/register.pm	Mon Apr  4 11:35:26 2005
@@ -37,6 +37,8 @@
     my $user_quoted = $dbh->quote( $user );
     my %params = ();
     my %qry_items = ();
+    my @rowitems = ();
+    my @rowtitles = ();
     my @query = split/&/,$r->args;
     push @query, split/&/,$r->content;
     foreach (@query) {
@@ -69,6 +71,8 @@
     my %items = ();
     my %form_elements = ();
     my @curr_workshops = ();
+    my @sponsors = ();
+    my %sponsorinfo = ();
     my ($page,$year,$event,$portal,$returnpage,$event_id,$webpath,$year_quoted,$event_quoted);
     if (exists $params{'return'}) {
         $returnpage = $params{'return'};
@@ -82,15 +86,25 @@
         $event_quoted = $dbh->quote( $event );
     }
     if ($year && $event) {
+        my $sth = $dbh->prepare("SELECT name,url,image_path,orientation FROM event_sponsors WHERE event_id = '$event_id' ORDER BY position");
+        $sth->execute();
+        while (my ($name,$url,$image_path,$orientation) = $sth->fetchrow_array) {
+            push @sponsors, $name;
+            %{$sponsorinfo{$name}} = ();
+            $sponsorinfo{$name}{url} = $url;
+            $sponsorinfo{$name}{image_path} = $image_path;
+            $sponsorinfo{$name}{orientation} = $orientation;
+        }
+        $sth->finish;
         ($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);
+            &invalid_event($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,\@sponsors,\%sponsorinfo);
             return OK;
         } else { 
-            my $sth = $dbh->prepare("SELECT name,type,multivalued,contents,v_position,h_position,required,title FROM event_formfields WHERE event_id = '$event_id'");
+            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'");
             $sth->execute();
-            while (my ($name,$type,$multivalued,$contents,$v_position,$h_position,$required,$title)  = $sth->fetchrow_array) {
+            while (my ($name,$type,$multivalued,$contents,$v_position,$h_position,$required,$title,$rowtitle,$preamble,$preamblerow,$text_position,$alignment,$size) = $sth->fetchrow_array) {
                 $form_elements{$name}{'multivalued'} = $multivalued;
                 $form_elements{$name}{'contents'} = $contents;
                 $form_elements{$name}{'v_position'} = $v_position;
@@ -98,7 +112,20 @@
                 $form_elements{$name}{'required'} = $required;
                 $form_elements{$name}{'title'} = $title;
                 $form_elements{$name}{'type'} = $type;
+                $form_elements{$name}{'rowtitle'} = $rowtitle;
+                $form_elements{$name}{'preamble'} = $preamble;
+                $form_elements{$name}{'preamblerow'} = $preamblerow;
+                $form_elements{$name}{'text_position'} = $text_position;
+                $form_elements{$name}{'alignment'} = $alignment;
+                $form_elements{$name}{'size'} = $size;
                 push @{$items{$type}}, $name;
+                my $vpos = $v_position-1;
+                my $hpos = $h_position-1;
+                unless(exists($rowitems[$vpos])) {
+                    @{$rowitems[$vpos]} = ();
+                    $rowtitles[$vpos] = $form_elements{$name}{'rowtitle'};
+                }
+                $rowitems[$vpos][$hpos] = $name;
             }
             $sth->finish;
             $sth= $dbh->prepare("SELECT name FROM workshop_registration WHERE user_id = $user_quoted AND event_id = '$event_id'");
@@ -108,7 +135,7 @@
             }
         }
     } else {
-        &invalid_event($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage);
+        &invalid_event($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,\@sponsors,\%sponsorinfo);
         return OK;
     }
     my @workshop = ('workshop');
@@ -121,9 +148,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);
+        &display_two($r,$event_id,\%params,$user,$portal,$returnpage,$exitpage,\%items,\@info,\@workshop,$dbh,$current_page,$contact_email,$contact_name,\@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);
+        &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);
     }
     return OK;
 }
@@ -136,7 +163,7 @@
 }
 
 sub invalid_event {
-    my ($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage) = @_;
+    my ($r,$dbh,$page,$year,$event,$portal,$returnpage,$exitpage,$sponsors,$sponsorinfo) = @_;
     if ($portal eq '') {
         $portal = $exitpage;
     }
@@ -197,11 +224,11 @@
       </tr>
     </table><br />
 END_OF_C
-    &main_footer($r,$page,$year,$event,$returnpage);
+    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo);
 }
 
 sub display_one() {
-    my ($r,$event_id,$params,$user,$portal,$returnpage,$exitpage,$items,$info,$workshop,$dbh,$page,$contact_email,$contact_name,$form_elements) = @_;
+    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 $year = $$params{'year'};
     my $event = $$params{'event'};
     my $user_quoted = $dbh->quote( $user );
@@ -327,6 +354,14 @@
             }
         }
 
+        if (exists ($$items{'textarea'}) ) {
+            foreach (@{$$items{'textarea'}}) {
+                $set_func .= qq|
+ formName.$_.value = "$curr{$_}"
+            \n|;
+            }
+        }
+
         if (exists ($$items{'checkbox'}) ) {
             foreach (@{$$items{'checkbox'}}) {
                 if ($curr{$_}) {
@@ -347,7 +382,7 @@
              formName.$_.checked = true
          }
      }
- }\n|;
+ }\n|
                 }
             }
         }
@@ -400,7 +435,14 @@
   }
                     |;
                 }
-            }
+            } elsif ($$form_elements{$_}{type} eq 'textarea') {
+                $verify_func .= qq|
+  if (document.regForm.$_.value == "") {
+      msg = msg + "Enter a value in the text area for the $$form_elements{$_}{title} field.\\n"
+      checkok = 0
+  }
+                    |;
+                }
         }
     }
     $verify_func .= <<'END';
@@ -533,345 +575,119 @@
                <tr>
                 <td>
                  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
+END_OF_BLOCK
+    for (my $i=0; $i<@{$rowitems}; $i++) {
+        $r->print(<<"END_ITEM");
                    <tr>
                     <td width="200" bgcolor="#FFEEBB">
                      <table width="200" border="0" cellpadding="8" cellspacing="0">
                       <tr>
-                       <td align="right"><font face="Arial, Helvetica, sans-serif"><b>Name</b></font>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr align="left">
-                       <td align="center">
-                        first<br />
-                        <input type="text" size="20" name="firstname" value="$userinfo{firstname}">
-                       </td>
-                       <td align="center">
-                        middle<br />
-                        <input type="text" size="5" name="middlename" value="$userinfo{middlename}">
-                       </td>
-                       <td align="middle">
-                        last<br />
-                        <input type="text" size="20" name="lastname" value="$userinfo{lastname}">
-                       </td>
-                       <td align="center">
-                        gen.<br />
-                        <input type="text" size="5" name="generation" value="$userinfo{generation}">
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Title</font></b>
+                       <td align="right"><font face="Arial, Helvetica, sans-serif"><b>$$rowtitles[$i]</b></font>
                        </td>
                       </tr>
                      </table>
                     </td>
                     <td valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>
-                        <input type="text" size="20" name="title" value="">
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Department</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>
-                        <input type="text" size="30" name="dept" value="">
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Institution</font</b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>
-                        <input type="text" size="20" name="institution" value="$userinfo{institution}">
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">E-mail address</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>
-                        <input type="text" size="30" name="email" value="$userinfo{email}">
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Mailing Address</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td  align="center">
-                        street<br />
-                        <input type="text" size="20" name="streetaddress" value="">
-                       </td>
-                       <td align="center">
-                        city/state<br />
-                        <input type="text" size="25" name="citystate" value="$userinfo{citystate}">
-                       </td>
-                       <td align="center">
-                        zip<br />
-                        <input type="text" size="8" name="zip" value="">
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Phone Number</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>
-                        <input type="text" size="30" name="phone" value="">
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Days of attendance</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>
-                        <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                         <tr>
-                          <td align="left">Arriving on:
-                           <select name="arrival">
-                            <option value="-1">Please select
-                            <option value="2005-01-06">Thursday
-                            <option value="2005-01-07">Friday
-                            <option value="2005-01-08">Saturday 
-                            <option value="2005-01-09">Sunday
-                           </select>
-                          </td>
-                          <td align="right">Departing on: 
-                           <select name="departure">
-                            <option value="-1">Please select
-                            <option value="2005-01-06">Thursday
-                            <option value="2005-01-07">Friday
-                            <option value="2005-01-08">Saturday 
-                            <option value="2005-01-09">Sunday
+                     <table width="100%" border="0" cellpadding="8" cellspacing="0">                      <tr align="left">
+END_ITEM
+        for (my $j=0; $j<@{$$rowitems[$i]}; $j++) {
+            if ($$form_elements{$$rowitems[$i][$j]}{preamble}) {
+                if ($$form_elements{$$rowitems[$i][$j]}{preamblerow}) {
+                    my @items = split/\&/,$$form_elements{$$rowitems[$i][$j]}{contents};
+                    if (@items > 1) { 
+                        my $colspan = scalar(@items);
+                        $r->print('<td colspan="'.$colspan.'">'.
+                          $$form_elements{$$rowitems[$i][$j]}{preamble}.
+                          '</td></tr><tr>'.
+                          '<td align="'.$$form_elements{$$rowitems[$i][$j]}{alignment}.'">'
+                        );
+                    } else {
+                        $r->print('<td>'.
+                          $$form_elements{$$rowitems[$i][$j]}{preamble}.
+                          '</td></tr><tr>'.
+                          '<td align="'.$$form_elements{$$rowitems[$i][$j]}{alignment}.'">'
+                        );
+                    }
+                } else {
+                    $r->print('<td>'.$$form_elements{$$rowitems[$i][$j]}{preamble}.'&nbsp;&nbsp;');
+                }
+            } else {
+                $r->print('
+                   <td align="'.$$form_elements{$$rowitems[$i][$j]}{alignment}.'">'
+                );
+                if (@{$$rowitems[$i]} > 1) {
+                    $r->print($$form_elements{$$rowitems[$i][$j]}{title});
+                    if ($$form_elements{$$rowitems[$i][$j]}{text_position} eq 'above') {
+                        $r->print('<br />');
+                    } else {
+                        $r->print(':&nbsp;');
+                    }
+                }
+            }
+            if ($$form_elements{$$rowitems[$i][$j]}{type} eq 'textbox') {
+                $r->print('<input type="text" size="'.$$form_elements{$$rowitems[$i][$j]}{size}.'" name="'.$$rowitems[$i][$j].'" value="'.$userinfo{$$rowitems[$i][$j]}.'">');
+            } elsif ($$form_elements{$$rowitems[$i][$j]}{type} eq 'radio') {
+                my @items = split/\&/,$$form_elements{$$rowitems[$i][$j]}{contents};
+                foreach (@items) {
+                    my ($value,$name) = split/=/,$_;
+                    $r->print('<input type="radio" name="'.$$rowitems[$i][$j].'" value="'.$value.'">'.$name.'&nbsp;&nbsp;');
+                }
+            } elsif ($$form_elements{$$rowitems[$i][$j]}{type} eq 'checkbox') {
+                my @items = split/\&/,$$form_elements{$$rowitems[$i][$j]}{contents};
+                for (my $k=0; $k<@items; $k++) {
+                    my ($value,$name) = split/=/,$items[$k];
+                    if ($k > 0) {
+                        $r->print('<td align="'.$$form_elements{$$rowitems[$i][$j]}{alignment}.'">');
+                    }
+                    $r->print('<input type="checkbox" name="'.$$rowitems[$i][$j].'" value="'.$value.'">'.$name.'</td>'."\n");
+                }
+            } elsif ($$form_elements{$$rowitems[$i][$j]}{type} eq 'selectbox') {
+                my @items = split/\&/,$$form_elements{$$rowitems[$i][$j]}{contents};
+                my $multiple = '';
+                if ($$form_elements{$$rowitems[$i][$j]}{multivalued} eq 'Y') {
+                    $multiple = "multiple";
+                }
+                $r->print('<select name="'.$$rowitems[$i][$j].
+                           '"'.$multiple.'><option value="-1">Please select'."\n"
+                );
+                foreach (@items) {
+                    my ($value,$name) = split/=/,$_;
+                    $r->print('<option value="'.$value.'">'.$name.'</option>'."\n");
+                }
+                $r->print('
                            </select>
-                          </td>
-                         </tr>
-                        </table>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Catered events</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="left"><nobr>
-                        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>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Vegetarian meals</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>
-                        Vegetarian meals preferred:&nbsp;&nbsp;<input type="radio" size="30" name="vegetarian" value="Y">Yes&nbsp;&nbsp;<input type="radio" size="30" name="vegetarian" value="N">No
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
-                   <tr>
-                    <td colspan="2" bgcolor="#000000">
-                     <img src="/images/login/blackdot.jpg" /><br />
-                    </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Poster Sessions</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td>I will provide a poster on:
-                        <select name="poster">
-                         <option value="-1">Please select
-                         <option value="resource">Resource Creation and Sharing
-                         <option value="subject">Specific Subject Matter Application
-                         <option value="pedagogy">Alternative Pedagogical Models with LON-CAPA 
-                         <option value="research">Research about LON-CAPA
-                         <option value="other">Other
-                         <option value="none">No poster
-                        </select>
+                ');
+            } elsif ($$form_elements{$$rowitems[$i][$j]}{type} eq 'textarea') {
+                if ($$form_elements{$$rowitems[$i][$j]}{size}) {
+                    my ($rows,$cols) = ($$form_elements{$$rowitems[$i][$j]}{size} =~ m/rows=(\d+)\&cols=(\d+)/);
+                    $r->print('<textarea rows="'.$rows.'" cols="'.$cols.'" name="'.$$rowitems[$i][$j].'">');
+                } else {
+                    $r->print('<textarea name="'.$$rowitems[$i][$j].'">'."\n");
+                }
+                $r->print($$form_elements{$$rowitems[$i][$j]}{content}.'</textarea>'."\n");
+            }
+            $r->print('
                        </td>
+            ');
+        }
+        $r->print('
                       </tr>
                      </table>
                     </td>
-                   </tr>
+                   </tr>');
+        unless ($i == @{$rowitems}-1) {
+            $r->print(' 
                    <tr>
                     <td colspan="2" bgcolor="#000000">
                      <img src="/images/login/blackdot.jpg" /><br />
                     </td>
-                   </tr>
-                   <tr>
-                    <td width="200" bgcolor="#FFEEBB">
-                     <table width="200" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td align="right"><b><font face="Arial, Helvetica, sans-serif">Workshops</font></b>
-                       </td>
-                      </tr>
-                     </table>
-                    </td>
-                    <td width="100%" valign="top" bgcolor="#FFFFBB">
-                     <table width="100%" border="0" cellpadding="8" cellspacing="0">
-                      <tr>
-                       <td colspan="4">I am interested in attending workshop(s) about:</td>
-                      </tr>
-                      <tr>
-                       <td> 
-                       <input type="checkbox" name="workshop" value="features">New features</td><td>
-                           <input type="checkbox" name="workshop" value="coord">Course coordinator</td>
-                       <td><input type="checkbox" name="workshop" value="author">Author</td><td>
-                           <input type="checkbox" name="workshop" value="other">Other</td>
-                      </tr>
-                     </table>
-                    </td>
-                   </tr>
+                   </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>
                  </td>
                 </tr>
@@ -886,7 +702,7 @@
        </tr>
       </table>
       <br />
-END_OF_BLOCK
+ENDBLOCK
     if ($status eq "enroll") {
         $r->print(qq|
               <input type="button" class="buttonred" name="modify" value="Modify" onClick="javascript:validForm('modify')">&nbsp;&nbsp;&nbsp;<input type="button" class="buttonred" value="Cancel" name="cancel" onClick=javascript:validForm('cancel')
@@ -905,12 +721,12 @@
     </tr>
    </table>
     |);
-    &main_footer($r,$page,$year,$event,$returnpage);
+    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo);
 }
 
 
 sub display_two() {
-    my ($r,$event_id,$params,$user,$portal,$returnpage,$exitpage,$items,$info,$workshop,$dbh,$page,$contact_email,$contact_name) = @_;
+    my ($r,$event_id,$params,$user,$portal,$returnpage,$exitpage,$items,$info,$workshop,$dbh,$page,$contact_email,$contact_name,$sponsors,$sponsorinfo) = @_;
     my $year = $$params{'year'};
     my $event = $$params{'event'};
     my $enc_event = &HTML::Entities::encode($event);
@@ -1135,7 +951,7 @@
             print MAIL $requestmail;
             close(MAIL);
         } else {
-            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email);
+            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email,$sponsors,$sponsorinfo);
             return;
         }
         my $mailcopy = "To: helen\@lon-capa.org\n".
@@ -1147,7 +963,7 @@
             print MAIL $mailcopy;
             close(MAIL);
         } else {
-            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email);
+            &error_exit($r,$page,$year,$event,"Can't fork for sendmail:$!\n",$contact_name,$contact_email,$sponsors,$sponsorinfo);
             return;
         }
     }
@@ -1228,11 +1044,11 @@
     </table>
 END_OF_B
 
-    &main_footer($r,$page,$year,$event);
+    &main_footer($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo);
 }
 
 sub error_exit() {
-    my ($r,$page,$year,$event,$error_msg,$contact_name,$contact_email) = @_;
+    my ($r,$page,$year,$event,$error_msg,$contact_name,$contact_email,$sponsors,$sponsorinfo) = @_;
     $r->print(<<"END_OF_TOP");
 <HTML>
 <HEAD>
@@ -1284,7 +1100,7 @@
      </tr> 
     </table>
 END_OF_CRUMBS
-    &main_footer($r,$page,$year,$event);
+    &main_footer($r,$page,$year,$event,undef,$sponsors,$sponsorinfo);
     return $error_msg;
 }
 
@@ -1314,8 +1130,8 @@
 }
 
 sub main_footer() {
-    my ($r,$page,$year,$event,$returnpage) = @_;
-    $r->print(<<"END_OF_FOOT");
+    my ($r,$page,$year,$event,$returnpage,$sponsors,$sponsorinfo) = @_;
+    $r->print(<<"START_OF_FOOT");
    </td>
    <td bgcolor="#FFFF99" width="8">&nbsp;</td>
    <td width="8" bgcolor="#CC6633">&nbsp;</td>
@@ -1325,13 +1141,18 @@
   </tr>
  </table>
 </td>
-  <td valign="middle" align="right">
-    <a href="http://www.sc.edu"><img src="/images/login/usc_small.jpg" border="0" targt="sponsor"></a><br /><br />
-    <a href="http://www.msu.edu"><img src="/images/login/msu_logo.gif" border="0" target="sponsor"></a><br /><br />
-    <a href="http://www.mhhe.com/"><img src="/images/login/logo_mghe_bg.gif" border="0" target="sponsor"><br /><br />
-    <a href="http://www.dell.com"><img src="/images/login/dell_logo.gif" border="0" target="sponsor"><br /><br />
-    <a href="http://www.nsf.gov"><img src="/images/login/nsf_logo.gif" border="0" target="sponsor"><br /><br />
-  </td>
+START_OF_FOOT
+    if (ref($sponsors) eq 'ARRAY') {
+        $r->print('<td valign="middle" align="right">');
+        foreach (@{$sponsors}) {
+            $r->print('<a href="'.$$sponsorinfo{$_}{url}.'"><img src="'.
+                      $$sponsorinfo{$_}{image_path}.'" border="0" target="sponsor">'.
+                      '</a><br /><br />'
+            );
+        }
+        $r->print('</td>');
+    }
+    $r->print(<<"END_OF_FOOT");
 </tr>
 </table>
 <input type="hidden" name="go" value="">

--raeburn1112628926--