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

ng lon-capa-cvs@mail.lon-capa.org
Wed, 19 Mar 2003 14:50:32 -0000


ng		Wed Mar 19 09:50:32 2003 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  When show resource option is checked, paint cell if not a resource.
  Line up name at top of the cell if resource option is checked - makes it
  easier to read name and see resource at the same time.
  
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.62 loncom/interface/lonindexer.pm:1.63
--- loncom/interface/lonindexer.pm:1.62	Fri Mar 14 11:12:14 2003
+++ loncom/interface/lonindexer.pm	Wed Mar 19 09:50:32 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.62 2003/03/14 16:12:14 albertel Exp $
+# $Id: lonindexer.pm,v 1.63 2003/03/19 14:50:32 ng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -390,11 +390,12 @@
 <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>
-<td rowspan="2"><input type="checkbox" name="attr8" value="1" $attrchk[8] /> Show Resource</td></tr><tr>
+<td><input type="checkbox" name="attr8" value="1" $attrchk[8] /> All versions</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>
-<td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> All versions</td>
+<td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> Show Resource</td>
+<td>&nbsp;</td>
 </tr></table>
 <input type="hidden" name="dirPointer" value="on" />
 <input type="hidden" name="acts" value="" />
@@ -428,7 +429,7 @@
 	$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);
+	    if ($hash{'display_attrs_7'} == 1);
 	$r->print('</tr>');
 
 # ----------------- read in what directories have previously been set to "open"
@@ -514,7 +515,7 @@
 	my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); 
 	next if $strip =~ /.*\.meta$/;
 	my (@fileparts) = split(/\./,$strip);
