--- loncom/interface/londocs.pm 2004/02/05 15:19:41 1.103 +++ loncom/interface/londocs.pm 2004/02/11 00:10:01 1.104 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.103 2004/02/05 15:19:41 matthew Exp $ +# $Id: londocs.pm,v 1.104 2004/02/11 00:10:01 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,10 +68,13 @@ sub mapread { sub storemap { my ($coursenum,$coursedom,$map)=@_; - $hadchanges=1; - return + my ($outtext,$errtext)= &Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. $map,1); + if ($errtext) { return ($errtext,2); } + + $hadchanges=1; + return ($errtext,0); } # ----------------------------------------- Return hash with valid author names @@ -250,7 +253,7 @@ sub group_import { join ':', ($name, $url, $ext, 'normal', 'res'); } } - &storemap($coursenum, $coursedom, $folder.'.sequence'); + return &storemap($coursenum, $coursedom, $folder.'.sequence'); } sub editor { @@ -295,7 +298,12 @@ sub editor { $comment.':'.$url.':'.$ext.':normal:res'; $Apache::lonratedt::order[$#Apache::lonratedt::order+1]= $newidx; - &storemap($coursenum,$coursedom,$folder.'.sequence'); + + ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.sequence'); + if ($fatal) { + $r->print('

'.$errtext.'

'); + return; + } } } if ($ENV{'form.cmd'}) { @@ -335,7 +343,12 @@ sub editor { } # Store the changed version - &storemap($coursenum,$coursedom,$folder.'.sequence'); + ($errtext,$fatal)=&storemap($coursenum,$coursedom, + $folder.'.sequence'); + if ($fatal) { + $r->print('

'.$errtext.'

'); + return; + } } # Group import/search if ($ENV{'form.importdetail'}) { @@ -349,21 +362,30 @@ sub editor { } } # Store the changed version - group_import($coursenum, $coursedom, $folder, @imports); + ($errtext,$fatal)=group_import($coursenum, $coursedom, $folder, + @imports); + if ($fatal) { + $r->print('

'.$errtext.'

'); + return; + } } # Loading a complete map if (($ENV{'form.importmap'}) && ($ENV{'form.loadmap'})) { - foreach -(&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) { + foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) { my $idx=$#Apache::lonratedt::resources; $idx++; $Apache::lonratedt::resources[$idx]=$_; $Apache::lonratedt::order - [$#Apache::lonratedt::order+1]=$idx; - } + [$#Apache::lonratedt::order+1]=$idx; + } # Store the changed version - &storemap($coursenum,$coursedom,$folder.'.sequence'); + ($errtext,$fatal)=&storemap($coursenum,$coursedom, + $folder.'.sequence'); + if ($fatal) { + $r->print('

'.$errtext.'

'); + return; + } } } # ---------------------------------------------------------------- End commands