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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 29 May 2008 19:35:54 -0000


raeburn		Thu May 29 15:35:54 2008 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - Seems better to replace use of timezone.tab file with use of the appropriate method from DateTime/TimeZone.pm included in the perl-DateTime rpm for internal consistency with use of DateTime.pm elsewhere in LON-CAPA, when retrieving possible timezones.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.656 loncom/interface/loncommon.pm:1.657
--- loncom/interface/loncommon.pm:1.656	Thu May 29 11:39:16 2008
+++ loncom/interface/loncommon.pm	Thu May 29 15:35:53 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.656 2008/05/29 15:39:16 www Exp $
+# $Id: loncommon.pm,v 1.657 2008/05/29 19:35:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -67,6 +67,7 @@
 use Apache::lontexconvert();
 use Apache::lonclonecourse();
 use LONCAPA qw(:DEFAULT :match);
+use DateTime::TimeZone;
 
 # ---------------------------------------------- Designs
 use vars qw(%defaultdesign);
@@ -654,12 +655,13 @@
 sub select_timezone {
    my ($name,$selected,$onchange)=@_;
    my $output="<select name='$name' $onchange>\n";
-   foreach my $key (sort(keys(%timezone))) {
-      $output.="<option value='$timezone{$key}'";
-      if ($key eq $selected) {
-         $output.=" selected='selected'";
-      }
-      $output.=">$timezone{$key}</option>\n";
+   my @timezones = DateTime::TimeZone->all_names;
+   foreach my $tzone (@timezones) {
+       $output.= '<option value="'.$tzone.'"';
+       if ($tzone eq $selected) {
+           $output.=' selected="selected"';
+       }
+       $output.=">$tzone</option>\n";
    }
    $output.="</select>";
    return $output;