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

www lon-capa-cvs@mail.lon-capa.org
Fri, 17 Jun 2005 20:56:11 -0000


www		Fri Jun 17 16:56:11 2005 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Saving my work, add "days" to offset
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.226 loncom/interface/lonparmset.pm:1.227
--- loncom/interface/lonparmset.pm:1.226	Fri Jun 17 16:01:50 2005
+++ loncom/interface/lonparmset.pm	Fri Jun 17 16:56:06 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.226 2005/06/17 20:01:50 www Exp $
+# $Id: lonparmset.pm,v 1.227 2005/06/17 20:56:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -313,7 +313,11 @@
 	   my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/);
 # set triggered parameter on same level
 	   my $newspnam=$prefix.$triggered;
-
+	   my $newvalue='';
+	   if ($action eq 'when_setting_') {
+	   } else {
+	       my $totalsecs=((&rulescache($triggered.'_days')*24+&rulescache($triggered.'_hours'))*60+&rulescache($triggered.'_min'))*60+&rulescache($triggered.'_sec');
+	   }
 	   &Apache::lonnet::logthis('About to set '.$newspnam.' using action '.$whichaction.' with '.$parm.' ('.$whichparm.')');
        }
     }
@@ -2632,11 +2636,13 @@
 		    }
 		    $newrules{$tempkey.'_type'}=$defkeytype{$tempkey};
 		    if (&isdateparm($defkeytype{$tempkey})) {
+			$newrules{$tempkey.'_days'}=$env{'form.'.$tempkey.'_days'};
 			$newrules{$tempkey.'_hours'}=$env{'form.'.$tempkey.'_hours'};
 			$newrules{$tempkey.'_min'}=$env{'form.'.$tempkey.'_min'};
 			$newrules{$tempkey.'_sec'}=$env{'form.'.$tempkey.'_sec'};
 		    } else {
 			$newrules{$tempkey.'_value'}=$env{'form.'.$tempkey.'_value'};
+			$newrules{$tempkey.'_triggervalue'}=$env{'form.'.$tempkey.'_triggervalue'};
 		    }
 		} else {
 		    push(@delrules,$tempkey.'_action');
@@ -2655,7 +2661,8 @@
 	&Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs);
 	&resetrulescache();
     }
-    my %lt=&Apache::lonlocal::texthash('hours' => 'Hours',
+    my %lt=&Apache::lonlocal::texthash('days' => 'Days',
+				       'hours' => 'Hours',
 				       'min' => 'Minutes',
 				       'sec' => 'Seconds',
 				       'yes' => 'Yes',
@@ -2698,15 +2705,19 @@
 	    }
 	}
 	$r->print('</select>');
-
-
+	unless (&isdateparm($defkeytype{$tempkey})) {
+	    $r->print("\n<br />".&mt('Triggering value(s) of other parameter (optional, comma-separated):').
+		      '<input type="text" size="20" name="'.$tempkey.'_triggervalue" value="'.&rulescache($tempkey.'_triggervalue').'" />');
+	}
 	$r->print("\n</td><td>\n");
 
         if (&isdateparm($defkeytype{$tempkey})) {
+	    my $days=&rulescache($tempkey.'_days');
 	    my $hours=&rulescache($tempkey.'_hours');
 	    my $min=&rulescache($tempkey.'_min');
 	    my $sec=&rulescache($tempkey.'_sec');
 	    $r->print(<<ENDINPUTDATE);
+<input name="$tempkey\_days" type="text" size="4" value="$days" />$lt{'days'}<br />
 <input name="$tempkey\_hours" type="text" size="4" value="$hours" />$lt{'hours'}<br />
 <input name="$tempkey\_min" type="text" size="4" value="$min" />$lt{'min'}<br />
 <input name="$tempkey\_sec" type="text" size="4" value="$sec" />$lt{'sec'}