[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm portfolio.pm /publisher lonpubdir.pm

bisitz bisitz@source.lon-capa.org
Fri, 28 Nov 2008 16:10:26 -0000


This is a MIME encoded message

--bisitz1227888626
Content-Type: text/plain

bisitz		Fri Nov 28 16:10:26 2008 EDT

  Modified files:              
    /loncom/interface	loncommon.pm portfolio.pm 
    /loncom/publisher	lonpubdir.pm 
  Log:
  - Use LON-CAPA standard data tables in Construction Space and Portofolio Tables
  - Moved color indicator from whole background to new and only small column.
    This should prevent a "color shock" but keeps the "show status by different colors" functionality.
  
  loncommon.pm:
  - Adjusted the related styles ("LC_browser...") correspondingly to the changes described above.
  
  Additional changes/optimizations/corrections in portfolio.pm:
  - Added missing &mt() calls to headline in selection mode
  - Replaced hardcoded nobreak with CSS
  - Fill empty table cells in directory rows with blanks to have a proper table structure
  - Optimized and extended colspan precalculation
  - XHTML conform "checked" usage in checkboxes
  
  
--bisitz1227888626
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20081128161026.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.695 loncom/interface/loncommon.pm:1.696
--- loncom/interface/loncommon.pm:1.695	Fri Nov 28 14:36:50 2008
+++ loncom/interface/loncommon.pm	Fri Nov 28 16:10:20 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.695 2008/11/28 14:36:50 raeburn Exp $
+# $Id: loncommon.pm,v 1.696 2008/11/28 16:10:20 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4855,33 +4855,25 @@
   font-size: smaller;
 }
 
-table#LC_browser {
- 
-}
-table#LC_browser tr th {
-  background: $table_header;
-}
-table#LC_browser tr td {
-  padding: 2px;
-}
-table#LC_browser tr.LC_browser_file,
-table#LC_browser tr.LC_browser_file_published {
+table.LC_data_table tr > td.LC_browser_file,
+table.LC_data_table tr > td.LC_browser_file_published {
   background: #CCFF88;
 }
-table#LC_browser tr.LC_browser_file_locked,
-table#LC_browser tr.LC_browser_file_unpublished {
+table.LC_data_table tr > td.LC_browser_file_locked,
+table.LC_data_table tr > td.LC_browser_file_unpublished {
   background: #FFAA99;
 }
-table#LC_browser tr.LC_browser_file_obsolete {
+table.LC_data_table tr > td.LC_browser_file_obsolete {
   background: #AAAAAA;
 }
-table#LC_browser tr.LC_browser_file_modified,
-table#LC_browser tr.LC_browser_file_metamodified {
+table.LC_data_table tr > td.LC_browser_file_modified,
+table.LC_data_table tr > td.LC_browser_file_metamodified {
   background: #FFFF77;
 }
-table#LC_browser tr.LC_browser_folder {
+table.LC_data_table tr.LC_browser_folder > td {
   background: #CCCCFF;
 }
+
 span.LC_current_location {
   font-size: x-large;
   background: $pgbg;
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.196 loncom/interface/portfolio.pm:1.197
--- loncom/interface/portfolio.pm:1.196	Mon Nov 17 17:04:20 2008
+++ loncom/interface/portfolio.pm	Fri Nov 28 16:10:20 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.196 2008/11/17 17:04:20 schafran Exp $
+# $Id: portfolio.pm,v 1.197 2008/11/28 16:10:20 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -191,7 +191,7 @@
 	$href_location, $url, $current_path, $access_admin_text, $versions)=@_;
 
     my $fullpath =  &prepend_group($current_path.$filename);
