Diff for /loncom/interface/lonprintout.pm between versions 1.526 and 1.536

version 1.526, 2008/03/28 21:05:29 version 1.536, 2008/07/14 10:40:57
Line 39  use Apache::File(); Line 39  use Apache::File();
 use Apache::lonnavmaps;  use Apache::lonnavmaps;
 use Apache::admannotations;  use Apache::admannotations;
 use Apache::lonenc;  use Apache::lonenc;
   use Apache::entities;
   
 use HTTP::Response;  use HTTP::Response;
   
 use LONCAPA::map();  use LONCAPA::map();
Line 150  sub ssi_with_retries { Line 152  sub ssi_with_retries {
  $ssi_error               = 1;   $ssi_error               = 1;
  $ssi_last_error_resource = $resource;   $ssi_last_error_resource = $resource;
  $ssi_last_error          = $response->code . " " . $response->message;   $ssi_last_error          = $response->code . " " . $response->message;
         $content='\section*{!!! An error occured !!!}';          $content='\section*{!!! An error occurred !!!}';
  &Apache::lonnet::logthis("Error in SSI resource: $resource Error: $ssi_last_error");   &Apache::lonnet::logthis("Error in SSI resource: $resource Error: $ssi_last_error");
     }      }
   
Line 166  sub get_student_view_with_retries { Line 168  sub get_student_view_with_retries {
         $ssi_error               = 1;          $ssi_error               = 1;
         $ssi_last_error_resource = $curresline.' for user '.$username.':'.$userdomain;          $ssi_last_error_resource = $curresline.' for user '.$username.':'.$userdomain;
         $ssi_last_error          = $response->code . " " . $response->message;          $ssi_last_error          = $response->code . " " . $response->message;
         $content='\section*{!!! An error occured !!!}';          $content='\section*{!!! An error occurred !!!}';
         &Apache::lonnet::logthis("Error in SSI (student view) resource: $curresline Error: $ssi_last_error User: $username:$userdomain");          &Apache::lonnet::logthis("Error in SSI (student view) resource: $curresline Error: $ssi_last_error User: $username:$userdomain");
     }      }
     return $content;      return $content;
