Diff for /loncom/interface/lonprintout.pm between versions 1.151 and 1.164

version 1.151, 2003/05/05 20:14:32 version 1.164, 2003/05/13 15:28:32
Line 1350  ENDPART Line 1350  ENDPART
     }      }
     my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format_new($papersize,$laystyle,$numberofcolumns);      my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format_new($papersize,$laystyle,$numberofcolumns);
     my $assignment =  $ENV{'form.assignment'};      my $assignment =  $ENV{'form.assignment'};
 #    if ($choice eq 'Subdirectory print') {  
 # if ($ENV{'form.layout'} eq '') {$layout = 'CAPA';}  
 # if ($ENV{'form.papersize'} eq '') {$papersize = 'Letter [8 1/2x11 in]';}  
 # if ($ENV{'form.numberofcolumns'} eq '') {$numberofcolumns = 2;}  
 #    }  
 #    if (($choice eq 'Standard LaTeX output for current document') &&  
 # ($ENV{'form.url'}=~m|^/~|)) {  
 # if ($ENV{'form.layout'} eq '') {$layout = 'CAPA';}  
 # if ($ENV{'form.papersize'} eq '') {$papersize = 'Letter [8 1/2x11 in]';}  
 # if ($ENV{'form.numberofcolumns'} eq '') {$numberofcolumns = 2;}  
 #    }  
   
       
 #    my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);  
 #    if ($numberofcolumns == 1) {  
 # $textwidth=$ENV{'form.width'};  
 # $textheight=$ENV{'form.height'};  
 #    }  
     my $LaTeXwidth;       my $LaTeXwidth; 
     if ($textwidth=~/(\d+)\s*cm/) {      if ($textwidth=~/(\d+)\s*cm/) {
  $LaTeXwidth = $1*10;   $LaTeXwidth = $1*10;
Line 1377  ENDPART Line 1359  ENDPART
  $LaTeXwidth = $1*25.4;   $LaTeXwidth = $1*25.4;
     }      }
     $LaTeXwidth.=' mm';      $LaTeXwidth.=' mm';
       
   
     if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {      if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
       #-- single document - problem, page, html, xml, ...        #-- single document - problem, page, html, xml, ...
  my $currentURL;   my $currentURL;
  if (defined $helper->{'VARS'}->{'url'}) {   if ($helper->{'VARS'}->{'construction'} ne '1') {
     $currentURL=$helper->{'VARS'}->{'url'};              #prins published resource
  } else {  
     $currentURL=$helper->{'VARS'}->{'postdata'};      $currentURL=$helper->{'VARS'}->{'postdata'};
    } else {
               #prins resource from the construction space
       $currentURL=$helper->{'VARS'}->{'filename'};
       $currentURL=~s/\/home\//\/~/;
       $currentURL=~s/public_html\///;
  }   }
  $selectionmade = 1;   $selectionmade = 1;
  if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {   if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
         my %moreenv;      my %moreenv;
         $moreenv{'form.grade_target'}='tex';      $moreenv{'form.grade_target'}='tex';
  if (&Apache::lonnet::allowed('bre',$currentURL)) {      $moreenv{'request.filename'}=$currentURL;
     $currentURL=~s/http:\/\/[^\/]+//;      $moreenv{'form.textwidth'}=$LaTeXwidth;
  }      &Apache::lonnet::appenv(%moreenv);
         $moreenv{'request.filename'}=$currentURL;      my $texversion=&Apache::lonnet::ssi($currentURL);
         $moreenv{'form.textwidth'}=$LaTeXwidth;      &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');
         &Apache::lonnet::appenv(%moreenv);      if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
         my $texversion=&Apache::lonnet::ssi($currentURL);   $moreenv{'form.grade_target'}='answer';
         &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');   $moreenv{'form.print_answer'}='yes';
         $result .= $texversion;   &Apache::lonnet::appenv(%moreenv);
         if ($currentURL=~m/\.page\s*$/) {   my $answer=&Apache::lonnet::ssi($currentURL);
   ($result,$number_of_columns) = &page_cleanup($result);   &Apache::lonnet::delenv('form.grade_target','form.print_answer');
         }   my $start=index($answer,'\vskip 0 mm',0);
       } else {   my $finish=rindex $answer,'\vskip 0 mm' ;
    if ($start!=-1 && $finish!=-1) {$answer=substr($answer,$start,$finish-$start+12);}
   # $r->print('<pre>'.$answer.'</pre>'); return OK;
    $texversion=~s/(\\end{document})/$answer$1/;
       }
       $result .= $texversion;
       if ($currentURL=~m/\.page\s*$/) {
    ($result,$number_of_columns) = &page_cleanup($result);
       }
    } else {
 #  $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';  #  $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';
 #  if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) {  #  if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) {
 #      $result.=$1;  #      $result.=$1;
Line 1411  ENDPART Line 1405  ENDPART
 #      $result.=$ENV{'form.url'};  #      $result.=$ENV{'form.url'};
 #  }  #  }
 #  $result.=' \end{document}'  #  $result.=' \end{document}'
       }   }
   
   
     } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or      } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or
              ($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')) {                ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')) { 
Line 1509  ENDPART Line 1501  ENDPART
     #prints selected problems from the subdirectory       #prints selected problems from the subdirectory 
  $selectionmade = 6;   $selectionmade = 6;
         my @list_of_files=split /\|\|\|/, $helper->{'VARS'}->{'FILES'};          my @list_of_files=split /\|\|\|/, $helper->{'VARS'}->{'FILES'};
    @list_of_files=sort @list_of_files;
  my $flag_latex_header_remove = 'NO';     my $flag_latex_header_remove = 'NO';  
  for (my $i=0;$i<=$#list_of_files;$i++) {   for (my $i=0;$i<=$#list_of_files;$i++) {
 #    my $urlp = $list_of_files[$i];      my $urlp = $list_of_files[$i];
 #    if ($urlp=~/\//) {      if ($urlp=~/\//) {
  my %moreenv;   my %moreenv;
  $moreenv{'form.grade_target'}='tex';   $moreenv{'form.grade_target'}='tex';
  $moreenv{'form.textwidth'}=$LaTeXwidth;   $moreenv{'form.textwidth'}=$LaTeXwidth;
  &Apache::lonnet::appenv(%moreenv);   &Apache::lonnet::appenv(%moreenv);
 # if ($urlp =~ m|/home/([^/]+)/public_html|) {   if ($urlp =~ m|/home/([^/]+)/public_html|) {
 #    $urlp =~ s|/home/([^/]*)/public_html|/~$1|;      $urlp =~ s|/home/([^/]*)/public_html|/~$1|;
 # } else {   } else {
 #    $urlp =~ s|^/home/httpd/html||;      $urlp =~ s|^/home/httpd/html||;
 # }   }
 # my $texversion=&Apache::lonnet::ssi($urlp);   my $texversion=&Apache::lonnet::ssi($urlp);
  &Apache::lonnet::delenv('form.grade_target','form.textwidth');   &Apache::lonnet::delenv('form.grade_target','form.textwidth');
                 #this chunck is responsible for printing the path to problem                  #this chunck is responsible for printing the path to problem
 # my $newurlp = '';   my $newurlp = '';
 # my $HowMany = length($urlp)*2;   my $HowMany = length($urlp)*2;
 # if ($HowMany > $LaTeXwidth) {   if ($HowMany > $LaTeXwidth) {
 #    my @temporrary = split '/',$urlp;      my @temporrary = split '/',$urlp;
 #    my $HowManyNew = 0;      my $HowManyNew = 0;
 #    for (my $ii=0;$ii<=$#temporrary;$ii++) {      for (my $ii=0;$ii<=$#temporrary;$ii++) {
 # if ($temporrary[$ii] ne '') {   if ($temporrary[$ii] ne '') {
 #    $HowManyNew += length($temporrary[$ii])*2;      $HowManyNew += length($temporrary[$ii])*2;
 #    if ($HowManyNew < $LaTeXwidth ) {      if ($HowManyNew < $LaTeXwidth ) {
 # $newurlp .=  '/'.$temporrary[$ii];   $newurlp .=  '/'.$temporrary[$ii];
 #    } else {      } else {
 # $HowManyNew = 0;   $HowManyNew = 0;
 # $newurlp .=  '|\vskip -1 mm \noindent \verb|';   $newurlp .=  '|\vskip -1 mm \noindent \verb|';
 # $ii--;   $ii--;
 #    }      }
 # }   }
 #    }      }
 # }   }
 # $texversion =~ s/(\\begin{minipage}{\\textwidth})/$1 {\\small\\noindent\\verb|$newurlp\|\\vskip 0 mm}/;   $texversion =~ s/(\\begin{minipage}{\\textwidth})/$1 {\\small\\noindent\\verb|$newurlp\|\\vskip 0 mm}/;
 # if ($flag_latex_header_remove ne 'NO') {   if ($flag_latex_header_remove ne 'NO') {
 #    $texversion = &latex_header_footer_remove($texversion);      $texversion = &latex_header_footer_remove($texversion);
 # } else {   } else {
 #    $texversion =~ s/\\end{document}//;      $texversion =~ s/\\end{document}//;
 # }   }
 # $result .= $texversion;   $result .= $texversion;
 #    }      }
 #    $flag_latex_header_remove = 'YES';        $flag_latex_header_remove = 'YES';  
  }   }
 # $result .= '\end{document}';         $result .= '\end{document}';      
     }      }
 #-------------------------------------------------------- corrections for the different page formats  #-------------------------------------------------------- corrections for the different page formats
     $result = &page_format_transformation_new($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'});      $result = &page_format_transformation_new($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'});
