Diff for /loncom/interface/lonprintout.pm between versions 1.515 and 1.519.2.2

version 1.515, 2008/02/26 10:46:14 version 1.519.2.2, 2008/03/24 00:03:05
Line 38  use Apache::edit; Line 38  use Apache::edit;
 use Apache::File();  use Apache::File();
 use Apache::lonnavmaps;  use Apache::lonnavmaps;
 use Apache::admannotations;  use Apache::admannotations;
   use Apache::lonenc;
 use HTTP::Response;  use HTTP::Response;
   
 use LONCAPA::map();  use LONCAPA::map();
Line 144  sub ssi_with_retries { Line 145  sub ssi_with_retries {
     my ($resource, $retries, %form) = @_;      my ($resource, $retries, %form) = @_;
   
   
     my $ok = 0; # True if we got a good response.      my ($content, $response) = &Apache::loncommon::ssi_with_retries($resource, $retries, %form);
     my $content;      if (!$response->is_success) {
     my $response;  
   
     # Try to get the ssi done. within the retries count:  
   
     do {  
  ($content, $response) = &Apache::lonnet::ssi($resource, %form);  
  $ok      = $response->is_success;  
  $retries--;  
     } while (!$ok && ($retries > 0));  
   
     # Two cases: ok is true we have valid data, if not, retries have been exhausted  
     # if ok is true, $response->content is what we want to return.. otherwise  
     # set the error information:  
   
     if ($ok) {  
  return $content;  
     } else {  
  $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;
  return ''; # Nothing we can add to the printout that makes sense.  
    &Apache::lonnet::logthis("Error in SSI resource: $resource Error: $ssi_last_error");
     }      }
   
       return $content;
   
 }  }
   
 #  #
Line 1139  sub print_latex_header { Line 1127  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".
      '\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 1677  ENDPART Line 1666  ENDPART
  my $pbreakresources = keys %page_breaks;   my $pbreakresources = keys %page_breaks;
  for (my $i=0;$i<=$#master_seq;$i++) {   for (my $i=0;$i<=$#master_seq;$i++) {
   
               &Apache::lonenc::reset_enc();
   
     # Note due to document structure, not allowed to put \newpage      # Note due to document structure, not allowed to put \newpage
     # prior to the first resource      # prior to the first resource
   
Line 1685  ENDPART Line 1676  ENDPART
     $result.="\\newpage\n";      $result.="\\newpage\n";
  }   }
     }      }
     my ($sequence,undef,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]);              my ($sequence,$middle_thingy,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]);
     $urlp=&Apache::lonnet::clutter($urlp);      $urlp=&Apache::lonnet::clutter($urlp);
     $form{'symb'}=$master_seq[$i];      $form{'symb'}=$master_seq[$i];
   
     my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #title of the assignment which contains this problem      my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #title of the assignment which contains this problem
   
     if ($selectionmade==7) {$helper->{VARS}->{'assignment'}=$assignment;}      if ($selectionmade==7) {$helper->{VARS}->{'assignment'}=$assignment;}
     if ($i==0) {$prevassignment=$assignment;}      if ($i==0) {$prevassignment=$assignment;}
     my $texversion='';      my $texversion='';
Line 1996  ENDPART Line 1988  ENDPART
     $rndseed=$helper->{'VARS'}->{'curseed'};      $rndseed=$helper->{'VARS'}->{'curseed'};
  }   }
  for (my $i=0;$i<=$#list_of_files;$i++) {   for (my $i=0;$i<=$#list_of_files;$i++) {
   
               &Apache::lonenc::reset_enc();
   
     my $urlp = $list_of_files[$i];      my $urlp = $list_of_files[$i];
     $urlp=~s|//|/|;      $urlp=~s|//|/|;
     if ($urlp=~/\//) {      if ($urlp=~/\//) {
Line 2095  ENDPART Line 2090  ENDPART
     #      #
   
     if ($ssi_error) {      if ($ssi_error) {
  my $end_page = &Apache::loncommon::end_page();  
  $r->print(<<ERROR_END);          my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk');
           my $end_page = &Apache::loncommon::end_page();
           $r->print('
 <br />  <br />
 <h2>An unrecoverable error occured:</h2>  <h2>'.&mt('An unrecoverable error occured:').'</h2>
 <p>  <p>
   I was not able to render one of the print resources ($ssi_last_error_resource)     '.&mt('One of the resources ([_1]) you chose to print could not be rendered due to an unrecoverable error when communicating with a server:',$ssi_last_error_resource).'
 due to an unrecoverable error communicating with a server:  
 <br />  
 $ssi_last_error;  
 <br />  <br />
   '.$ssi_last_error.'
 </p>  </p>
 <p>  <p>'.
 I recommend that you try printing again later as this may mean the server was just   &mt('It is recommended that you try printing again later, as this error may mean the server was just temporarily unavailable, or is down for maintenance.').'<br />'.
 temporarily unavailable, or is down for maintenance.  If this error persists, then  &mt('If the error persists, please contact the [_1] for assistance.',$helpurl).
 please contact your LonCAPA support folks for assistance and diagnosis.   '</p><p>'.
 <br />  &mt('We apologize for the inconvenience.').
 <br />  '</p>'.
 We apologize for the inconvenience.  $end_page);
 </p>  
 $end_page  
 ERROR_END  
     } else {      } else {
   
 #-- writing .tex file in prtspool   #-- writing .tex file in prtspool 
Line 2498  sub printHelper { Line 2491  sub printHelper {
     $helper->declareVar("showallfoils");      $helper->declareVar("showallfoils");
     $helper->declareVar("STUDENTS");      $helper->declareVar("STUDENTS");
   
   
      
   
   
     #  The page breaks can get loaded initially from the course environment:      #  The page breaks can get loaded initially from the course environment:
     # But we only do this in the initial state so that they are allowed to change.      # But we only do this in the initial state so that they are allowed to change.
     #      #
Line 3220  RNDSEED Line 3217  RNDSEED
   
   
     addMessage("<tr><td>Problem Type:</td><td>");      addMessage("<tr><td>Problem Type:</td><td>");
     $paramHash = &Apache::lonhelper::getParamHash();  
     $paramHash->{'variable'} = 'probstatus'; # Already declared:  
     #      #
     # Initial value from construction space:      # Initial value from construction space:
     #      #
     if (!$helper->{VARS}->{'probstatus'} && $env{'form.problemtype'}) {      if (!$helper->{VARS}->{'probstatus'} && $env{'form.problemtype'}) {
  $helper->{VARS}->{'probstatus'} = $env{'form.problemtype'}; # initial value   $helper->{VARS}->{'probstatus'} = $env{'form.problemtype'}; # initial value
     }      }
     $paramHash->{CHOICES} = [      $xmlfrag = << "PROBTYPE";
      ['Homework problem',     'problem'],   <dropdown variable="probstatus" multichoice="0" allowempty="0">
      ['Exam Problem', 'exam'],     <defaultvalue>
      ['Survey question',      'survey']];        return "$helper->{VARS}->{'probstatus'}";
     Apache::lonhelper::dropdown->new();                     </defaultvalue>
      <choice computer="problem">Homework Problem</choice>
      <choice computer="exam">Exam Problem</choice>
      <choice computer="survey">Survey question</choice>
    </dropdown>
   PROBTYPE
               &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
       
     addMessage("</td></tr>");       addMessage("</td></tr>"); 
   
  }    } 

Removed from v.1.515  
changed lines
  Added in v.1.519.2.2


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