version 1.88, 2004/01/27 16:35:37
|
version 1.95, 2004/03/28 21:01:06
|
Line 47 use strict;
|
Line 47 use strict;
|
use Apache::lonnet(); |
use Apache::lonnet(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
|
use Apache::lonsequence(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonmeta; |
use Apache::lonmeta; |
use Apache::File; |
use Apache::File; |
Line 164 END
|
Line 165 END
|
# selection is made. |
# selection is made. |
# $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'); |
Line 187 END
|
Line 188 END
|
$element = $ENV{'form.element'}; |
$element = $ENV{'form.element'}; |
$titleelement = $ENV{'form.titleelement'}; |
$titleelement = $ENV{'form.titleelement'}; |
} |
} |
&Apache::lonxml::debug("mode=$mode form=$form element=$element |
#&Apache::lonxml::debug("mode=$mode form=$form element=$element titleelement=$titleelement"); |
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 562 sub scanDir {
|
Line 562 sub scanDir {
|
my $c = $r->connection(); |
my $c = $r->connection(); |
my ($compuri,$curdir); |
my ($compuri,$curdir); |
my $dirptr=16384; |
my $dirptr=16384; |
|
my $obs; |
$indent++; |
$indent++; |
|
|
my %dupdirs = %dirs; |
my %dupdirs = %dirs; |
my @list=&get_list($r,$startdir); |
my @list=&get_list($r,$startdir); |
foreach my $line (@list) { |
foreach my $line (@list) { |
return if ($c->aborted()); |
return if ($c->aborted()); |
my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); |
#This is a kludge, sorry aboot this |
next if $strip =~ /.*\.meta$/; |
my ($strip,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); |
|
next if($strip =~ /.*\.meta$/ | $obs eq '1'); |
my (@fileparts) = split(/\./,$strip); |
my (@fileparts) = split(/\./,$strip); |
if ($hash{'display_attrs_9'} != 1) { |
if ($hash{'display_attrs_9'} != 1) { |
|
# if not all versions to be shown |
if (scalar(@fileparts) >= 3) { |
if (scalar(@fileparts) >= 3) { |
my $fext = pop @fileparts; |
my $fext = pop @fileparts; |
my $ov = pop @fileparts; |
my $ov = pop @fileparts; |
Line 590 sub scanDir {
|
Line 592 sub scanDir {
|
$curdir = $startdir; |
$curdir = $startdir; |
} |
} |
my $diropen = 'closed'; |
my $diropen = 'closed'; |
if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/)) { |
if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/) || ($compuri=~/\.(sequence|page)$/)) { |
while (my ($key,$val)= each %dupdirs) { |
while (my ($key,$val)= each %dupdirs) { |
if ($key eq $compuri and $val eq "open") { |
if ($key eq $compuri and $val eq "open") { |
$diropen = "opened"; |
$diropen = "opened"; |
Line 618 sub get_list {
|
Line 620 sub get_list {
|
|
|
if ($hash{'dirlist_files_'.$luri}) { |
if ($hash{'dirlist_files_'.$luri}) { |
@list = split(/\n/,$hash{'dirlist_files_'.$luri}); |
@list = split(/\n/,$hash{'dirlist_files_'.$luri}); |
|
} elsif ($uri=~/\.(page|sequence)$/) { |
|
# is a page or a sequence |
|
@list= &Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$uri)); |
|
$hash{'dirlist_files_'.$luri} = join("\n",@list); |
} else { |
} else { |
|
# is really a directory |
@list = &Apache::lonnet::dirlist($uri); |
@list = &Apache::lonnet::dirlist($uri); |
$hash{'dirlist_files_'.$luri} = join("\n",@list); |
$hash{'dirlist_files_'.$luri} = join("\n",@list); |
} |
} |
Line 694 sub display_line {
|
Line 701 sub display_line {
|
|
|
my $tabtag='</td>'; |
my $tabtag='</td>'; |
my $i=0; |
my $i=0; |
|
|
while ($i<=8) { |
while ($i<=8) { |
$tabtag=join('',$tabtag,"<td> </td>") |
$tabtag=join('',$tabtag,"<td> </td>") |
if $hash{'display_attrs_'.$i} == 1; |
if $hash{'display_attrs_'.$i} == 1; |
Line 722 sub display_line {
|
Line 728 sub display_line {
|
$r->print(&mt("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? |
|
if($filecom[15] ne '1') { return OK if (!&Apache::lonnet::allowed('bre',$startdir.$filecom[0])); } |
return OK if (!&Apache::lonnet::allowed('bre',$startdir.$filecom[0])); |
|
|
|
# display domain |
# display domain |
if ($filecom[1] eq 'domain') { |
if ($filecom[1] eq 'domain') { |
Line 782 sub display_line {
|
Line 787 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) { |
Line 810 sub display_line {
|
Line 814 sub display_line {
|
$r->print("<img src='",$iconpath,"select.gif' border='0' /></a>". |
$r->print("<img src='",$iconpath,"select.gif' border='0' /></a>". |
"\n"); |
"\n"); |
$r->print("</td><td nowrap>"); |
$r->print("</td><td nowrap>"); |
} |
} elsif ($ENV{'form.catalogmode'} eq 'groupimport') { |
elsif ($ENV{'form.catalogmode'} eq 'groupimport') { |
|
$title=$listname; |
$title=$listname; |
$title = &Apache::lonnet::metadata($filelink,'title') |
#$title = &Apache::lonnet::metadata($filelink,'title') |
if ($metafile == 1); |
#if ($metafile == 1); |
$title=$listname unless $title; |
$title=$listname unless $title; |
my $titleesc=&HTML::Entities::encode($title); |
my $titleesc=&HTML::Entities::encode($title); |
$r->print("<form name='form$fnum'>\n"); |
$r->print("<form name='form$fnum'>\n"); |
Line 833 sub display_line {
|
Line 836 sub display_line {
|
$hash{"pre_${fnum}_title"}=$titleesc; |
$hash{"pre_${fnum}_title"}=$titleesc; |
$fnum++; |
$fnum++; |
} |
} |
|
# Form to open or close sequences |
|
if ($filelink=~/\.(page|sequence)$/) { |
|
my $curdir = $startdir.$filecom[0].'/'; |
|
my $anchor = $curdir; |
|
$anchor =~ s/\///g; |
|
&begin_form($r,$curdir); |
|
$indent--; |
|
} |
|
# General indentation |
if ($indent > 0 and $indent < 11) { |
if ($indent > 0 and $indent < 11) { |
$r->print("<img src=",$iconpath,"whitespace",$indent, |
$r->print("<img src=",$iconpath,"whitespace",$indent, |
".gif border='0' />\n"); |
".gif border='0' />\n"); |
Line 849 sub display_line {
|
Line 860 sub display_line {
|
$r->print("<img src=",$iconpath,"whitespace",$rem, |
$r->print("<img src=",$iconpath,"whitespace",$rem, |
".gif border='0' />\n") if $rem > 0; |
".gif border='0' />\n") if $rem > 0; |
} |
} |
|
# Sequence open/close icon |
|
if ($filelink=~/\.(page|sequence)$/) { |
|
my $curdir = $startdir.$filecom[0].'/'; |
|
my $anchor = $curdir; |
|
$anchor =~ s/\///g; |
|
$r->print ('<input type="hidden" name="acts" value="">'); |
|
$r->print ('<a name="'.$anchor.'"><input src="'.$iconpath. |
|
'folder_pointer_'.$diropen.'.gif"'); |
|
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
|
"\n"); |
|
} |
|
# Filetype icons |
$r->print("<img src='$iconname' border='0' />\n"); |
$r->print("<img src='$iconname' border='0' />\n"); |
|
# Close form to open/close sequence |
|
if ($filelink=~/\.(page|sequence)$/) { |
|
$r->print('</form>'); |
|
} |
$r->print (" <a href=\"javascript:openWindow('".$filelink. |
$r->print (" <a href=\"javascript:openWindow('".$filelink. |
"', 'previewfile', '450', '500', 'no', 'yes','yes')\";". |
"', 'previewfile', '450', '500', 'no', 'yes','yes')\";". |
" TARGET=_self>$listname</a> "); |
" TARGET=_self>$listname</a> "); |
Line 900 sub display_line {
|
Line 926 sub display_line {
|
my $output=''; |
my $output=''; |
my $embstyle=&Apache::loncommon::fileembstyle($curfext); |
my $embstyle=&Apache::loncommon::fileembstyle($curfext); |
if ($embstyle eq 'ssi') { |
if ($embstyle eq 'ssi') { |
$output=&Apache::lonnet::ssi_body($filelink); |
my $cache=$Apache::lonnet::perlvar{'lonDocRoot'}.$filelink. |
$output='<font size="-2">'.$output.'</font>'; |
'.tmp'; |
|
if ((!$ENV{'form.updatedisplay'}) && |
|
(-e $cache)) { |
|
open(FH,$cache); |
|
$output=join("\n",<FH>); |
|
close(FH); |
|
} else { |
|
$output=&Apache::lonnet::ssi_body($filelink); |
|
open(FH,">$cache"); |
|
print FH $output; |
|
close(FH); |
|
} |
|
$output='<font size="-2">'.$output.'</font>'; |
} elsif ($embstyle eq 'img') { |
} elsif ($embstyle eq 'img') { |
$output='<img src="'.$filelink.'" />'; |
$output='<img src="'.$filelink.'" />'; |
} elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) { |
} elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) { |