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

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Fri, 31 Oct 2008 18:02:33 -0000


This is a MIME encoded message

--bisitz1225476153
Content-Type: text/plain

bisitz		Fri Oct 31 18:02:33 2008 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Optimized first page of print options screen (Part 1):
  - Use LON-CAPA pick box style for print options (Finished for authors. More to do for CCs, but still functional)
  - Use LON-CAPA data table style for layout options
  - Added/optimized headlines
  - Recent printouts:
      - Separator line between options and list of recent printouts
      - Use proper table (data table) with separated columns for download, creation date and file size
  - Added missing &mt() calls
  - Added "&" to some sub routine calls
  
  
--bisitz1225476153
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20081031180233.txt"

Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.543 loncom/interface/lonprintout.pm:1.544
--- loncom/interface/lonprintout.pm:1.543	Thu Oct  2 17:12:18 2008
+++ loncom/interface/lonprintout.pm	Fri Oct 31 18:02:33 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.543 2008/10/02 17:12:18 raeburn Exp $
+# $Id: lonprintout.pm,v 1.544 2008/10/31 18:02:33 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1281,20 +1281,43 @@
 	    $cuid,$cgid,$crdev,$csize,
 	    $catime,$cmtime,$cctime,
 	    $cblksize,$cblocks)=stat($prtspool.'/'.$filename);
-	my $result="<a href='/prtspool/$filename'>".
-	    &mt('Generated [_1] ([_2] bytes)',
-		&Apache::lonlocal::locallocaltime($cctime),$csize).
-		'</a><br />';
+        my $ext_text = 'pdf' ? &mt('PDF File'):&mt('Zip File');
+	my $result=&Apache::loncommon::start_data_table_row()
+                  .'<td>'
+                  .'<a href="/prtspool/'.$filename.'">'.$ext_text.'</a>'
+                  .'</td>'
+                  .'<td>'.&Apache::lonlocal::locallocaltime($cctime).'</td>'
+                  .'<td align="right">'.$csize.'</td>'
+                  .&Apache::loncommon::end_data_table_row();
 	if ($ext eq 'pdf') { $pdf_result .= $result; }
 	if ($ext eq 'zip') { $zip_result .= $result; }
     }
+    if ($zip_result || $pdf_result) {
+        $r->print('<hr />');
+    }
     if ($zip_result) {
-	$r->print('<h4>'.&mt('Recently generated printout zip files')."</h4>\n"
-		  .$zip_result);
+	$r->print('<h3>'.&mt('Recently generated printout zip files')."</h3>\n"
+                  .&Apache::loncommon::start_data_table()
+                  .&Apache::loncommon::start_data_table_header_row()
+                  .'<th>'.&mt('Download').'</th>'
+                  .'<th>'.&mt('Creation Date').'</th>'
+                  .'<th>'.&mt('File Size (Bytes)').'</th>'
+                  .&Apache::loncommon::end_data_table_header_row()
+                  .$zip_result
+                  .&Apache::loncommon::end_data_table()
+        );
     }
     if ($pdf_result) {
-	$r->print('<h4>'.&mt('Recently generated printouts')."</h4>\n"
-		  .$pdf_result);
+	$r->print('<h3>'.&mt('Recently generated printouts')."</h3>\n"
+                  .&Apache::loncommon::start_data_table()
+                  .&Apache::loncommon::start_data_table_header_row()
+                  .'<th>'.&mt('Download').'</th>'
+                  .'<th>'.&mt('Creation Date').'</th>'
+                  .'<th>'.&mt('File Size (Bytes)').'</th>'
+                  .&Apache::loncommon::end_data_table_header_row()
+                  .$pdf_result
+                  .&Apache::loncommon::end_data_table()
+        );
     }
 }
 
