[LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm

www lon-capa-cvs@mail.lon-capa.org
Wed, 15 Jan 2003 23:58:58 -0000


www		Wed Jan 15 18:58:58 2003 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  First steps towards being able to render resource in directory browsing
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.55 loncom/interface/lonindexer.pm:1.56
--- loncom/interface/lonindexer.pm:1.55	Tue Jan 14 13:47:50 2003
+++ loncom/interface/lonindexer.pm	Wed Jan 15 18:58:58 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.55 2003/01/14 18:47:50 www Exp $
+# $Id: lonindexer.pm,v 1.56 2003/01/15 23:58:58 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -373,7 +373,7 @@
 	
 # ---------------------------------- get state of file attributes to be showing
 	if ($ENV{'form.attrs'} ne '') {
-	    for (my $i=0; $i<=7; $i++) {
+	    for (my $i=0; $i<=8; $i++) {
 		delete $hash{'display_attrs_'.$i};
 		if ($ENV{'form.attr'.$i} == 1) {
 		    $attrchk[$i] = 'checked';
@@ -381,7 +381,7 @@
 		}
 	    }
 	} else {
-	    for (my $i=0; $i<=7; $i++) {
+	    for (my $i=0; $i<=8; $i++) {
 		$attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;
 	    }
 	}
@@ -395,7 +395,7 @@
 <td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> Size</td>
 <td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> Last access</td>
 <td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> Last modified</td>
-</tr><tr>
+<td rowspan="2"><input type="checkbox" name="attr8" value="1" $attrchk[8] /> Show Resource</td></tr><tr>
 <td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> Author</td>
 <td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> Keywords</td>
 <td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> Language</td>
@@ -432,6 +432,8 @@
 	    if ($hash{'display_attrs_5'} == 1);
 	$r->print("<td><b>Language</b></td>\n")
 	    if ($hash{'display_attrs_6'} == 1);
+	$r->print("<td><b>Resource</b></td>\n")
+	    if ($hash{'display_attrs_8'} == 1);
 	$r->print('</tr>');
 
 # ----------------- read in what directories have previously been set to "open"
@@ -834,6 +836,17 @@
 	    $r->print('<td valign=bottom> '.($lang eq '' ? '&nbsp;' : $lang).
 		      " </td>\n");
 	}
+        if ($hash{'display_attrs_8'} == 1) {
+            my $output='';
+	    if (&Apache::loncommon::fileembstyle($curfext) eq 'ssi') {
+	       $output=&Apache::lonnet::ssi($filelink);
+               $output=~s/^.*\<body[^\>]*\>//si;
+               $output=~s/\<\/body\s*\>.*$//si;
+               $output='<font size="-2">'.$output.'</font>';
+	   }
+	   $r->print('<td valign=bottom> '.($output eq '' ? '&nbsp;':$output).
+		      " </td>\n");
+        }
 	$r->print("</tr>\n");
     }