[LON-CAPA-cvs] cvs: loncom /auth lonauth.pm /interface lonnavmaps.pm /localize lonlocal.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 20 Apr 2006 04:30:27 -0000


albertel		Thu Apr 20 00:30:27 2006 EDT

  Modified files:              
    /loncom/auth	lonauth.pm 
    /loncom/interface	lonnavmaps.pm 
    /loncom/localize	lonlocal.pm 
  Log:
  - handling timezones correctly
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.74 loncom/auth/lonauth.pm:1.75
--- loncom/auth/lonauth.pm:1.74	Wed Apr  5 18:39:55 2006
+++ loncom/auth/lonauth.pm	Thu Apr 20 00:30:02 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.74 2006/04/05 22:39:55 albertel Exp $
+# $Id: lonauth.pm,v 1.75 2006/04/20 04:30:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,7 +40,6 @@
 use Apache::lonmenu();
 use Fcntl qw(:flock);
 use Apache::lonlocal;
-use POSIX qw(strftime);
 
 my %FORM;
 
@@ -156,8 +155,6 @@
            print $idf "browser.localres=$FORM{'localres'}\n";
         }
         print $idf "server.domain=".$r->dir_config('lonDefDomain')."\n";
-        my $timezone=POSIX::strftime("%Z",localtime(time));
-        print $idf "server.timezone=$timezone\n";
 	print $idf "request.course.fn=\n";
 	print $idf "request.course.uri=\n";
 	print $idf "request.course.sec=\n";
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.377 loncom/interface/lonnavmaps.pm:1.378
--- loncom/interface/lonnavmaps.pm:1.377	Mon Apr 10 17:55:48 2006
+++ loncom/interface/lonnavmaps.pm	Thu Apr 20 00:30:11 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.377 2006/04/10 21:55:48 www Exp $
+# $Id: lonnavmaps.pm,v 1.378 2006/04/20 04:30:11 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -679,7 +679,7 @@
 
 	if($format ne '') {
 	    my $timeStr = strftime($format, localtime($time));
-	    return $timeStr.&Apache::lonlocal::gettimezone();
+	    return $timeStr.&Apache::lonlocal::gettimezone($time);
 	}
 
         # Less then 5 days away, display day of the week and
@@ -690,7 +690,7 @@
             $timeStr =~ s/12:00 am/00:00/;
             $timeStr =~ s/12:00 pm/noon/;
             return ($inPast ? "last " : "this ") .
-                $timeStr.&Apache::lonlocal::gettimezone();
+                $timeStr.&Apache::lonlocal::gettimezone($time);
         }
         
 	my $conjunction='on';
@@ -705,14 +705,14 @@
             my $timeStr = strftime("$conjunction %A, %b %e at %I:%M %P", localtime($time));
             $timeStr =~ s/12:00 am/00:00/;
             $timeStr =~ s/12:00 pm/noon/;
-            return $timeStr.&Apache::lonlocal::gettimezone();
+            return $timeStr.&Apache::lonlocal::gettimezone($time);
         }
 
         # Not this year, so show the year
         my $timeStr = strftime("$conjunction %A, %b %e %Y at %I:%M %P", localtime($time));
         $timeStr =~ s/12:00 am/00:00/;
         $timeStr =~ s/12:00 pm/noon/;
-        return $timeStr.&Apache::lonlocal::gettimezone();
+        return $timeStr.&Apache::lonlocal::gettimezone($time);
     }
 }
 
Index: loncom/localize/lonlocal.pm
diff -u loncom/localize/lonlocal.pm:1.38 loncom/localize/lonlocal.pm:1.39
--- loncom/localize/lonlocal.pm:1.38	Fri Apr  7 18:03:55 2006
+++ loncom/localize/lonlocal.pm	Thu Apr 20 00:30:23 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Localization routines
 #
-# $Id: lonlocal.pm,v 1.38 2006/04/07 22:03:55 albertel Exp $
+# $Id: lonlocal.pm,v 1.39 2006/04/20 04:30:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -163,7 +163,7 @@
 use strict;
 use Apache::localize;
 use locale;
-use POSIX qw(locale_h);
+use POSIX qw(locale_h strftime);
 
 require Exporter;
 
@@ -258,13 +258,14 @@
 
 # ========================================================== Localize localtime
 sub gettimezone {
-    return ' ('.$Apache::lonnet::env{'server.timezone'}.')';
+    my ($time) = @_;
+    return ' ('.&strftime("%Z",localtime($time)).')';
 }
 
 sub locallocaltime {
     my $thistime=shift;
     if ((&current_language=~/^en/) || (!$lh)) {
-	return ''.localtime($thistime).&gettimezone();
+	return ''.localtime($thistime).&gettimezone($thistime);
     } else {
 	my $format=$lh->maketext('date_locale');
 	if ($format eq 'date_locale') {
@@ -294,7 +295,7 @@
 	 'month','weekday','ampm') {
 	    $format=~s/\$$_/eval('$'.$_)/gse;
 	}
-	return $format.&gettimezone();
+	return $format.&gettimezone($thistime);
     }
 }