version 1.29, 2005/02/17 09:09:57
|
version 1.31, 2005/06/08 15:18:28
|
Line 32 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 118 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 205 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 219 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 241 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 259 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 272 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 282 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); |