[LON-CAPA-cvs] cvs: loncom /interface printout.pl

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 12 Jun 2006 18:05:03 -0000


albertel		Mon Jun 12 14:05:03 2006 EDT

  Modified files:              
    /loncom/interface	printout.pl 
  Log:
  - some style fixes
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.100 loncom/interface/printout.pl:1.101
--- loncom/interface/printout.pl:1.100	Mon Jun 12 07:21:07 2006
+++ loncom/interface/printout.pl	Mon Jun 12 14:05:02 2006
@@ -161,7 +161,8 @@
 }
  &Apache::lonlocal::get_language_handle();
  &Apache::loncommon::content_type(undef,'text/html');
- print(&Apache::loncommon::start_page('Creating PDF'));
+
+  print(&Apache::loncommon::start_page('Creating PDF'));
 
   my $identifier = $ENV{'QUERY_STRING'};
   my $texfile = $env{'cgi.'.$identifier.'.file'};
@@ -640,6 +641,7 @@
     
     $SIG{CHLD} = \&REAPER;
     $done=0;
+    print("<p> Doing : <tt>$command</tt>");
     my $pid=open(CMD,"$command |");
     if ($advanced_role) {
 	&Apache::lonhtmlcommon::Update_PrgWin('',$progress_win,$message);
@@ -659,7 +661,7 @@
     $SIG{CHLD}='IGNORE';
     close(CMD);
 }
-
+    print("<p> End</p>");
 
 #  Repagninate a postscript file.
 #  What we need to do:
@@ -693,7 +695,7 @@
 	
 	# Check for total pages (%%Pages:)
 
-	if (($line =~ "^%%Pages:") && (!$seen_pages)) {
+	if (($line =~ /^%%Pages:/) && (!$seen_pages)) {
 	    my @pageinfo = split(/ /,$line);
 	    $total_pages = $pageinfo[1];
 	    $seen_pages  = 1;
@@ -704,7 +706,7 @@
 	#  we only are looking for the largest n (n is page number at the
 	#  bottom of the page, m the page number within the document.
 	#
-	if ($line =~ "^%%Page:") {
+	if ($line =~ /^%%Page:/) {
 	    my @pageinfo = split(/ /, $line);
 	    if ($page_number < $pageinfo[1]) {
 		$page_number = $pageinfo[1];
@@ -713,7 +715,7 @@
 	#  ENDOFSTUDENTSTAMP - save the page_number, reset and, if necessary
 	#                      udpate max_pages.
 	#
-	if ($line =~ "ENDOFSTUDENTSTAMP") {
+	if ($line =~ /ENDOFSTUDENTSTAMP/) {
 	    $pages_in_student[$student_number] = $page_number;
 	    $student_number++;
 
@@ -753,15 +755,15 @@
     $total_pages += $add_pages;
     $student_number = 0;
  
-   open(PSFILE, "<$postscript_filename");
+    open(PSFILE, "<$postscript_filename");
     open(PSOFILE,">$postscript_filename"."repaginating"); # unique if original fname is.
     $seen_pages = 0;		# Reset seen %%Pages flag...
     while ($line = <PSFILE>) {
-	if (($line =~ "^%%Pages:") && (!$seen_pages)) {
+	if (($line =~ /^%%Pages:/) && (!$seen_pages)) {
 	    $line = "%%Pages: $total_pages\n";
 	    $seen_pages = 1;
 	}
-	if ($line =~ "ENDOFSTUDENTSTAMP") {
+	if ($line =~ /ENDOFSTUDENTSTAMP/) {
 	    $add_pages = ($max_pages - $pages_in_student[$student_number]);
 	    $line = "\n";
 	    my $last_student_page = $pages_in_student[$student_number];
@@ -776,10 +778,10 @@
 	    }
 	    $student_number++;
 	}
-	print PSOFILE $line;
+	print PSOFILE ($line);
     }
-    close PSOFILE;
-    close PSFILE;
+    close(PSOFILE);
+    close(PSFILE);
 
     rename($postscript_filename."repaginating", $postscript_filename);