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

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Mon, 19 May 2008 21:40:30 -0000


bisitz		Mon May 19 17:40:30 2008 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm 
  Log:
  Added table to course selection list
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.70 loncom/interface/lonpickcourse.pm:1.71
--- loncom/interface/lonpickcourse.pm:1.70	Sat Jan 19 19:15:02 2008
+++ loncom/interface/lonpickcourse.pm	Mon May 19 17:40:26 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.70 2008/01/20 00:15:02 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.71 2008/05/19 21:40:26 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -251,6 +251,7 @@
         my $description = $descr;
         push (@{$by_descrip{$description}}, $course);
     }
+ 
     if ($numcourses > 1 && $multiple) {
         $r->print('<input type="button" value="check all"
                   onclick="javascript:checkAll(document.courselist.course_id)" />
@@ -258,7 +259,21 @@
                   onclick="javascript:uncheckAll(document.courselist.course_id)" />
                   <br /><br />');
     }
+
+    if (%courses) {
+        $r->print(&Apache::loncommon::start_data_table());
+        $r->print(&Apache::loncommon::start_data_table_header_row());
+        $r->print('<th>'.&mt('Select').'</th>'
+                 .'<th>'.&mt('Course Description').'</th>'
+                 .'<th>'.&mt('Domain').'</th>'
+                 .'<th>'.&mt('Course Code').'</th>'
+                 .'<th>'.&mt('Owner:Domain').'</th>'
+                 .'<th>'.&mt('Type').'</th>'
+                 );
+        $r->print(&Apache::loncommon::end_data_table_header_row());
+    }
     foreach my $description (sort { lc($a) cmp lc($b) } (keys(%by_descrip))) {
+        $r->print(&Apache::loncommon::start_data_table_row());
         foreach my $course (@{$by_descrip{$description}}) {
             my $cleandesc=&HTML::Entities::encode($description,'<>&"');
             $cleandesc=~s/'/\\'/g;
@@ -280,25 +295,42 @@
                 push(@owners,&unescape($singleowner));
             }
             my $owner = join(', ',@owners);
-            $r->print(&course_chooser($multiple,$cdom,$cnum,$cleandesc));
-            $r->print($description.' ('.
-                      (&Apache::lonnet::domain($cdom,'description')?
-                       &Apache::lonnet::domain($cdom,'description'):$cdom).")");
+            $r->print('<td>'.&course_chooser($multiple,$cdom,$cnum,$cleandesc).'</td>');
+            $r->print('<td>'.$description.'</td>');
+            $r->print('<td>');
+            $r->print(&Apache::lonnet::domain($cdom,'description')?
+                      $cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom);
+            $r->print('</td>');
+            $r->print('<td>');
             if ($instcode ne '') {
-                $r->print(" - ".&unescape($instcode));
+                $r->print(&unescape($instcode));
+            } else {
+                $r->print('&nbsp;');
             }
+            $r->print('</td>');
+            $r->print('<td>');
             if (@owners > 1) {
-                $r->print(', '.&mt('owners').' - ',join(', ',@owners)); 
+#               $r->print(', '.&mt('owners').' - ',join(', ',@owners)); 
+                $r->print(join(', ',@owners)); 
             } elsif (@owners == 1) {
-                $r->print(', '.&mt('owner').' - '.$owner);
+#               $r->print(', '.&mt('owner').' - '.$owner);
+                $r->print($owner);
             }
+            $r->print('</td>');
+            $r->print('<td>');
             if ($ttype ne '') {
-                $r->print(' ('.&unescape($ttype).')');
+                $r->print(&mt(&unescape($ttype)));
+            } else {
+                $r->print('&nbsp;');
             }
+            $r->print('</td>');
             if ($multiple) { $r->print("</label>\n"); }
-            $r->print("<br />\n");
+            # $r->print("<br />\n");
         }
+        $r->print(&Apache::loncommon::end_data_table_row());
     }
+    $r->print(&Apache::loncommon::end_data_table());
+
     if (!%courses) {
         $r->print(&mt('None found'));
     } elsif ($multiple) {
@@ -483,7 +515,7 @@
     my ($r,$type,$onlyown,$filter) = @_;
     my %courses;
     if (!$onlyown) {
-        $r->print(&mt('Searching').' ...<br />&nbsp;<br />');
+        $r->print(&mt('Searching ...').'<br />&nbsp;<br />');
         $r->rflush();
         if (($filter->{'ownerfilter'} ne '') ||
             ($filter->{'ownerdomfilter'} ne '')) {
@@ -523,7 +555,7 @@
     if ($multiple) {
         $output = '<label><input type="checkbox" name="course_id" value="'.$cdom.'_'.$cnum.'" />'."\n";
     } else {
-        $output = '<input type="button" value="Select" onClick="gochoose('.
+        $output = '<input type="button" value="'.&mt('Select').'" onClick="gochoose('.
                   "'".$cnum."','".$cdom."','".$cleandesc."')".'" />'."\n";
     }
     return $output;