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

raeburn raeburn@source.lon-capa.org
Sat, 13 Dec 2008 21:56:57 -0000


raeburn		Sat Dec 13 21:56:57 2008 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  - Eliminate double line at the end of each table.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.221 loncom/interface/lonmeta.pm:1.222
--- loncom/interface/lonmeta.pm:1.221	Sat Dec 13 21:10:14 2008
+++ loncom/interface/lonmeta.pm	Sat Dec 13 21:56:57 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.221 2008/12/13 21:10:14 raeburn Exp $
+# $Id: lonmeta.pm,v 1.222 2008/12/13 21:56:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -927,10 +927,14 @@
 		   'obsolete', 
 		   'obsoletereplacement');
     }
+    my $rownum = 0;
     foreach my $field (@fields) {
+        my $lastrow = '';
+        $rownum ++;
+        $lastrow = 1 if ($rownum == @fields); 
         $table.=&Apache::lonhtmlcommon::row_title($lt{$field})
                .&prettyprint($field,$content{$field})
-               .&Apache::lonhtmlcommon::row_closure();
+               .&Apache::lonhtmlcommon::row_closure($lastrow);
         delete($content{$field});
     }
     #
@@ -971,14 +975,17 @@
         exists($dynmeta{'course'})) {
         $r->print('<h4>'.&mt('Access and Usage Statistics').'</h4>'.
                   &Apache::lonhtmlcommon::start_pick_box());
-        foreach my $item ('count',
-                          'sequsage','sequsage_list',
-                          'comefrom','comefrom_list',
-                          'goto','goto_list',
-                          'course','course_list') {
+        my @counts = ('count','sequsage','sequsage_list',
+                      'comefrom','comefrom_list','goto',
+                      'goto_list','course','course_list');
+        my $rownum = 0;
+        foreach my $item (@counts) {
+            my $lastrow = '';
+            $rownum ++;
+            $lastrow = 1 if ($rownum == @counts);
             $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
                      .&prettyprint($item,$dynmeta{$item})
-                     .&Apache::lonhtmlcommon::row_closure()
+                     .&Apache::lonhtmlcommon::row_closure($lastrow)
             );
         }
         $r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -1001,10 +1008,15 @@
                      .&prettyprint('stdno',$dynmeta{'stdno'})
                      .&Apache::lonhtmlcommon::row_closure()
             );
-            foreach my $item ('avetries','difficulty','disc') {
+            my @stats = ('avetries','difficulty','disc');
+            my $rownum = 0;
+            foreach my $item (@stats) {
+                my $lastrow = '';
+                $rownum ++;
+                $lastrow = 1 if ($rownum == @stats);
                 $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
                          .&prettyprint($item,sprintf('%5.2f',$dynmeta{$item}))
-                         .&Apache::lonhtmlcommon::row_closure()
+                         .&Apache::lonhtmlcommon::row_closure($lastrow)
                 );
             }
             $r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -1077,10 +1089,15 @@
         exists($dynmeta{'technical'})){ 
         $r->print('<h4>'.&mt('Evaluation Data').'</h4>'.
                   &Apache::lonhtmlcommon::start_pick_box());
-        foreach my $item ('clear','depth','helpful','correct','technical') {
+        my @criteria = ('clear','depth','helpful','correct','technical');
+        my $rownum = 0;
+        foreach my $item (@criteria) {
+            my $lastrow = '';
+            $rownum ++;
+            $lastrow = 1 if ($rownum == @criteria);
             $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
                      .&prettyprint($item,$dynmeta{$item})
-                     .&Apache::lonhtmlcommon::row_closure()
+                     .&Apache::lonhtmlcommon::row_closure($lastrow)
             );
         }
         $r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -1113,8 +1130,19 @@
               &mt('Additional Metadata (non-standard, parameters, exports)').
               '</h3>');
     $r->print(&Apache::lonhtmlcommon::start_pick_box());
-    foreach my $name (sort(keys(%content))) {
-        if ($name!~/\.display$/) {
+    my @names;
+    foreach my $key (sort(keys(%content))) {
+        if ($key!~/\.display$/) {
+            push(@names,$key);
+        }
+    }
+    if (@names > 0) {
+        my $rownum = 0;
+        foreach my $name (@names) {
+            my $lastrow = '';
+            $rownum ++;
+            $lastrow = 1 if ($rownum == @names);
+
             my $display=&Apache::lonnet::metadata($uri,
                                                   $name.'.display');
             if (! $display) { 
@@ -1135,7 +1163,7 @@
             if ($otherinfo) {
                 $r->print(' ('.$otherinfo.')');
             }
-            $r->print(&Apache::lonhtmlcommon::row_closure());
+            $r->print(&Apache::lonhtmlcommon::row_closure($lastrow));
         }
     }
     $r->print(&Apache::lonhtmlcommon::end_pick_box());