[LON-CAPA-cvs] cvs: loncom /html/adm/helper parameter.helper /interface lonhelper.pm

raeburn raeburn at source.lon-capa.org
Sat Mar 5 16:49:53 EST 2016


raeburn		Sat Mar  5 21:49:53 2016 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm 
    /loncom/html/adm/helper	parameter.helper 
  Log:
  - Bug 4373. 
    Parameter helper can set map-level parameters which apply recursively to
    subfolders.
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.197 loncom/interface/lonhelper.pm:1.198
--- loncom/interface/lonhelper.pm:1.197	Fri Aug 28 22:44:59 2015
+++ loncom/interface/lonhelper.pm	Sat Mar  5 21:49:44 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.197 2015/08/28 22:44:59 raeburn Exp $
+# $Id: lonhelper.pm,v 1.198 2016/03/05 21:49:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3826,38 +3826,54 @@
     if ($vars->{GRANULARITY} eq 'whole_course') {
         $resourceString .= '<li>'.&mt('for [_1]all resources in the course[_2]','<b>','</b>').'</li>';
 	if ($vars->{TARGETS} eq 'course') {
-	    $level = 14; # general course, see lonparmset.pm perldoc
+	    $level = 18; # general course, see lonparmset.pm perldoc
 	} elsif ($vars->{TARGETS} eq 'section') {
-	    $level = 9;
+	    $level = 12;
 	} elsif ($vars->{TARGETS} eq 'group') {
-	    $level = 6;
+	    $level = 8;
 	} else {
-	    $level = 3;
+	    $level = 4;
 	}
         $affectedResourceId = "0.0";
         $symb = 'a';
         $paramlevel = 'general';
-    } elsif ($vars->{GRANULARITY} eq 'map') {
+    } elsif (($vars->{GRANULARITY} eq 'map') || ($vars->{GRANULARITY} eq 'maprecurse')) {
         my $navmap = Apache::lonnavmaps::navmap->new();
         if (defined($navmap)) {
              my $res = $navmap->getByMapPc($vars->{RESOURCE_ID});
              my $title = $res->compTitle();
              $symb = $res->symb();
-             $resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>';
+             if ($vars->{GRANULARITY} eq 'map') {
+                 $resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>';
+             } else {
+                 $resourceString .= '<li>'.&mt('for the map named [_1] (applies recursively to sub-folders)',"<b>$title</b>").'</li>';
+             }
         } else {
             $resourceString .= '<li>'.&mt('for the map ID [_1] (name unavailable)','<b>'.$vars->{RESOURCE_ID}.'</b>').'</li>';
             &Apache::lonnet::logthis('Retrieval of map title failed in lonhelper.pm - could not create navmap object for course.');
 
         }
-	if ($vars->{TARGETS} eq 'course') {
-	    $level = 13; # general course, see lonparmset.pm perldoc
-	} elsif ($vars->{TARGETS} eq 'section') {
-	    $level = 8;
-	} elsif ($vars->{TARGETS} eq 'group') {
-	    $level = 5;
-	} else {
-	    $level = 2;
-	}
+        if ($vars->{GRANULARITY} eq 'maprecurse') {
+            if ($vars->{TARGETS} eq 'course') {
+                $level = 17; # general course, see lonparmset.pm perldoc
+            } elsif ($vars->{TARGETS} eq 'section') {
+                $level = 11;
+            } elsif ($vars->{TARGETS} eq 'group') {
+                $level = 7;
+            } else {
+                $level = 3;
+            }
+        } else {
+	    if ($vars->{TARGETS} eq 'course') {
+	        $level = 16; # general course, see lonparmset.pm perldoc
+	    } elsif ($vars->{TARGETS} eq 'section') {
+	        $level = 10;
+	    } elsif ($vars->{TARGETS} eq 'group') {
+	        $level = 6;
+	    } else {
+	        $level = 2;
+	    }
+        }
         $affectedResourceId = $vars->{RESOURCE_ID};
         $paramlevel = 'map';
     } else {
@@ -3874,11 +3890,11 @@
             &Apache::lonnet::logthis('Retrieval of resource title failed in lonhelper.pm - could not create navmap object for course.');
         }
 	if ($vars->{TARGETS} eq 'course') {
-	    $level = 10; # general course, see lonparmset.pm perldoc
+	    $level = 13; # general course, see lonparmset.pm perldoc
 	} elsif ($vars->{TARGETS} eq 'section') {
-	    $level = 7;
+	    $level = 9;
 	} elsif ($vars->{TARGETS} eq 'group') {
-	    $level = 4;
+	    $level = 5;
 	} else {
 	    $level = 1;
 	}
@@ -3894,7 +3910,7 @@
     if ($vars->{GRANULARITY} eq 'resource') {
 	$result .= "<input type='hidden' name='symb' value='".
 	    HTML::Entities::encode($symb,"'<>&\"") . "' />\n";
-    } elsif ($vars->{GRANULARITY} eq 'map') {
+    } elsif (($vars->{GRANULARITY} eq 'map') || ($vars->{GRANULARITY} eq 'maprecurse')) {
 	$result .= "<input type='hidden' name='pschp' value='".
 	    $affectedResourceId."' />\n";
     }
Index: loncom/html/adm/helper/parameter.helper
diff -u loncom/html/adm/helper/parameter.helper:1.22 loncom/html/adm/helper/parameter.helper:1.23
--- loncom/html/adm/helper/parameter.helper:1.22	Fri Aug 28 22:45:11 2015
+++ loncom/html/adm/helper/parameter.helper	Sat Mar  5 21:49:52 2016
@@ -53,6 +53,13 @@
       <choice computer="whole_course" nextstate="CHOOSE_ACTION">
         Course default for all problems
         </choice>
+     <condition>
+        <clause>return 1 if (&Apache::lonnet::get_server_loncaparev($env{'course.'.$env{'request.course.id'}.'.home'}) >= 2.12)</clause>
+        <choice computer="maprecurse" nextstate="CHOOSE_FOLDER">
+        Every problem in a particular folder and (recursively) for sub-folders 
+        (overrides course default)
+        </choice>
+      <condition>
       <choice computer="map" nextstate="CHOOSE_FOLDER">
         Every problem in a particular folder (overrides course default)
         </choice>




More information about the LON-CAPA-cvs mailing list