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

www lon-capa-cvs@mail.lon-capa.org
Mon, 06 Jun 2005 15:54:30 -0000


www		Mon Jun  6 11:54:30 2005 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  In date_setter, when falling back to "today," don't set seconds and minutes
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.106 loncom/interface/lonhtmlcommon.pm:1.107
--- loncom/interface/lonhtmlcommon.pm:1.106	Fri Jun  3 11:47:29 2005
+++ loncom/interface/lonhtmlcommon.pm	Mon Jun  6 11:54:28 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.106 2005/06/03 15:47:29 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.107 2005/06/06 15:54:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -259,6 +259,7 @@
 sub date_setter {
     my ($formname,$dname,$currentvalue,$special,$includeempty,$state,
         $no_hh_mm_ss) = @_;
+    my $wasdefined=1;
     if (! defined($state) || $state ne 'disabled') {
         $state = '';
     }
@@ -268,6 +269,7 @@
     if (! defined($currentvalue) || $currentvalue eq 'now') {
 	unless ($includeempty) {
 	    $currentvalue = time;
+	    $wasdefined=0;
 	} else {
 	    $currentvalue = 0;
 	}
@@ -279,6 +281,10 @@
 	    localtime($currentvalue);
 	$year += 1900;
     }
+    unless ($wasdefined) {
+	$sec=0;
+	$min=0;
+    }
     my $result = "\n<!-- $dname date setting form -->\n";
     $result .= <<ENDJS;
 <script language="Javascript">