Diff for /loncom/interface/lonprintout.pm between versions 1.622 and 1.639

version 1.622, 2012/11/20 12:03:06 version 1.639, 2014/02/08 23:49:12
Line 27 Line 27
 #  #
 package Apache::lonprintout;  package Apache::lonprintout;
 use strict;  use strict;
 use POSIX;  
 use Apache::Constants qw(:common :http);  use Apache::Constants qw(:common :http);
 use Apache::lonxml;  use Apache::lonxml;
 use Apache::lonnet;  use Apache::lonnet;
Line 47  use File::Basename; Line 46  use File::Basename;
   
 use HTTP::Response;  use HTTP::Response;
 use LONCAPA::map();  use LONCAPA::map();
 use POSIX qw(ctime);  
 use Apache::lonlocal;  use Apache::lonlocal;
 use Carp;  use Carp;
 use LONCAPA;  use LONCAPA;
Line 149  sub printable_sequence { Line 147  sub printable_sequence {
 # Return:  # Return:
 #     XML that can be parsed by the helper to drive the state machine.  #     XML that can be parsed by the helper to drive the state machine.
 #  #
 sub create_incomplete_folder_selstud_helper($helper)  sub create_incomplete_folder_selstud_helper {
 {  
     my ($helper, $map)  = @_;      my ($helper, $map)  = @_;
   
   
Line 495  RESOURCE_SELECTOR Line 492  RESOURCE_SELECTOR
 #  #
 # @return ($open, $close)   # @return ($open, $close) 
 #  #
 # @note If open/close dates are not defined they will be retunred as undef  # @note If open/close dates are not defined they will be returned as undef
 # @note It is possible for there to be no overlap in which case -1,-1   # @note It is possible for there to be no overlap in which case -1,-1 
 #       will be returned.  #       will be returned.
 # @note The algorithm used is to take the latest open date and the earliest end date.  # @note The algorithm used is to take the latest open date and the earliest end date.
Line 525  sub compute_open_window { Line 522  sub compute_open_window {
   
     # If no overlap...both are -1 as promised.      # If no overlap...both are -1 as promised.
   
     if (defined($earliest_close) && defined($latest_open)      if (($earliest_close ne '') && ($latest_open ne '')
  && ($earliest_close < $latest_open)) {   && ($earliest_close < $latest_open)) {
  $latest_open  = -1;   $latest_open  = -1;
  $earliest_close = -1;   $earliest_close = -1;
Line 573  sub printable { Line 570  sub printable {
 #  #
 # @return (opendate, closedate)  # @return (opendate, closedate)
 #  #
 # @note If open/close dates are not defined they will be retunred as undef  # @note If open/close dates are not defined they will be returned as undef
 # @note It is possible for there to be no overlap in which case -1,-1   # @note It is possible for there to be no overlap in which case -1,-1 
 #       will be returned.  #       will be returned.
 # @note The algorithm used is to take the latest open date and the earliest end date.  # @note The algorithm used is to take the latest open date and the earliest end date.
 #  #       For consistency with &printable() in lonnavmaps.pm determination of start
   #       date for printing checks printstartdate param first, then, if not set,
   #       opendate param, then, if not set, contentopen param.
   
 sub get_print_dates {  sub get_print_dates {
     my $res = shift;      my $res = shift;
Line 596  sub get_print_dates { Line 595  sub get_print_dates {
  foreach my $part (@parts) {   foreach my $part (@parts) {
     my $partopen  = $res->parmval('printstartdate', $part);      my $partopen  = $res->parmval('printstartdate', $part);
     my $partclose = $res->parmval('printenddate',  $part);      my $partclose = $res->parmval('printenddate',  $part);
               if (!$partopen) {
                   $partopen = $res->parmval('opendate',$part);
               }
               if (!$partopen) {
                   $partopen = $res->parmval('contentopen',$part);
               }
               if ($partopen) {
                   push(@open_dates, $partopen);
               }
               if ($partclose) {
                   push(@close_dates, $partclose);
               }
     push(@open_dates, $partopen);      push(@open_dates, $partopen);
     push(@close_dates, $partclose);      push(@close_dates, $partclose);
  }   }
Line 604  sub get_print_dates { Line 614  sub get_print_dates {
   
     ($open_date, $close_date)  = &compute_open_window(\@open_dates, \@close_dates);      ($open_date, $close_date)  = &compute_open_window(\@open_dates, \@close_dates);
   
     if ($open_date) {  
  $open_date  = POSIX::strftime('%D', localtime($open_date));  
     }  
     if ($close_date) {  
  $close_date = POSIX::strftime('%D', localtime($close_date));  
     }  
   
     return ($open_date, $close_date);      return ($open_date, $close_date);
 }  }
   
Line 705  sub incomplete { Line 708  sub incomplete {
 #  to only those that are in the original set selcted to be printed.  #  to only those that are in the original set selcted to be printed.
 #  #
 # Parameters:  # Parameters:
 #   $helper - The helper we need $helper->{'VARS'}->{'symb'}  #   $map - The URL of the folder being printed.
 #            to construct the navmap and the iteration.  #          Used to determine which startResource and finishResource
 #   $seq   - The original set of resources to print   #          to use when using the navmap's getIterator method.
   #   $seq   - The original set of resources to print.
 #            (really an array of resource names (array of symb's).  #            (really an array of resource names (array of symb's).
 #   $who   - Student/domain for whome the sequence will be generated.  #   $who   - Student/domain for whome the sequence will be generated.
   #   $code  - CODE being printed when printing Problems/Resources
   #            from folder for CODEd assignments
 #  #
 # Implicit inputs:  # Implicit inputs:
 #   $  #   $
Line 718  sub incomplete { Line 724  sub incomplete {
 #   print_resources.  #   print_resources.
 #   # 
 sub master_seq_to_person_seq {  sub master_seq_to_person_seq {
     my ($helper, $seq, $who) = @_;      my ($map, $seq, $who, $code, $nohidemap) = @_;
   
   
     my ($username, $userdomain, $usersection) = split(/:/, $who);      my ($username, $userdomain, $usersection) = split(/:/, $who);
   
   
     # Toss the sequence up into a hash so that we have O(1) lookup time.      # Toss the sequence up into a hash so that we have O(1) lookup time.
     # on the items that come out of the user's list of resources.      # on the items that come out of the user's list of resources.
     #      #
       
     my %seq_hash = map {$_  => 1} @$seq;      my %seq_hash = map {$_  => 1} @$seq;
     my @output_seq;      my @output_seq;
   
       my $unhidden;
       if ($perm{'pav'} && $perm{'vgr'} && $nohidemap) {
           $unhidden = &Apache::lonnet::clutter($map);
       }
           
     my ($map, $id, $url) = &Apache::lonnet::decode_symb($helper->{VARS}->{'symb'});      my $navmap           = Apache::lonnavmaps::navmap->new($username, $userdomain,
     my $navmap           = Apache::lonnavmaps::navmap->new($username, $userdomain);                                                             $code, $unhidden);
     my $iterator         = $navmap->getIterator($navmap->firstResource(),      my ($start,$finish);
  $navmap->finishResource(),  
  {}, 1);      if ($map) {
     my %nonResourceItems = (          my $mapres = $navmap->getResourceByUrl($map);
  $iterator->BEGIN_MAP    => 1,          if ($mapres->is_map()) {
  $iterator->BEGIN_BRANCH => 1,              $start = $mapres->map_start();
  $iterator->END_BRANCH   => 1,              $finish = $mapres->map_finish();
  $iterator->END_MAP      => 1,          }
  $iterator->FORWARD      => 1,      }
  $iterator->BACKWARD     => 1      unless ($start && $finish) {
           $start = $navmap->firstResource();
           $finish = $navmap->finishResource();
       }
   
     ); # These items are not resources but appear in the midst of iteration.      my $iterator         = $navmap->getIterator($start,$finish,{},1);
   
     #  Iterate on the resource..select the items that are randomly selected      #  Iterate on the resource..select the items that are randomly selected
     #  and that are in the seq_has.  Presumably the iterator will take care      #  and that are in the seq_has.  Presumably the iterator will take care
Line 756  sub master_seq_to_person_seq { Line 769  sub master_seq_to_person_seq {
  #  Only process resources..that are not removed by randomout...   #  Only process resources..that are not removed by randomout...
  #  and are selected for printint as well.   #  and are selected for printint as well.
  #   #
                if (ref($curres) && ! $curres->randomout()) {
  if (! exists $nonResourceItems{$curres} && ! $curres->randomout()) {              my $currsymb = $curres->symb();
     my $symb = $curres->symb();              if (exists($seq_hash{$currsymb})) {
     if (exists $seq_hash{$symb}) {                  push(@output_seq, $currsymb);
  push(@output_seq, $symb);  
     }      }
  }   }
     }      }
      
   
     return \@output_seq; # for now.      return \@output_seq; # for now.
           
Line 1098  sub format_page_header { Line 1109  sub format_page_header {
     # there is '\\ \\ ' in the page header. That's cause a error in LaTeX      # there is '\\ \\ ' in the page header. That's cause a error in LaTeX
     if($format =~ /\\\\\s\\\\\s/) {      if($format =~ /\\\\\s\\\\\s/) {
         #TODO find sensible caption for page header          #TODO find sensible caption for page header
         my $testPrintout = '\\\\'.&mt('Construction Space').' \\\\'.&mt('Test-Printout ');          my $testPrintout = '\\\\'.&mt('Authoring Space').' \\\\'.&mt('Test-Printout ');
         $format =~ s/\\\\\s\\\\\s/$testPrintout/;          $format =~ s/\\\\\s\\\\\s/$testPrintout/;
     }      }
     #      #
Line 2060  sub unsupported { Line 2071  sub unsupported {
     my $result.= &print_latex_header($mode);      my $result.= &print_latex_header($mode);
     if ($currentURL=~m|^(/adm/wrapper/)?ext/|) {      if ($currentURL=~m|^(/adm/wrapper/)?ext/|) {
  $currentURL=~s|^(/adm/wrapper/)?ext/|http://|;   $currentURL=~s|^(/adm/wrapper/)?ext/|http://|;
           $currentURL=~s|^http://https://|https://|;
  my $title=&Apache::lonnet::gettitle($symb);   my $title=&Apache::lonnet::gettitle($symb);
  $title = &Apache::lonxml::latex_special_symbols($title);   $title = &Apache::lonxml::latex_special_symbols($title);
  $result.=' \strut \\\\ '.$title.' \strut \\\\ '.$currentURL.' ';   $result.=' \strut \\\\ '.$title.' \strut \\\\ '.$currentURL.' ';
Line 2139  sub print_page_in_course { Line 2151  sub print_page_in_course {
     my @page_resources = $navmap->retrieveResources($resource_src);      my @page_resources = $navmap->retrieveResources($resource_src);
     $result           .= &print_page_in_course($helper, $rparmhash,       $result           .= &print_page_in_course($helper, $rparmhash, 
        $resource_src, \@page_resources);         $resource_src, \@page_resources);
           } elsif ($resource->ext()) {
               $result .= &unsupported($currentURL,$mode,$symb);
  }   }
  # these resources go through the XML transformer:   # these resources go through the XML transformer:
   
Line 2208  sub print_page_in_course { Line 2222  sub print_page_in_course {
  $texversion.=&path_to_problem($urlp,$LaTeXwidth);   $texversion.=&path_to_problem($urlp,$LaTeXwidth);
     } else {      } else {
  $texversion.='\vskip 0 mm \noindent\textbf{'.   $texversion.='\vskip 0 mm \noindent\textbf{'.
                         &mt("Printing from Construction Space: No Title").'}\vskip 0 mm ';                          &mt("Printing from Authoring Space: No Title").'}\vskip 0 mm ';
  $texversion.=&path_to_problem($urlp,$LaTeXwidth);   $texversion.=&path_to_problem($urlp,$LaTeXwidth);
     }      }
     $texversion.='\vskip 1 mm '.$answer.'\end{document}';      $texversion.='\vskip 1 mm '.$answer.'\end{document}';
Line 2789  ENDPART Line 2803  ENDPART
  $texversion.=&path_to_problem($cleanURL,$LaTeXwidth);   $texversion.=&path_to_problem($cleanURL,$LaTeXwidth);
     } else {      } else {
  $texversion.='\vskip 0 mm \noindent\textbf{'.   $texversion.='\vskip 0 mm \noindent\textbf{'.
                         &mt("Printing from Construction Space: No Title").'}\vskip 0 mm ';                          &mt("Printing from Authoring Space: No Title").'}\vskip 0 mm ';
   
  $texversion.=&path_to_problem($cleanURL,$LaTeXwidth);   $texversion.=&path_to_problem($cleanURL,$LaTeXwidth);
     }      }
Line 3141  ENDPART Line 3155  ENDPART
  }   }
  my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};   my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
   
            my $map;
            if ($helper->{VARS}->{'symb'}) {
                ($map, my $id, my $resource) =
                    &Apache::lonnet::decode_symb($helper->{VARS}->{'symb'});
            }
   
  #loop over students   #loop over students
   
   my $flag_latex_header_remove = 'NO';    my $flag_latex_header_remove = 'NO';
Line 3175  ENDPART Line 3195  ENDPART
      } else {       } else {
  $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'});   $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'});
      }       }
      my $actual_seq = master_seq_to_person_seq($helper, \@master_seq, $person);       my $actual_seq = master_seq_to_person_seq($map, \@master_seq,
                                                          $person, undef, 1);
      my ($output,$fullname, $printed)=&print_resources($r,$helper,       my ($output,$fullname, $printed)=&print_resources($r,$helper,
      $person,$type,       $person,$type,
      \%moreenv,  $actual_seq,       \%moreenv,  $actual_seq,
Line 3201  ENDPART Line 3222  ENDPART
  my $old_name=$helper->{'VARS'}->{'REUSE_OLD_CODES'};   my $old_name=$helper->{'VARS'}->{'REUSE_OLD_CODES'};
  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::grades::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);
Line 3218  ENDPART Line 3238  ENDPART
                  }                   }
      }       }
  }   }
            my ($randomorder,$randompick,$map);
            if ($helper->{VARS}{'symb'}) {
                ($map, my $id, my $resource) =
                    &Apache::lonnet::decode_symb($helper->{VARS}{'symb'});
                my $navmap = Apache::lonnavmaps::navmap->new();
                if (defined($navmap)) {
                    if ($map) {
                        my $mapres = $navmap->getResourceByUrl($map);
                        $randomorder = $mapres->randomorder();
                        $randompick = $mapres->randompick();
                    }
                }
            }
  my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth));   my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth));
  $moreenv{'problem_split'}    = $parmhash{'problem_stream_switch'};   $moreenv{'problem_split'}    = $parmhash{'problem_stream_switch'};
          $moreenv{'instructor_comments'}='hide';           $moreenv{'instructor_comments'}='hide';
Line 3279  ENDPART Line 3312  ENDPART
      } else {       } else {
  $moreenv{'CODE'}=&num_to_letters($code);   $moreenv{'CODE'}=&num_to_letters($code);
      }       }
                my $actual_seq = \@master_seq;
                if ($randomorder || $randompick) {
                    $env{'form.CODE'} = $moreenv{'CODE'};
                    $actual_seq = master_seq_to_person_seq($map, \@master_seq,
                                                           undef,
                                                           $moreenv{'CODE'}, 1);
                    delete($env{'form.CODE'});
                }
      my ($output,$fullname, $printed)=       my ($output,$fullname, $printed)=
  &print_resources($r,$helper,'anonymous',$type,\%moreenv,   &print_resources($r,$helper,'anonymous',$type,\%moreenv,
   \@master_seq,$flag_latex_header_remove,    $actual_seq,$flag_latex_header_remove,
   $LaTeXwidth);    $LaTeXwidth);
      $resources_printed .= ":";       $resources_printed .= ":";
      $print_array[$file_num].=$output;       $print_array[$file_num].=$output;
Line 3334  ENDPART Line 3375  ENDPART
     $texversion.=&path_to_problem ($urlp,$LaTeXwidth);      $texversion.=&path_to_problem ($urlp,$LaTeXwidth);
  } else {   } else {
     $texversion.='\vskip 0 mm \noindent\textbf{'.      $texversion.='\vskip 0 mm \noindent\textbf{'.
                                          &mt("Printing from Construction Space: No Title").'}\vskip 0 mm ';                                           &mt("Printing from Authoring Space: No Title").'}\vskip 0 mm ';
     $texversion.=&path_to_problem ($urlp,$LaTeXwidth);      $texversion.=&path_to_problem ($urlp,$LaTeXwidth);
  }   }
  $texversion.='\vskip 1 mm '.$answer.'\end{document}';   $texversion.='\vskip 1 mm '.$answer.'\end{document}';
Line 3571  sub print_resources { Line 3612  sub print_resources {
     #      #
   
     my $syllabus_first = 0;      my $syllabus_first = 0;
       my $assessment_first = 0;
     my $current_assignment = "";      my $current_assignment = "";
     my $assignment;      my $assignment;
     my $courseidinfo = &get_course();      my $courseidinfo = &get_course();
Line 3592  sub print_resources { Line 3634  sub print_resources {
     if ($print_incomplete && !&incomplete($username, $userdomain, $res_url)) {      if ($print_incomplete && !&incomplete($username, $userdomain, $res_url)) {
  next;   next;
     }      }
               if ((!$actually_printed) && ($curresline =~ m/$LONCAPA::assess_re/)) {
                   $assessment_first = 1;
               }
     $actually_printed++; # we're going to print one.      $actually_printed++; # we're going to print one.
   
     if (&Apache::lonnet::allowed('bre',$res_url)) {      if (&Apache::lonnet::allowed('bre',$res_url)) {
  if ($res_url!~m|^ext/|   if ($res_url!~m|^ext/|
     && $res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {      && $res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
Line 3725  sub print_resources { Line 3771  sub print_resources {
     if ($syllabus_first) {      if ($syllabus_first) {
         $current_output =~ s/\\\\ Last updated:/Last updated:/          $current_output =~ s/\\\\ Last updated:/Last updated:/
     }      }
     if (0) {      my $newheader;
       unless ($assessment_first) {
  my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');   my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');
  my $header_line =   my $header_line =
     &format_page_header($LaTeXwidth, $parmhash{'print_header_format'},      &format_page_header($LaTeXwidth, $parmhash{'print_header_format'},
  $currentassignment, $courseidinfo, $fullname, $usersection);   $currentassignment, $courseidinfo, $fullname, $usersection);
  my $header_start = ($columns_in_format == 1) ? '\lhead'   my $header_start = ($columns_in_format == 1) ? '\lhead'
     : '\fancyhead[LO]';      : '\fancyhead[LO]';
  $header_line = $header_start.'{'.$header_line.'}';   $newheader = $header_start.'{'.$header_line.'}';
     }      }
     if ($current_output=~/\\documentclass/) {      if ($current_output=~/\\documentclass/) {
 # $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$header_line$namepostfix}\\vskip 5 mm /;   $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$newheader$namepostfix}\\vskip 5 mm /;
  $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$namepostfix}\\vskip 5 mm /;  
   
     } else {      } else {
  my $blankpages =    my $blankpages = 
     '\clearpage\strut\clearpage'x$helper->{'VARS'}->{'EMPTY_PAGES'};      '\clearpage\strut\clearpage'x$helper->{'VARS'}->{'EMPTY_PAGES'};
   
 # $current_output = '\strut\vspace*{-6 mm}\\newline'.  
 #    &copyright_line().' \newpage '.$blankpages.$end_of_student.  
 #    '\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent'.  
 #    $header_line.$namepostfix. '} \vskip 5 mm '.$current_output;  
  $current_output = '\strut\vspace*{-6 mm}\\newline'.   $current_output = '\strut\vspace*{-6 mm}\\newline'.
     &copyright_line().' \newpage '.$blankpages.$end_of_student.      &copyright_line().' \newpage '.$blankpages.$end_of_student.
     '\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent'      '\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent'.
     .$namepostfix. '} \vskip 5 mm '.$current_output;      $newheader.$namepostfix. '} \vskip 5 mm '.$current_output;
   
     }      }
     #      #
Line 4018  sub printHelper { Line 4060  sub printHelper {
  &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));   &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     my $res   = $navmap->getBySymb($symb);      my $res   = $navmap->getBySymb($symb);
     $res_printable  = $res->resprintable() | $userCanPrint; #printability in course context      $res_printable  = $res->resprintable() || $userCanPrint; #printability in course context
     ($res_printstartdate, $res_printenddate) = &get_print_dates($res);      ($res_printstartdate, $res_printenddate) = &get_print_dates($res);
     ($course_open, $course_close) = &course_print_dates($res);      ($course_open, $course_close) = &course_print_dates($res);
     ($map_open, $map_close)       = &map_print_dates($res);      ($map_open, $map_close)       = &map_print_dates($res);
Line 4098  sub printHelper { Line 4140  sub printHelper {
     my $start_new_option;      my $start_new_option;
     if ($perm{'pav'}) {      if ($perm{'pav'}) {
  $start_new_option =    $start_new_option = 
     "<option text='".&mt('Start new page<br />before selected').      "<option text='".&mt('Start new page[_1]before selected','<br />').
     "' variable='FINISHPAGE' />".      "' variable='FINISHPAGE' />".
     "<option text='".&mt('Extra space<br />before selected').      "<option text='".&mt('Extra space[_1]before selected','<br />').
     "' variable='EXTRASPACE' type='text' />" .      "' variable='EXTRASPACE' type='text' />" .
     "<option " .      "<option " .
     "' variable='POSSIBLE_RESOURCES' type='hidden' />".      "' variable='POSSIBLE_RESOURCES' type='hidden' />".
     "<option text='".&mt('Space units<br />check for mm').      "<option text='".&mt('Space units[_1]check for mm','<br />').
     "' variable='EXTRASPACE_UNITS' type='checkbox' />"      "' variable='EXTRASPACE_UNITS' type='checkbox' />"
     ;      ;
           
Line 4269  my $suffixXml = <<ALL_PROBLEMS; Line 4311  my $suffixXml = <<ALL_PROBLEMS;
 ALL_PROBLEMS  ALL_PROBLEMS
          &Apache::lonxml::xmlparse($r, 'helper',            &Apache::lonxml::xmlparse($r, 'helper', 
    &generate_resource_chooser('ALL_PROBLEMS',     &generate_resource_chooser('ALL_PROBLEMS',
       'SelectProblem(s) to print',        'Select Problem(s) to print',
       'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',        'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',
       'RESOURCES',        'RESOURCES',
       'PAGESIZE',        'PAGESIZE',
Line 4412  ALL_PROBLEMS Line 4454  ALL_PROBLEMS
         my @lines = &Apache::grades::get_scantronformat_file();          my @lines = &Apache::grades::get_scantronformat_file();
  my $codechoice='';   my $codechoice='';
  foreach my $line (@lines) {   foreach my $line (@lines) {
               next if (($line =~ /^\#/) || ($line eq ''));
     my ($name,$description,$code_type,$code_length)=      my ($name,$description,$code_type,$code_length)=
  (split(/:/,$line))[0,1,2,4];   (split(/:/,$line))[0,1,2,4];
     if ($code_length > 0 &&       if ($code_length > 0 && 
Line 4623  CHOOSE_FROM_ANY_SEQUENCE Line 4666  CHOOSE_FROM_ANY_SEQUENCE
     # 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) {
  $paramHash = Apache::lonhelper::getParamHash();          my $now = time;
  $paramHash->{MESSAGE_TEXT} =           my $shownprintstart = &Apache::lonlocal::locallocaltime($res_printstartdate);
     &mt('<p><b>Printing for current resource is only possible between [_1] and [_1]</b></p>',          my $shownprintend = &Apache::lonlocal::locallocaltime($res_printenddate);
     $res_printstartdate, $res_printenddate);          my $noprintmsg;
  Apache::lonhelper::message->new();          if (($res_printenddate) && ($res_printenddate < $now)) {
                   $noprintmsg = &mt('Printing for current resource no longer available (ended: [_1])',
                                     $shownprintend);
           } else {
               if (($res_printstartdate) && ($res_printstartdate > $now)) {
                   if (($res_printenddate) && ($res_printenddate > $now) && ($res_printenddate > $res_printstartdate)) {
                       $noprintmsg = &mt('Printing for current resource is only possible between [_1] and [_2]',
                                     $shownprintstart,$shownprintend);
                   } elsif (!$res_printenddate) {
                       $noprintmsg = &mt('Printing for current resource will only be possible starting [_1]',
                                         $shownprintstart);
                   } else {
                       $noprintmsg = &mt('Printing for current resource is unavailable');
                   }
               }
           }
   
           if ($noprintmsg) {
               $paramHash = Apache::lonhelper::getParamHash();
       $paramHash->{MESSAGE_TEXT} = 
                   '<p class="LC_info">'.$noprintmsg.'</p>';
       Apache::lonhelper::message->new();
           }
     }      }
     $paramHash = Apache::lonhelper::getParamHash();      $paramHash = Apache::lonhelper::getParamHash();
     $paramHash = Apache::lonhelper::getParamHash();      $paramHash = Apache::lonhelper::getParamHash();
Line 4851  FONT_SELECTION Line 4916  FONT_SELECTION
       return "$helper->{VARS}->{'probstatus'}";        return "$helper->{VARS}->{'probstatus'}";
                    </defaultvalue>                     </defaultvalue>
    <choice computer="problem">Homework Problem</choice>     <choice computer="problem">Homework Problem</choice>
    <choice computer="exam">Exam Problem</choice>     <choice computer="exam">Bubblesheet Exam Problem</choice>
    <choice computer="survey">Survey question</choice>     <choice computer="survey">Survey question</choice>
                    ,choice computer="anonsurvey"Anonymous survey question</choice>                     ,choice computer="anonsurvey"Anonymous survey question</choice>
  </dropdown>   </dropdown>

Removed from v.1.622  
changed lines
  Added in v.1.639


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