Line 1599  sub handler { Line 1592  sub handler {
             return $result;              return $result;
         }          }
         $helper = $result;          $helper = $result;
       
   
   
 #    my $key;    my $key; 
 #    foreach $key (keys %{$helper->{'VARS'}}) {   foreach $key (keys %{$helper->{'VARS'}}) {
 # $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<br />');      $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-<br />');
 #    }   }
 # return OK;  # return OK;
   
   
Line 1707  sub printHelper { Line 1701  sub printHelper {
           
     my $helper = Apache::lonhelper::helper->new("Printing Wizard");      my $helper = Apache::lonhelper::helper->new("Printing Wizard");
     $helper->declareVar('symb');      $helper->declareVar('symb');
     $helper->declareVar('postdata');      $helper->declareVar('postdata');    
       $helper->declareVar('filename');
       $helper->declareVar('construction');
           
     # This will persistently load in the data we want from the      # This will persistently load in the data we want from the
     # very first screen.      # very first screen.
     if ($ENV{'form.postdata'}) {      # Detect whether we're coming from construction space
         $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($ENV{'form.postdata'});      if ($ENV{'form.postdata'} =~ /http:\/\// ) {
           $ENV{'form.postdata'} =~ /http:\/\/[a-zA-Z.]+\/~([a-zA-Z0-9]+)\/(.*)/;
           $helper->{VARS}->{'filename'} = "/home/$1/public_html/$2";
           $helper->{VARS}->{'construction'} = 1;
       } else {
           if ($ENV{'form.postdata'}) {
               $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($ENV{'form.postdata'});
           }
           if ($ENV{'form.symb'}) {
               $helper->{VARS}->{'symb'} = $ENV{'form.symb'};
           }
           if ($ENV{'form.url'}) {
               $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
           }
     }      }
   
     if ($ENV{'form.symb'}) {      if ($ENV{'form.symb'}) {
         $helper->{VARS}->{'symb'} = $ENV{'form.symb'};          $helper->{VARS}->{'symb'} = $ENV{'form.symb'};
     }      }
     if ($ENV{'form.url'}) {      if ($ENV{'form.url'}) {
         $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});          $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
     }  
   
       }
           
     my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu;      my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu;
     $helper->{VARS}->{'assignment'} = $sequenceTitle;      $helper->{VARS}->{'assignment'} = $sequenceTitle;
   
       
     # Extract map      # Extract map
     my $symb = $helper->{VARS}->{'symb'};      my $symb = $helper->{VARS}->{'symb'};
     my ($map, $id, $url) = split(/___/, $symb);      my ($map, $id, $url);
     $helper->{VARS}->{'postdata'} = Apache::lonnet::clutter($url);      my $subdir;
   
       # Get the resource name from construction space
       if ($helper->{VARS}->{'construction'}) {
           $resourceTitle = substr($helper->{VARS}->{'filename'}, 
                                   rindex($helper->{VARS}->{'filename'}, '/')+1);
           $subdir = substr($helper->{VARS}->{'filename'},
                            0, rindex($helper->{VARS}->{'filename'}, '/') + 1);
       } else {
           ($map, $id, $url) = split(/___/, $symb);
           $helper->{VARS}->{'postdata'} = Apache::lonnet::clutter($url);
   
     if (!$resourceTitle) { # if the resource doesn't have a title, use the filename          if (!$resourceTitle) { # if the resource doesn't have a title, use the filename
         my $url = $helper->{VARS}->{'postdata'};              my $url = $helper->{VARS}->{'postdata'};
         $resourceTitle = substr($url, rindex($url, '/') + 1);              $resourceTitle = substr($url, rindex($url, '/') + 1);
           }
           $subdir = &Apache::lonnet::filelocation("", $url);
     }      }
   
     Apache::lonhelper::registerHelperTags();      Apache::lonhelper::registerHelperTags();
   
     my $subdir = &Apache::lonnet::filelocation("", $url);  
   
     # "Delete everything after the last slash."      # "Delete everything after the last slash."
     $subdir =~ s|/[^/]+$||;      $subdir =~ s|/[^/]+$||;
     $subdir =  '/home/httpd/html/res'.$subdir.'/';      if (not $helper->{VARS}->{'construction'}) {
    $subdir='/home/httpd/html/res/'.$subdir;
       }
   
   
     # What can be printed is a very dynamic decision based on      # What can be printed is a very dynamic decision based on
     # lots of factors. So we need to dynamically build this list.      # lots of factors. So we need to dynamically build this list.
