--- rat/lonratedt.pm 2002/05/13 21:26:05 1.15 +++ rat/lonratedt.pm 2002/05/14 15:19:13 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.15 2002/05/13 21:26:05 www Exp $ +# $Id: lonratedt.pm,v 1.16 2002/05/14 15:19:13 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -126,6 +126,48 @@ sub mapread { return $errtext; } +# ---------------------------------------------- Read a map as well as possible + +sub attemptread { + my $fn=shift; + + my @links; + undef @links; + my @theseres; + undef @theseres; + + my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,''); + if ($errtext) { return @theseres } + +# -------------------------------------------------------------------- Read map + foreach (split(/\<\&\>/,$outtext)) { + my ($command,$number,$content)=split(/\<\:\>/,$_); + if ($command eq 'objcont') { + $theseres[$number]=$content; + } + if ($command eq 'objlinks') { + $links[$number]=$content; + } + } + +# --------------------------------------------------------------- Sort, sort of + + my $startidx=0; + my $endidx=0; + for (my $i=0; $i<=$#theseres; $i++) { + if (defined($theseres[$i])) { + my ($title,$url,$ext,$type)=split(/\:/,$theseres[$i]); + if ($type eq 'start') { $startidx=$i; } + if ($type eq 'finish') { $endidx=$i; } + } + } + + + return @theseres; + +} + + # --------------------------------------------------------- Build up RAT screen sub ratedt { my ($r,$url)=@_; @@ -193,7 +235,7 @@ sub smpedt { my $importdetail=$ENV{'form.curimpdetail'}; # ---------------------------------------------------- Importing from groupsort - if ($ENV{'form.importdetail'}) { + if (($ENV{'form.importdetail'}) && (!$ENV{'form.impfortarget'})) { $importdetail=''; my @curimport=split(/\&/,$ENV{'form.curimpdetail'}); @@ -401,9 +443,17 @@ value="Browse"> +