Diff for /loncom/interface/lonprintout.pm between versions 1.343.2.3 and 1.352

version 1.343.2.3, 2005/02/09 19:53:55 version 1.352, 2005/01/10 12:15:23
Line 1 Line 1
 # The LearningOnline Network  #  The LearningOnline Network
 # Printout  # Printout
 #  #
 # $Id$  # $Id$
Line 698  sub IndexCreation { Line 698  sub IndexCreation {
 sub print_latex_header {  sub print_latex_header {
     my $mode=shift;      my $mode=shift;
     my $output='\documentclass[letterpaper]{article}';      my $output='\documentclass[letterpaper]{article}';
     if ($mode eq 'batchmode' || !$ENV{'request.role.adv'}) {      if ($mode eq 'batchmode') {
  $output.='\batchmode';   $output.='\batchmode';
     }      }
     $output.='\newcommand{\keephidden}[1]{}\renewcommand{\deg}{$^{\circ}$}'."\n".      $output.='\newcommand{\keephidden}[1]{}\renewcommand{\deg}{$^{\circ}$}'."\n".
Line 1014  ENDPART Line 1014  ENDPART
  my $flag_latex_header_remove = 'NO';   my $flag_latex_header_remove = 'NO';
  my $flag_page_in_sequence = 'NO';   my $flag_page_in_sequence = 'NO';
  my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};   my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
    my %page_breaks;
    foreach my $break (split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'}) {
       $page_breaks{$break} = 1;
    }
  my $prevassignment='';   my $prevassignment='';
  &Apache::lonnet::delenv('form.counter');   &Apache::lonnet::delenv('form.counter');
  &Apache::lonxml::init_counter();   &Apache::lonxml::init_counter();
  for (my $i=0;$i<=$#master_seq;$i++) {   for (my $i=0;$i<=$#master_seq;$i++) {
   
       # Note due to document structure, not allowed to put \newpage
       # prior to the first resource
   
       if (defined $page_breaks{$master_seq[$i]}) {
    if($i != 0) {
       $result.="\\newpage\n";
    }
       }
     my (undef,undef,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]);      my (undef,undef,$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];
Line 1135  ENDPART Line 1148  ENDPART
      $helper->{'VARS'}->{'NUMBER_TO_PRINT'}=$#students+1;       $helper->{'VARS'}->{'NUMBER_TO_PRINT'}=$#students+1;
  }   }
  my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};   my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
   
  #loop over students   #loop over students
  my $flag_latex_header_remove = 'NO';    my $flag_latex_header_remove = 'NO'; 
  my %moreenv;   my %moreenv;
