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

jms jms@source.lon-capa.org
Mon, 02 Feb 2009 19:38:13 -0000


jms		Mon Feb  2 19:38:13 2009 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  "Subject" field for importing now an option
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.184 loncom/interface/lonindexer.pm:1.185
--- loncom/interface/lonindexer.pm:1.184	Fri Dec  5 10:23:56 2008
+++ loncom/interface/lonindexer.pm	Mon Feb  2 19:38:12 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.184 2008/12/05 10:23:56 bisitz Exp $
+# $Id: lonindexer.pm,v 1.185 2009/02/02 19:38:12 jms Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -420,7 +420,7 @@
 
 # ---------------------------------- get state of file attributes to be showing
 	if ($env{'form.attrs'}) {
-	    for (my $i=0; $i<=11; $i++) {
+	    for (my $i=0; $i<=12; $i++) {
 		delete $hash{'display_attrs_'.$i};
 		if ($env{'form.attr'.$i} == 1) {
 		    $attrchk[$i] = 'checked';
@@ -428,7 +428,7 @@
 		}
 	    }
 	} else {
-	    for (my $i=0; $i<=11; $i++) {
+	    for (my $i=0; $i<=12; $i++) {
 		$attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;
 	    }
 	}
@@ -444,6 +444,7 @@
 					   'st' => 'Statistics',
 					   'au' => 'Author',
 					   'kw' => 'Keywords',
+					   'sb' => 'Subject',
 					   'ln' => 'Language',
 					   'sa' => 'Source Available',
 					   'sr' => 'Show resource',
@@ -478,6 +479,7 @@
 <td><label><input type="checkbox" name="attr8" value="1" $attrchk[8] onClick="this.form.submit();" /> $lt{'st'}</label></td>
 <td><label><input type="checkbox" name="attr11" value="1" $attrchk[11] onClick="this.form.submit();" /> $lt{'li'}</label></td>
 <td><label><input type="checkbox" name="attr7" value="1" $attrchk[7] onClick="this.form.submit();" /> $lt{'sr'}</label></td>
+<td><label><input type="checkbox" name="attr12" value="1" $attrchk[12] onClick="this.form.submit();" /> $lt{'sb'}</label></td>
 <td>&nbsp;</td>
 </tr>
 </table>
@@ -569,7 +571,12 @@
 	    if ($hash{'display_attrs_11'} == 1);
 	$r->print("<th>".&mt("Resource")."</th>\n")
 	    if ($hash{'display_attrs_7'} == 1);
-        $r->print(&Apache::loncommon::end_data_table_header_row());
+	$r->print("<th>".&mt("Subject")."</th>\n")
+	    if ($hash{'display_attrs_12'} == 1);
+	    
+    $r->print(&Apache::loncommon::end_data_table_header_row());
+    
+    	
 
 # ----------------- read in what directories have previously been set to "open"
 	foreach (keys %hash) {
@@ -834,7 +841,7 @@
 
     my $tabtag='</td>';
     my $i=0;
-    while ($i<=11) {
+    while ($i<=12) {
 	$tabtag=join('',$tabtag,"<td>&nbsp;</td>")
 	    if ($i != 9 &&
 		$hash{'display_attrs_'.$i} == 1);
@@ -992,7 +999,7 @@
 	    $indent--;
 	}
 # General indentation
-	if ($indent > 0 and $indent < 11) {
+	if ($indent > 0 and $indent < 12) {
 	    $r->print("<img alt=\"\" src='",$iconpath,"whitespace",$indent,
 		      ".gif' class='LC_icon' />\n");
 	} elsif ($indent >0) {
@@ -1060,7 +1067,6 @@
 	    $r->print('<td> '.($keywords eq '' ? '&nbsp;' : $keywords).
 		      " </td>\n");
 	}
-#'
 
 	if ($hash{'display_attrs_6'} == 1) {
 	    my $lang = &Apache::lonnet::metadata($filelink,'language');
@@ -1112,14 +1118,27 @@
            &dynmetaprint($r,$filelink,'course_list');
 	   $r->print('</td>');
         }
-        if ($hash{'display_attrs_7'} == 1) {
+        
+   
+	
+	if ($hash{'display_attrs_7'} == 1) {
 # Show resource
 	   my $output=&showpreview($filelink);
            $r->print('<td> '.($output eq '' ? '&nbsp;':$output).
 		      " </td>\n");
-        }
-        $r->print(&Apache::loncommon::end_data_table_row());
     }
+    
+    if ($hash{'display_attrs_12'} == 1) {
+	    my $subject = &Apache::lonnet::metadata($filelink,'subject');
+	    # $keywords = '&nbsp;' if (!$keywords);
+	    $r->print('<td> '.($subject eq '' ? '&nbsp;' : $subject).
+		      " </td>\n");
+	}
+	
+	$r->print(&Apache::loncommon::end_data_table_row());
+}
+    
+    
 
 # -- display directory
     if ($fnptr == $dirptr) {
@@ -1132,7 +1151,7 @@
         $r->print($extrafield.'<td valign="'.$valign.'">');
 	&begin_form ($r,$curdir);
 	my $indentm1 = $indent-1;
-	if ($indentm1 < 11 and $indentm1 > 0) {
+	if ($indentm1 < 12 and $indentm1 > 0) {
 	    $r->print("<img alt=\"\" src=",$iconpath,"whitespace",$indentm1,
 		      ".gif class='LC_icon' />\n");
 	} else {
@@ -1194,19 +1213,27 @@
 	    $r->print('<td> '.($lang eq '' ? '&nbsp;' : $lang).
 		      " </td>\n");
 	}
+	
 	if ($hash{'display_attrs_8'} == 1) {
 	   $r->print('<td>&nbsp;</td>');
 	}
  	if ($hash{'display_attrs_10'} == 1) {
 	   $r->print('<td>&nbsp;</td>');
 	}
-	if ($hash{'display_attrs_11'} == 1) {
-	   $r->print('<td>&nbsp;</td>');
-	}
 	if ($hash{'display_attrs_7'} == 1) {
 	   $r->print('<td>&nbsp;</td>');
-        }
-        $r->print(&Apache::loncommon::end_data_table_row());
+    }     
+    if ($hash{'display_attrs_11'} == 1) {
+	   $r->print('<td>&nbsp;</td>');
+	}
+	if ($hash{'display_attrs_12'} == 1) {
+	    my $subject = &Apache::lonnet::metadata($filelink,'subject');
+	    # $keywords = '&nbsp;' if (!$keywords);
+	    $r->print('<td> '.($subject eq '' ? '&nbsp;' : $subject).
+		      " </td>\n");
+	}
+	
+	$r->print(&Apache::loncommon::end_data_table_row());
     }
 
 }