Line 502  sub adjust_number_to_print { Line 504  sub adjust_number_to_print {
  #  Unmodified.   #  Unmodified.
     } else {      } else {
  # Error!!!!   # Error!!!!
   
  croak "bad SPLIT_PDFS: $split_pdf in lonprintout::adjust_number_to_print";   croak "bad SPLIT_PDFS: $split_pdf in lonprintout::adjust_number_to_print";
   
     }      }
 }  }
   
   
 sub character_chart {  sub character_chart {
       my $result = shift;
       return  &Apache::entities::replace_entities($result);
   }
   
   sub old_character_chart {
     my $result = shift;      my $result = shift;
     $result =~ s/&\#0?0?(7|9);//g;      $result =~ s/&\#0?0?(7|9);//g;
     $result =~ s/&\#0?(10|13);//g;      $result =~ s/&\#0?(10|13);//g;
Line 629  sub character_chart { Line 638  sub character_chart {
     $result =~ s/&(\#165|yen);/\\textyen /g;      $result =~ s/&(\#165|yen);/\\textyen /g;
     $result =~ s/&(\#166|brvbar);/\\textbrokenbar /g;      $result =~ s/&(\#166|brvbar);/\\textbrokenbar /g;
     $result =~ s/&(\#167|sect);/\\textsection /g;      $result =~ s/&(\#167|sect);/\\textsection /g;
     $result =~ s/&(\#168|uml);/\\texthighdieresis /g;      $result =~ s/&(\#168|uml);/\\"\{\} /g;
     $result =~ s/&(\#169|copy);/\\copyright /g;      $result =~ s/&(\#169|copy);/\\copyright /g;
     $result =~ s/&(\#170|ordf);/\\textordfeminine /g;      $result =~ s/&(\#170|ordf);/\\textordfeminine /g;
     $result =~ s/&(\#172|not);/\\ensuremath\{\\neg\}/g;      $result =~ s/&(\#172|not);/\\ensuremath\{\\neg\}/g;
Line 640  sub character_chart { Line 649  sub character_chart {
     $result =~ s/&(\#177|plusmn);/\\ensuremath\{\\pm\}/g;      $result =~ s/&(\#177|plusmn);/\\ensuremath\{\\pm\}/g;
     $result =~ s/&(\#178|sup2);/\\ensuremath\{^2\}/g;      $result =~ s/&(\#178|sup2);/\\ensuremath\{^2\}/g;
     $result =~ s/&(\#179|sup3);/\\ensuremath\{^3\}/g;      $result =~ s/&(\#179|sup3);/\\ensuremath\{^3\}/g;
     $result =~ s/&(\#180|acute);/\\textacute /g;      $result =~ s/&(\#180|acute);/\\'\{\} /g;
     $result =~ s/&(\#181|micro);/\\ensuremath\{\\mu\}/g;      $result =~ s/&(\#181|micro);/\\ensuremath\{\\mu\}/g;
     $result =~ s/&(\#182|para);/\\P/g;      $result =~ s/&(\#182|para);/\\P/g;
     $result =~ s/&(\#183|middot);/\\ensuremath\{\\cdot\}/g;      $result =~ s/&(\#183|middot);/\\ensuremath\{\\cdot\}/g;
Line 1142  sub print_latex_header { Line 1151  sub print_latex_header {
      '\usepackage[dvips]{graphicx}\usepackage{epsfig}'."\n".       '\usepackage[dvips]{graphicx}\usepackage{epsfig}'."\n".
      '\usepackage{wrapfig}'.       '\usepackage{wrapfig}'.
      '\usepackage{picins}\usepackage{calc}'."\n".       '\usepackage{picins}\usepackage{calc}'."\n".
      '\usepackage[utf8]{inputenc}'."\n".       '\usepackage[T1]{fontenc}'."\n".
        '\usepackage[postscript]{ucs}'."\n".
        '\usepackage[utf8x]{inputenc}'."\n".
        '\usepackage{pifont}'  . "\n".
        '\usepackage{latexsym}'."\n".
        '\usepackage{amsmath}'.
        '\usepackage{amssymb}'.
        '\usepackage{amsfonts}'.
        '\usepackage{amsthm}'.
        '\usepackage{amscd}'.
      '\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}'."\n".       '\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}'."\n".
      '\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}'."\n".       '\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}'."\n".
      '\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}'."\n".       '\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}'."\n".
Line 1647  ENDPART Line 1665  ENDPART
              ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or               ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or
              ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')       or               ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')       or
      ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources')      or # BUGBUG       ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources')      or # BUGBUG
      ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences')) {        ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences') 
        ) { 
   
   
         #-- produce an output string          #-- produce an output string
Line 1655  ENDPART Line 1674  ENDPART
     $selectionmade = 2;      $selectionmade = 2;
  } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') {   } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') {
     $selectionmade = 3;      $selectionmade = 3;
  } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') {   } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') 
    ) {
     $selectionmade = 4;      $selectionmade = 4;
  } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') {  #BUGBUG   } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') {  #BUGBUG
     $selectionmade = 4;      $selectionmade = 4;
Line 1810  ENDPART Line 1830  ENDPART
  }   }
  $result .= '\end{document}';   $result .= '\end{document}';
      } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') ||       } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') ||
         ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') ||
       ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students')){        ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students')){
   
   
      #-- prints assignments for whole class or for selected students         #-- prints assignments for whole class or for selected students  
  my $type;   my $type;
  if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') {   if (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') ||
        ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') ) {
      $selectionmade=5;       $selectionmade=5;
      $type='problems';       $type='problems';
  } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students') {   } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students') {
Line 2180  ENDPART Line 2202  ENDPART
  "cgi.$identifier.resources" => $resources_printed});   "cgi.$identifier.resources" => $resources_printed});
   
     my $end_page = &Apache::loncommon::end_page();      my $end_page = &Apache::loncommon::end_page();
       my $continue_text = &mt('Continue');
     # If there's been an unrecoverable SSI error, report it to the user      # If there's been an unrecoverable SSI error, report it to the user
     if ($ssi_error) {      if ($ssi_error) {
         my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk');          my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk');
         my $end_page = &Apache::loncommon::end_page();  
         $r->print('<br /><h2>'.&mt('An unrecoverable network error occurred:').'</h2><p>  '.          $r->print('<br /><h2>'.&mt('An unrecoverable network error occurred:').'</h2><p>  '.
                   &mt('At least one of the resources you chose to print could not be rendered due to an unrecoverable error when communicating with a server:').                    &mt('At least one of the resources you chose to print could not be rendered due to an unrecoverable error when communicating with a server:').
                   '<br />'.$ssi_last_error_resource.'<br />'.$ssi_last_error.                    '<br />'.$ssi_last_error_resource.'<br />'.$ssi_last_error.
                   '</p><p>'.&mt('You can continue using the link provided below, but make sure to carefully inspect your output file! The errors will be marked in the file.').'<br />'.                    '</p><p>'.&mt('You can continue using the link provided below, but make sure to carefully inspect your output file! The errors will be marked in the file.').'<br />'.
                   &mt('You may be able to reprint the individual resources for which this error occured, as the issue may be temporary.').                    &mt('You may be able to reprint the individual resources for which this error occurred, as the issue may be temporary.').
                   '<br />'.&mt('If the error persists, please contact the [_1] for assistance.',$helpurl).'</p><p>'.                    '<br />'.&mt('If the error persists, please contact the [_1] for assistance.',$helpurl).'</p><p>'.
                   &mt('We apologize for the inconvenience.').'</p>'.                    &mt('We apologize for the inconvenience.').'</p>'.
                   '<a href="/cgi-bin/printout.pl?'.$identifier.'">Continue</a>'.$end_page);                    '<a href="/cgi-bin/printout.pl?'.$identifier.'">'.$continue_text.'</a>'.$end_page);
     } else {      } else {
  $r->print(<<FINALEND);   $r->print(<<FINALEND);
 <br />  <br />
 <meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" />  <meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" />
 <a href="/cgi-bin/printout.pl?$identifier">Continue</a>  <a href="/cgi-bin/printout.pl?$identifier">$continue_text</a>
 $end_page  $end_page
 FINALEND  FINALEND
   }                                       # endif ssi errors.      }                                     # endif ssi errors.
 }  }
   
   
Line 2314  sub print_resources { Line 2336  sub print_resources {
     $current_output .= $rendered;          $current_output .= $rendered;    
  } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {   } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
     $printed .= $curresline.':';      $printed .= $curresline.':';
     my $rendered = &get_student_view($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);      my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
     if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') {      if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') {
  my $url = &Apache::lonnet::clutter($res_url);   my $url = &Apache::lonnet::clutter($res_url);
  my $annotation = &annotate($url);   my $annotation = &annotate($url);
Line 2682  HELPERFRAGMENT Line 2704  HELPERFRAGMENT
   
         push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b>'), 'all_problems', 'ALL_PROBLEMS'];          push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b>'), 'all_problems', 'ALL_PROBLEMS'];
  push @{$printChoices}, [&mtn('Selected <b>Resources</b> from <b>entire course</b>'), 'all_resources', 'ALL_RESOURCES'];   push @{$printChoices}, [&mtn('Selected <b>Resources</b> from <b>entire course</b>'), 'all_resources', 'ALL_RESOURCES'];
    push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b> for <b>selected people</b>'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS'];
          &Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS);           &Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS);
   <state name="ALL_PROBLEMS" title="Select Problem(s) to print">    <state name="ALL_PROBLEMS" title="Select Problem(s) to print">
     <resource variable="RESOURCES" toponly='0' multichoice="1"      <resource variable="RESOURCES" toponly='0' multichoice="1"
