[LON-CAPA-cvs] cvs: loncom /html/adm/helper newslot.helper /interface slotrequest.pm

raeburn raeburn at source.lon-capa.org
Wed Sep 23 19:05:04 EDT 2015


raeburn		Wed Sep 23 23:05:04 2015 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
    /loncom/html/adm/helper	newslot.helper 
  Log:
  - Usage restriction for slot can be for a .sequence or .page, in which case
    the slot may be used for all resources within that map.
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.125 loncom/interface/slotrequest.pm:1.126
--- loncom/interface/slotrequest.pm:1.125	Wed Sep 23 20:09:07 2015
+++ loncom/interface/slotrequest.pm	Wed Sep 23 23:04:53 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for requesting to have slots added to a students record
 #
-# $Id: slotrequest.pm,v 1.125 2015/09/23 20:09:07 raeburn Exp $
+# $Id: slotrequest.pm,v 1.126 2015/09/23 23:04:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1000,10 +1000,21 @@
     return 0 if (!$userallowed);
 
     # not allowed for this resource
-    if (defined($slot->{'symb'})
-	&& $slot->{'symb'} ne $symb) {
-        unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) {
-	    return 0;
+    if (defined($slot->{'symb'})) {
+        my $exclude = 1;
+        my ($slotmap,$slotid,$sloturl) = &Apache::lonnet::decode_symb($slot->{'symb'});
+        if ($sloturl=~/\.(page|sequence)$/) {
+            my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb);
+            if (($map ne '') && ($map eq $slotmap)) {
+                $exclude = 0;
+            }
+        } elsif ($slot->{'symb'} eq $symb) {
+            $exclude = 0;
+        }
+        if ($exclude) {
+            unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) {
+	        return 0;
+            }
         }
     }
 
@@ -1349,7 +1360,7 @@
 	     'secret'          => 'Secret Word',
 	     'space'           => '# of students/max',
 	     'ip'              => 'IP or DNS restrictions',
-	     'symb'            => 'Resource slot is restricted to.',
+	     'symb'            => 'Resource/Map slot is restricted to.',
 	     'allowedsections' => 'Sections slot is restricted to.',
 	     'allowedusers'    => 'Users slot is restricted to.',
 	     'uniqueperiod'    => 'Period of time slot is unique',
@@ -2672,7 +2683,7 @@
 	    ['proctor','List of proctor ids'],
 	    ['description','Slot Description'],
 	    ['maxspace','Maximum number of reservations'],
-	    ['symb','Resource Restriction'],
+	    ['symb','Resource/Map Restriction'],
 	    ['uniqueperiod','Date range of slot exclusion'],
 	    ['secret','Secret word proctor uses to validate'],
 	    ['allowedsections','Sections slot is restricted to'],
Index: loncom/html/adm/helper/newslot.helper
diff -u loncom/html/adm/helper/newslot.helper:1.30 loncom/html/adm/helper/newslot.helper:1.31
--- loncom/html/adm/helper/newslot.helper:1.30	Wed Jul 24 18:21:46 2013
+++ loncom/html/adm/helper/newslot.helper	Wed Sep 23 23:05:04 2015
@@ -220,11 +220,19 @@
 
     <choices variable="restricttosymb">
       <choice nextstate="PROCTOR" computer='any'>usable for any resource.</choice>
+      <choice nextstate="MAPSELECT" computer='map'>restricted to resources in a specific folder/composite page.</choice>
       <choice nextstate="RESOURCESELECT" computer='resource'>restricted to a specific resource.</choice>
       <defaultvalue>
         my $default=&{$helper->{DATA}{origslot}}('symb');
-        if ($default) { return 'resource'; }
-        return 'any';
+        if ($default) {
+            if ($default =~ /\.(page|sequence)$/) {
+                return 'map';
+            } else {
+                return 'resource';
+            }
+        } else {
+            return 'any';
+        }
       </defaultvalue>
     </choices>
     
@@ -256,6 +264,18 @@
     </resource>    
   </state>
 
+  <state name="MAPSELECT" title="Specify Optional Attributes">
+
+    <nextstate>PROCTOR</nextstate>
+
+    <resource variable="symb">
+      <filterfunc>return $res->is_map()</filterfunc>
+      <valuefunc>return $res->symb()</valuefunc>
+      <defaultvalue>
+        return &{$helper->{DATA}{origslot}}('symb');
+      </defaultvalue>
+    </resource>
+  </state>
 
   <state name="PROCTOR" title="Specify Proctors"
 	 help="Slot_SpecifyProctors">




More information about the LON-CAPA-cvs mailing list