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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 12 May 2006 05:12:27 -0000


albertel		Fri May 12 01:12:27 2006 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
  Log:
  - remove 'Request another attmpt button' from the non-slot based acces mode
  - Improve error message if yuser some how requests a new from a resource that is not a slto based access mechanism
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.60 loncom/interface/slotrequest.pm:1.61
--- loncom/interface/slotrequest.pm:1.60	Thu May 11 21:20:31 2006
+++ loncom/interface/slotrequest.pm	Fri May 12 01:12:27 2006
@@ -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.60 2006/05/12 01:20:31 albertel Exp $
+# $Id: slotrequest.pm,v 1.61 2006/05/12 05:12:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -41,7 +41,8 @@
     my ($r,$code)=@_;
     if ($code eq 'not_valid') {
 	$r->print('<p>'.&mt('Unable to understand what resource you wanted to sign up for.').'</p>');
-
+    } elsif ($code eq 'not_available') {
+	$r->print('<p>'.&mt('No slots are available.').'</p>');
     } elsif ($code eq 'not_allowed') {
 	$r->print('<p>'.&mt('Not allowed to sign up or change reservations at this time.').'</p>');
     } else {
@@ -1550,10 +1551,14 @@
 	}
     } else {
 	my $symb=&Apache::lonnet::unescape($env{'form.symb'});
+	if (!defined($symb)) {
+	    &fail($r,'not_valid');
+	    return OK;
+	}
 	my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb);
 	my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb);
 	if ($useslots ne 'resource' && $useslots ne 'map') {
-	    &fail($r,'not_valid');
+	    &fail($r,'not_available');
 	    return OK;
 	}
 	$env{'request.symb'}=$symb;