[LON-CAPA-cvs] cvs: modules /msu/sentinel sentinelonly.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 06 Mar 2008 16:42:40 -0000


raeburn		Thu Mar  6 11:42:40 2008 EDT

  Modified files:              
    /modules/msu/sentinel	sentinelonly.pm 
  Log:
  Make extraction of institutional code from course ID compatible with format of values in %courseidhash retrieved by lonnet::courseiddump() for both 2.6.X and 2.5.X and older.
  
  
Index: modules/msu/sentinel/sentinelonly.pm
diff -u modules/msu/sentinel/sentinelonly.pm:1.3 modules/msu/sentinel/sentinelonly.pm:1.4
--- modules/msu/sentinel/sentinelonly.pm:1.3	Thu Sep 27 19:23:32 2007
+++ modules/msu/sentinel/sentinelonly.pm	Thu Mar  6 11:42:38 2008
@@ -2,7 +2,7 @@
 # is successful but there is no corresponding account in the 
 # MSU LON-CAPA domain.
 #
-# $Id: sentinelonly.pm,v 1.3 2007/09/27 23:23:32 raeburn Exp $
+# $Id: sentinelonly.pm,v 1.4 2008/03/06 16:42:38 raeburn Exp $
 # 
 # Copyright Michigan State University Board of Trustees
 #
@@ -184,7 +184,16 @@
         &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',undef,undef,'Course');
     my %instcodes;
     foreach my $cid (keys(%allcourses)) {
-        my ($description,$code,$other) = split(/:/,$allcourses{$cid},3);
+        my ($description,$code,$other);
+        if (ref($allcourses{$cid}) eq 'HASH') {
+            # LON-CAPA > 2.6: course information returned in Hash of a Hash.
+            $code = $allcourses{$cid}{'inst_code'};
+        } else {
+            # LON-CAPA <= 2.5: course information returned in a Hash
+            #     containing : separated description,inst_code,owner.
+            ($description,$code,$other) =
+                map { &unescape($_); } split(/:/,$allcourses{$cid},3);
+        }
         if ($code ne '') {
             push(@{$instcodes{$code}},$cid);
         }