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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 12 Apr 2004 20:03:32 -0000


albertel		Mon Apr 12 16:03:32 2004 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm lonparmset.pm 
  Log:
  - Both parts of BUG#2916
      - if sec or min is left blank we assume they mean 0
      - if they specify an invalid date don't set the date to undef, leave it at it's previous value
  
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.63 loncom/interface/lonhtmlcommon.pm:1.64
--- loncom/interface/lonhtmlcommon.pm:1.63	Wed Apr  7 18:33:00 2004
+++ loncom/interface/lonhtmlcommon.pm	Mon Apr 12 16:03:31 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.63 2004/04/07 22:33:00 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.64 2004/04/12 20:03:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -392,12 +392,14 @@
         if (($tmpsec =~ /^\d+$/) && ($tmpsec >= 0) && ($tmpsec < 60)) {
             $sec = $tmpsec;
         }
+	if (!defined($tmpsec) || $tmpsec eq '') { $sec = 0; }
     }
     if (defined($ENV{'form.'.$dname.'_minute'})) {
         my $tmpmin = $ENV{'form.'.$dname.'_minute'};
         if (($tmpmin =~ /^\d+$/) && ($tmpmin >= 0) && ($tmpmin < 60)) {
             $min = $tmpmin;
         }
+	if (!defined($tmpmin) || $tmpmin eq '') { $min = 0; }
     }
     if (defined($ENV{'form.'.$dname.'_hour'})) {
         my $tmphour = $ENV{'form.'.$dname.'_hour'};
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.152 loncom/interface/lonparmset.pm:1.153
--- loncom/interface/lonparmset.pm:1.152	Thu Apr  1 10:12:27 2004
+++ loncom/interface/lonparmset.pm	Mon Apr 12 16:03:31 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.152 2004/04/01 15:12:27 albertel Exp $
+# $Id: lonparmset.pm,v 1.153 2004/04/12 20:03:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1499,7 +1499,7 @@
         }
         #
         # Let the user know we made the changes
-        if ($name) {
+        if ($name && defined($value)) {
             my $put_result = &Apache::lonnet::put('environment',
                                                   {$name=>$value},$dom,$crs);
             if ($put_result eq 'ok') {
@@ -1776,7 +1776,7 @@
 		push (@deldata,$thiskey);
 	    } elsif ($cmd eq 'datepointer') {
 		my $data=&Apache::lonhtmlcommon::get_date_from_form($ENV{$_});
-		if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; }
+		if (defined($data) and $olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; }
 	    }
 	}
     }