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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 06 Dec 2006 21:52:49 -0000


albertel		Wed Dec  6 16:52:49 2006 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  - get course announcements workign again, and try to make less parsing needed of the item entries
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.63 loncom/interface/lonannounce.pm:1.64
--- loncom/interface/lonannounce.pm:1.63	Mon Dec  4 21:55:51 2006
+++ loncom/interface/lonannounce.pm	Wed Dec  6 16:52:49 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.63 2006/12/05 02:55:51 albertel Exp $
+# $Id: lonannounce.pm,v 1.64 2006/12/06 21:52:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -78,7 +78,8 @@
     my %returnhash=();
     foreach my $item (keys(%thiscal)) {
         unless (($item=~/^error\:/) || ($thiscal{$item}=~/^error\:/)) {
-	   $returnhash{$courseid.'@'.$item}=$thiscal{$item};
+	    my ($start,$end)=split('_',$item);
+	    $returnhash{join("\0",$courseid,$start,$end)}=$thiscal{$item};
         }
     }
     my $can_see_hidden = ($env{'request.role.adv'} &&
@@ -161,8 +162,9 @@
 		} 
 		$data{'datetype'}=&mt('Answer Available'); 
 	    }
-	    $returnhash{$courseid.'@'.$resourcedata{$thiskey}.'_'.
-			    $resourcedata{$thiskey}}=\%data;
+	    $returnhash{join("\0",$courseid,
+			     $resourcedata{$thiskey},
+			     $resourcedata{$thiskey})}=\%data;
 	}
     }
     return %returnhash;
@@ -310,9 +312,9 @@
 	$nextday+=$oneday;
     }
     foreach my $item (keys(%allcal)) {
-	my ($course,$startdate,$enddate)=($item=~/^($match_courseid)\@(\d+)\_(\d+)$/);
-        if (($startdate<$nextday) && ($enddate>=$tk))  {
-	    push(@outp,[$course,$startdate,$enddate,$allcal{$item}]);
+	my ($courseid,$startdate,$enddate)= split("\0",$item);
+	if (($startdate<$nextday) && ($enddate>=$tk))  {
+	    push(@outp,[$courseid,$startdate,$enddate,$allcal{$item}]);
         }
     }
     unless ($mode) {
@@ -376,7 +378,7 @@
     $r->print("PRODID:-//LONCAPA//LONCAPA Calendar Output//EN$crlf");
     my %allcal=&get_all_calendars();
     foreach my $event (keys(%allcal)) {
-	my ($courseid,$startdate,$enddate)=($event=~/^($match_courseid)\@(\d+)\_(\d+)$/);
+	my ($courseid,$startdate,$enddate)= split('\0',$event);
 	my $uid=$event;
 	$uid=~s/[\W\_]/-/gs;
 	$uid.='@loncapa';