-    $r->print('<tr class="'.$css_class.'">');
+    $r->print(&Apache::loncommon::start_data_table_row());
     $r->print($line); # contains first two cells of table
     my $lock_info;
     if ($version_flag) { # versioned can't be versioned, so TRUE when root file
@@ -227,15 +227,19 @@
     $r->print('<td>'.$size.'</td>');
     $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
     if ($select_mode ne 'true') {
-	$r->print('<td><span style="white-space: nowrap">'.
-		  &mt($curr_access).'&nbsp;&nbsp;&nbsp;');
+        $r->print('<td class="'.$css_class.'">&nbsp;&nbsp;</td>'); # Display status
+        $r->print('<td><span class="LC_nobreak">'
+                 .&mt($curr_access).'&nbsp;&nbsp;&nbsp;'
+       );
         my %anchor_fields = (
             'access' => $filename,
             'currentpath' => $current_path
         );
 	$r->print(&make_anchor($url, \%anchor_fields, $access_admin_text).'</span></td>');
+    } else {
+        $r->print('<td class="'.$css_class.'">&nbsp;&nbsp;</td>'); # Display status
     }
-    $r->print('</tr>'.$/);
+    $r->print(&Apache::loncommon::end_data_table_row().$/);
 }
 
 sub display_directory {
@@ -277,21 +281,30 @@
     }
     if ($select_mode eq 'true') {
         $r->print('<form method="post" name="checkselect" action="'.$url.'">');
-        $r->print('<table id="LC_browser">'.
-            '<tr><th>Select</th><th>&nbsp;</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');
+        $r->print(&Apache::loncommon::start_data_table()
+                 .&Apache::loncommon::start_data_table_header_row()
+                 .'<th>'.&mt('Select').'</th>'
+                 .'<th>&nbsp;</th><th>&nbsp;</th>'
+                 .'<th>'.&mt('Name').'</th>'
+                 .'<th>'.&mt('Size').'</th>'
+                 .'<th>'.&mt('Last Modified').'</th>'
+                 .'<th>&nbsp;</th>'
+                 .&Apache::loncommon::end_data_table_header_row()
+        );
     } else {
         $r->print('<form method="post" action="'.$url.'">');
 	$r->print(&Apache::loncommon::help_open_topic('Portfolio FileList',
 						      &mt('Using the portfolio file list')));
-        $r->print('<table id="LC_browser">'.
-                  '<tr>'
+        $r->print(&Apache::loncommon::start_data_table()
+                 .&Apache::loncommon::start_data_table_header_row()
                  .'<th colspan="2">'.&mt('Actions'). &Apache::loncommon::help_open_topic('Portfolio FileAction').'</th>'
                  .'<th>&nbsp;</th><th>&nbsp;</th>'
                  .'<th>'.&mt('Name').&Apache::loncommon::help_open_topic('Portfolio OpenFile').'</th>'
                  .'<th>'.&mt('Size').'</th>'
                  .'<th>'.&mt('Last Modified').'</th>'
+                 .'<th>&nbsp;</th>'
                  .'<th>'.&mt('Current Access Status').&Apache::loncommon::help_open_topic('Portfolio ShareFile').'</th>'
-                 .'</tr>');
+                 .&Apache::loncommon::end_data_table_header_row());
     }
     $r->print("\n".&group_form_data()."\n");
 
