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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 29 Sep 2006 18:11:51 -0000


albertel		Fri Sep 29 14:11:51 2006 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  - metadata_cols_to_hash changed arguments
  - sort the course listings by domain then course description
     (and adding a domain identifier to it)
  
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.179 loncom/interface/lonmeta.pm:1.180
--- loncom/interface/lonmeta.pm:1.179	Thu Sep 28 19:37:57 2006
+++ loncom/interface/lonmeta.pm	Fri Sep 29 14:11:49 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.179 2006/09/28 23:37:57 banghart Exp $
+# $Id: lonmeta.pm,v 1.180 2006/09/29 18:11:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -95,7 +95,8 @@
         while (my $result = <$fh>) {
             chomp($result);
             next if (! $result);
-            my %hash=&LONCAPA::lonmetadata::metadata_col_to_hash(map { &unescape($_) } split(/\,/,$result));
+            my %hash=&LONCAPA::lonmetadata::metadata_col_to_hash('metadata',
+								 map { &unescape($_) } split(/\,/,$result));
             foreach my $key (keys(%hash)) {
                 $ReturnHash{$hash{'url'}}->{$key}=$hash{$key};
             }
@@ -505,6 +506,7 @@
     if ($type=~/\_list/) {
         my @Courses = split(/\s*\,\s*/,$value);
         my $Str='<font size="-1"><ul>';
+	my %descriptions;
         foreach my $course (@Courses) {
             my %courseinfo =
 		&Apache::lonnet::coursedescription($course,
@@ -512,10 +514,16 @@
             if (! exists($courseinfo{'num'}) || $courseinfo{'num'} eq '') {
                 next;
             }
-            $Str .= '<li><a href="/public/'.$courseinfo{'domain'}.'/'.
+	    $descriptions{join('\0',@courseinfo{'domain','description'})} .= 
+		'<li><a href="/public/'.$courseinfo{'domain'}.'/'.
                 $courseinfo{'num'}.'/syllabus" target="preview">'.
-                $courseinfo{'description'}.'</a></li>';
+                $courseinfo{'description'}.' ('.$courseinfo{'domain'}.
+		')</a></li>';
         }
+	foreach my $course (sort {lc($a) cmp lc($b)} (keys(%descriptions))) {
+	    $Str .= $descriptions{$course};
+	}
+
 	return $Str.'</ul></font>';
     }
     # No pretty print found