-	if ($hash{'display_attrs_7'} != 1) {
+	if ($hash{'display_attrs_8'} != 1) {
 	    if (scalar(@fileparts) >= 3) {
 		my $fext = pop @fileparts;
 		my $ov = pop @fileparts;
@@ -638,16 +639,18 @@
     my $tabtag='</td>';
     my $i=0;
 
-    while ($i<=6) {
+    while ($i<=7) {
 	$tabtag=join('',$tabtag,"<td>&nbsp;</td>")
 	    if $hash{'display_attrs_'.$i} == 1;
 	$i++;
     }
+	
+    my $valign = ($hash{'display_attrs_7'} == 1 ? 'top' : 'bottom');
 
 # display uplink arrow
     if ($filecom[1] eq 'viewOneUp') {
 	$r->print("<tr bgcolor=$fileclr>$extrafield");
-	$r->print("<td valign=bottom>\n");
+	$r->print("<td valign=$valign>\n");
 	$r->print ('<form method="post" name="dirpathUP" action="'.$startdir.
 		   '/" '.
 		   'onSubmit="return rep_dirpath(\'UP\','.
@@ -669,7 +672,7 @@
 	$r->print ('<input type="hidden" name="dirPointer" value="on">'."\n")
 	    if ($ENV{'form.dirPointer'} eq "on");
 	$r->print("<tr bgcolor=$fileclr>$extrafield");
-	$r->print("<td valign=bottom>");
+	$r->print("<td valign=$valign>");
 	&begin_form ($r,$filecom[0].'/');
 	my $anchor = $filecom[0].'/';
 	$anchor =~ s/\///g;
@@ -694,7 +697,7 @@
     }
     if ($filecom[1] eq 'user') {
 	$r->print("<tr bgcolor=$fileclr>$extrafield");
-	$r->print("<td valign=bottom nowrap>\n");
+	$r->print("<td valign=$valign nowrap>\n");
 	my $curdir = $startdir.$filecom[0].'/';
 	my $anchor = $curdir;
 	$anchor =~ s/\///g;
@@ -738,7 +741,7 @@
 	$iconname = $curfext.".gif" unless
 	    (!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn');
 	#
-	$r->print("<tr bgcolor=$fileclr><td nowrap valign='bottom'>");
+	$r->print("<tr bgcolor=$fileclr><td nowrap valign='$valign'>");
 	my $metafile = grep /^\Q$filecom[0]\E\.meta\&/, @list;
 	my $title;
         if ($ENV{'form.catalogmode'} eq 'interactive') {
@@ -752,7 +755,7 @@
                       $titleesc,"','",$filelink,"')\">");
 	    $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".
 		      "\n");
-	    $r->print("</td><td valign='bottom' nowrap>");
+	    $r->print("</td><td valign='$valign' nowrap>");
 	}
         elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
 	    $title=$listname;
@@ -771,7 +774,7 @@
 	    $r->print("<input type='hidden' name='title"."' ".
 		      "value='$titleesc'>\n");
 	    $r->print("</form>\n");
-	    $r->print("</td><td valign='bottom' nowrap>");
+	    $r->print("</td><td valign='$valign' nowrap>");
 	    $hash{"pre_${fnum}_link"}=$filelink;
 	    $hash{"pre_${fnum}_title"}=$titleesc;
   	    $fnum++;
@@ -806,40 +809,40 @@
 	if ($hash{'display_attrs_0'} == 1) {
 	    my $title = &Apache::lonnet::metadata($filelink,'title')
 		if ($metafile == 1);
-	    $r->print('<td valign=bottom> '.($title eq '' ? '&nbsp;' : $title).
+	    $r->print('<td valign=$valign> '.($title eq '' ? '&nbsp;' : $title).
 		      ' </td>'."\n");
 	}
-	$r->print('<td align=right valign=bottom> ',
+	$r->print('<td align=right valign=$valign> ',
 		  $filecom[8]," </td>\n") 
 	    if $hash{'display_attrs_1'} == 1;
-	$r->print('<td valign=bottom> '.
+	$r->print('<td valign=$valign> '.
 		  (localtime($filecom[9]))." </td>\n") 
 	    if $hash{'display_attrs_2'} == 1;
-	$r->print('<td valign=bottom> '.
+	$r->print('<td valign=$valign> '.
 		  (localtime($filecom[10]))." </td>\n") 
 	    if $hash{'display_attrs_3'} == 1;
 
 	if ($hash{'display_attrs_4'} == 1) {
 	    my $author = &Apache::lonnet::metadata($filelink,'author')
 		if ($metafile == 1);
-	    $r->print('<td valign=bottom> '.($author eq '' ? '&nbsp;' : $author).
+	    $r->print('<td valign=$valign> '.($author eq '' ? '&nbsp;' : $author).
 		      " </td>\n");
 	}
 	if ($hash{'display_attrs_5'} == 1) {
 	    my $keywords = &Apache::lonnet::metadata($filelink,'keywords')
 		if ($metafile == 1);
 	    # $keywords = '&nbsp;' if (!$keywords);
-	    $r->print('<td valign=bottom> '.($keywords eq '' ? '&nbsp;' : $keywords).
+	    $r->print('<td valign=$valign> '.($keywords eq '' ? '&nbsp;' : $keywords).
 		      " </td>\n");
 	}
 	if ($hash{'display_attrs_6'} == 1) {
 	    my $lang = &Apache::lonnet::metadata($filelink,'language')
 		if ($metafile == 1);
 	    $lang = &Apache::loncommon::languagedescription($lang);
-	    $r->print('<td valign=bottom> '.($lang eq '' ? '&nbsp;' : $lang).
+	    $r->print('<td valign=$valign> '.($lang eq '' ? '&nbsp;' : $lang).
 		      " </td>\n");
 	}
-        if ($hash{'display_attrs_8'} == 1) {
+        if ($hash{'display_attrs_7'} == 1) {
             my $output='';
             my $embstyle=&Apache::loncommon::fileembstyle($curfext);
 	    if ($embstyle eq 'ssi') {
@@ -852,7 +855,7 @@
 		 $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.
                  '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';
            }
-	   $r->print('<td valign=bottom> '.($output eq '' ? '&nbsp;':$output).
+	   $r->print('<td valign=$valign> '.($output eq '' ? '&nbsp;':$output).
 		      " </td>\n");
         }
 	$r->print("</tr>\n");
@@ -865,7 +868,7 @@
 	my $curdir = $startdir.$filecom[0].'/';
 	my $anchor = $curdir;
 	$anchor =~ s/\///g;
-	$r->print("<tr bgcolor=$fileclr>$extrafield<td valign=bottom>");
+	$r->print("<tr bgcolor=$fileclr>$extrafield<td valign=$valign>");
 	&begin_form ($r,$curdir);
 	my $indentm1 = $indent-1;
 	if ($indentm1 < 11 and $indentm1 > 0) {