Line 1756  sub printHelper { Line 1780  sub printHelper {
     # the helper by hand.      # the helper by hand.
     my $printChoices = [];      my $printChoices = [];
     my $paramHash;      my $paramHash;
     # We can always print the current screen.  
   
     push @{$printChoices}, ["<b>$resourceTitle</b> (exactly what was on the screen)", 'current_document', 'PAGESIZE'];      if ($resourceTitle) {
           push @{$printChoices}, ["<b>$resourceTitle</b> (prints what you just saw on the screen)", 'current_document', 'PAGESIZE'];
       }
   
       $r->print($helper->{VARS}->{'postdata'});
   
     # If we're in a sequence...      # If we're in a sequence...
     if ($helper->{VARS}->{'postdata'} =~ /\/res\//) {      if ($helper->{'VARS'}->{'construction'} ne '1') {
         # Allow problems from sequence          # Allow problems from sequence
         push @{$printChoices}, ["Problems from <b>$sequenceTitle</b>", 'map_problems', 'CHOOSE_PROBLEMS'];          push @{$printChoices}, ["Problem(s) from <b>$sequenceTitle</b>", 'map_problems', 'CHOOSE_PROBLEMS'];
         # Allow all resources from sequence          # Allow all resources from sequence
         push @{$printChoices}, ["Problems and pages from <b>$sequenceTitle</b>", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];          push @{$printChoices}, ["Everything (problem(s), page(s), html/xml file(s)) from <b>$sequenceTitle</b>", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
   
         my $isProblem = '$res->is_problem();';          my $isProblem = '$res->is_problem();';
         my $isProblemOrMap = '$res->is_problem() || $res->is_map()';          my $isProblemOrMap = '$res->is_problem() || $res->is_map()';
         my $isNotMap = '!$res->is_map();';          my $isNotMap = '!$res->is_map();';
         my $symb = '$res->symb();';          my $symb = '$res->symb();';
         my $helperFragment = <<HELPERFRAGMENT;          my $helperFragment = <<HELPERFRAGMENT;
   <state name="CHOOSE_PROBLEMS" title="Select Problems">    <state name="CHOOSE_PROBLEMS" title="Select Problem(s) to print">
     <message>Select problems to print:</message>      <message>(mark them then click "next" button) <br /></message>
     <resource variable="RESOURCES" multichoice="1" toponly='1'>      <resource variable="RESOURCES" multichoice="1" toponly='1'>
       <nextstate>PAGESIZE</nextstate>        <nextstate>PAGESIZE</nextstate>
       <filterfunc>return $isProblem</filterfunc>        <filterfunc>return $isProblem</filterfunc>
Line 1782  sub printHelper { Line 1809  sub printHelper {
       </resource>        </resource>
     </state>      </state>
   
   <state name="CHOOSE_PROBLEMS_HTML" title="Select Resources">    <state name="CHOOSE_PROBLEMS_HTML" title="Select Resource(s) to print">
     <message>Select resources to print:</message>      <message>(mark them then click "next" button) <br /></message>
     <resource variable="RESOURCES" multichoice="1" toponly='1'>      <resource variable="RESOURCES" multichoice="1" toponly='1'>
       <nextstate>PAGESIZE</nextstate>        <nextstate>PAGESIZE</nextstate>
       <filterfunc>return $isNotMap;</filterfunc>        <filterfunc>return $isNotMap;</filterfunc>
Line 1799  HELPERFRAGMENT Line 1826  HELPERFRAGMENT
     # If the user is priviledged, allow them to print all       # If the user is priviledged, allow them to print all 
     # problems in the course, optionally for selected students      # problems in the course, optionally for selected students
     if (($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) and ($helper->{VARS}->{'postdata'}=~/\/res\//)) {       if (($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) and ($helper->{VARS}->{'postdata'}=~/\/res\//)) { 
         push @{$printChoices}, ['<b>All problems</b> in course (may take a lot of time)', 'all_problems', 'ALL_PROBLEMS'];          push @{$printChoices}, ['<b>Problems</b> in this course', 'all_problems', 'ALL_PROBLEMS'];
         push @{$printChoices}, ["Problems from <b>$sequenceTitle</b> for selected students", 'problems_for_students', 'CHOOSE_STUDENTS'];          push @{$printChoices}, ["Problems from <b>$sequenceTitle</b> for selected students", 'problems_for_students', 'CHOOSE_STUDENTS'];
   
         my $isProblem = '$res->is_problem();';          my $isProblem = '$res->is_problem();';
         my $isProblemOrMap = '$res->is_problem() || $res->is_map()';          my $isProblemOrMap = '$res->is_problem() || $res->is_map()';
         my $symb = '$res->symb();';          my $symb = '$res->symb();';
         &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS);          &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS);
   <state name="ALL_PROBLEMS" title="Select Problems">    <state name="ALL_PROBLEMS" title="Select Problem(s) to print">
     <message>Select problems to print:</message>      <message>(mark them then click "next" button) <br /></message>
     <resource variable="RESOURCES" multichoice="1">      <resource variable="RESOURCES" multichoice="1">
       <nextstate>PAGESIZE</nextstate>        <nextstate>PAGESIZE</nextstate>
       <filterfunc>return $isProblemOrMap</filterfunc>        <filterfunc>return $isProblemOrMap</filterfunc>
Line 1816  HELPERFRAGMENT Line 1843  HELPERFRAGMENT
       </resource>        </resource>
     </state>      </state>
   
   <state name="CHOOSE_STUDENTS" title="Choose Students">    <state name="CHOOSE_STUDENTS" title="Choose Students whose assignments you want to print">
     <message>Select the students you wish to print the problems for:</message>      <message>(do not forget to select assignment itself - make another selection below) <br /></message>
     <student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" />      <student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" />
       <message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>
     <resource variable="RESOURCES" multichoice="1">      <resource variable="RESOURCES" multichoice="1">
       <filterfunc>return $isProblem</filterfunc>        <filterfunc>return $isProblem</filterfunc>
       <mapurl>$map</mapurl>        <mapurl>$map</mapurl>
       <valuefunc>return $symb</valuefunc>        <valuefunc>return $symb</valuefunc>
       </resource>        </resource>
     <message>How should the results be printed?</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">
       <choice computer='0'>Print all problems with no blank space between them</choice>        <choice computer='0'>Print students assignments without separations (as uniform flow)</choice>
       <choice computer='1'>Put each student's problems on a new page (add pagefeed after each student)</choice> <!-- ' -->        <choice computer='1'>Start student assignment from new page (add pagefeed after each student)</choice>
       <choice computer='2'>Seperate each student's problems with a full blank page</choice> <!-- ' -->        <choice computer='2'>Add one emty page after each student assignment</choice> 
       <choice computer='3'>Seperate each student's problems with two full blank pages</choice> <!-- ' -->        <choice computer='3'>Add two emty page after each student assignment</choice> 
       </choices>        </choices>
     </state>      </state>
 CHOOSE_STUDENTS  CHOOSE_STUDENTS
     }      }
   
     # FIXME: That RE should come from a library somewhere.      # FIXME: That RE should come from a library somewhere.
     if ((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) {          if (((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) {    
         push @{$printChoices}, ["Problems from <b>$subdir</b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];          push @{$printChoices}, ["Problems from current subdirectory <b>$subdir</b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
                   
         my $f = '$filename';          my $f = '$filename';
         my $xmlfrag = <<CHOOSE_FROM_SUBDIR;          my $xmlfrag = <<CHOOSE_FROM_SUBDIR;
   <state name="CHOOSE_FROM_SUBDIR" title="Select Files">    <state name="CHOOSE_FROM_SUBDIR" title="Select File(s) from <b><small>$subdir</small></b> to print">
     <message>Select problems you wish to print from <b>$subdir</b></message>      <message>(mark them then click "next" button) <br /></message>
     <files variable="FILES" multichoice='1'>      <files variable="FILES" multichoice='1'>
       <nextstate>PAGESIZE</nextstate>        <nextstate>PAGESIZE</nextstate>
       <filechoice>return '$subdir';</filechoice>        <filechoice>return '$subdir';</filechoice>
Line 1859  CHOOSE_FROM_SUBDIR Line 1887  CHOOSE_FROM_SUBDIR
     }      }
   
     # Generate the first state, to select which resources get printed.      # Generate the first state, to select which resources get printed.
     Apache::lonhelper::state->new("START", "Selecting Resources to Print");      Apache::lonhelper::state->new("START", "What do you want to print? Make a choice.");
     $paramHash = Apache::lonhelper::getParamHash();      $paramHash = Apache::lonhelper::getParamHash();
     $paramHash->{MESSAGE_TEXT} = "What do you want to print?";      $paramHash->{MESSAGE_TEXT} = "";
     Apache::lonhelper::message->new();      Apache::lonhelper::message->new();
     $paramHash = Apache::lonhelper::getParamHash();      $paramHash = Apache::lonhelper::getParamHash();
     $paramHash->{'variable'} = 'PRINT_TYPE';      $paramHash->{'variable'} = 'PRINT_TYPE';
     $helper->declareVar('PRINT_TYPE');      $helper->declareVar('PRINT_TYPE');
     $paramHash->{CHOICES} = $printChoices;      $paramHash->{CHOICES} = $printChoices;
     Apache::lonhelper::choices->new();      Apache::lonhelper::choices->new();
   
       if ($ENV{'request.role.adv'}) {
           $paramHash = Apache::lonhelper::getParamHash();
           $paramHash->{MESSAGE_TEXT} = "<br /><big><b><i>Next option is available only for advanced users:</i></b></big><br />";
           Apache::lonhelper::message->new();
           $paramHash = Apache::lonhelper::getParamHash();
    $paramHash->{'variable'} = 'ANSWER_TYPE';   
    $helper->declareVar('ANSWER_TYPE');         
           $paramHash->{CHOICES} = [
                                      ['Print without answer', 'yes'],
                                      ['Print with answers', 'no'] ];
           Apache::lonhelper::choices->new();
       }
   
     Apache::lonprintout::page_format_state->new("FORMAT");      Apache::lonprintout::page_format_state->new("FORMAT");
   
     # Generate the PAGESIZE state which will offer the user the margin      # Generate the PAGESIZE state which will offer the user the margin
Line 1956  sub render { Line 1998  sub render {
   
     $result .= <<STATEHTML;      $result .= <<STATEHTML;
   
 <p>How should the printing be formatted?</p>  <p><big><i><b>What page format do you prefer?</b></i></big></p>
 <table cellpadding="3">  <table cellpadding="3">
   <tr>    <tr>
     <td align="center"><b>Layout</b></td>      <td align="center"><b>Page layout</b></td>
     <td align="center"><b>Columns</b></td>      <td align="center"><b>Number of columns</b></td>
     <td align="center"><b>Paper type</b></td>      <td align="center"><b>Paper type</b></td>
   </tr>    </tr>
   <tr>    <tr>
     <td>      <td>
       <input type="radio" name="${var}.layout" value="L" checked='1' /> Landscape<br />        <input type="radio" name="${var}.layout" value="L" /> Landscape<br />
       <input type="radio" name="${var}.layout" value="P" /> Portrait        <input type="radio" name="${var}.layout" value="P" checked='1'  /> Portrait
     </td>      </td>
     <td>      <td align="center">
       <select name="${var}.cols">        <select name="${var}.cols">
 STATEHTML  STATEHTML
   

Removed from v.1.151  
changed lines
  Added in v.1.164


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