Diff for /loncom/interface/lonprintout.pm between versions 1.627.2.23 and 1.627.2.27

version 1.627.2.23, 2018/09/02 16:36:29 version 1.627.2.27, 2019/02/21 20:40:12
Line 157  sub create_incomplete_folder_selstud_hel Line 157  sub create_incomplete_folder_selstud_hel
   
     my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_PEOPLE_SEQ',      my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_PEOPLE_SEQ',
       'Select problem(s) to print',        'Select problem(s) to print',
       'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',        'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
       'RESOURCES',        'RESOURCES',
       'CHOOSE_STUDENTS_INCOMPLETE',        'CHOOSE_STUDENTS_INCOMPLETE',
       $map,        $map,
Line 206  sub create_incomplete_course_helper { Line 206  sub create_incomplete_course_helper {
           
     my $resource_chooser = &generate_resource_chooser('INCOMPLETE_PROBLEMS_COURSE_RESOURCES',      my $resource_chooser = &generate_resource_chooser('INCOMPLETE_PROBLEMS_COURSE_RESOURCES',
       'Select problem(s) to print',        'Select problem(s) to print',
       'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1"',        'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1" modallink="1"',
       'RESOURCES',        'RESOURCES',
       'INCOMPLETE_PROBLEMS_COURSE_STUDENTS',        'INCOMPLETE_PROBLEMS_COURSE_STUDENTS',
       '',        '',
Line 252  sub create_incomplete_folder_helper { Line 252  sub create_incomplete_folder_helper {
   
     my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_SEQ',      my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_SEQ',
       'Select problem(s) to print',        'Select problem(s) to print',
       'multichoice="1", toponly ="1", addstatus="1", closeallpages="1"',        'multichoice="1", toponly ="1", addstatus="1", closeallpages="1" modallink="1"',
       'RESOURCES',        'RESOURCES',
       'PAGESIZE',        'PAGESIZE',
       $map,        $map,
Line 306  CHOOSE_STUDENTS Line 306  CHOOSE_STUDENTS
 #     this_state    - State name of the chooser.  #     this_state    - State name of the chooser.
 #     prompt_text   - Text to use to prompt user.  #     prompt_text   - Text to use to prompt user.
 #     resource_options - Resource tag options e.g.  #     resource_options - Resource tag options e.g.
 #                        "multichoice='1', toponly='1', addstatus='1'"  #                        "multichoice='1', toponly='1', addstatus='1',
   #                         modallink='1'"
 #                     that control the selection and appearance of the  #                     that control the selection and appearance of the
 #                     resource selector.  #                     resource selector.
 #     variable      - Name of the variable to hold the choice  #     variable      - Name of the variable to hold the choice
Line 847  sub set_font_size { Line 848  sub set_font_size {
     if ($font_size ne '') {      if ($font_size ne '') {
   
  $text =~ s/\\begin\{document}/\\begin{document}{\\$font_size/;   $text =~ s/\\begin\{document}/\\begin{document}{\\$font_size/;
    $text =~ s/\\end\{document}/}\\end{document}/;
     }      }
     $text =~ s/\\end\{document}/}\\end{document}/;  
     return $text;      return $text;
   
   
Line 3227  ENDPART Line 3228  ENDPART
  $result .= $print_array[0].'  \end{document}';   $result .= $print_array[0].'  \end{document}';
      } elsif (($print_type eq 'problems_for_anon')      ||       } elsif (($print_type eq 'problems_for_anon')      ||
       ($print_type eq 'problems_for_anon_page') ||        ($print_type eq 'problems_for_anon_page') ||
       ($print_type eq 'resources_for_anon')  ) {         ($print_type eq 'resources_for_anon')  ) {
  my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};   my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
  my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};   my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
  my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};   my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};
Line 3353  ENDPART Line 3354  ENDPART
  }   }
  &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);   &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
  $result .= $print_array[0].'  \end{document}';   $result .= $print_array[0].'  \end{document}';
      } elsif ($print_type eq 'problems_from_directory') {             } elsif ($print_type eq 'problems_from_directory') {
     #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'};
Line 4064  sub printHelper { Line 4065  sub printHelper {
         $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});          $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
   
     }      }
     $helper->{VARS}->{'symb'}=      if ($helper->{VARS}->{'symb'} ne '') {
  &Apache::lonenc::check_encrypt($helper->{VARS}->{'symb'});          $helper->{VARS}->{'symb'}=
       &Apache::lonenc::check_encrypt($helper->{VARS}->{'symb'});
       }
     my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu($helper);      my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu($helper);
     if ($sequenceTitle ne '') {$helper->{VARS}->{'assignment'}=$sequenceTitle;}      if ($sequenceTitle ne '') {$helper->{VARS}->{'assignment'}=$sequenceTitle;}
   
