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

raeburn raeburn@source.lon-capa.org
Wed, 01 Sep 2010 23:58:40 -0000


raeburn		Wed Sep  1 23:58:40 2010 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm lonprintout.pm 
  Log:
  - xhtml -- action in <form> tag for helpform
  - HTML markup for recent printouts need to be within body of HTML
    for valid xhtml, and to avoid case where browse displays blank page.  
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.180 loncom/interface/lonhelper.pm:1.181
--- loncom/interface/lonhelper.pm:1.180	Mon May 24 09:21:18 2010
+++ loncom/interface/lonhelper.pm	Wed Sep  1 23:58:40 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.180 2010/05/24 09:21:18 foxr Exp $
+# $Id: lonhelper.pm,v 1.181 2010/09/01 23:58:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -571,7 +571,7 @@
 # 4: Render the current state to the screen as an HTML page.
 sub display {
     my $self = shift;
-
+    my $footer = shift;
     my $state = $self->{STATES}{$self->{STATE}};
 
     my $result = "";
@@ -606,7 +606,7 @@
     # FIXME: This should be parameterized, not concatenated - Jeremy
 
 
-    if (!$state->overrideForm()) { $result.='<form name="helpform" method="post">'; }
+    if (!$state->overrideForm()) { $result.='<form name="helpform" method="post" action="">'; }
     if ($stateHelp) {
         $stateHelp = &Apache::loncommon::help_open_topic($stateHelp);
     }
@@ -661,7 +661,7 @@
         </form>
 FOOTER
 
-    $result .= &Apache::loncommon::end_page();
+    $result .= $footer.&Apache::loncommon::end_page();
     # Handle writing out the vars to the file
     my $file = Apache::File->new('>'.$self->{FILENAME});
     print $file $self->_varsInFile();
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.583 loncom/interface/lonprintout.pm:1.584
--- loncom/interface/lonprintout.pm:1.583	Wed Aug  4 22:17:14 2010
+++ loncom/interface/lonprintout.pm	Wed Sep  1 23:58:40 2010
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.583 2010/08/04 22:17:14 raeburn Exp $
+# $Id: lonprintout.pm,v 1.584 2010/09/01 23:58:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1707,8 +1707,8 @@
 # List of recently generated print files
 #
 sub recently_generated {
-    my $r=shift;
-    my $prtspool=$r->dir_config('lonPrtDir');
+    my ($prtspool) = @_;
+    my $output;
     my $zip_result;
     my $pdf_result;
     opendir(DIR,$prtspool);
@@ -1741,10 +1741,10 @@
 	if ($ext eq 'zip') { $zip_result .= $result; }
     }
     if ($zip_result || $pdf_result) {
-        $r->print('<hr />');
+        $output ='<hr />';
     }
     if ($zip_result) {
-	$r->print('<h3>'.&mt('Recently generated printout zip files')."</h3>\n"
+	$output .='<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>'
@@ -1752,11 +1752,10 @@
                   .'<th>'.&mt('File Size (Bytes)').'</th>'
                   .&Apache::loncommon::end_data_table_header_row()
                   .$zip_result
-                  .&Apache::loncommon::end_data_table()
-        );
+                  .&Apache::loncommon::end_data_table();
     }
     if ($pdf_result) {
-	$r->print('<h3>'.&mt('Recently generated printouts')."</h3>\n"
+	$output .='<h3>'.&mt('Recently generated printouts')."</h3>\n"
                   .&Apache::loncommon::start_data_table()
                   .&Apache::loncommon::start_data_table_header_row()
                   .'<th>'.&mt('Download').'</th>'
@@ -1764,9 +1763,9 @@
                   .'<th>'.&mt('File Size (Bytes)').'</th>'
                   .&Apache::loncommon::end_data_table_header_row()
                   .$pdf_result
-                  .&Apache::loncommon::end_data_table()
-        );
+                  .&Apache::loncommon::end_data_table();
     }
+    return $output;
 }
 
 #
@@ -4148,10 +4147,12 @@
         return $helper;
     }    
 
-    $r->print($helper->display());
+    my $footer;
     if ($helper->{STATE} eq 'START') {
-	&recently_generated($r);
+        my $prtspool=$r->dir_config('lonPrtDir'); 
+	$footer = &recently_generated($prtspool);
     }
+    $r->print($helper->display($footer));
     &Apache::lonhelper::unregisterHelperTags();
 
     return OK;