[LON-CAPA-cvs] cvs: rat / lonratedt.pm

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Mon, 13 Oct 2008 11:54:54 -0000


bisitz		Mon Oct 13 07:54:54 2008 EDT

  Modified files:              
    /rat	lonratedt.pm 
  Log:
  - Added error style to error message
  - Added warning style to warning message and removed hardcoded style
  - Use LON-CAPA standard table for sequence table and removed hardcoded styles
  - Added dummy content ( ) to have proper table structure in all cases
  
  
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.89 rat/lonratedt.pm:1.90
--- rat/lonratedt.pm:1.89	Thu Sep 11 10:47:24 2008
+++ rat/lonratedt.pm	Mon Oct 13 07:54:54 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.89 2008/09/11 14:47:24 bisitz Exp $
+# $Id: lonratedt.pm,v 1.90 2008/10/13 11:54:54 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -775,21 +775,29 @@
 	      &Apache::loncommon::help_open_menu('','',6,'RAT').
 	      &buttons($adv));
     if ($errtext) {
-	$r->print($errtext.'<hr />');
+	$r->print('<div class="LC_error">'
+                 .$errtext
+                 .'</div>'
+                 .'<hr />'
+        );
     }
     my $idx=0;
     $r->print('<h1>'.$url.'</h1>');
     if ($adv) {
-	$r->print('<p><b><font color="red">'.&mt('Map contents are not shown in order.').'</font></b></p><br />');
+	$r->print('<p class="LC_warning">'
+                 .&mt('Map contents are not shown in order.')
+                 .'</p><br />'
+        );
     }
-    $r->print( '<table border="0" cellspacing="2" cellpadding="4">'.
-               '<tr bgcolor="#DDDDDD"><th>'.&mt('Type').'</th>'.
-               '<th>'.&mt('Title in map').'</th>'.
-               '<th>'.&mt('Filename of resource').'</th>'.
-               '<th>'.&mt('Link to published resource').'</th>'.
-               '<th>'.&mt('Link to resource in Construction Space').'</th>'.
-               '</tr>');
-    my @backgroundColors = ("#FFFFFF", "#F6F6F6");
+    $r->print(&Apache::loncommon::start_data_table()
+             .&Apache::loncommon::start_data_table_header_row()
+             .'<th>'.&mt('Type').'</th>'
+             .'<th>'.&mt('Title in map').'</th>'
+             .'<th>'.&mt('Filename of resource').'</th>'
+             .'<th>'.&mt('Link to published resource').'</th>'
+             .'<th>'.&mt('Link to resource in Construction Space').'</th>'
+             .&Apache::loncommon::end_data_table_header_row()
+    );
     foreach (&LONCAPA::map::attemptread(&Apache::lonnet::filelocation('',$url))) {
 	if (defined($_)) {
             $idx++;
@@ -807,23 +815,34 @@
             }
             my $cstrurl = $resurl;
             $cstrurl =~ s#^/res/[^/]+/([^/]+)/#/priv/$1/#;
-            my $bgcol = $idx%2; 
-            $r->print('<tr bgcolor='.$backgroundColors[$bgcol].'><td>'.
-                      '<img src="'.&Apache::loncommon::icon($resfilepath).
-                      '" /></td><td>'.&HTML::Entities::encode(&LONCAPA::map::qtescape($title)).
-                      '</td><td>'.$filename.'</td><td>');
+            $r->print(&Apache::loncommon::start_data_table_row()
+                     .'<td>'
+                     .'<img src="'.&Apache::loncommon::icon($resfilepath).'" />'
+                     .'</td>'
+                     .'<td>'
+                     .&HTML::Entities::encode(&LONCAPA::map::qtescape($title))
+                     .'</td>'
+                     .'<td>'.$filename.'</td>'
+                     .'<td>'
+            );
             if ($url) {
 		$r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>');
+            } else {
+                $r->print('&nbsp;');
             }
             $r->print('</td><td>');
             if ($url) {
                $r->print('<a href="'.$cstrurl.'">'.
                          &mt('Construction space').'</a>');
+            } else {
+                $r->print('&nbsp;');
             }
-            $r->print('</td></tr>'."\n");
+            $r->print('</td>'
+                     .&Apache::loncommon::end_data_table_row()
+            );
         }
     }
-    $r->print('</table>');
+    $r->print(&Apache::loncommon::end_data_table());
     $r->print(&Apache::loncommon::end_page());
 }