Line 1145  ENDPART Line 1159  ENDPART
  my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75');   my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75');
  my $student_counter=-1;   my $student_counter=-1;
  foreach my $person (@students) {   foreach my $person (@students) {
   
              my $duefile="/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";               my $duefile="/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";
      if (-e $duefile) {       if (-e $duefile) {
  my $temp_file = Apache::File->new('>>'.$duefile);   my $temp_file = Apache::File->new('>>'.$duefile);
Line 1411  sub print_resources { Line 1426  sub print_resources {
  $namepostfix="\\\\Name: ";   $namepostfix="\\\\Name: ";
  $fullname = "CODE - ".$moreenv->{'CODE'};   $fullname = "CODE - ".$moreenv->{'CODE'};
     }      }
       my %page_breaks;
       foreach my $break (split /\|\|\|/,$helper->{'VARS'}->{'FINISHPAGE'}) {
    $page_breaks{$break} = 1;
       }
       my $i           = 0;
     #goes through all resources, checks if they are available for       #goes through all resources, checks if they are available for 
     #current student, and produces output         #current student, and produces output   
     &Apache::lonnet::delenv('form.counter');      &Apache::lonnet::delenv('form.counter');
     &Apache::lonxml::init_counter();      &Apache::lonxml::init_counter();
     foreach my $curresline (@{$master_seq})  {      foreach my $curresline (@{$master_seq})  {
    if (defined $page_breaks{$curresline}) {
       if($i != 0) {
    $current_output.= "\\newpage\n";
       }
    }
    $i++;
  if ( !($type eq 'problems' &&    if ( !($type eq 'problems' && 
        ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library)$/)) ) {         ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library)$/)) ) {
     my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);      my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
Line 1527  sub handler { Line 1553  sub handler {
 # }  # }
 # return OK;  # return OK;
   
   
   
     
     &output_data($r,$helper,\%parmhash);      &output_data($r,$helper,\%parmhash);
     return OK;      return OK;
 }   } 
Line 1692  sub printHelper { Line 1721  sub printHelper {
   
     # If we're in a sequence...      # If we're in a sequence...
     if (($helper->{'VARS'}->{'construction'} ne '1') &&      if (($helper->{'VARS'}->{'construction'} ne '1') &&
   
  $helper->{VARS}->{'postdata'} &&   $helper->{VARS}->{'postdata'} &&
  $helper->{VARS}->{'assignment'}) {   $helper->{VARS}->{'assignment'}) {
         # Allow problems from sequence          # Allow problems from sequence
Line 1708  sub printHelper { Line 1738  sub printHelper {
       <filterfunc>return $isProblem;</filterfunc>        <filterfunc>return $isProblem;</filterfunc>
       <mapurl>$map</mapurl>        <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>        <valuefunc>return $symbFilter;</valuefunc>
         <option text='Newpage' variable='FINISHPAGE' />
       </resource>        </resource>
     </state>      </state>
   
Line 1719  sub printHelper { Line 1750  sub printHelper {
       <filterfunc>return $isNotMap;</filterfunc>        <filterfunc>return $isNotMap;</filterfunc>
       <mapurl>$map</mapurl>        <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>        <valuefunc>return $symbFilter;</valuefunc>
         <option text='Newpage' variable='FINISHPAGE' />
       </resource>        </resource>
     </state>      </state>
 HELPERFRAGMENT  HELPERFRAGMENT
Line 1730  HELPERFRAGMENT Line 1762  HELPERFRAGMENT
     # problems in the course, optionally for selected students      # problems in the course, optionally for selected students
     if ($userPriviledged &&       if ($userPriviledged && 
         ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) {           ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { 
   
         push @{$printChoices}, ['<b>Problems</b> from <b>entire course</b>', 'all_problems', 'ALL_PROBLEMS'];          push @{$printChoices}, ['<b>Problems</b> from <b>entire course</b>', 'all_problems', 'ALL_PROBLEMS'];
          &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">
Line 1740  HELPERFRAGMENT Line 1773  HELPERFRAGMENT
       <filterfunc>return $isProblemOrMap;</filterfunc>        <filterfunc>return $isProblemOrMap;</filterfunc>
       <choicefunc>return $isNotMap;</choicefunc>        <choicefunc>return $isNotMap;</choicefunc>
       <valuefunc>return $symbFilter;</valuefunc>        <valuefunc>return $symbFilter;</valuefunc>
         <option text='Newpage' variable='FINISHPAGE' />
     </resource>      </resource>
   </state>    </state>
 ALL_PROBLEMS  ALL_PROBLEMS
Line 1755  ALL_PROBLEMS Line 1789  ALL_PROBLEMS
       <filterfunc>return $isProblem;</filterfunc>        <filterfunc>return $isProblem;</filterfunc>
       <mapurl>$map</mapurl>        <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>        <valuefunc>return $symbFilter;</valuefunc>
         <option text='New Page' variable='FINISHPAGE' />
       </resource>        </resource>
     <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>      <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>
     <choices variable="EMPTY_PAGES">      <choices variable="EMPTY_PAGES">
Line 1770  RESOURCE_SELECTOR Line 1805  RESOURCE_SELECTOR
         &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS);          &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS);
   <state name="CHOOSE_STUDENTS" title="Select Students and Resources">    <state name="CHOOSE_STUDENTS" title="Select Students and Resources">
       <student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" />        <student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" />
         <message><b>Select sort order</b> </message>
     <choices variable='student_sort'>      <choices variable='student_sort'>
       <choice computer='0'>Sort by section then student</choice>        <choice computer='0'>Sort by section then student</choice>
       <choice computer='1'>Sort by students across sections.</choice>        <choice computer='1'>Sort by students across sections.</choice>
Line 1817  CHOOSE_ANON1 Line 1853  CHOOSE_ANON1
       <filterfunc>return $isNotMap;</filterfunc>        <filterfunc>return $isNotMap;</filterfunc>
       <mapurl>$map</mapurl>        <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>        <valuefunc>return $symbFilter;</valuefunc>
         <option text='Newpage' variable='FINISHPAGE' />
       </resource>        </resource>
     <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>      <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>
     <choices variable="EMPTY_PAGES">      <choices variable="EMPTY_PAGES">
Line 1900  CHOOSE_FROM_SUBDIR Line 1937  CHOOSE_FROM_SUBDIR
       <nextstate>CHOOSE_FROM_ANY_SEQUENCE</nextstate>        <nextstate>CHOOSE_FROM_ANY_SEQUENCE</nextstate>
       <filterfunc>return \$res->is_sequence;</filterfunc>        <filterfunc>return \$res->is_sequence;</filterfunc>
       <valuefunc>return $urlValue;</valuefunc>        <valuefunc>return $urlValue;</valuefunc>
         <option text='Newpage' variable='FINISHPAGE' />
       </resource>        </resource>
     </state>      </state>
   <state name="CHOOSE_FROM_ANY_SEQUENCE" title="Select Resources To Print">    <state name="CHOOSE_FROM_ANY_SEQUENCE" title="Select Resources To Print">
Line 1910  CHOOSE_FROM_SUBDIR Line 1948  CHOOSE_FROM_SUBDIR
       <filterfunc>return $isProblem</filterfunc>        <filterfunc>return $isProblem</filterfunc>
       <mapurl evaluate='1'>return '$escapedSequenceName';</mapurl>        <mapurl evaluate='1'>return '$escapedSequenceName';</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>        <valuefunc>return $symbFilter;</valuefunc>
         <option text='Newpage' variable='FINISHPAGE' />
       </resource>        </resource>
     </state>      </state>
 CHOOSE_FROM_ANY_SEQUENCE  CHOOSE_FROM_ANY_SEQUENCE

Removed from v.1.343.2.3  
changed lines
  Added in v.1.352


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