--- rat/lonratedt.pm 2002/08/31 00:42:30 1.34 +++ rat/lonratedt.pm 2002/10/11 14:00:42 1.38 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.34 2002/08/31 00:42:30 www Exp $ +# $Id: lonratedt.pm,v 1.38 2002/10/11 14:00:42 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -103,7 +103,12 @@ sub mapread { } } } - +# ---------------------------------------------- Did we just read an empty map? + if ($#resources<1) { + undef $resources[0]; + $resources[1]=':::start'; + $resources[2]=':::finish'; + } # -------------------------------------------------- This is a linear map, sort my $startidx=0; @@ -300,6 +305,7 @@ sub pastetarget { my $ext='false'; if ($url=~/^http\:\/\//) { $ext='true'; } $url=~s/\:/\:/g; + $name=~s/\:/\:/g; $resources[$idx]=$name.':'.$url.':'.$ext.':normal:res'; } } @@ -331,10 +337,16 @@ sub startfinish { sub storemap { my $realfn=shift; - my $fn=$realfn.'.tmp'; - unless (-e $fn) { - copy($realfn,$fn); + my $fn=$realfn; +# unless this is forced to work from the original file, use a temporary file +# instead + unless (shift) { + $fn=$realfn.'.tmp'; + unless (-e $fn) { + copy($realfn,$fn); + } } +# store data either into tmp or real file &startfinish(); my $output='graphdef<:>no'; my $k=1; @@ -474,10 +486,14 @@ sub smpedt { $targetmsg='Saving ...
'; copy($tmpfn,&Apache::lonnet::filelocation('',$url)); unlink($tmpfn); + my ($errtext,$fatal)= + &mapread(&Apache::lonnet::filelocation('',$url),''); } if ($ENV{'form.revert'}) { $targetmsg='Reverting ...
'; unlink($tmpfn); + my ($errtext,$fatal)= + &mapread(&Apache::lonnet::filelocation('',$url),''); } if (-e $tmpfn) { $targetmsg= @@ -700,6 +716,7 @@ sub smpedt { $targetdetail.='&'.&Apache::lonnet::escape($name).'='. &Apache::lonnet::escape($url); $idx++; + $name=~s/\:/\:/g; ''; } @order); @@ -736,16 +753,15 @@ sub smpedt { $bodytag $buttons $errtext -

$url

- + - +
Import
Temporary Assembly Workspace  Target
File: $url
- - + + after selected
@@ -759,9 +775,9 @@ value="Browse">
  +"javascript:impfortarget.value=1;groupsearch()" value="Search"> +"javascript:impfortarget.value=1;groupimport();" value="Import"> after selected
$targetmsg