version 1.22, 2003/08/26 05:44:11
|
version 1.27, 2004/05/10 08:34:50
|
Line 38 use strict;
|
Line 38 use strict;
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use GDBM_File; |
use GDBM_File; |
use Apache::loncommon; |
use Apache::loncommon; |
|
use Apache::lonlocal; |
|
use Apache::lonnet; |
|
|
my %hash; # variable to tie to user specific database |
my %hash; # variable to tie to user specific database |
my $iconpath; # variable to be accessible to multiple subroutines |
my $iconpath; # variable to be accessible to multiple subroutines |
Line 61 sub handler {
|
Line 63 sub handler {
|
my $fileclr = '#ffffe6'; |
my $fileclr = '#ffffe6'; |
my $titleclr = '#ddffff'; |
my $titleclr = '#ddffff'; |
|
|
$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; |
|
|
# finish_import looks different for graphical or "simple" RAT |
# finish_import looks different for graphical or "simple" RAT |
my $finishimport=''; |
my $finishimport=''; |
if ($ENV{'form.mode'} eq 'simple') { |
if ($ENV{'form.mode'} eq 'simple' || $ENV{'form.mode'} eq '') { |
$finishimport=(<<ENDSMP); |
$finishimport=(<<ENDSMP); |
function finish_import() { |
function finish_import() { |
opener.document.forms.simpleedit.importdetail.value=''; |
opener.document.forms.simpleedit.importdetail.value=''; |
Line 233 END
|
Line 235 END
|
my $key = $_; |
my $key = $_; |
$key =~ s/^store_//; |
$key =~ s/^store_//; |
$shash{$key} = $hash{'storectr_'.$key}; |
$shash{$key} = $hash{'storectr_'.$key}; |
$thash{$key} = $hash{'store_'.$key}; |
if (&Apache::lonnet::gettitle($key) eq '') { |
|
$thash{$key} = $hash{'store_'.$key}; } |
|
else { |
|
$thash{$key} = &Apache::lonnet::gettitle($key); } |
} |
} |
} |
} |
if ($ENV{'form.oldval'}) { |
if ($ENV{'form.oldval'}) { |
Line 290 END
|
Line 295 END
|
my $ctr = 0; |
my $ctr = 0; |
my $clen = scalar(keys %shash); |
my $clen = scalar(keys %shash); |
if ($clen > 1) { |
if ($clen > 1) { |
|
my %lt=&Apache::lonlocal::texthash( |
|
'fin'=> 'Finalize order of resources', |
|
'gb' => 'Go Back', |
|
'ns' => 'New Search', |
|
'fi' => 'Finish Import', |
|
'ca' => 'Cancel', |
|
'co' => 'Change Order', |
|
'ti' => 'Title', |
|
'pa' => 'Path' |
|
); |
$r->print(&Apache::loncommon::bodytag('Sort Imported Resources')); |
$r->print(&Apache::loncommon::bodytag('Sort Imported Resources')); |
$r->print(<<END); |
$r->print(<<END); |
<b><font color="#888888">Finalize order of resources</font></b> |
<b><font color="#888888">$lt{'fin'}</font></b> |
<form method='post' action='/adm/groupsort' name='groupsort' |
<form method='post' action='/adm/groupsort' name='groupsort' |
enctype='application/x-www-form-urlencoded'> |
enctype='application/x-www-form-urlencoded'> |
<input type="hidden" name="fnum" value="$clen" /> |
<input type="hidden" name="fnum" value="$clen" /> |
Line 304 END
|
Line 319 END
|
# --- Expand here if "GO BACK" button desired |
# --- Expand here if "GO BACK" button desired |
if ($ENV{'form.catalogmode'} eq 'groupimport') { |
if ($ENV{'form.catalogmode'} eq 'groupimport') { |
$r->print(<<END); |
$r->print(<<END); |
<input type="button" name="alter" value="GO BACK" |
<input type="button" name="alter" value="$lt{'gb'}" |
onClick="window.location='/res/?catalogmode=groupimport'" /> |
onClick="window.location='/res/?catalogmode=groupimport'" /> |
END |
END |
} |
} |
if ($ENV{'form.catalogmode'} eq 'groupsearch') { |
if ($ENV{'form.catalogmode'} eq 'groupsearch') { |
$r->print(<<END); |
$r->print(<<END); |
<input type="button" name="alter" value="New Search" |
<input type="button" name="alter" value="$lt{'ns'}" |
onClick="window.location='/adm/searchcat?catalogmode=groupsearch&cleargroupsort=1'" /> |
onClick="window.location='/adm/searchcat?catalogmode=groupsearch&cleargroupsort=1'" /> |
END |
END |
} |
} |
# --- |
# --- |
|
|
$r->print(<<END); |
$r->print(<<END); |
<input type="button" name="alter" value="FINISH IMPORT" |
<input type="button" name="alter" value="$lt{'fi'}" |
onClick="finish_import()" /> |
onClick="finish_import()" /> |
<input type="button" name="alter" value="CANCEL" onClick="self.close()" /> |
<input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" /> |
END |
END |
$r->print("<table border='0'><tr><td bgcolor='#eeeeee'>"); |
$r->print("<table border='0'><tr><td bgcolor='#eeeeee'>"); |
$r->print("<table border=0><tr>\n"); |
$r->print("<table border=0><tr>\n"); |
$r->print("<td colspan='2' bgcolor='$titleclr'><b>Change order</b></td>\n"); |
$r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'co'}</b></td>\n"); |
$r->print("<td colspan='2' bgcolor='$titleclr'><b>Title</b></td>\n"); |
$r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'ti'}</b></td>\n"); |
$r->print("<td bgcolor='$titleclr'><b>Path</b></td></tr>\n"); |
$r->print("<td bgcolor='$titleclr'><b>$lt{'pa'}</b></td></tr>\n"); |
} else { |
} else { |
$r->print(<<END); |
$r->print(<<END); |
<body> |
<body> |
Line 340 END
|
Line 355 END
|
foreach (sort {$shash{$a}<=>$shash{$b}} (keys %shash)) { |
foreach (sort {$shash{$a}<=>$shash{$b}} (keys %shash)) { |
my $key=$_; |
my $key=$_; |
$ctr++; |
$ctr++; |
my @file_ext = split(/\./,$key); |
my $iconname=&Apache::loncommon::icon($key); |
my $curfext = $file_ext[scalar(@file_ext)-1]; |
|
my $iconname="unknown.gif"; |
|
my $embstyle = &Apache::loncommon::fileembstyle($curfext); |
|
# The unless conditional that follows is a bit of overkill |
|
$iconname = $curfext.".gif" unless |
|
(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn'); |
|
if ($clen > 1) { |
if ($clen > 1) { |
$r->print("<tr><td bgcolor='$fileclr'>"); |
$r->print("<tr><td bgcolor='$fileclr'>"); |
$r->print(&movers($clen,$ctr)); |
$r->print(&movers($clen,$ctr)); |
Line 356 END
|
Line 365 END
|
$r->print("</td><td bgcolor='$fileclr'>"); |
$r->print("</td><td bgcolor='$fileclr'>"); |
$r->print(&select_box($clen,$ctr)); |
$r->print(&select_box($clen,$ctr)); |
$r->print("</td><td bgcolor='$fileclr'>"); |
$r->print("</td><td bgcolor='$fileclr'>"); |
$r->print("<img src='$iconpath$iconname'>"); |
$r->print("<img src='$iconname' />"); |
$r->print("</td><td bgcolor='$fileclr'>"); |
$r->print("</td><td bgcolor='$fileclr'>"); |
$r->print("$thash{$key}</td><td bgcolor='$fileclr'>\n"); |
$r->print("$thash{$key}</td><td bgcolor='$fileclr'>\n"); |
$r->print("$key</td></tr>\n"); |
$r->print("$key</td></tr>\n"); |