[LON-CAPA-cvs] cvs: loncom /interface lonmsgdisplay.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 26 Apr 2006 14:11:00 -0000


albertel		Wed Apr 26 10:11:00 2006 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  - did the data tabling incorrectly, fixed that
  - eliminate some $_
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.17 loncom/interface/lonmsgdisplay.pm:1.18
--- loncom/interface/lonmsgdisplay.pm:1.17	Tue Apr 25 19:13:25 2006
+++ loncom/interface/lonmsgdisplay.pm	Wed Apr 26 10:10:58 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.17 2006/04/25 23:13:25 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.18 2006/04/26 14:10:58 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1291,8 +1291,8 @@
         'modi' => 'Modify',
         'canc' => 'Cancel',
     );
+    $r->print(&Apache::loncommon::start_data_table());
     $r->print(<<"END");
-<table class="LC_data_table">
   <tr>
     <th>$$ltext{'dura'}</th>
     <th>$$ltext{'setb'}</th>
@@ -1300,26 +1300,27 @@
     <th>$$ltext{'actn'}?</th>
   </tr>
 END
-    foreach (sort keys %{$records}) {
-        my $iter = $parmcount%2;
+    foreach my $record (sort(keys(%{$records}))) {
         my $onchange = 'onFocus="javascript:window.document.forms['.
                        "'blockform'].elements['modify_".$parmcount."'].".
                        'checked=true;"';
-        my ($start,$end) = split/____/,$_;
+        my ($start,$end) = split(/____/,$record);
         my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange);
         my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange);
 	
-	my ($setuname,$setudom,$title) = &parse_block_record($$records{$_});
+	my ($setuname,$setudom,$title) = 
+	    &parse_block_record($$records{$record});
+	$title = &HTML::Entities::encode($title,'"<>');
         my $settername = &Apache::loncommon::plainname($setuname,$setudom);
+        $r->print(&Apache::loncommon::start_data_table_row());
         $r->print(<<"END");
-       <tr>
         <td>$$ltext{'star'}:&nbsp;$startform<br/>$$ltext{'endd'}:&nbsp;&nbsp;$endform</td>
         <td>$settername</td>
-        <td><input type="text" name="title_$parmcount" size="15" value="$title" /><input type="hidden" name="key_$parmcount" value="$_" /></td>
+        <td><input type="text" name="title_$parmcount" size="15" value="$title" /><input type="hidden" name="key_$parmcount" value="$record" /></td>
         <td><label>$lt{'modi'}?&nbsp;<input type="checkbox" name="modify_$parmcount" /></label><br /><label>$lt{'canc'}?&nbsp;&nbsp;<input type="checkbox" name="cancel_$parmcount" /></label>
-       </tr>
 END
-        $parmcount ++;
+        $r->print(&Apache::loncommon::end_data_table_row());
+        $parmcount++;
     }
     $r->print(<<"END");
 </table>
@@ -1358,19 +1359,23 @@
     );
     $r->print(<<"END");
 <h4>$lt{'addn'}</h4> 
- <table class="LC_data_table">
+END
+    $r->print(&Apache::loncommon::start_data_table());
+    $r->print(<<"END");
    <tr>
      <th>$$ltext{'dura'}</th>
      <th>$$ltext{'even'} $lt{'exam'}</th>
      <th>$$ltext{'actn'}?</th>
    </tr>
-   <tr>
+END
+   $r->print(&Apache::loncommon::start_data_table_row());
+    $r->print(<<"END");
      <td>$$ltext{'star'}:&nbsp;$startform<br />$$ltext{'endd'}:&nbsp;&nbsp;$endform</td>
      <td><input type="text" name="title_$parmcount" size="15" value="" /></td>
      <td><label>$lt{'addb'}?&nbsp;<input type="checkbox" name="add_$parmcount" value="1" /></label></td>
-   </tr>
-  </table>
 END
+    $r->print(&Apache::loncommon::end_data_table_row());
+    $r->print(&Apache::loncommon::end_data_table());
     return;
 }
 
@@ -1428,31 +1433,35 @@
         'cour' => 'Course',
         'dura' => 'Duration',
         'blse' => 'Block set by'
-    ); 
+    );
+    $r->print(<<"END");
+<br /><br />$lt{'cacb'}:<br /><br />
+END
+    $r->print(&Apache::loncommon::start_data_table());
     $r->print(<<"END");
-<br /<br />$lt{'cacb'}:<br /><br />
-<table class="LC_data_table">
 <tr>
  <th>$lt{'cour'}</th>
  <th>$lt{'dura'}</th>
  <th>$lt{'blse'}</th>
 </tr>
 END
-    foreach (keys %{$setters}) {
-        my %courseinfo=&Apache::lonnet::coursedescription($_);
-        for (my $i=0; $i<@{$$setters{$_}{staff}}; $i++) {
-            my ($uname,$udom) = @{$$setters{$_}{staff}[$i]};
+    foreach my $course (keys(%{$setters})) {
+        my %courseinfo=&Apache::lonnet::coursedescription($course);
+        for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) {
+            my ($uname,$udom) = @{$$setters{$course}{staff}[$i]};
             my $fullname = &Apache::loncommon::plainname($uname,$udom);
-            my ($openblock,$closeblock) = @{$$setters{$_}{times}[$i]};
+            my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]};
             $openblock = &Apache::lonlocal::locallocaltime($openblock);
             $closeblock= &Apache::lonlocal::locallocaltime($closeblock);
-            $r->print('<tr><td>'.$courseinfo{'description'}.'</td>'.
+            $r->print(&Apache::loncommon::start_data_table_row().
+		      '<td>'.$courseinfo{'description'}.'</td>'.
                       '<td>'.$openblock.' to '.$closeblock.'</td>'.
                       '<td>'.$fullname.' ('.$uname.':'.$udom.
-                      ')</td></tr>');
+                      ')</td>'.
+		       &Apache::loncommon::end_data_table_row());
         }
     }
-    $r->print('</table>');
+    $r->print(&Apache::loncommon::end_data_table());
 }
 
 # ----------------------------------------------------------- Display a message