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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 21 Sep 2007 22:37:26 -0000


albertel		Fri Sep 21 18:37:26 2007 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
  Log:
  - map and map_map reservations store the map as their symb of the
    reservation occurred for, need to fetch a symb for a resource in the map
    to remove the parameter
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.79 loncom/interface/slotrequest.pm:1.80
--- loncom/interface/slotrequest.pm:1.79	Wed Apr 11 17:49:02 2007
+++ loncom/interface/slotrequest.pm	Fri Sep 21 18:37:23 2007
@@ -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.79 2007/04/11 21:49:02 albertel Exp $
+# $Id: slotrequest.pm,v 1.80 2007/09/21 22:37:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -241,7 +241,8 @@
 				   $env{'user.domain'},$env{'user.name'});
     &Apache::lonxml::debug("value is  $value<br />");
 
-    my $use_slots = &Apache::lonnet::EXT("resource.0.useslots");
+    my $use_slots = &Apache::lonnet::EXT("resource.0.useslots",$symb,
+					 $env{'user.domain'},$env{'user.name'});
     &Apache::lonxml::debug("use_slots is  $use_slots<br />");
 
     if (&Apache::lonnet::error($value) 
@@ -459,6 +460,18 @@
 	    return (0,&mt('Not allowed to release Reservation: [_1], as it has already ended.',$description));
 	}
     }
+
+    # if the reservation symb is for a map get a resource in that map
+    # to check slot parameters on
+    my $navmap=Apache::lonnavmaps::navmap->new;
+    my $passed_resource = $navmap->getBySymb($symb);
+    if ($passed_resource->is_map()) {
+	my ($a_resource) = 
+	    $navmap->retrieveResources($passed_resource, 
+				       sub {$_[0]->is_problem()},0,1);
+	$symb = $a_resource->symb();
+    }
+
     # get parameter string, check for existance, rebuild string with the slot
     my @slots = split(/:/,&Apache::lonnet::EXT("resource.0.availablestudent",
 					       $symb,$udom,$uname));
@@ -482,7 +495,8 @@
 	}
     }
 
-    my $use_slots = &Apache::lonnet::EXT("resource.0.useslots");
+    my $use_slots = &Apache::lonnet::EXT("resource.0.useslots",
+					 $symb,$udom,$uname);
     &Apache::lonxml::debug("use_slots is  $use_slots<br />");
 
     if (&Apache::lonnet::error($use_slots)) {