[LON-CAPA-cvs] cvs: rat / lonratsrv.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 23 Apr 2004 19:59:01 -0000
www Fri Apr 23 15:59:01 2004 EDT
Modified files:
/rat lonratsrv.pm
Log:
Hopefully fixing bug #2942 in a better way.
Index: rat/lonratsrv.pm
diff -u rat/lonratsrv.pm:1.27 rat/lonratsrv.pm:1.28
--- rat/lonratsrv.pm:1.27 Fri Apr 23 13:30:33 2004
+++ rat/lonratsrv.pm Fri Apr 23 15:59:01 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Server for RAT Maps
#
-# $Id: lonratsrv.pm,v 1.27 2004/04/23 17:30:33 www Exp $
+# $Id: lonratsrv.pm,v 1.28 2004/04/23 19:59:01 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,7 +25,13 @@
#
# http://www.lon-capa.org/
#
-
+# (Edit Handler for RAT Maps
+# (TeX Content Handler
+#
+# 05/29/00,05/30 Gerd Kortemeyer)
+# 7/1 Gerd Kortemeyer)
+# 7/1,7/3,7/4,7/7,7/8,7/10,7/26,10/2 Gerd Kortemeyer
+# 5/3,06/25,07/03,07/04,07/05 Gerd Kortemeyer
package Apache::lonratsrv;
@@ -60,7 +66,8 @@
# --------------------------------------------------------- Loads map from disk
sub loadmap {
- my ($fn,$errtext)=@_;
+ my ($fn,$errtext,$infotext)=@_;
+ if ($errtext) { return('',$errtext); }
my $outstr='';
my @obj=();
my @links=();
@@ -190,7 +197,7 @@
} else {
$errtext.='Map not loaded: The file does not exist. ';
}
- return($outstr,$errtext);
+ return($outstr,$errtext,$infotext);
}
@@ -198,6 +205,7 @@
sub savemap {
my ($fn,$errtext)=@_;
+ my $infotext='';
my %alltypes;
my %allvalues;
if (($fn=~/\.sequence(\.tmp)*$/) ||
@@ -298,7 +306,7 @@
my $fh;
if ($fh=Apache::File->new(">$fn")) {
print $fh $outstr;
- $errtext.="Map saved as $fn. ";
+ $infotext.="Map saved as $fn. ";
} else {
$errtext.='Could not write file '.$fn.'. Map not saved. ';
}
@@ -307,7 +315,7 @@
# -------------------------------------------- Cannot write to that file, error
$errtext.='Map not saved: The specified path does not exist. ';
}
- return $errtext;
+ return ($errtext,$infotext);
}
# ================================================================ Main Handler
@@ -334,12 +342,13 @@
$fn=~s|/[^/]*/ratserver$||;
}
my $errtext='';
+ my $infotext='';
my $outtext='';
if ($mode ne 'loadonly') {
- $errtext=&savemap($fn,$errtext);
+ ($errtext,$infotext)=&savemap($fn,$errtext);
}
- ($outtext,$errtext)=&loadmap($fn,$errtext);
+ ($outtext,$errtext,$infotext)=&loadmap($fn,$errtext,$infotext);
$r->print(<<ENDDOCUMENT);
<html>
@@ -351,10 +360,10 @@
parent.flag=1;
</script>
ENDDOCUMENT
- if ($errtext ne '') {
+ if (($errtext ne '') || ($infotext ne '')) {
$r->print(<<ENDSCRIPT);
<script>
- alert("$errtext");
+ alert("$infotext $errtext");
</script>
ENDSCRIPT
}