Diff for /loncom/interface/lonprintout.pm between versions 1.627.2.23.2.1 and 1.627.2.24

version 1.627.2.23.2.1, 2019/02/05 19:03:38 version 1.627.2.24, 2018/09/04 14:35:21
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 1237  sub is_valid_alpha_code { Line 1238  sub is_valid_alpha_code {
 sub is_code_valid {  sub is_code_valid {
     my ($code_value, $code_option) = @_;      my ($code_value, $code_option) = @_;
     my ($code_type, $code_length) = ('letter', 6); # defaults.      my ($code_type, $code_length) = ('letter', 6); # defaults.
     my @lines = &Apache::lonnet::get_scantronformat_file();      my @lines = &Apache::grades::get_scantronformat_file();
     foreach my $line (@lines) {      foreach my $line (@lines) {
         next if (($line =~ /^\#/) || ($line eq ''));          next if (($line =~ /^\#/) || ($line eq ''));
  my ($name, $type, $length) = (split(/:/, $line))[0,2,4];   my ($name, $type, $length) = (split(/:/, $line))[0,2,4];
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 3236  ENDPART Line 3237  ENDPART
  my $single_code = $helper->{'VARS'}->{'SINGLE_CODE'};   my $single_code = $helper->{'VARS'}->{'SINGLE_CODE'};
  my $selected_code = $helper->{'VARS'}->{'CODE_SELECTED_FROM_LIST'};   my $selected_code = $helper->{'VARS'}->{'CODE_SELECTED_FROM_LIST'};
  my $code_option=$helper->{'VARS'}->{'CODE_OPTION'};   my $code_option=$helper->{'VARS'}->{'CODE_OPTION'};
          my @lines = &Apache::lonnet::get_scantronformat_file();           my @lines = &Apache::grades::get_scantronformat_file();
  my ($code_type,$code_length,$bubbles_per_row)=('letter',6,10);   my ($code_type,$code_length,$bubbles_per_row)=('letter',6,10);
  foreach my $line (@lines) {   foreach my $line (@lines) {
              chomp($line);               chomp($line);
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 4062  sub printHelper { Line 4063  sub printHelper {
     }      }
     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'});
   
     }      }
     if ($helper->{VARS}->{'symb'} ne '') {      $helper->{VARS}->{'symb'}=
         $helper->{VARS}->{'symb'}=   &Apache::lonenc::check_encrypt($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 4077  sub printHelper { Line 4077  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 4099  sub printHelper { Line 4098  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));
             if (!$userCanPrint) {      my $navmap = Apache::lonnavmaps::navmap->new();
         my $navmap = Apache::lonnavmaps::navmap->new();      my $res   = $navmap->getBySymb($symb);
                 if (ref($navmap)) {      $res_printable  = $res->resprintable() || $userCanPrint; #printability in course context
             my $res = $navmap->getBySymb($symb);      ($res_printstartdate, $res_printenddate) = &get_print_dates($res);
                     if (ref($res)) {           ($course_open, $course_close) = &course_print_dates($res);
                 $res_printable = $res->resprintable(); #printability in course context      ($map_open, $map_close)       = &map_print_dates($res);
                 ($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 4230  sub printHelper { Line 4220  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 4240  sub printHelper { Line 4230  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 4305  sub printHelper { Line 4295  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 4314  sub printHelper { Line 4304  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 4362  ALL_PROBLEMS Line 4352  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 4371  ALL_PROBLEMS Line 4361  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 4379  ALL_PROBLEMS Line 4369  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 4423  ALL_PROBLEMS Line 4413  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 4434  ALL_PROBLEMS Line 4424  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 4501  ALL_PROBLEMS Line 4491  ALL_PROBLEMS
   
  }   }
   
         my @lines = &Apache::lonnet::get_scantronformat_file();          my @lines = &Apache::grades::get_scantronformat_file();
  my $codechoice='';   my $codechoice='';
  foreach my $line (@lines) {   foreach my $line (@lines) {
     my ($name,$description,$code_type,$code_length)=      my ($name,$description,$code_type,$code_length)=
Line 4532  ALL_PROBLEMS Line 4522  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 4556  ALL_PROBLEMS Line 4546  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 4701  CHOOSE_FROM_SUBDIR Line 4691  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 4712  CHOOSE_FROM_SUBDIR Line 4702  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_error) {          if (($res_printenddate) && ($res_printenddate < $now)) {
             $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');
                     }  
                 }                  }
             }              }
         }          }

Removed from v.1.627.2.23.2.1  
changed lines
  Added in v.1.627.2.24


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