'
+ .&Apache::loncommon::end_data_table_header_row()
+ .$pdf_result
+ .&Apache::loncommon::end_data_table()
+ );
}
}
@@ -1487,8 +1536,8 @@ ENDPART
}
if ($helper->{'VARS'}->{'style_file'}=~/\w/) {
- &Apache::lonnet::appenv('construct.style' =>
- $helper->{'VARS'}->{'style_file'});
+ &Apache::lonnet::appenv({'construct.style' =>
+ $helper->{'VARS'}->{'style_file'}});
} elsif ($env{'construct.style'}) {
&Apache::lonnet::delenv('construct\\.style');
}
@@ -1531,7 +1580,7 @@ ENDPART
$rndseed=$helper->{'VARS'}->{'curseed'};
}
$form{'rndseed'}=$rndseed;
- &Apache::lonnet::appenv(%moreenv);
+ &Apache::lonnet::appenv(\%moreenv);
&Apache::lonxml::clear_problem_counter();
@@ -1645,7 +1694,8 @@ ENDPART
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') or
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') or # BUGBUG
- ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences')) {
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences')
+ ) {
#-- produce an output string
@@ -1653,7 +1703,8 @@ ENDPART
$selectionmade = 2;
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') {
$selectionmade = 3;
- } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') {
+ } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')
+ ) {
$selectionmade = 4;
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') { #BUGBUG
$selectionmade = 4;
@@ -1679,7 +1730,8 @@ ENDPART
my $pbreakresources = keys %page_breaks;
for (my $i=0;$i<=$#master_seq;$i++) {
- &Apache::lonenc::reset_enc();
+ &Apache::lonenc::reset_enc();
+
# Note due to document structure, not allowed to put \newpage
# prior to the first resource
@@ -1689,10 +1741,11 @@ ENDPART
$result.="\\newpage\n";
}
}
- my ($sequence,$middle_thingy,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]);
+ my ($sequence,$middle_thingy,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]);
$urlp=&Apache::lonnet::clutter($urlp);
$form{'symb'}=$master_seq[$i];
+
my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #title of the assignment which contains this problem
if ($selectionmade==7) {$helper->{VARS}->{'assignment'}=$assignment;}
@@ -1806,12 +1859,14 @@ ENDPART
}
$result .= '\end{document}';
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') ||
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') ||
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students')){
#-- prints assignments for whole class or for selected students
my $type;
- if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') {
+ if (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') ||
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') ) {
$selectionmade=5;
$type='problems';
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students') {
@@ -1908,9 +1963,9 @@ ENDPART
my $selected_code = $helper->{'VARS'}->{'CODE_SELECTED_FROM_LIST'};
my $code_option=$helper->{'VARS'}->{'CODE_OPTION'};
- open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
+ my @lines = &Apache::grades::get_scantronformat_file();
my ($code_type,$code_length)=('letter',6);
- foreach my $line () {
+ foreach my $line (@lines) {
my ($name,$type,$length) = (split(/:/,$line))[0,2,4];
if ($name eq $code_option) {
$code_length=$length;
@@ -2002,7 +2057,7 @@ ENDPART
}
for (my $i=0;$i<=$#list_of_files;$i++) {
- &Apache::lonenc::reset_enc();
+ &Apache::lonenc::reset_enc();
my $urlp = $list_of_files[$i];
$urlp=~s|//|/|;
@@ -2097,88 +2152,84 @@ ENDPART
}
}
-
- # If there's been an unrecoverable SSI error, report it to the user
- # otherwise, we can write the tex file.
- #
-
#-- writing .tex file in prtspool
my $temp_file;
my $identifier = &Apache::loncommon::get_cgi_id();
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout_$identifier.tex";
if (!($#print_array>0)) {
- unless ($temp_file = Apache::File->new('>'.$filename)) {
- $r->log_error("Couldn't open $filename for output $!");
- return SERVER_ERROR;
- }
- print $temp_file $result;
- my $begin=index($result,'\begin{document}',0);
- my $inc=substr($result,0,$begin+16);
+ unless ($temp_file = Apache::File->new('>'.$filename)) {
+ $r->log_error("Couldn't open $filename for output $!");
+ return SERVER_ERROR;
+ }
+ print $temp_file $result;
+ my $begin=index($result,'\begin{document}',0);
+ my $inc=substr($result,0,$begin+16);
} else {
- my $begin=index($result,'\begin{document}',0);
- my $inc=substr($result,0,$begin+16);
- for (my $i=0;$i<=$#print_array;$i++) {
- if ($i==0) {
- $print_array[$i]=$result;
- } else {
- $print_array[$i].='\end{document}';
- $print_array[$i] =
- &latex_corrections($number_of_columns,$print_array[$i],
- $selectionmade,
- $helper->{'VARS'}->{'ANSWER_TYPE'});
-
- my $anobegin=index($print_array[$i],'\setcounter{page}',0);
- substr($print_array[$i],0,$anobegin)='';
- $print_array[$i]=$inc.$print_array[$i];
- }
- my $temp_file;
- my $newfilename=$filename;
- my $num=$i+1;
- $newfilename =~s/\.tex$//;
- $newfilename=sprintf("%s_%03d.tex",$newfilename, $num);
- unless ($temp_file = Apache::File->new('>'.$newfilename)) {
- $r->log_error("Couldn't open $newfilename for output $!");
- return SERVER_ERROR;
- }
- print $temp_file $print_array[$i];
- }
+ my $begin=index($result,'\begin{document}',0);
+ my $inc=substr($result,0,$begin+16);
+ for (my $i=0;$i<=$#print_array;$i++) {
+ if ($i==0) {
+ $print_array[$i]=$result;
+ } else {
+ $print_array[$i].='\end{document}';
+ $print_array[$i] =
+ &latex_corrections($number_of_columns,$print_array[$i],
+ $selectionmade,
+ $helper->{'VARS'}->{'ANSWER_TYPE'});
+
+ my $anobegin=index($print_array[$i],'\setcounter{page}',0);
+ substr($print_array[$i],0,$anobegin)='';
+ $print_array[$i]=$inc.$print_array[$i];
+ }
+ my $temp_file;
+ my $newfilename=$filename;
+ my $num=$i+1;
+ $newfilename =~s/\.tex$//;
+ $newfilename=sprintf("%s_%03d.tex",$newfilename, $num);
+ unless ($temp_file = Apache::File->new('>'.$newfilename)) {
+ $r->log_error("Couldn't open $newfilename for output $!");
+ return SERVER_ERROR;
+ }
+ print $temp_file $print_array[$i];
+ }
}
my $student_names='';
if ($#print_array>0) {
- for (my $i=0;$i<=$#print_array;$i++) {
- $student_names.=$student_names[$i].'_ENDPERSON_';
+ for (my $i=0;$i<=$#print_array;$i++) {
+ $student_names.=$student_names[$i].'_ENDPERSON_';
}
} else {
if ($#student_names>-1) {
- $student_names=$student_names[0].'_ENDPERSON_';
+ $student_names=$student_names[0].'_ENDPERSON_';
} else {
- my $fullname = &get_name($env{'user.name'},$env{'user.domain'});
- $student_names=join(':',$env{'user.name'},$env{'user.domain'},
- $env{'request.course.sec'},$fullname).
- '_ENDPERSON_'.'_END_';
+ my $fullname = &get_name($env{'user.name'},$env{'user.domain'});
+ $student_names=join(':',$env{'user.name'},$env{'user.domain'},
+ $env{'request.course.sec'},$fullname).
+ '_ENDPERSON_'.'_END_';
}
- }
+ }
+
+ # logic for now is too complex to trace if this has been defined
+ # yet.
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ &Apache::lonnet::appenv({'cgi.'.$identifier.'.file' => $filename,
+ 'cgi.'.$identifier.'.layout' => $laystyle,
+ 'cgi.'.$identifier.'.numcol' => $numberofcolumns,
+ 'cgi.'.$identifier.'.paper' => $papersize,
+ 'cgi.'.$identifier.'.selection' => $selectionmade,
+ 'cgi.'.$identifier.'.tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'},
+ 'cgi.'.$identifier.'.tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'},
+ 'cgi.'.$identifier.'.role' => $perm{'pav'},
+ 'cgi.'.$identifier.'.numberoffiles' => $#print_array,
+ 'cgi.'.$identifier.'.studentnames' => $student_names,
+ 'cgi.'.$identifier.'.backref' => $URLback,});
+ &Apache::lonnet::appenv({"cgi.$identifier.user" => $env{'user.name'},
+ "cgi.$identifier.domain" => $env{'user.domain'},
+ "cgi.$identifier.courseid" => $cnum,
+ "cgi.$identifier.coursedom" => $cdom,
+ "cgi.$identifier.resources" => $resources_printed});
- # logic for now is too complex to trace if this has been defined
- # yet.
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- &Apache::lonnet::appenv('cgi.'.$identifier.'.file' => $filename,
- 'cgi.'.$identifier.'.layout' => $laystyle,
- 'cgi.'.$identifier.'.numcol' => $numberofcolumns,
- 'cgi.'.$identifier.'.paper' => $papersize,
- 'cgi.'.$identifier.'.selection' => $selectionmade,
- 'cgi.'.$identifier.'.tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'},
- 'cgi.'.$identifier.'.tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'},
- 'cgi.'.$identifier.'.role' => $perm{'pav'},
- 'cgi.'.$identifier.'.numberoffiles' => $#print_array,
- 'cgi.'.$identifier.'.studentnames' => $student_names,
- 'cgi.'.$identifier.'.backref' => $URLback,);
- &Apache::lonnet::appenv("cgi.$identifier.user" => $env{'user.name'},
- "cgi.$identifier.domain" => $env{'user.domain'},
- "cgi.$identifier.courseid" => $cnum,
- "cgi.$identifier.coursedom" => $cdom,
- "cgi.$identifier.resources" => $resources_printed);
my $end_page = &Apache::loncommon::end_page();
my $continue_text = &mt('Continue');
# If there's been an unrecoverable SSI error, report it to the user
@@ -2191,15 +2242,15 @@ ENDPART
&mt('You may be able to reprint the individual resources for which this error occurred, as the issue may be temporary.').
' '.&mt('If the error persists, please contact the [_1] for assistance.',$helpurl).'
'.
&mt('We apologize for the inconvenience.').'
'.
- ''.&mt('Continue').''.$end_page);
+ ''.$continue_text.''.$end_page);
} else {
$r->print(<
-Continue
+$continue_text
$end_page
FINALEND
- } # endif ssi errors.
+ } # endif ssi errors.
}
@@ -2435,17 +2486,23 @@ sub get_randomly_ordered_warning {
my $postdata = $env{'form.postdata'} || $helper->{VARS}{'postdata'};
my $navmap = Apache::lonnavmaps::navmap->new();
- my $res = $navmap->getResourceByUrl($map);
- if ($res) {
- my $func =
- sub { return ($_[0]->is_map() && $_[0]->randomorder); };
- my @matches = $navmap->retrieveResources($res, $func,1,1,1);
- if (@matches) {
- $message = "Some of the items below are in folders set to be randomly ordered. However, when printing the contents of these folders, they will be printed in the original order for all students, not the randomized order.";
- }
- }
- if ($message) {
- return ''.$message.'';
+ if (defined($navmap)) {
+ my $res = $navmap->getResourceByUrl($map);
+ if ($res) {
+ my $func =
+ sub { return ($_[0]->is_map() && $_[0]->randomorder); };
+ my @matches = $navmap->retrieveResources($res, $func,1,1,1);
+ if (@matches) {
+ $message = "Some of the items below are in folders set to be randomly ordered. However, when printing the contents of these folders, they will be printed in the original order for all students, not the randomized order.";
+ }
+ }
+ if ($message) {
+ return ''.$message.'';
+ }
+ } else {
+ &Apache::lonnet::logthis('Retrieval of resources to check for folders set to be randomly ordered failed - could not create navmap object');
+ $message = "Retrieval of information about ordering of resources failed.";
+ return ''.$message.'';
}
return;
}
@@ -2619,9 +2676,9 @@ sub printHelper {
}
# Useful filter strings
- my $isProblem = '($res->is_problem()||$res->contains_problem) ';
+ my $isProblem = '($res->is_problem()||$res->contains_problem||$res->is_practice()) ';
$isProblem .= ' && !$res->randomout()' if !$userCanSeeHidden;
- my $isProblemOrMap = '$res->is_problem() || $res->contains_problem() || $res->is_sequence()';
+ my $isProblemOrMap = '$res->is_problem() || $res->contains_problem() || $res->is_sequence() || $res->is_practice()';
my $isNotMap = '!$res->is_sequence()';
$isNotMap .= ' && !$res->randomout()' if !$userCanSeeHidden;
my $isMap = '$res->is_map()';
@@ -2682,6 +2739,7 @@ HELPERFRAGMENT
push @{$printChoices}, [&mtn('Selected Problems from entire course'), 'all_problems', 'ALL_PROBLEMS'];
push @{$printChoices}, [&mtn('Selected Resources from entire course'), 'all_resources', 'ALL_RESOURCES'];
+ push @{$printChoices}, [&mtn('Selected Problems from entire course for selected people'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS'];
&Apache::lonxml::xmlparse($r, 'helper', <
+
+
+ STUDENTS1
+ return $isProblemOrMap;
+ return $isNotMap;
+ return $symbFilter;
+ $start_new_option
+
+
+
+ Select sorting order of printout
+
+ Sort by section then student
+ Sort by students across sections.
+
+
+
+
+
ALL_PROBLEMS
if ($helper->{VARS}->{'assignment'}) {
@@ -2811,10 +2889,9 @@ CHOOSE_STUDENTS
}
-
- open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
+ my @lines = &Apache::grades::get_scantronformat_file();
my $codechoice='';
- foreach my $line () {
+ foreach my $line (@lines) {
my ($name,$description,$code_type,$code_length)=
(split(/:/,$line))[0,1,2,4];
if ($code_length > 0 &&
@@ -3079,10 +3156,18 @@ CHOOSE_FROM_ANY_SEQUENCE
if (($perm{'pav'} and &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) or
($helper->{VARS}->{'construction'} eq '1')) {
- addMessage("