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

www lon-capa-cvs@mail.lon-capa.org
Sat, 18 Jun 2005 17:23:26 -0000


www		Sat Jun 18 13:23:26 2005 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm lonparmset.pm 
  Log:
  Default now works for parameter window
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.108 loncom/interface/lonhtmlcommon.pm:1.109
--- loncom/interface/lonhtmlcommon.pm:1.108	Mon Jun 13 22:33:18 2005
+++ loncom/interface/lonhtmlcommon.pm	Sat Jun 18 13:23:25 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.108 2005/06/14 02:33:18 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.109 2005/06/18 17:23:25 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -513,11 +513,13 @@
 ##############################################
 sub pjump_javascript_definition {
     my $Str = <<END;
-    function pjump(type,dis,value,marker,ret,call) {
+    function pjump(type,dis,value,marker,ret,call,hour,min,sec) {
         parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
                  +"&value="+escape(value)+"&marker="+escape(marker)
                  +"&return="+escape(ret)
-                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
+                 +"&call="+escape(call)+"&name="+escape(dis)
+                 +"&defhour="+escape(hour)+"&defmin="+escape(min)
+                 +"&defsec="+escape(sec),"LONCAPAparms",
                  "height=350,width=350,scrollbars=no,menubar=no");
     }
 END
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.228 loncom/interface/lonparmset.pm:1.229
--- loncom/interface/lonparmset.pm:1.228	Sat Jun 18 10:39:24 2005
+++ loncom/interface/lonparmset.pm	Sat Jun 18 13:23:25 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.228 2005/06/18 14:39:24 www Exp $
+# $Id: lonparmset.pm,v 1.229 2005/06/18 17:23:25 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -260,6 +260,20 @@
     return $rules{$id};
 }
 
+sub preset_defaults {
+    my $type=shift;
+    if (&rulescache($type.'_action') eq 'default') {
+# yes, there is something
+	return (&rulescache($type.'_hours'),
+		&rulescache($type.'_min'),
+		&rulescache($type.'_sec'),
+		&rulescache($type.'_value'));
+    } else {
+# nothing there or something else
+	return ('','','','','');
+    }
+}
+
 ##################################################
 ##################################################
 #
@@ -510,11 +524,13 @@
             $winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]};
         }
     }
-
-
+    my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/);
+    &Apache::lonnet::logthis($marker.'-'.$parmname);
+    my ($hour,$min,$sec,$val)=&preset_defaults($parmname);
+    unless (defined($winvalue)) { $winvalue=$val; }
     return 
 	'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"
-	    .$marker."','".$return."','".$call."'".');">'.
+	    .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.
 		&valout($value,$type).'</a><a name="'.$marker.'"></a>';
 }