Diff for /loncom/interface/lonprintout.pm between versions 1.517 and 1.523

version 1.517, 2008/03/10 08:54:19 version 1.523, 2008/03/24 18:22:36
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 115  sub annotate { Line 116  sub annotate {
 #                      the number of times requested by the caller.  #                      the number of times requested by the caller.
 #                      If we still have a proble, no text is appended to the  #                      If we still have a proble, no text is appended to the
 #                      output and we set some global variables.  #                      output and we set some global variables.
 #                      to indicate to the caller an SSI error occured.    #                      to indicate to the caller an SSI error occurred.  
 #                      All of this is supposed to deal with the issues described  #                      All of this is supposed to deal with the issues described
 #                      in LonCAPA BZ 5631 see:  #                      in LonCAPA BZ 5631 see:
 #                      http://bugs.lon-capa.org/show_bug.cgi?id=5631  #                      http://bugs.lon-capa.org/show_bug.cgi?id=5631
Line 131  sub annotate { Line 132  sub annotate {
 #   On success, returns the rendered resource identified by the resource parameter.  #   On success, returns the rendered resource identified by the resource parameter.
 # Side Effects:  # Side Effects:
 #   The following global variables can be set:  #   The following global variables can be set:
 #    ssi_error                - If an unrecoverable error occured this becomes true.  #    ssi_error                - If an unrecoverable error occurred this becomes true.
 #                               It is up to the caller to initialize this to false  #                               It is up to the caller to initialize this to false
 #                               if desired.  #                               if desired.
 #    ssi_last_error_resource  - If an unrecoverable error occured, this is the value  #    ssi_last_error_resource  - If an unrecoverable error occurred, this is the value
 #                               of the resource that could not be rendered by the ssi  #                               of the resource that could not be rendered by the ssi
 #                               call.  #                               call.
 #    ssi_last_error           - The error string fetched from the ssi response  #    ssi_last_error           - The error string fetched from the ssi response
Line 149  sub ssi_with_retries { Line 150  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;
   
    &Apache::lonnet::logthis("Error in SSI resource: $resource Error: $ssi_last_error");
     }      }
   
     return $content;      return $content;
Line 1471  ENDPART Line 1474  ENDPART
     }      }
           
     if ($helper->{'VARS'}->{'style_file'}=~/\w/) {      if ($helper->{'VARS'}->{'style_file'}=~/\w/) {
  &Apache::lonnet::appenv('construct.style' =>   &Apache::lonnet::appenv({'construct.style' =>
  $helper->{'VARS'}->{'style_file'});   $helper->{'VARS'}->{'style_file'}});
     } elsif ($env{'construct.style'}) {      } elsif ($env{'construct.style'}) {
  &Apache::lonnet::delenv('construct\\.style');   &Apache::lonnet::delenv('construct\\.style');
     }      }
Line 1515  ENDPART Line 1518  ENDPART
     $rndseed=$helper->{'VARS'}->{'curseed'};      $rndseed=$helper->{'VARS'}->{'curseed'};
  }   }
  $form{'rndseed'}=$rndseed;   $form{'rndseed'}=$rndseed;
  &Apache::lonnet::appenv(%moreenv);   &Apache::lonnet::appenv(\%moreenv);
   
  &Apache::lonxml::clear_problem_counter();   &Apache::lonxml::clear_problem_counter();
   
Line 1663  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 1671  ENDPART Line 1677  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 1982  ENDPART Line 1990  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 2081  ENDPART Line 2092  ENDPART
     #      #
   
     if ($ssi_error) {      if ($ssi_error) {
   
           my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk');
  my $end_page = &Apache::loncommon::end_page();   my $end_page = &Apache::loncommon::end_page();
  $r->print(<<ERROR_END);   $r->print('
 <br />  <br />
 <h2>An unrecoverable error occured:</h2>  <h2>'.&mt('An unrecoverable network error occurred:').'</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 2166  ERROR_END Line 2174  ERROR_END
  #  yet.   #  yet.
  my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};   my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
  my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};   my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
  &Apache::lonnet::appenv('cgi.'.$identifier.'.file'   => $filename,   &Apache::lonnet::appenv({'cgi.'.$identifier.'.file'   => $filename,
  'cgi.'.$identifier.'.layout'  => $laystyle,   'cgi.'.$identifier.'.layout'  => $laystyle,
  'cgi.'.$identifier.'.numcol'  => $numberofcolumns,   'cgi.'.$identifier.'.numcol'  => $numberofcolumns,
  'cgi.'.$identifier.'.paper'  => $papersize,   'cgi.'.$identifier.'.paper'  => $papersize,
Line 2176  ERROR_END Line 2184  ERROR_END
  'cgi.'.$identifier.'.role' => $perm{'pav'},   'cgi.'.$identifier.'.role' => $perm{'pav'},
  'cgi.'.$identifier.'.numberoffiles' => $#print_array,   'cgi.'.$identifier.'.numberoffiles' => $#print_array,
  'cgi.'.$identifier.'.studentnames' => $student_names,   'cgi.'.$identifier.'.studentnames' => $student_names,
  'cgi.'.$identifier.'.backref' => $URLback,);   'cgi.'.$identifier.'.backref' => $URLback,});
  &Apache::lonnet::appenv("cgi.$identifier.user"    => $env{'user.name'},   &Apache::lonnet::appenv({"cgi.$identifier.user"    => $env{'user.name'},
  "cgi.$identifier.domain"  => $env{'user.domain'},   "cgi.$identifier.domain"  => $env{'user.domain'},
  "cgi.$identifier.courseid" => $cnum,    "cgi.$identifier.courseid" => $cnum, 
  "cgi.$identifier.coursedom" => $cdom,    "cgi.$identifier.coursedom" => $cdom, 
  "cgi.$identifier.resources" => $resources_printed);   "cgi.$identifier.resources" => $resources_printed});
   
  my $end_page = &Apache::loncommon::end_page();   my $end_page = &Apache::loncommon::end_page();
  $r->print(<<FINALEND);   $r->print(<<FINALEND);
Line 2484  sub printHelper { Line 2492  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 3206  RNDSEED Line 3218  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.517  
changed lines
  Added in v.1.523


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