--- rat/lonambiguous.pm 2002/11/06 22:51:51 1.7 +++ rat/lonambiguous.pm 2003/04/12 15:43:58 1.9 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to resolve ambiguous file locations # -# $Id: lonambiguous.pm,v 1.7 2002/11/06 22:51:51 albertel Exp $ +# $Id: lonambiguous.pm,v 1.9 2003/04/12 15:43:58 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,7 +37,18 @@ use strict; use Apache::lonnet; use Apache::Constants qw(:common REDIRECT); use GDBM_File; +use Apache::loncommon; +my %bighash; + +sub cleanup { + if (tied(%bighash)){ + &Apache::lonnet::logthis('Cleanup ambiguous: bighash'); + unless (untie(%bighash)) { + &Apache::lonnet::logthis('Failed cleanup ambiguous: bighash'); + } + } +} # ----------------------------------------------------------- Could not resolve @@ -46,8 +57,9 @@ sub getlost { $r->content_type('text/html'); $r->send_http_header; $r->print( - 'Unknown Error

'. - 'LON-CAPA

Could not handle ambiguous resource reference.

'.$errmsg. + 'Unknown Error'. + &Apache::loncommon::bodytag('Could not handle ambiguous resource reference'). + $errmsg. ''); } @@ -63,9 +75,7 @@ sub handler { } # ---------------------------------------------------------- Is this selecting? - - my %bighash; - + if ($ENV{'form.selecturl'}) { my $envkey; if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', @@ -154,10 +164,11 @@ sub handler { # ----------------------------------------------- Okay, really multiple choices $r->content_type('text/html'); $r->send_http_header; + my $bodytag= + &Apache::loncommon::bodytag('Pick Instance of Resource'); $r->print(<Choose Location - -

LON-CAPA

+$bodytag The resource you had been accessing appears more than once in this course, and LON-CAPA has insufficient session information to determine which instance of the resource you meant. @@ -175,8 +186,10 @@ ENDSTART $r->print(''.$bighash{'title_'.$_}. ''.$bighash{'type_'.$_}. - ''.$mapurl. - ''); + ''. + ($mapurl=~/^\/uploaded\//?'':''). + &Apache::lonnet::gettitle($mapurl).' '. + ($mapurl=~/^\/uploaded\//?'':'').''); } @possibilities; $r->print(''); untie(%bighash);