version 1.34, 2005/06/10 02:19:51
|
version 1.35, 2005/06/10 15:17:35
|
Line 200 sub cleanup {
|
Line 200 sub cleanup {
|
# -------------------------------------------------------------- Read from file |
# -------------------------------------------------------------- Read from file |
|
|
sub readfromfile { |
sub readfromfile { |
my ($r,$shash,$thash)=@_; |
my ($r,$shash,$thash,$nhash)=@_; |
my $cont=&Apache::lonnet::getfile |
my $cont=&Apache::lonnet::getfile |
(&Apache::lonnet::filelocation('',$env{'form.readfile'})); |
(&Apache::lonnet::filelocation('',$env{'form.readfile'})); |
if ($cont==-1) { |
if ($cont==-1) { |
Line 209 sub readfromfile {
|
Line 209 sub readfromfile {
|
} else { |
} else { |
my $parser = HTML::TokeParser->new(\$cont); |
my $parser = HTML::TokeParser->new(\$cont); |
my $token; |
my $token; |
|
my $n=1; |
while ($token = $parser->get_token) { |
while ($token = $parser->get_token) { |
if ($token->[0] eq 'S') { |
if ($token->[0] eq 'S') { |
if ($token->[1] eq 'resource') { |
if ($token->[1] eq 'resource') { |
Line 217 sub readfromfile {
|
Line 218 sub readfromfile {
|
} else { |
} else { |
if ($token->[2]->{'type'} eq 'zombie') { next; } |
if ($token->[2]->{'type'} eq 'zombie') { next; } |
} |
} |
my $name=$token->[2]->{'title'}; |
|
my $url=$token->[2]->{'src'}; |
my $url=$token->[2]->{'src'}; |
|
my $name=$token->[2]->{'title'}; |
$name=~s/ \[\((\d+)\,(\w+)\,(\w+)\)\]$//; |
$name=~s/ \[\((\d+)\,(\w+)\,(\w+)\)\]$//; |
if ($1) { |
if ($1) { |
$name.='<br />'.&mt('Removed by '). |
$$nhash{$url}='<br />'.&mt('Removed by '). |
&Apache::loncommon::plainname($2,$3).', '. |
&Apache::loncommon::plainname($2,$3).', '. |
&Apache::lonlocal::locallocaltime($1); |
&Apache::lonlocal::locallocaltime($1); |
} |
} |
$r->print('<br />'.$name); |
$$thash{$url}=$name; |
|
$$shash{$url}=$n; |
|
$n++; |
} |
} |
} |
} |
} |
} |
Line 326 END
|
Line 330 END
|
|
|
my %shash; # sort order (key is resource location, value is sort order) |
my %shash; # sort order (key is resource location, value is sort order) |
my %thash; # title (key is resource location, value is title) |
my %thash; # title (key is resource location, value is title) |
|
my %nhash; # notes (key is resource location); |
|
|
if ($env{'form.readfile'}) { |
if ($env{'form.readfile'}) { |
&readfromfile($r,\%shash,\%thash); |
&readfromfile($r,\%shash,\%thash,\%nhash); |
} else { |
} else { |
&readfromdb($r,\%shash,\%thash); |
&readfromdb($r,\%shash,\%thash); |
} |
} |