version 1.108, 2004/05/18 15:53:58
|
version 1.112, 2004/06/17 01:44:34
|
Line 52 use Apache::Constants qw(:common);
|
Line 52 use Apache::Constants qw(:common);
|
use Apache::lonmeta; |
use Apache::lonmeta; |
use Apache::File; |
use Apache::File; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonsource(); |
use GDBM_File; |
use GDBM_File; |
|
|
# ---------------------------------------- variables used throughout the module |
# ---------------------------------------- variables used throughout the module |
my %hash; # global user-specific gdbm file |
my %hash; # global user-specific gdbm file |
my %dirs; # keys are directories, values are the open/close status |
my %dirs; # keys are directories, values are the open/close status |
my %language; # has the reference information present in language.tab |
my %language; # has the reference information present in language.tab |
|
my %dynhash; # hash of hashes for dynamic metadata |
|
|
# ----- Values which are set by the handler subroutine and are accessible to |
# ----- Values which are set by the handler subroutine and are accessible to |
# ----- other methods. |
# ----- other methods. |
Line 406 $r->print(&Apache::loncommon::bodytag('B
|
Line 408 $r->print(&Apache::loncommon::bodytag('B
|
|
|
# ---------------------------------- get state of file attributes to be showing |
# ---------------------------------- get state of file attributes to be showing |
if ($ENV{'form.attrs'}) { |
if ($ENV{'form.attrs'}) { |
for (my $i=0; $i<=9; $i++) { |
for (my $i=0; $i<=11; $i++) { |
delete $hash{'display_attrs_'.$i}; |
delete $hash{'display_attrs_'.$i}; |
if ($ENV{'form.attr'.$i} == 1) { |
if ($ENV{'form.attr'.$i} == 1) { |
$attrchk[$i] = 'checked'; |
$attrchk[$i] = 'checked'; |
Line 414 $r->print(&Apache::loncommon::bodytag('B
|
Line 416 $r->print(&Apache::loncommon::bodytag('B
|
} |
} |
} |
} |
} else { |
} else { |
for (my $i=0; $i<=9; $i++) { |
for (my $i=0; $i<=11; $i++) { |
$attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1; |
$attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1; |
} |
} |
} |
} |
Line 431 $r->print(&Apache::loncommon::bodytag('B
|
Line 433 $r->print(&Apache::loncommon::bodytag('B
|
'au' => 'Author', |
'au' => 'Author', |
'kw' => 'Keywords', |
'kw' => 'Keywords', |
'ln' => 'Language', |
'ln' => 'Language', |
|
'sa' => 'Source Available', |
'sr' => 'Show resource', |
'sr' => 'Show resource', |
|
'li' => 'Linked/Related Resources', |
'av' => 'All versions', |
'av' => 'All versions', |
'ud' => 'Update Display' |
'ud' => 'Update Display' |
); |
); |
Line 446 $r->print(&Apache::loncommon::bodytag('B
|
Line 450 $r->print(&Apache::loncommon::bodytag('B
|
<td><input type="checkbox" name="attr2" value="1" $attrchk[2] onClick="this.form.submit();" /> $lt{'la'}</td> |
<td><input type="checkbox" name="attr2" value="1" $attrchk[2] onClick="this.form.submit();" /> $lt{'la'}</td> |
<td><input type="checkbox" name="attr3" value="1" $attrchk[3] onClick="this.form.submit();" /> $lt{'lm'}</td> |
<td><input type="checkbox" name="attr3" value="1" $attrchk[3] onClick="this.form.submit();" /> $lt{'lm'}</td> |
<td><input type="checkbox" name="attr8" value="1" $attrchk[8] onClick="this.form.submit();" /> $lt{'st'}</td> |
<td><input type="checkbox" name="attr8" value="1" $attrchk[8] onClick="this.form.submit();" /> $lt{'st'}</td> |
|
<td><input type="checkbox" name="attr10" value="1" $attrchk[10] onClick="this.form.submit();" /> $lt{'sa'}</td> |
</tr><tr> |
</tr><tr> |
<td><input type="checkbox" name="attr4" value="1" $attrchk[4] onClick="this.form.submit();" /> $lt{'au'}</td> |
<td><input type="checkbox" name="attr4" value="1" $attrchk[4] onClick="this.form.submit();" /> $lt{'au'}</td> |
<td><input type="checkbox" name="attr5" value="1" $attrchk[5] onClick="this.form.submit();" /> $lt{'kw'}</td> |
<td><input type="checkbox" name="attr5" value="1" $attrchk[5] onClick="this.form.submit();" /> $lt{'kw'}</td> |
<td><input type="checkbox" name="attr6" value="1" $attrchk[6] onClick="this.form.submit();" /> $lt{'ln'}</td> |
<td><input type="checkbox" name="attr6" value="1" $attrchk[6] onClick="this.form.submit();" /> $lt{'ln'}</td> |
<td><input type="checkbox" name="attr7" value="1" $attrchk[7] onClick="this.form.submit();" /> $lt{'sr'}</td> |
<td><input type="checkbox" name="attr7" value="1" $attrchk[7] onClick="this.form.submit();" /> $lt{'sr'}</td> |
<td><input type="checkbox" name="attr9" value="1" $attrchk[9] onClick="this.form.submit();" /> $lt{'av'}</td> |
<td><input type="checkbox" name="attr9" value="1" $attrchk[9] onClick="this.form.submit();" /> $lt{'av'}</td> |
<td> </td> |
<td><input type="checkbox" name="attr11" value="1" $attrchk[11] onClick="this.form.submit();" /> $lt{'li'}</td> |
</tr></table> |
</tr></table> |
<input type="hidden" name="attrs" value="1" /> |
<input type="hidden" name="attrs" value="1" /> |
<input type="submit" name="updatedisplay" value="$lt{'ud'}" /> |
<input type="submit" name="updatedisplay" value="$lt{'ud'}" /> |
Line 511 END
|
Line 516 END
|
$r->print("<td><b>".&mt("Usage Statistics")." <br />(". |
$r->print("<td><b>".&mt("Usage Statistics")." <br />(". |
&mt("Courses/Network Hits").")</b></td>\n") |
&mt("Courses/Network Hits").")</b></td>\n") |
if ($hash{'display_attrs_8'} == 1); |
if ($hash{'display_attrs_8'} == 1); |
|
$r->print("<td><b>".&mt("Source Available")."</b></td>\n") |
|
if ($hash{'display_attrs_10'} == 1); |
|
$r->print("<td><b>".&mt("Linked/Related Resources")."</b></td>\n") |
|
if ($hash{'display_attrs_11'} == 1); |
$r->print('</tr>'); |
$r->print('</tr>'); |
|
|
# ----------------- read in what directories have previously been set to "open" |
# ----------------- read in what directories have previously been set to "open" |
Line 665 sub get_list {
|
Line 674 sub get_list {
|
# is really a directory |
# 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); |
|
&dynmetaread($uri); |
} |
} |
return @list=&match_ext($r,@list); |
return @list=&match_ext($r,@list); |
} |
} |
|
|
|
sub dynmetaread { |
|
my $uri=shift; |
|
if (($hash{'display_attrs_8'}==1) || ($hash{'display_attrs_11'}==1)) { |
|
%dynhash= |
|
(%dynhash,&Apache::lonmeta::get_dynamic_metadata_from_sql($uri)); |
|
&Apache::lonnet::logthis('Found: '.$uri." : ".join(',',keys %dynhash)); |
|
} |
|
} |
|
|
sub initdebug { |
sub initdebug { |
return <<ENDJS; |
return <<ENDJS; |
<script> |
<script> |
Line 749 sub display_line {
|
Line 768 sub display_line {
|
|
|
my $tabtag='</td>'; |
my $tabtag='</td>'; |
my $i=0; |
my $i=0; |
while ($i<=8) { |
while ($i<=11) { |
$tabtag=join('',$tabtag,"<td> </td>") |
$tabtag=join('',$tabtag,"<td> </td>") |
if $hash{'display_attrs_'.$i} == 1; |
if $hash{'display_attrs_'.$i} == 1; |
$i++; |
$i++; |
} |
} |
|
|
my $valign = ($hash{'display_attrs_7'} == 1 ? 'top' : 'bottom'); |
my $valign = ($hash{'display_attrs_7'} == 1 ? 'top' : 'bottom'); |
|
|
# display uplink arrow |
# display uplink arrow |
Line 786 sub display_line {
|
Line 804 sub display_line {
|
if($filecom[15] ne '1') { return OK if (!&Apache::lonnet::allowed('bre',$pathprefix.$filecom[0])); } |
if($filecom[15] ne '1') { return OK if (!&Apache::lonnet::allowed('bre',$pathprefix.$filecom[0])); } |
|
|
# make absolute links appear on different background |
# make absolute links appear on different background |
if ($absolute) { $fileclr='#aaaa88'; } |
if ($absolute) { $fileclr='#ccdd99'; } |
|
|
# display domain |
# display domain |
if ($filecom[1] eq 'domain') { |
if ($filecom[1] eq 'domain') { |
Line 960 sub display_line {
|
Line 978 sub display_line {
|
$r->print('<td> '.($keywords eq '' ? ' ' : $keywords). |
$r->print('<td> '.($keywords eq '' ? ' ' : $keywords). |
" </td>\n"); |
" </td>\n"); |
} |
} |
|
#' |
|
|
if ($hash{'display_attrs_6'} == 1) { |
if ($hash{'display_attrs_6'} == 1) { |
my $lang = &Apache::lonnet::metadata($filelink,'language'); |
my $lang = &Apache::lonnet::metadata($filelink,'language'); |
$lang = &Apache::loncommon::languagedescription($lang); |
$lang = &Apache::loncommon::languagedescription($lang); |
Line 995 sub display_line {
|
Line 1015 sub display_line {
|
" </td>\n"); |
" </td>\n"); |
} |
} |
if ($hash{'display_attrs_8'} == 1) { |
if ($hash{'display_attrs_8'} == 1) { |
my (%stat) = &Apache::lonmeta::dynamicmeta($filelink); |
# statistics |
my $stat = (exists($stat{'course'}) ? $stat{'course'} : ''). |
$r->print("<td>"); |
((exists($stat{'course'}) || exists($stat{'count'})) ? '/' : ''). |
if ($dynhash{$filelink}->{'stdno'}) { |
(exists($stat{'count'}) ? $stat{'count'} : ''); |
$r->print(&mt('Number of students: '). |
$r->print('<td align=center> '.($stat eq '' ? ' ' : $stat). |
$dynhash{$filelink}->{'stdno'}.'<br />'); |
' </td>'."\n"); |
} |
} |
$r->print(" </td>\n"); |
|
|
|
} |
|
if ($hash{'display_attrs_10'} == 1) { |
|
my $source = &Apache::lonnet::metadata($filelink,'sourceavail'); |
|
if($source eq 'open') { |
|
my $sourcelink = &Apache::lonsource::make_link($filelink); |
|
$r->print('<td>'."<a href=\"javascript:openWindow('".$sourcelink. |
|
"', 'previewsource', '700', '700', 'no', 'yes','yes')\";". |
|
" TARGET=_self>Yes</a> "."</td>\n"); |
|
} else { #A cuddled else. :P |
|
$r->print("<td> </td>\n"); |
|
} |
|
} |
|
if ($hash{'display_attrs_11'} == 1) { |
|
# links |
|
$r->print("<td>$filelink"); |
|
if ($dynhash{$filelink}->{'goto_list'}) { |
|
$r->print(&mt('Number of students: '). |
|
$dynhash{$filelink}->{'goto_list'}.'<br />'); |
|
} |
|
if ($dynhash{$filelink}->{'comefrom_list'}) { |
|
$r->print(&mt('Number of students: '). |
|
$dynhash{$filelink}->{'comefrom_list'}.'<br />'); |
|
} |
|
$r->print(" </td>\n"); |
|
} |
$r->print("</tr>\n"); |
$r->print("</tr>\n"); |
} |
} |
|
|
Line 1079 sub display_line {
|
Line 1124 sub display_line {
|
if ($hash{'display_attrs_8'} == 1) { |
if ($hash{'display_attrs_8'} == 1) { |
$r->print('<td> </td>'); |
$r->print('<td> </td>'); |
} |
} |
|
if ($hash{'display_attrs_10'} == 1) { |
|
$r->print('<td> </td>'); |
|
} |
|
if ($hash{'display_attrs_11'} == 1) { |
|
$r->print('<td> </td>'); |
|
} |
$r->print('</form></tr>'); |
$r->print('</form></tr>'); |
} |
} |
|
|