version 1.28, 2004/04/23 19:59:01
|
version 1.31, 2005/06/08 15:18:28
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# 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; |
package Apache::lonratsrv; |
|
|
Line 39 use strict;
|
Line 32 use strict;
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::File; |
use Apache::File; |
use HTML::TokeParser; |
use HTML::TokeParser; |
|
use Apache::lonnet; |
|
|
# ------------------------------------------------------------- From RAT to XML |
# ------------------------------------------------------------- From RAT to XML |
|
|
Line 125 sub loadmap {
|
Line 118 sub loadmap {
|
} else { |
} else { |
$outstr.='normal:'; |
$outstr.='normal:'; |
} |
} |
$outstr.='res'; |
if ($token->[2]->{'type'} ne 'zombie') { |
|
$outstr.='res'; |
|
} else { |
|
$outstr.='zombie'; |
|
} |
} elsif ($token->[1] eq 'condition') { |
} elsif ($token->[1] eq 'condition') { |
# ------------------------------------------------------------------- Condition |
# ------------------------------------------------------------------- Condition |
$outstr.='<&>objcont'; |
$outstr.='<&>objcont'; |
Line 212 sub savemap {
|
Line 209 sub savemap {
|
($fn=~/\.page(\.tmp)*$/)) { |
($fn=~/\.page(\.tmp)*$/)) { |
|
|
# ------------------------------------------------------------- Deal with input |
# ------------------------------------------------------------- Deal with input |
my @tags=split(/<&>/,$ENV{'form.output'}); |
my @tags=split(/<&>/,$env{'form.output'}); |
my $outstr=''; |
my $outstr=''; |
my $graphdef=0; |
my $graphdef=0; |
if ($tags[0] eq 'graphdef<:>yes') { |
if ($tags[0] eq 'graphdef<:>yes') { |
Line 226 sub savemap {
|
Line 223 sub savemap {
|
if ($parts[0] eq 'objcont') { |
if ($parts[0] eq 'objcont') { |
my @comp=split(/:/,$parts[$#parts]); |
my @comp=split(/:/,$parts[$#parts]); |
# --------------------------------------------------------------- Logical input |
# --------------------------------------------------------------- Logical input |
if ($comp[$#comp] eq 'res') { |
if (($comp[$#comp] eq 'res') || ($comp[$#comp] eq 'zombie')) { |
$comp[0]=qtescape($comp[0]); |
$comp[0]=qtescape($comp[0]); |
$comp[1]=qtescape($comp[1]); |
$comp[1]=qtescape($comp[1]); |
if ($comp[2] eq 'true') { |
if ($comp[2] eq 'true') { |
Line 248 sub savemap {
|
Line 245 sub savemap {
|
if ($comp[0] ne '') { |
if ($comp[0] ne '') { |
$outstr.=' title="'.$comp[0].'"'; |
$outstr.=' title="'.$comp[0].'"'; |
} |
} |
$outstr.="></resource>\n"; |
$outstr.=" />\n"; |
} elsif ($comp[$#comp] eq 'cond') { |
} elsif ($comp[$#comp] eq 'cond') { |
$outstr.='<condition id="'.$parts[1].'"'; |
$outstr.='<condition id="'.$parts[1].'"'; |
if (($comp[1] ne '') && ($comp[1] ne 'normal')) { |
if (($comp[1] ne '') && ($comp[1] ne 'normal')) { |
$outstr.=' type="'.$comp[1].'"'; |
$outstr.=' type="'.$comp[1].'"'; |
} |
} |
$outstr.=' value="'.qtescape($comp[0]).'"'; |
$outstr.=' value="'.qtescape($comp[0]).'"'; |
$outstr.="></condition>\n"; |
$outstr.=" />\n"; |
} |
} |
} elsif ($parts[0] eq 'objlinks') { |
} elsif ($parts[0] eq 'objlinks') { |
my @comp=split(/:/,$parts[$#parts]); |
my @comp=split(/:/,$parts[$#parts]); |
Line 266 sub savemap {
|
Line 263 sub savemap {
|
$outstr.=' condition="'.$comp[2].'"'; |
$outstr.=' condition="'.$comp[2].'"'; |
} |
} |
$outstr.=' index="'.$parts[1].'"'; |
$outstr.=' index="'.$parts[1].'"'; |
$outstr.="></link>\n"; |
$outstr.=" />\n"; |
} elsif ($parts[0] eq 'objparms') { |
} elsif ($parts[0] eq 'objparms') { |
undef %alltypes; |
undef %alltypes; |
undef %allvalues; |
undef %allvalues; |
Line 279 sub savemap {
|
Line 276 sub savemap {
|
if ($allvalues{$_} ne '') { |
if ($allvalues{$_} ne '') { |
$outstr.='<param to="'.$parts[1].'" type="' |
$outstr.='<param to="'.$parts[1].'" type="' |
.$alltypes{$_}.'" name="'.$_ |
.$alltypes{$_}.'" name="'.$_ |
.'" value="'.$allvalues{$_}.'">' |
.'" value="'.$allvalues{$_}.'" />' |
."</param>\n"; |
."\n"; |
} |
} |
} |
} |
} elsif (($parts[0] ne '') && ($graphdef)) { |
} elsif (($parts[0] ne '') && ($graphdef)) { |
Line 289 sub savemap {
|
Line 286 sub savemap {
|
if ($#parts==2) { |
if ($#parts==2) { |
$outstr.=' index="'.$parts[1].'"'; |
$outstr.=' index="'.$parts[1].'"'; |
} |
} |
$outstr.=' value="'.qtescape($parts[$#parts]).'"></'. |
$outstr.=' value="'.qtescape($parts[$#parts]).'" />'."\n"; |
$parts[0].">\n"; |
|
} |
} |
} |
} |
$outstr.="</map>\n"; |
$outstr.="</map>\n"; |
if ($fn=~/^\/*uploaded\/(\w+)\/(\w+)\/(.*)$/) { |
if ($fn=~/^\/*uploaded\/(\w+)\/(\w+)\/(.*)$/) { |
$ENV{'form.output'}=$outstr; |
$env{'form.output'}=$outstr; |
my $home=&Apache::lonnet::homeserver($2,$1); |
my $home=&Apache::lonnet::homeserver($2,$1); |
my $result=&Apache::lonnet::finishuserfileupload($2,$1,$home, |
my $result=&Apache::lonnet::finishuserfileupload($2,$1,$home, |
'output',$3); |
'output',$3); |
Line 322 sub savemap {
|
Line 318 sub savemap {
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
return OK if $r->header_only; |
return OK if $r->header_only; |