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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Tue, 15 May 2007 18:55:23 -0000


raeburn		Tue May 15 14:55:23 2007 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  Bug 5271.
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.68 loncom/interface/lonannounce.pm:1.69
--- loncom/interface/lonannounce.pm:1.68	Thu May 10 14:49:39 2007
+++ loncom/interface/lonannounce.pm	Tue May 15 14:55:22 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.68 2007/05/10 18:49:39 albertel Exp $
+# $Id: lonannounce.pm,v 1.69 2007/05/15 18:55:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,6 +74,16 @@
     my $courseid=shift;
     my $coursenum=$env{'course.'.$courseid.'.num'};
     my $coursedom=$env{'course.'.$courseid.'.domain'};
+    if ($coursenum eq '' || $coursedom eq '') {
+        my %courseinfo=&Apache::lonnet::coursedescription($courseid);
+        if ($coursenum eq '' && exists($courseinfo{'num'})) {
+            $coursenum = $courseinfo{'num'};
+        }
+        if ($coursedom eq '' && exists($courseinfo{'domain'})) {
+            $coursedom = $courseinfo{'domain'};
+        }
+    }
+
     my %thiscal=&Apache::lonnet::dump('calendar',$coursedom,$coursenum);
     my %returnhash=();
     foreach my $item (keys(%thiscal)) {
@@ -92,6 +102,9 @@
 
     my $resourcedata=
 	&Apache::lonnet::get_courseresdata($coursenum,$coursedom);
+    if (ref($resourcedata) ne 'HASH') {
+        return %returnhash;
+    } 
     foreach my $thiskey (keys(%$resourcedata)) {
 	if ($resourcedata->{$thiskey.'.type'}=~/^date/) {
 	    my ($course,$middle,$part,$name)=