[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Fri, 01 Aug 2008 18:09:39 -0000


bisitz		Fri Aug  1 14:09:39 2008 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  Corrected and optimized keyword table:
    - Row counter corrected - now first row with same amount of columns
    - Added missing standard row start / end calls (-> 1.241)
    - Proper ending of table (fill up with "empty" td)
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.242 loncom/publisher/lonpublisher.pm:1.243
--- loncom/publisher/lonpublisher.pm:1.242	Fri Aug  1 13:29:57 2008
+++ loncom/publisher/lonpublisher.pm	Fri Aug  1 14:09:38 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.242 2008/08/01 17:29:57 bisitz Exp $
+# $Id: lonpublisher.pm,v 1.243 2008/08/01 18:09:38 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1248,7 +1248,8 @@
     my $colcount=0;
 
     foreach (sort keys %keywords) {
-	$keywordout.='<td><label><input type="checkbox" name="keywords" value="'.$_.'"';
+	$colcount++;
+	$keywordout.='<td><label>'.$colcount.'<input type="checkbox" name="keywords" value="'.$_.'"';
 	if ($metadatafields{'keywords'}) {
 	    if ($metadatafields{'keywords'}=~/\Q$_\E/) {
 		$keywordout.=' checked="on"';
@@ -1259,12 +1260,20 @@
 	    $env{'form.keywords'}.=$_.',';
 	}
 	$keywordout.=' />'.$_.'</label></td>';
-	if ($colcount>10) {
-	    $keywordout.="</tr><tr>\n";
+	if ($colcount>=10) {
+	    $keywordout.=&Apache::loncommon::end_data_table_row()
+                        .&Apache::loncommon::start_data_table_row();
 	    $colcount=0;
 	}
-	$colcount++;
     }
+    # Proper end of started table row:
+    if ($colcount != 0) { # has still to be improved: if amount of keywords mod 10 == 0, then do not start another table row
+        while ($colcount<10) {
+            $keywordout.='<td>&nbsp;</td>';
+            $colcount++;
+        }
+    }
+
     $env{'form.keywords'}=~s/\,$//;
 
     $keywordout.=&Apache::loncommon::end_data_table_row()