version 1.76, 2003/09/23 00:26:10
|
version 1.79, 2003/10/24 21:09:24
|
Line 64 use Apache::loncommon();
|
Line 64 use Apache::loncommon();
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonmeta; |
use Apache::lonmeta; |
use Apache::File; |
use Apache::File; |
|
use Apache::lonlocal; |
use GDBM_File; |
use GDBM_File; |
|
|
# ---------------------------------------- variables used throughout the module |
# ---------------------------------------- variables used throughout the module |
Line 117 sub handler {
|
Line 118 sub handler {
|
# Get the parameters from the query string |
# Get the parameters from the query string |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['catalogmode','launch','acts','mode','form','element', |
['catalogmode','launch','acts','mode','form','element', |
'only','omit']); |
'only','omit','titleelement']); |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
my $closebutton=''; |
my $closebutton=''; |
my $groupimportbutton=''; |
my $groupimportbutton=''; |
Line 149 sub handler {
|
Line 150 sub handler {
|
'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'. |
'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'. |
' border="0" /></td>'; |
' border="0" /></td>'; |
$colspan=" colspan='2' "; |
$colspan=" colspan='2' "; |
|
my $cl=&mt('Close'); |
$closebutton=<<END; |
$closebutton=<<END; |
<input type="button" name="close" value='CLOSE' onClick="self.close()"> |
<input type="button" name="close" value='$cl' onClick="self.close()"> |
END |
END |
} |
} |
elsif ($ENV{'form.catalogmode'} eq 'groupimport') { |
elsif ($ENV{'form.catalogmode'} eq 'groupimport') { |
Line 158 END
|
Line 160 END
|
'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'. |
'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'. |
' border="0" /></td>'; |
' border="0" /></td>'; |
$colspan=" colspan='2' "; |
$colspan=" colspan='2' "; |
|
my $cl=&mt('Close'); |
|
my $gi=&mt('Group Import'); |
$closebutton=<<END; |
$closebutton=<<END; |
<input type="button" name="close" value='CLOSE' onClick="self.close()"> |
<input type="button" name="close" value='$cl' onClick="self.close()"> |
END |
END |
$groupimportbutton=<<END; |
$groupimportbutton=<<END; |
<input type="button" name="groupimport" value='GROUP IMPORT' |
<input type="button" name="groupimport" value='$gi' |
onClick="javascript:select_group()"> |
onClick="javascript:select_group()"> |
END |
END |
} |
} |
Line 175 END
|
Line 179 END
|
# $element is the name of the element in $formname which receives |
# $element is the name of the element in $formname which receives |
# the URL. |
# the URL. |
# &Apache::lonxml::debug('Checking mode, form, element'); |
# &Apache::lonxml::debug('Checking mode, form, element'); |
&setvalues(\%hash,'form.mode' ,\%ENV,'form.mode' ); |
&setvalues(\%hash,'form.mode' ,\%ENV,'form.mode' ); |
&setvalues(\%hash,'form.form' ,\%ENV,'form.form' ); |
&setvalues(\%hash,'form.form' ,\%ENV,'form.form' ); |
&setvalues(\%hash,'form.element',\%ENV,'form.element'); |
&setvalues(\%hash,'form.element' ,\%ENV,'form.element'); |
&setvalues(\%hash,'form.only' ,\%ENV,'form.only' ); |
&setvalues(\%hash,'form.titleelement',\%ENV,'form.titleelement'); |
&setvalues(\%hash,'form.omit' ,\%ENV,'form.omit' ); |
&setvalues(\%hash,'form.only' ,\%ENV,'form.only' ); |
|
&setvalues(\%hash,'form.omit' ,\%ENV,'form.omit' ); |
|
|
# Deal with 'omit' and 'only' |
# Deal with 'omit' and 'only' |
if (exists $ENV{'form.omit'}) { |
if (exists $ENV{'form.omit'}) { |
Line 190 END
|
Line 195 END
|
} |
} |
|
|
my $mode = $ENV{'form.mode'}; |
my $mode = $ENV{'form.mode'}; |
my ($form,$element); |
my ($form,$element,$titleelement); |
if ($mode eq 'edit' || $mode eq 'parmset') { |
if ($mode eq 'edit' || $mode eq 'parmset') { |
$form = $ENV{'form.form'}; |
$form = $ENV{'form.form'}; |
$element = $ENV{'form.element'}; |
$element = $ENV{'form.element'}; |
|
$titleelement = $ENV{'form.titleelement'}; |
} |
} |
&Apache::lonxml::debug("mode=$mode form=$form element=$element"); |
&Apache::lonxml::debug("mode=$mode form=$form element=$element |
|
titleelement=$titleelement"); |
# ------ set catalogmodefunctions to have extra needed javascript functionality |
# ------ set catalogmodefunctions to have extra needed javascript functionality |
my $catalogmodefunctions=''; |
my $catalogmodefunctions=''; |
if ($ENV{'form.catalogmode'} eq 'interactive' or |
if ($ENV{'form.catalogmode'} eq 'interactive' or |
Line 244 END
|
Line 251 END
|
// mode = $mode |
// mode = $mode |
function select_data(title,url) { |
function select_data(title,url) { |
changeURL(url); |
changeURL(url); |
|
changeTitle(title); |
self.close(); |
self.close(); |
} |
} |
|
|
Line 258 function changeURL(val) {
|
Line 266 function changeURL(val) {
|
alert("The file you selected is: "+val); |
alert("The file you selected is: "+val); |
} |
} |
} |
} |
|
|
END |
END |
|
if (!$titleelement) { |
|
$catalogmodefunctions.='function changeTitle(val) {}'; |
|
} else { |
|
$catalogmodefunctions.=<<END; |
|
function changeTitle(val) { |
|
if (window.opener.document) { |
|
window.opener.document.forms["$form"].elements["$titleelement"].value=val; |
|
} else { |
|
alert("The title of the file you selected is: "+val); |
|
} |
|
} |
|
END |
|
} |
} elsif ($mode eq 'parmset') { |
} elsif ($mode eq 'parmset') { |
my $location = "/adm/groupsort?catalogmode=interactive&"; |
my $location = "/adm/groupsort?catalogmode=interactive&"; |
$location .= "form=$form&element=$element&mode=parmset&acts="; |
$location .= "form=$form&element=$element&mode=parmset&acts="; |
Line 399 $r->print(&Apache::loncommon::bodytag('B
|
Line 419 $r->print(&Apache::loncommon::bodytag('B
|
# ------------------------------- output state of file attributes to be showing |
# ------------------------------- output state of file attributes to be showing |
# All versions has to the last item |
# All versions has to the last item |
# since it does not take an extra col |
# since it does not take an extra col |
|
my %lt=&Apache::lonlocal::texthash( |
|
'ti' => 'Title', |
|
'si' => 'Size', |
|
'la' => 'Last access', |
|
'lm' => 'Last modified', |
|
'st' => 'Statistics', |
|
'au' => 'Author', |
|
'kw' => 'Keywords', |
|
'ln' => 'Language', |
|
'sr' => 'Show resource', |
|
'av' => 'All versions', |
|
'ud' => 'Update Display' |
|
); |
$r->print(<<END); |
$r->print(<<END); |
<form method="post" name="fileattr" action="$uri" |
<form method="post" name="fileattr" action="$uri" |
enctype="application/x-www-form-urlencoded"> |
enctype="application/x-www-form-urlencoded"> |
<b><font color="#666666">Display file attributes</font></b><br /> |
<b><font color="#666666">Display file attributes</font></b><br /> |
<table border=0><tr> |
<table border=0><tr> |
<td><input type="checkbox" name="attr0" value="1" $attrchk[0] /> Title</td> |
<td><input type="checkbox" name="attr0" value="1" $attrchk[0] /> $lt{'ti'}</td> |
<td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> Size</td> |
<td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> $lt{'si'}</td> |
<td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> Last access</td> |
<td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> $lt{'la'}</td> |
<td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> Last modified</td> |
<td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> $lt{'lm'}</td> |
<td><input type="checkbox" name="attr8" value="1" $attrchk[8] /> Statistics</td></tr><tr> |
<td><input type="checkbox" name="attr8" value="1" $attrchk[8] /> $lt{'st'}</td> |
<td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> Author</td> |
</tr><tr> |
<td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> Keywords</td> |
<td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> $lt{'au'}</td> |
<td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> Language</td> |
<td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> $lt{'kw'}</td> |
<td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> Show Resource</td> |
<td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> $lt{'ln'}</td> |
<td><input type="checkbox" name="attr9" value="1" $attrchk[9] /> All versions</td> |
<td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> $lt{'sr'}</td> |
|
<td><input type="checkbox" name="attr9" value="1" $attrchk[9] /> $lt{'av'}</td> |
<td> </td> |
<td> </td> |
</tr></table> |
</tr></table> |
<input type="hidden" name="dirPointer" value="on" /> |
<input type="hidden" name="dirPointer" value="on" /> |
<input type="hidden" name="acts" value="" /> |
<input type="hidden" name="acts" value="" /> |
<input type="submit" name="attrs" value="Update Display" /> |
<input type="submit" name="attrs" value="$lt{'ud'}" /> |
$closebutton |
$closebutton |
$groupimportbutton |
$groupimportbutton |
</form> |
</form> |
Line 431 END
|
Line 465 END
|
# $r->print(&writedebug("Only:@Only")) if (@Only); |
# $r->print(&writedebug("Only:@Only")) if (@Only); |
$r->print("<table width='100\%' border=0><tr><td bgcolor=#777777>\n"); |
$r->print("<table width='100\%' border=0><tr><td bgcolor=#777777>\n"); |
$r->print("<table width='100\%' border=0><tr bgcolor=$titleclr>\n"); |
$r->print("<table width='100\%' border=0><tr bgcolor=$titleclr>\n"); |
$r->print("<td $colspan><b>Name</b></td>\n"); |
$r->print("<td $colspan><b>".&mt('Name')."</b></td>\n"); |
$r->print("<td><b>Title</b></td>\n") |
$r->print("<td><b>".&mt('Title')."</b></td>\n") |
if ($hash{'display_attrs_0'} == 1); |
if ($hash{'display_attrs_0'} == 1); |
$r->print("<td align=right><b>Size (bytes) ". |
$r->print("<td align=right><b>".&mt("Size")." (".&mt("bytes").") ". |
"</b></td>\n") if ($hash{'display_attrs_1'} == 1); |
"</b></td>\n") if ($hash{'display_attrs_1'} == 1); |
$r->print("<td><b>Last accessed</b></td>\n") |
$r->print("<td><b>".&mt("Last accessed")."</b></td>\n") |
if ($hash{'display_attrs_2'} == 1); |
if ($hash{'display_attrs_2'} == 1); |
$r->print("<td><b>Last modified</b></td>\n") |
$r->print("<td><b>".&mt("Last modified")."</b></td>\n") |
if ($hash{'display_attrs_3'} == 1); |
if ($hash{'display_attrs_3'} == 1); |
$r->print("<td><b>Author(s)</b></td>\n") |
$r->print("<td><b>".&mt("Author(s)")."</b></td>\n") |
if ($hash{'display_attrs_4'} == 1); |
if ($hash{'display_attrs_4'} == 1); |
$r->print("<td><b>Keywords</b></td>\n") |
$r->print("<td><b>".&mt("Keywords")."</b></td>\n") |
if ($hash{'display_attrs_5'} == 1); |
if ($hash{'display_attrs_5'} == 1); |
$r->print("<td><b>Language</b></td>\n") |
$r->print("<td><b>".&mt("Language")."</b></td>\n") |
if ($hash{'display_attrs_6'} == 1); |
if ($hash{'display_attrs_6'} == 1); |
$r->print("<td><b>Resource</b></td>\n") |
$r->print("<td><b>".&mt("Resource")."</b></td>\n") |
if ($hash{'display_attrs_7'} == 1); |
if ($hash{'display_attrs_7'} == 1); |
$r->print("<td><b>Usage Statistics <br />(Courses/Network Hits)</b></td>\n") |
$r->print("<td><b>".&mt("Usage Statistics")." <br />(". |
|
&mt("Courses/Network Hits").")</b></td>\n") |
if ($hash{'display_attrs_8'} == 1); |
if ($hash{'display_attrs_8'} == 1); |
$r->print('</tr>'); |
$r->print('</tr>'); |
|
|
Line 586 sub get_list {
|
Line 621 sub get_list {
|
my @list; |
my @list; |
(my $luri = $uri) =~ s/\//_/g; |
(my $luri = $uri) =~ s/\//_/g; |
|
|
if ($ENV{'form.attrs'} eq 'Update Display') { |
if ($ENV{'form.attrs'} eq &mt('Update Display')) { |
foreach (keys %hash) { |
foreach (keys %hash) { |
delete $hash{$_} if ($_ =~ /^dirlist_files_/); |
delete $hash{$_} if ($_ =~ /^dirlist_files_/); |
} |
} |
Line 665 sub display_line {
|
Line 700 sub display_line {
|
my @pathcom = split (/\//,$filecom[0]); |
my @pathcom = split (/\//,$filecom[0]); |
my $listname = $pathcom[scalar(@pathcom)-1]; |
my $listname = $pathcom[scalar(@pathcom)-1]; |
my $fnptr = $filecom[3]&$dirptr; |
my $fnptr = $filecom[3]&$dirptr; |
my $msg = 'View '.$filecom[0].' resources'; |
my $msg = &mt('View').' '.$filecom[0].' '.&mt('resources'); |
$msg = 'Close '.$filecom[0].' directory' if $diropen eq 'opened'; |
$msg = &mt('Close').' '.$filecom[0].' '.&mt('directory') if $diropen eq 'opened'; |
|
|
my $tabtag='</td>'; |
my $tabtag='</td>'; |
my $i=0; |
my $i=0; |
Line 695 sub display_line {
|
Line 730 sub display_line {
|
$r->print ('<input src="'.$iconpath.'arrow_up.gif"'); |
$r->print ('<input src="'.$iconpath.'arrow_up.gif"'); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
"\n"); |
"\n"); |
$r->print("Up $tabtag</tr></form>\n"); |
$r->print(&mt("Up")." $tabtag</tr></form>\n"); |
return OK; |
return OK; |
} |
} |
# Do we have permission to look at this? |
# Do we have permission to look at this? |
Line 720 sub display_line {
|
Line 755 sub display_line {
|
$r->print ('<a href="javascript:gothere(\''.$filecom[0]. |
$r->print ('<a href="javascript:gothere(\''.$filecom[0]. |
'\')"><img src="'.$iconpath.'server.gif"'); |
'\')"><img src="'.$iconpath.'server.gif"'); |
$r->print (' border="0" /></a>'."\n"); |
$r->print (' border="0" /></a>'."\n"); |
$r->print ("Domain - $listname "); |
$r->print (&mt("Domain")." - $listname "); |
if ($Apache::lonnet::domaindescription{$listname}) { |
if ($Apache::lonnet::domaindescription{$listname}) { |
$r->print("(".$Apache::lonnet::domaindescription{$listname}. |
$r->print("(".$Apache::lonnet::domaindescription{$listname}. |
")"); |
")"); |
Line 758 sub display_line {
|
Line 793 sub display_line {
|
# display file |
# display file |
if ($fnptr == 0 and $filecom[3] ne '') { |
if ($fnptr == 0 and $filecom[3] ne '') { |
my $filelink = $startdir.$filecom[0]; |
my $filelink = $startdir.$filecom[0]; |
|
next if &Apache::lonnet::metadata($filelink,'obsolete'); |
my @file_ext = split (/\./,$listname); |
my @file_ext = split (/\./,$listname); |
my $curfext = $file_ext[-1]; |
my $curfext = $file_ext[-1]; |
if (@Omit) { |
if (@Omit) { |