Line 4076  sub printHelper { Line 4079  sub printHelper {
     my $subdir;      my $subdir;
     my $is_published=0; # True when printing from resource space.      my $is_published=0; # True when printing from resource space.
     my $res_printable = 1; # By default the current resource is printable.          my $res_printable = 1; # By default the current resource is printable.    
       my $res_error;
     my $userCanPrint = ($perm{'pav'} || $perm{'pfo'});      my $userCanPrint = ($perm{'pav'} || $perm{'pfo'});
     my $res_printstartdate;      my $res_printstartdate;
     my $res_printenddate;      my $res_printenddate;
Line 4097  sub printHelper { Line 4101  sub printHelper {
     ($map, $id, $url) = &Apache::lonnet::decode_symb($symb);      ($map, $id, $url) = &Apache::lonnet::decode_symb($symb);
     $helper->{VARS}->{'postdata'} =       $helper->{VARS}->{'postdata'} = 
  &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));   &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));
     my $navmap = Apache::lonnavmaps::navmap->new();              if (!$userCanPrint) {
     my $res   = $navmap->getBySymb($symb);          my $navmap = Apache::lonnavmaps::navmap->new();
     $res_printable  = $res->resprintable() || $userCanPrint; #printability in course context                  if (ref($navmap)) {
     ($res_printstartdate, $res_printenddate) = &get_print_dates($res);              my $res = $navmap->getBySymb($symb);
     ($course_open, $course_close) = &course_print_dates($res);                      if (ref($res)) {
     ($map_open, $map_close)       = &map_print_dates($res);                  $res_printable = $res->resprintable(); #printability in course context
                   ($res_printstartdate, $res_printenddate) = &get_print_dates($res);
                   ($course_open, $course_close) = &course_print_dates($res);
                   ($map_open, $map_close) = &map_print_dates($res);
                       } else {
                           $res_error = 1;
                       }
                   } else {
                       $res_error = 1;
                   }
               }
  } else {   } else {
     # Resource space.      # Resource space.
   
Line 4219  sub printHelper { Line 4232  sub printHelper {
  }   }
         my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE',          my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE',
  'Select Problem(s) to print',   'Select Problem(s) to print',
  "multichoice='1' toponly='1' addstatus='1' closeallpages='1'",   "multichoice='1' toponly='1' addstatus='1' closeallpages='1' modallink='1'",
  'RESOURCES',   'RESOURCES',
  'PAGESIZE',   'PAGESIZE',
  $url,   $url,
Line 4229  sub printHelper { Line 4242  sub printHelper {
   
       $helperFragment .= &generate_resource_chooser('CHOOSE_RESOURCES_PAGE',        $helperFragment .= &generate_resource_chooser('CHOOSE_RESOURCES_PAGE',
     'Select Resource(s) to print',      'Select Resource(s) to print',
     'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',      'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
     'RESOURCES',      'RESOURCES',
     'PAGESIZE',      'PAGESIZE',
     $url,      $url,
Line 4294  sub printHelper { Line 4307  sub printHelper {
     'CHOOSE_PROBLEMS_HTML'];      'CHOOSE_PROBLEMS_HTML'];
     my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS',      my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS',
     'Select Problem(s) to print',      'Select Problem(s) to print',
     'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',      'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
     'RESOURCES',      'RESOURCES',
     'PAGESIZE',      'PAGESIZE',
     $map,      $map,
Line 4303  sub printHelper { Line 4316  sub printHelper {
     $start_new_option);      $start_new_option);
     $helperFragment .= &generate_resource_chooser('CHOOSE_PROBLEMS_HTML',      $helperFragment .= &generate_resource_chooser('CHOOSE_PROBLEMS_HTML',
   'Select Resource(s) to print',    'Select Resource(s) to print',
   'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',    'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
   'RESOURCES',    'RESOURCES',
   'PAGESIZE',    'PAGESIZE',
   $map,    $map,
Line 4351  ALL_PROBLEMS Line 4364  ALL_PROBLEMS
          &Apache::lonxml::xmlparse($r, 'helper',            &Apache::lonxml::xmlparse($r, 'helper', 
    &generate_resource_chooser('ALL_PROBLEMS',     &generate_resource_chooser('ALL_PROBLEMS',
       'Select Problem(s) to print',        'Select Problem(s) to print',
       'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',        'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
       'RESOURCES',        'RESOURCES',
       'PAGESIZE',        'PAGESIZE',
       '',        '',
Line 4360  ALL_PROBLEMS Line 4373  ALL_PROBLEMS
       $start_new_option) .        $start_new_option) .
    &generate_resource_chooser('ALL_RESOURCES',     &generate_resource_chooser('ALL_RESOURCES',
       'Select Resource(s) to print',        'Select Resource(s) to print',
       " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1'",        " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1' modallink='1'",
       'RESOURCES',        'RESOURCES',
       'PAGESIZE',        'PAGESIZE',
       '',        '',
Line 4368  ALL_PROBLEMS Line 4381  ALL_PROBLEMS
       $start_new_option) .        $start_new_option) .
    &generate_resource_chooser('ALL_PROBLEMS_STUDENTS',     &generate_resource_chooser('ALL_PROBLEMS_STUDENTS',
       'Select Problem(s) to print',        'Select Problem(s) to print',
       'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',        'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
       'RESOURCES',        'RESOURCES',
       'STUDENTS1',        'STUDENTS1',
       '',        '',
Line 4412  ALL_PROBLEMS Line 4425  ALL_PROBLEMS
  #   #
  my $resource_selector= &generate_resource_chooser('SELECT_PROBLEMS',   my $resource_selector= &generate_resource_chooser('SELECT_PROBLEMS',
   'Select resources to print',    'Select resources to print',
   'multichoice="1" addstatus="1" closeallpages="1"',    'multichoice="1" addstatus="1" closeallpages="1" modallink="1"',
   'RESOURCES',     'RESOURCES', 
   'PRINT_FORMATTING',    'PRINT_FORMATTING',
   $map,    $map,
Line 4423  ALL_PROBLEMS Line 4436  ALL_PROBLEMS
                                                          'PRINT_FORMATTING').                                                           'PRINT_FORMATTING').
                                &generate_resource_chooser('CHOOSE_STUDENTS_PAGE',                                 &generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
  'Select Problem(s) to print',   'Select Problem(s) to print',
  "multichoice='1' addstatus='1' closeallpages ='1'",   "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
  'RESOURCES',   'RESOURCES',
  'PRINT_FORMATTING',   'PRINT_FORMATTING',
  $url,   $url,
Line 4521  ALL_PROBLEMS Line 4534  ALL_PROBLEMS
  $namechoice) .   $namechoice) .
  &generate_resource_chooser('SELECT_PROBLEMS_PAGE',   &generate_resource_chooser('SELECT_PROBLEMS_PAGE',
    'Select Problem(s) to print',     'Select Problem(s) to print',
    "multichoice='1' addstatus='1' closeallpages ='1'",     "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
    'RESOURCES',     'RESOURCES',
    'PRINT_FORMATTING',     'PRINT_FORMATTING',
    $url,     $url,
Line 4545  ALL_PROBLEMS Line 4558  ALL_PROBLEMS
     <nextstate>PRINT_FORMATTING</nextstate>      <nextstate>PRINT_FORMATTING</nextstate>
     <message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>      <message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>
     <resource variable="RESOURCES" multichoice="1" addstatus="1"       <resource variable="RESOURCES" multichoice="1" addstatus="1" 
               closeallpages="1">                closeallpages="1" modallink="1">
       <filterfunc>return $isNotMap;</filterfunc>        <filterfunc>return $isNotMap;</filterfunc>
       <mapurl>$map</mapurl>        <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>        <valuefunc>return $symbFilter;</valuefunc>
Line 4690  CHOOSE_FROM_SUBDIR Line 4703  CHOOSE_FROM_SUBDIR
   <state name="CHOOSE_FROM_ANY_SEQUENCE" title="Select Resources To Print">    <state name="CHOOSE_FROM_ANY_SEQUENCE" title="Select Resources To Print">
     <message>(mark desired resources then click "next" button) <br /></message>      <message>(mark desired resources then click "next" button) <br /></message>
     <resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1"      <resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1"
               closeallpages="1">                closeallpages="1" modallink="1">
       <nextstate>PAGESIZE</nextstate>        <nextstate>PAGESIZE</nextstate>
       <filterfunc>return $isNotMap</filterfunc>        <filterfunc>return $isNotMap</filterfunc>
       <mapurl evaluate='1'>return '$escapedSequenceName';</mapurl>        <mapurl evaluate='1'>return '$escapedSequenceName';</mapurl>
Line 4701  CHOOSE_FROM_SUBDIR Line 4714  CHOOSE_FROM_SUBDIR
 CHOOSE_FROM_ANY_SEQUENCE  CHOOSE_FROM_ANY_SEQUENCE
 }  }
   
       my $numchoices = 0;
       if (ref($printChoices) eq 'ARRAY') {
           $numchoices = @{$printChoices};
       }
       # Early out if nothing to print
       if (!$numchoices) {
           $r->print(&Apache::loncommon::start_page('Printing Helper').
                     '<h2>'.&mt('Unable to determine print context').'</h2>'.
                     '<p>'.&mt('Please display a resource, and then click the "Print" button/icon').'</p>');
           my $prtspool=$r->dir_config('lonPrtDir');
           my $footer = &recently_generated($prtspool);
           $r->print($footer.&Apache::loncommon::end_page());
           return OK;
       }
   
     # 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", "Select Printing Options:");      Apache::lonhelper::state->new("START", "Select Printing Options:");
     if (!$res_printable) {      if (!$res_printable) {
         my $now = time;  
         my $shownprintstart = &Apache::lonlocal::locallocaltime($res_printstartdate);  
         my $shownprintend = &Apache::lonlocal::locallocaltime($res_printenddate);  
         my $noprintmsg;          my $noprintmsg;
         if (($res_printenddate) && ($res_printenddate < $now)) {          if ($res_error) {
               $noprintmsg = &mt('Print availability for current resource could not be determined');
           } else {
               my $now = time;
               my $shownprintstart = &Apache::lonlocal::locallocaltime($res_printstartdate);
               my $shownprintend = &Apache::lonlocal::locallocaltime($res_printenddate);
               if (($res_printenddate) && ($res_printenddate < $now)) {
                 $noprintmsg = &mt('Printing for current resource no longer available (ended: [_1])',                  $noprintmsg = &mt('Printing for current resource no longer available (ended: [_1])',
                                   $shownprintend);                                    $shownprintend);
         } else {              } else {
             if (($res_printstartdate) && ($res_printstartdate > $now)) {                  if (($res_printstartdate) && ($res_printstartdate > $now)) {
                 if (($res_printenddate) && ($res_printenddate > $now) && ($res_printenddate > $res_printstartdate)) {                      if (($res_printenddate) && ($res_printenddate > $now) && ($res_printenddate > $res_printstartdate)) {
                     $noprintmsg = &mt('Printing for current resource is only possible between [_1] and [_2]',                          $noprintmsg = &mt('Printing for current resource is only possible between [_1] and [_2]',
                                   $shownprintstart,$shownprintend);                                            $shownprintstart,$shownprintend);
                 } elsif (!$res_printenddate) {                      } elsif (!$res_printenddate) {
                     $noprintmsg = &mt('Printing for current resource will only be possible starting [_1]',                          $noprintmsg = &mt('Printing for current resource will only be possible starting [_1]',
                                       $shownprintstart);                                            $shownprintstart);
                 } else {                      } else {
                     $noprintmsg = &mt('Printing for current resource is unavailable');                          $noprintmsg = &mt('Printing for current resource is unavailable');
                       }
                 }                  }
             }              }
         }          }
Line 4776  CHOOSE_FROM_ANY_SEQUENCE Line 4808  CHOOSE_FROM_ANY_SEQUENCE
             my $xmlfrag = << "FONT_SELECTION";              my $xmlfrag = << "FONT_SELECTION";
   
                       
             <dropdown variable='fontsize' multichoice='0', allowempty='0'>              <dropdown variable='fontsize' multichoice='0' allowempty='0'>
             <defaultvalue>              <defaultvalue>
   return 'normalsize';    return 'normalsize';
             </defaultvalue>              </defaultvalue>

Removed from v.1.627.2.23  
changed lines
  Added in v.1.627.2.27


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