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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 06 Apr 2007 21:22:25 -0000


albertel		Fri Apr  6 17:22:25 2007 EDT

  Modified files:              
    /loncom/homework	structuretags.pm bridgetask.pm 
  Log:
  - BUG#5167, if proctors is defined but doesn't contain any vlaid proctor definitions show an error message
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.374 loncom/homework/structuretags.pm:1.375
--- loncom/homework/structuretags.pm:1.374	Fri Feb 23 20:44:14 2007
+++ loncom/homework/structuretags.pm	Fri Apr  6 17:22:24 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.374 2007/02/24 01:44:14 albertel Exp $
+# $Id: structuretags.pm,v 1.375 2007/04/06 21:22:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -739,7 +739,8 @@
 	    my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
 						       $style);
 	    if ($target eq 'web') {
-		$result .= &Apache::bridgetask::proctor_validation_screen();
+		$result .= 
+		    &Apache::bridgetask::proctor_validation_screen($slot);
 	    } elsif ($target eq 'grade') {
 		&Apache::bridgetask::proctor_check_auth($slot_name,$slot,
 							'problem');
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.229 loncom/homework/bridgetask.pm:1.230
--- loncom/homework/bridgetask.pm:1.229	Mon Mar 26 18:37:42 2007
+++ loncom/homework/bridgetask.pm	Fri Apr  6 17:22:24 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.229 2007/03/26 22:37:42 albertel Exp $
+# $Id: bridgetask.pm,v 1.230 2007/04/06 21:22:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,7 +38,6 @@
 use Apache::lonxml;
 use Apache::slotrequest();
 use Time::HiRes qw( gettimeofday tv_interval );
-use lib '/home/httpd/lib/perl/';
 use LONCAPA;
  
 
@@ -3015,13 +3014,35 @@
     my ($slot) = @_;
     my (undef,undef,$domain,$user) = &Apache::lonnet::whichuser();
     my $url=&Apache::lonnet::studentphoto($domain,$user,'jpg');
+    if ($url ne '/adm/lonKaputt/lonlogo_broken.gif') {
+	$url = "<tr><td colspan=\"2\"><img src=\"$url\" /></td></tr>";
+    } else {
+	undef($url);
+    }
+
     my $name=&Apache::loncommon::plainname($user,$domain);
     
     my $msg;
     if ($env{'form.proctorpassword'}) {
-	$msg='<p><font color="red">'.&mt("Failed to authenticate the proctor.")
-	    .'</font></p>';
+	$msg.='<p><span class="LC_warning">'
+	    .&mt("Failed to authenticate the proctor.")
+	    .'</span></p>';
     }
+
+    my $valid;
+    my @possible_proctors=split(",",$slot->{'proctor'});
+    foreach my $proctor (@possible_proctors) {
+	if ($proctor =~ /$LONCAPA::username_re:$LONCAPA::domain_re/) {
+	    $valid = 1;
+	    last;
+	}
+    }
+    if (!$valid) {
+	$msg.='<p><span class="LC_error">'
+	    .&mt("No valid poctors are defined.")
+	    .'</span></p>';
+    }
+    
     if (!$env{'form.proctordomain'}) { $env{'form.proctordomain'}=$domain; }
     my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
     $uri = &HTML::Entities::encode($uri,'<>&"');
@@ -3045,7 +3066,7 @@
       <tr><td>Name:</td><td>$name</td></tr>
       <tr><td>Student ID:</td><td>$env{'environment.id'}</td></tr>
       <tr><td>Usename</td><td>$user:$domain</td></tr>
-      <tr><td colspan="2"><img src="$url" /></td></tr>
+      $url
     </table>
   </tr></td>
 </table>