@@ -3128,10 +3151,18 @@
 
     if (($perm{'pav'} and &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) or 
 	($helper->{VARS}->{'construction'} eq '1')) {
-	addMessage("<hr width='33%' /><table><tr><td align='right'>".
-                   '<label for="ANSWER_TYPE_forminput">'.
-                   &mt('Print').
-                   "</label>: </td><td>");
+	&addMessage('<br />'
+                   .'<h3>'.&mt('Print Options').'</h3>'
+                   .&Apache::lonhtmlcommon::start_pick_box()
+#                  .&Apache::lonhtmlcommon::row_headline()
+#                  .'<h3>'.&mt('Print Options').'</h3>'
+#                  .&Apache::lonhtmlcommon::row_closure()
+                   .&Apache::lonhtmlcommon::row_title(
+                       '<label for="ANSWER_TYPE_forminput">'
+                      .&mt('Print Answers')
+                      .'</label>'
+                    )
+        );
         $paramHash = Apache::lonhelper::getParamHash();
 	$paramHash->{'variable'} = 'ANSWER_TYPE';   
 	$helper->declareVar('ANSWER_TYPE');         
@@ -3141,7 +3172,7 @@
                                    ['Only Answers', 'only']
                                 ];
         Apache::lonhelper::dropdown->new();
-	addMessage("</td></tr>");
+	&addMessage(&Apache::lonhtmlcommon::row_closure());
 	$startedTable = 1;
     }
 
@@ -3153,10 +3184,12 @@
                        "</label>: </td><td>");
 	    $startedTable = 1;
 	} else {
-	    addMessage("<tr><td align='right'>".
-                       '<label for="LATEX_TYPE_forminput">'.
-                        &mt('LaTeX mode').
-                       "</label>: </td><td>");
+	    &addMessage(&Apache::lonhtmlcommon::row_title(
+                           '<label for="LATEX_TYPE_forminput">'
+                           .&mt('LaTeX mode')
+                           .'</label>'
+                        )
+            );
 	}
         $paramHash = Apache::lonhelper::getParamHash();
 	$paramHash->{'variable'} = 'LATEX_TYPE';   
@@ -3172,10 +3205,13 @@
 	}
         Apache::lonhelper::dropdown->new();
  
-	addMessage("</td></tr><tr><td align='right'>".
-                   '<label for="TABLE_CONTENTS_forminput">'.
-                   &mt('Print Table of Contents').
-                   "</label>: </td><td>");
+	&addMessage(&Apache::lonhtmlcommon::row_closure()
+                   .&Apache::lonhtmlcommon::row_title(
+                        '<label for="TABLE_CONTENTS_forminput">'
+                       .&mt('Print Table of Contents')
+                       .'</label>'
+                    )
+        );
         $paramHash = Apache::lonhelper::getParamHash();
 	$paramHash->{'variable'} = 'TABLE_CONTENTS';   
 	$helper->declareVar('TABLE_CONTENTS');         
@@ -3183,7 +3219,7 @@
                                    ['No', 'no'],
                                    ['Yes', 'yes'] ];
         Apache::lonhelper::dropdown->new();
