version 1.33, 2005/06/09 22:06:09
|
version 1.34, 2005/06/10 02:19:51
|
Line 180 sub readfromdb {
|
Line 180 sub readfromdb {
|
} |
} |
} |
} |
} else { |
} else { |
$r->print('Unable to tie hash to db file</body></html>'); |
$r->print('Unable to tie hash to db file'); |
return OK; |
|
} |
} |
untie %hash; |
untie %hash; |
return ($shash,$thash); |
return ($shash,$thash); |
Line 198 sub cleanup {
|
Line 197 sub cleanup {
|
} |
} |
} |
} |
|
|
|
# -------------------------------------------------------------- Read from file |
|
|
|
sub readfromfile { |
|
my ($r,$shash,$thash)=@_; |
|
my $cont=&Apache::lonnet::getfile |
|
(&Apache::lonnet::filelocation('',$env{'form.readfile'})); |
|
if ($cont==-1) { |
|
$r->print('Unable to read file: '. |
|
&Apache::lonnet::filelocation('',$env{'form.readfile'})); |
|
} else { |
|
my $parser = HTML::TokeParser->new(\$cont); |
|
my $token; |
|
while ($token = $parser->get_token) { |
|
if ($token->[0] eq 'S') { |
|
if ($token->[1] eq 'resource') { |
|
if ($env{'form.recover'}) { |
|
if ($token->[2]->{'type'} ne 'zombie') { next; } |
|
} else { |
|
if ($token->[2]->{'type'} eq 'zombie') { next; } |
|
} |
|
my $name=$token->[2]->{'title'}; |
|
my $url=$token->[2]->{'src'}; |
|
$name=~s/ \[\((\d+)\,(\w+)\,(\w+)\)\]$//; |
|
if ($1) { |
|
$name.='<br />'.&mt('Removed by '). |
|
&Apache::loncommon::plainname($2,$3).', '. |
|
&Apache::lonlocal::locallocaltime($1); |
|
} |
|
$r->print('<br />'.$name); |
|
} |
|
} |
|
} |
|
} |
|
return ($shash,$thash); |
|
} |
|
|
# ---------------------------------------------------------------- Main Handler |
# ---------------------------------------------------------------- Main Handler |
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['acts','catalogmode','mode']); |
['acts','catalogmode','mode','readfile','recover']); |
# color scheme |
# color scheme |
my $fileclr = '#ffffe6'; |
my $fileclr = '#ffffe6'; |
my $titleclr = '#ddffff'; |
my $titleclr = '#ddffff'; |
Line 292 END
|
Line 327 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) |
|
|
&readfromdb($r,\%shash,\%thash); |
if ($env{'form.readfile'}) { |
|
&readfromfile($r,\%shash,\%thash); |
|
} else { |
|
&readfromdb($r,\%shash,\%thash); |
|
} |
|
|
my $ctr = 0; |
my $ctr = 0; |
my $clen = scalar(keys %shash); |
my $clen = scalar(keys %shash); |