@@ -349,12 +362,17 @@
     	        $version_flag = '&nbsp;';
     	    }
             if ($dirptr&$testdir) {
-		my $colspan='colspan="2"';
+		my $colspan_folder='';
+		my $colspan_fill='';
                 if ($select_mode eq 'true'){
-		    undef($colspan);
+                    $colspan_fill=' colspan="3"';
+                } else {
+                    $colspan_folder=' colspan="2"';
+                    $colspan_fill=' colspan="4"';
                 }
-		$r->print('<tr class="LC_browser_folder"><td '.$colspan.'><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_closed.gif" /></td>');
-                $r->print('<td>'.&mt('Go to ...').'</td>');
+		$r->print('<tr class="LC_browser_folder">');
+                $r->print('<td'.$colspan_folder.'><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_closed.gif" /></td>'
+                         .'<td>'.&mt('Go to ...').'</td>');
                 my %anchor_fields = (
                     'selectfile'    => $filename.'/',
                     'currentpath'   => $current_path.$filename.'/',
@@ -362,7 +380,9 @@
                     'fieldname'     => $env{"form.fieldname"},
                     'continue'      => $env{"form.continue"}
                 );  
-                $r->print('<td>'.$version_flag.'</td><td>'.&make_anchor($url,\%anchor_fields,$filename.'/').'</td>'); 
+                $r->print('<td>'.$version_flag.'</td>'
+                         .'<td>'.&make_anchor($url,\%anchor_fields,$filename.'/').'</td>'); 
+                $r->print('<td'.$colspan_fill.'>&nbsp;</td>');
                 $r->print('</tr>'); 
             } else {
 		my $css_class = 'LC_browser_file';
@@ -370,7 +390,7 @@
                 if ($select_mode eq 'true') {
                     $line='<td><input type="checkbox" name="checkfile" value="'.$filename.'"';
 		    if ($$checked_files{$filename} eq 'selected') {
-                        $line.=" checked ";
+                        $line.=' checked="checked" ';
                     }
 		    $line.=' /></td>';
                 } else {
@@ -453,7 +473,7 @@
         }
     }
     if ($select_mode eq 'true') {
-        $r->print('</table>
+        $r->print(&Apache::loncommon::end_data_table().'
             <input type="hidden" name="continue" value="true" />
             <input type="hidden" name="fieldname" value="'.$env{'form.fieldname'}.'" />
             <input type="hidden" name="mode" value="selectfile" />
@@ -462,7 +482,7 @@
             <input type="hidden" name="currentpath" value="'.$current_path.'" />
         </form>');        
     } else {
-        $r->print('</table>');
+        $r->print(&Apache::loncommon::end_data_table());
         if ($can_delete) {
             $r->print('
         <input type="submit" name="doit" value="'.&mt('Delete Selected').'" />'.
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.114 loncom/publisher/lonpubdir.pm:1.115
--- loncom/publisher/lonpubdir.pm:1.114	Thu Nov 20 15:19:28 2008
+++ loncom/publisher/lonpubdir.pm	Fri Nov 28 16:10:26 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.114 2008/11/20 15:19:28 jms Exp $
+# $Id: lonpubdir.pm,v 1.115 2008/11/28 16:10:26 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -106,14 +106,16 @@
   
   # Start off the directory table.
   $r->print('<h3>'.&mt('Directory Contents:').'</h3>');
-  $r->print('<table id="LC_browser"><tr>'.
-            '<th>'.&mt('Type').'</th>'.
-            '<th>'.&mt('Actions').'</th>'.
-            '<th>'.&mt('Name').'</th>'.
-            '<th>'.&mt('Title').'</th>'.
-	    '<th>'.&mt('Status').'</th>'.
-            '<th>'.&mt('Last Modified').
-	    '</th></tr>'."\n");
+  $r->print(&Apache::loncommon::start_data_table()
+           .&Apache::loncommon::start_data_table_header_row()
+           .'<th>'.&mt('Type').'</th>'
+           .'<th>'.&mt('Actions').'</th>'
+           .'<th>'.&mt('Name').'</th>'
+           .'<th>'.&mt('Title').'</th>'
+           .'<th colspan="2">'.&mt('Status').'</th>'
+           .'<th>'.&mt('Last Modified').'</th>'
+           .&Apache::loncommon::end_data_table_header_row()
+  );
 
   my $filename;
   my $dirptr=16384;		# Mask indicating a directory in stat.cmode.
@@ -139,7 +141,9 @@
   }
   closedir(DIR);
 
-  $r->print('</table>'.&Apache::loncommon::end_page());
+  $r->print(&Apache::loncommon::end_data_table()
+           .&Apache::loncommon::end_page()
+  );
   return OK;  
 }
 #
@@ -566,7 +570,7 @@
 		  '<td>'.$actionitem.'</td>'.
 		  '<td><span class="LC_filename"><a href="'.&HTML::Entities::encode($here.'/'.$dirname,'<>&"').'/" target="_parent">'.
 		  $disfilename.'</a></span></td>'.
-		        '<td colspan="2">'.($kaputt?&Apache::lonhtmlcommon::authorbombs($resdir.'/'.$disfilename.'/'):'').$Apache::lonpublisher::metadatafields{'title'});
+		        '<td colspan="3">'.($kaputt?&Apache::lonhtmlcommon::authorbombs($resdir.'/'.$disfilename.'/'):'').$Apache::lonpublisher::metadatafields{'title'});
 	if ($Apache::lonpublisher::metadatafields{'subject'} ne '') {
 	    $r->print(' <i>'.
 		      $Apache::lonpublisher::metadatafields{'subject'}.
@@ -688,7 +692,7 @@
     }
     my $pub_select = '';
     &create_pubselect($r,\$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres);
-    $r->print('<tr class="LC_browser_file_'.$pubstatus.'">'.
+    $r->print(&Apache::loncommon::start_data_table_row().
 	      '<td>'.($filename=~/[\#\~]$/?'&nbsp;':
 		      '<img src="'.&Apache::loncommon::icon($filename).'" alt="" />').'</td>'.
               '<td>'.$pub_select.'</td>'.
@@ -697,9 +701,11 @@
                $filename.'</a></span>'.$editlink2.$editlink.
 	      '</td>'.
 	      '<td>'.$title.'</td>'.
-	      '<td>'.$status.'</td>'.
+              '<td class="LC_browser_file_'.$pubstatus.'">&nbsp;&nbsp;</td>'. # Display publication status
+              '<td>'.$status.'</td>'.
 	      '<td>'.&Apache::lonlocal::locallocaltime($cmtime).'</td>'.
-	      "</tr>\n");
+	      &Apache::loncommon::end_data_table_row()
+    );
     return OK;
 }
 

--bisitz1227888626--