-	addMessage("</td></tr>");
+	&addMessage(&Apache::lonhtmlcommon::row_closure());
         
 	if (not $helper->{VARS}->{'construction'}) {
 	    addMessage("<tr><td align='right'>".
@@ -3242,32 +3278,44 @@
             my $stylefiletext=&mt("Use style file");
             my $selectfiletext=&mt("Select style file");
 
-	    my $xmlfrag .= <<"RNDSEED";
-	    <message><tr><td align='right'>
-            <label for="curseed_forminput">$randseedtext</label>:
-            </td><td></message>
-	    <string variable="curseed" size="15" maxlength="15">
-		<defaultvalue>
-	            return $helper->{VARS}->{'curseed'};
-	        </defaultvalue>
-	    </string>
-	     <message></td></tr><tr><td align="right">
-             <label for="style_file">$stylefiletext</label>:
-             </td><td></message>
+	    my $xmlfrag .= '<message>'
+            .&Apache::lonhtmlcommon::row_title('<label for="curseed_forminput">'
+                                              .$randseedtext
+                                              .'</label>'
+             )
+            .'</message>
+            <string variable="curseed" size="15" maxlength="15">
+                <defaultvalue>
+                   return '.$helper->{VARS}->{'curseed'}.';
+                </defaultvalue>'
+            .'</string>'
+            .'<message>'
+            .&Apache::lonhtmlcommon::row_closure()
+            .&Apache::lonhtmlcommon::row_title('<label for="style_file">'
+                                              .$stylefiletext
+                                              .'</label>'
+             )
+            .'</message>
              <string variable="style_file" size="40">
-		<defaultvalue>
-	            return $stylevalue;
-	        </defaultvalue>
-             </string><message>&nbsp; <a href="javascript:openbrowser('helpform','style_file_forminput','sty')">$selectfiletext</a> </td></tr><tr><td></td><td align="left"></message>
+                <defaultvalue>
+                    return '.$stylevalue.';
+                </defaultvalue>
+             </string><message>&nbsp;'
+.qq|<a href="javascript:openbrowser('helpform','style_file_forminput','sty')">|
+.$selectfiletext.'</a>'
+            .&Apache::lonhtmlcommon::row_closure()
+            .&Apache::lonhtmlcommon::row_title(&mt('Show all foils'))
+            .'</message>
 	     <choices allowempty="1" multichoice="true" variable="showallfoils">
-                <choice computer="1">Show all foils</choice>
-             </choices>
-	     <message></td></tr></message>
-RNDSEED
+                <choice computer="1">&nbsp;</choice>
+             </choices>'
+	    .'<message>'
+            .&Apache::lonhtmlcommon::row_closure()
+            .'</message>';
             &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
 
 
-	    addMessage("<tr><td>Problem Type:</td><td>");
+            &addMessage(&Apache::lonhtmlcommon::row_title(&mt('Problem Type')));
 	    #
 	    # Initial value from construction space:
 	    #
@@ -3286,16 +3334,16 @@
 PROBTYPE
             &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
 	    
-	    addMessage("</td></tr>"); 
+            &addMessage(&Apache::lonhtmlcommon::row_closure(1));
 
-	} 
+        }
     }
 
 
 
 
     if ($startedTable) {
-	addMessage("</table>");
+        &addMessage(&Apache::lonhtmlcommon::end_pick_box());
     }
 
     Apache::lonprintout::page_format_state->new("FORMAT");
@@ -3397,24 +3445,22 @@
     my $pdfFormLabel=&mt('PDF-Formfields');
     my $with=&mt('with Formfields');
     my $without=&mt('without Formfields');
-    $result .= <<STATEHTML;
+    $result.='<h3>'.&mt('Layout Options').'</h3>'
+            .&Apache::loncommon::start_data_table()
+            .&Apache::loncommon::start_data_table_header_row()
+            .'<th>'.$PageLayout.'</th>'
+            .'<th>'.$NumberOfColumns.'</th>'
+            .'<th>'.$PaperType.'</th>'
+            .'<th>'.$pdfFormLabel.'</th>'
+            .&Apache::loncommon::end_data_table_header_row()
+            .&Apache::loncommon::start_data_table_row()
+    .'<td>'
+    .'<label><input type="radio" name="'.${var}.'.layout" value="L" />'.$landscape.'</label><br />'
+    .'<label><input type="radio" name="'.${var}.'.layout" value="P" checked="checked" />'.$portrait.'</label>'
+    .'</td>';
 
-<hr width="33%" />
-<table cellpadding="3">
-  <tr>
-    <td align="center"><b>$PageLayout</b></td>
-    <td align="center"><b>$NumberOfColumns</b></td>
-    <td align="center"><b>$PaperType</b></td>
-    <td align="center"><b>$pdfFormLabel</b></td>
-  </tr>
-  <tr>
-    <td>
-      <label><input type="radio" name="${var}.layout" value="L" /> $landscape </label><br />
-      <label><input type="radio" name="${var}.layout" value="P" checked='1'  /> $portrait </label>
-    </td>
-    <td align="center">
-      <select name="${var}.cols">
-STATEHTML
+    $result.='<td align="center">'
+            .'<select name="'.${var}.'.cols">';
 
     my $i;
     for ($i = 1; $i <= $maxColumns; $i++) {
@@ -3452,8 +3498,9 @@
             <option value='yes'>$with</option>
         </select>
     </td>
-  </tr></table>
 HTML
+    $result.=&Apache::loncommon::end_data_table_row()
+            .&Apache::loncommon::end_data_table();
 
     return $result;
 }

--bisitz1225476153--