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

raeburn raeburn at source.lon-capa.org
Mon Feb 18 08:25:49 EST 2019


raeburn		Mon Feb 18 13:25:49 2019 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - For string-type parameters in table mode, when the suggested value for an 
    unset parameter is based on the value recently set for the same parameter 
    type, include specialized string types.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.588 loncom/interface/lonparmset.pm:1.589
--- loncom/interface/lonparmset.pm:1.588	Sun Jan  6 15:27:48 2019
+++ loncom/interface/lonparmset.pm	Mon Feb 18 13:25:49 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.588 2019/01/06 15:27:48 raeburn Exp $
+# $Id: lonparmset.pm,v 1.589 2019/02/18 13:25:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1071,7 +1071,7 @@
     my ($type,$dis,$value,$marker,$return,$call,$recursive,$extra)=@_;
     my $winvalue=$value;
     unless ($winvalue) {
-        if (&isdateparm($type)) {
+        if ((&isdateparm($type) || (&is_specialstring($type))) {
             $winvalue=$env{'form.recent_'.$type};
         } else {
             $winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]};
@@ -1108,12 +1108,14 @@
     $pjump_def
 
     function psub() {
+        var specstring = /^string_/i;
         if (document.parmform.pres_marker.value!='') {
             document.parmform.action+='#'+document.parmform.pres_marker.value;
             var typedef=new Array();
             typedef=document.parmform.pres_type.value.split('_');
             if (document.parmform.pres_type.value!='') {
-                if (typedef[0]=='date') {
+                if ((typedef[0]=='date') || 
+                    (specstring.test(document.parmform.pres_type.value) && (typedef[1]!='yesno')))  {
                     eval('document.parmform.recent_'+
                         document.parmform.pres_type.value+
                         '.value=document.parmform.pres_value.value;');
@@ -2062,6 +2064,14 @@
     return (($type=~/^date/) && (!($type eq 'date_interval')));
 }
 
+# Determine if parameter type is specialized string type (i.e.,
+# not just string or string_yesno.  
+
+sub is_specialstring {
+    my $type=shift;
+    return (($type=~/^string_/) && ((!$type ne 'string_yesno')));
+}
+
 # Prints the HTML and Javascript to select parameters, with various shortcuts.
 #
 # @param {Apache2::RequestRec} $r - the Apache request
@@ -3268,7 +3278,10 @@
     &startpage($r,$pssymb,$crstype);
 
     foreach my $item ('tolerance','date_default','date_start','date_end',
-            'date_interval','int','float','string') {
+            'date_interval','int','float','string','string_lenient',
+            'string_examcode','string_deeplink','string_discussvote',
+            'string_useslots','string_problemstatus','string_ip',
+            'string_questiontype') {
         $r->print('<input type="hidden" value="'.
             &HTML::Entities::encode($env{'form.recent_'.$item},'"&<>').
             '" name="recent_'.$item.'" />');




More information about the LON-CAPA-cvs mailing list