[LON-CAPA-cvs] cvs: rat / lonambiguous.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 20 Dec 2004 20:13:03 -0000


albertel		Mon Dec 20 15:13:03 2004 EDT

  Modified files:              
    /rat	lonambiguous.pm 
  Log:
  - if there is only one place to go, uh how about we just go to it?
  
  
Index: rat/lonambiguous.pm
diff -u rat/lonambiguous.pm:1.11 rat/lonambiguous.pm:1.12
--- rat/lonambiguous.pm:1.11	Fri Dec 17 17:40:24 2004
+++ rat/lonambiguous.pm	Mon Dec 20 15:13:03 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to resolve ambiguous file locations
 #
-# $Id: lonambiguous.pm,v 1.11 2004/12/17 22:40:24 albertel Exp $
+# $Id: lonambiguous.pm,v 1.12 2004/12/20 20:13:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -149,7 +149,6 @@
            return OK;
        }
     }
-
 # ------------------------------------------------ Would be standalone resource
 
    if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
@@ -173,6 +172,17 @@
 	 }
          if ($couldbe) {
             @possibilities=split(/\,/,$couldbe);
+	    if ($#possibilities==0) {
+		my $id=$possibilities[0];
+		my $resurl=$bighash{'src_'.$id};
+		my $mapurl=$bighash{'map_id_'.(split(/\./,$id))[0]};
+		my $symb=&make_symb($id);
+		$r->content_type('text/html');
+		&Apache::lonnet::logthis('http://'.$ENV{'HTTP_HOST'}.$resurl.'?symb='.$symb);
+		$r->header_out(Location => 
+			   'http://'.$ENV{'HTTP_HOST'}.$resurl.'?symb='.$symb);
+		return REDIRECT;
+	    }
             if ($#possibilities>0) {
 # ----------------------------------------------- Okay, really multiple choices
                $r->content_type('text/html');