[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm

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


albertel		Fri May 12 01:18:38 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - don't emit the 'request another attempt' button in a non slot environment
  - acess the correct starttime for slot versus non-slot access
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.148 loncom/homework/bridgetask.pm:1.149
--- loncom/homework/bridgetask.pm:1.148	Fri May 12 00:32:58 2006
+++ loncom/homework/bridgetask.pm	Fri May 12 01:18:34 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.148 2006/05/12 04:32:58 albertel Exp $
+# $Id: bridgetask.pm,v 1.149 2006/05/12 05:18:34 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -223,6 +223,12 @@
     if (!$text) { $text="Request another attempt"; }
     my $result;
     my $symb=&Apache::lonnet::symbread();
+    # not a slot access based resource
+    my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb);
+    if ($useslots =~ /^\s*no\s*$/i) {
+	return '';
+    }
+
     my ($slot_name,$slot)=&Apache::slotrequest::check_for_reservation($symb);
     my $action='get_reservation';
     if ($slot_name) {
@@ -807,11 +813,19 @@
 		    my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"};
 		    my $title=&Apache::lonnet::gettitle();
 
+		    my $start_time;
+
 		    my $slot_name=
 			$Apache::lonhomework::history{"resource.$version.0.checkedin.slot"};
-		    my %slot=&Apache::lonnet::get_slot($slot_name);
-		    my $start_time=
-			&Apache::lonlocal::locallocaltime($slot{'starttime'});
+		    if ($slot_name) {
+			my %slot=&Apache::lonnet::get_slot($slot_name);
+
+			$start_time=$slot{'starttime'}
+		    } else {
+			$start_time= 
+			    &Apache::lonnet::EXT('resource.0.opendate');
+		    }
+		    $start_time=&Apache::lonlocal::locallocaltime($start_time);
 
 		    my $status = "\n<div class='LC_$bt_status LC_criteria'>\n";
 		    
@@ -848,8 +862,6 @@
 		    my $internal_location=&internal_location();
 		    $result=~s/\Q$internal_location\E/$status/;
 		}
-	    } 
-	    if ($target eq 'web') {
 		$result.="\n</div>\n".
 		    &Apache::loncommon::end_page({'discussion' => 1});
 	    }