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

www lon-capa-cvs@mail.lon-capa.org
Wed, 18 Jun 2003 15:02:20 -0000


www		Wed Jun 18 11:02:20 2003 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm lonhtmlcommon.pm 
  Log:
  Bug #1807: calendar dates pre and post epoch problems.
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.12 loncom/interface/lonannounce.pm:1.13
--- loncom/interface/lonannounce.pm:1.12	Fri May 23 12:14:33 2003
+++ loncom/interface/lonannounce.pm	Wed Jun 18 11:02:20 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.12 2003/05/23 16:14:33 www Exp $
+# $Id: lonannounce.pm,v 1.13 2003/06/18 15:02:20 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -263,9 +263,19 @@
     my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year);
     if ($pm<1) { ($pm,$py)=(12,$year-1); }
     if ($fm>12){ ($fm,$fy)=(1,$year+1); }
+    if (($year<1970) || ($year>2037)) {
+    }
     $r->print('<h1>'.('','January','February','March','April','May',
 		      'June','July','August','September','October',
-                      'November','December')[$month].' '.$year.'</h1>'.
+                      'November','December')[$month].' '.$year.'</h1>');
+# Reached the end of times, give up
+    if (($year<1970) || ($year>2037)) {
+	$r->print('<h3>No calendar available for this date.</h3>'.
+ '<a href="/adm/announcements?month='.$todayhash{'month'}.
+ '&year='.$todayhash{'year'}.'">Current Month</a></body></html>');
+	return OK;
+    }
+    $r->print(
  '<a href="/adm/announcements?month='.$pm.'&year='.$py.'">Previous Month</a> '.
  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.'">Next Month</a>'.
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.23 loncom/interface/lonhtmlcommon.pm:1.24
--- loncom/interface/lonhtmlcommon.pm:1.23	Wed Jun 11 10:20:29 2003
+++ loncom/interface/lonhtmlcommon.pm	Wed Jun 18 11:02:20 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.23 2003/06/11 14:20:29 matthew Exp $
+# $Id: lonhtmlcommon.pm,v 1.24 2003/06/18 15:02:20 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -252,6 +252,7 @@
             $year = $tmpyear - 1900;
         }
     }
+    if (($year<70) || ($year>137)) { return undef; }
     if (eval(&timelocal($sec,$min,$hour,$day,$month,$year))) {
         return &timelocal($sec,$min,$hour,$day,$month,$year);
     } else {