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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 31 May 2008 23:53:19 -0000


raeburn		Sat May 31 19:53:19 2008 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm loncommon.pm 
  Log:
  &loncommon::select_timezone() can take an additional argument - to display a blank option - this allows the timezone set for a course to be deleted.
  In the Course parameters screen, the timezone select box defaults to the default timezone for the domain, if a course specific timezone has not been set.   
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.398 loncom/interface/lonparmset.pm:1.399
--- loncom/interface/lonparmset.pm:1.398	Thu May 29 11:39:16 2008
+++ loncom/interface/lonparmset.pm	Sat May 31 19:53:18 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.398 2008/05/29 15:39:16 www Exp $
+# $Id: lonparmset.pm,v 1.399 2008/05/31 23:53:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2401,10 +2401,12 @@
                                                         $onchange).
                                                         '</td>';
             } elsif ($parameter eq 'timezone') {
+                my $includeempty = 1;
+                my $timezone = &Apache::lonlocal::gettimezone();
                 $output .= '<td>'.
                     &Apache::loncommon::select_timezone($parameter.'_value',
-                                                        $values{$parameter},
-                                                        $onchange).'</td>';
+                                                        $timezone,
+                                                        $onchange,$includeempty).'</td>';
             } else {
                 $output .= '<td>'.
                     &Apache::lonhtmlcommon::textbox($parameter.'_value',
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.658 loncom/interface/loncommon.pm:1.659
--- loncom/interface/loncommon.pm:1.658	Fri May 30 21:51:42 2008
+++ loncom/interface/loncommon.pm	Sat May 31 19:53:18 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.658 2008/05/31 01:51:42 raeburn Exp $
+# $Id: loncommon.pm,v 1.659 2008/05/31 23:53:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -636,8 +636,15 @@
 }
 
 sub select_timezone {
-   my ($name,$selected,$onchange)=@_;
-   my $output="<select name='$name' $onchange>\n";
+   my ($name,$selected,$onchange,$includeempty)=@_;
+   my $output='<select name="'.$name.'" '.$onchange.'>'."\n";
+   if ($includeempty) {
+       $output .= '<option value=""';
+       if (($selected eq '') || ($selected eq 'local')) {
+           $output .= ' selected="selected" ';
+       }
+       $output .= '> </option>';
+   }
    my @timezones = DateTime::TimeZone->all_names;
    foreach my $tzone (@timezones) {
        $output.= '<option value="'.$tzone.'"';