Line 2702  HELPERFRAGMENT Line 2725  HELPERFRAGMENT
       $start_new_option        $start_new_option
     </resource>      </resource>
   </state>    </state>
     <state name="ALL_PROBLEMS_STUDENTS" title="Select Problem(s) to print">
       <resource variable="RESOURCES" toponly='0' multichoice="1"
    suppressEmptySequences='0' addstatus="1" closeallpages="1">
         <nextstate>STUDENTS1</nextstate>
         <filterfunc>return $isProblemOrMap;</filterfunc>
         <choicefunc>return $isNotMap;</choicefunc>
         <valuefunc>return $symbFilter;</valuefunc>
         $start_new_option
       </resource>
     </state>
     <state name="STUDENTS1" title="Select People">
         <message><b>Select sorting order of printout</b> </message>
       <choices variable='student_sort'>
         <choice computer='0'>Sort by section then student</choice>
         <choice computer='1'>Sort by students across sections.</choice>
       </choices>
         <message><br /><hr /><br /> </message>
         <student multichoice='1' variable="STUDENTS" nextstate="PRINT_FORMATTING" coursepersonnel="1"/>
     </state>
   
 ALL_PROBLEMS  ALL_PROBLEMS
   
  if ($helper->{VARS}->{'assignment'}) {   if ($helper->{VARS}->{'assignment'}) {

Removed from v.1.526  
changed lines
  Added in v.1.536


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>