version 1.568.2.7, 2010/05/24 22:10:42
|
version 1.568.2.10, 2010/11/13 01:57:14
|
Line 1525 sub print_page_in_course {
|
Line 1525 sub print_page_in_course {
|
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); |
} else { |
} else { |
$result.=$currentURL; |
my $esc_currentURL= $currentURL; |
|
$esc_currentURL =~ s/_/\\_/g; |
|
$result.=$esc_currentURL; |
} |
} |
$result .= '\\\\'; |
$result .= '\\\\'; |
|
|
Line 1555 sub print_page_in_course {
|
Line 1557 sub print_page_in_course {
|
} |
} |
# these resources go through the XML transformer: |
# these resources go through the XML transformer: |
|
|
elsif ($resource_src =~ /\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { |
elsif ($resource_src =~ /\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { |
my $urlp = &Apache::lonnet::clutter($resource_src); |
my $urlp = &Apache::lonnet::clutter($resource_src); |
my %form; |
my %form; |
my %moreenv; |
my %moreenv; |
Line 1670 sub print_page_in_course {
|
Line 1672 sub print_page_in_course {
|
# List of recently generated print files |
# List of recently generated print files |
# |
# |
sub recently_generated { |
sub recently_generated { |
my $r=shift; |
my ($prtspool) = @_; |
my $prtspool=$r->dir_config('lonPrtDir'); |
my $output; |
|
|
my $zip_result; |
my $zip_result; |
my $pdf_result; |
my $pdf_result; |
opendir(DIR,$prtspool); |
opendir(DIR,$prtspool); |
Line 1704 sub recently_generated {
|
Line 1707 sub recently_generated {
|
if ($ext eq 'zip') { $zip_result .= $result; } |
if ($ext eq 'zip') { $zip_result .= $result; } |
} |
} |
if ($zip_result || $pdf_result) { |
if ($zip_result || $pdf_result) { |
$r->print('<hr />'); |
$output = '<hr />'; |
} |
} |
if ($zip_result) { |
if ($zip_result) { |
$r->print('<h3>'.&mt('Recently generated printout zip files')."</h3>\n" |
$output .='<h3>'.&mt('Recently generated printout zip files')."</h3>\n" |
.&Apache::loncommon::start_data_table() |
.&Apache::loncommon::start_data_table() |
.&Apache::loncommon::start_data_table_header_row() |
.&Apache::loncommon::start_data_table_header_row() |
.'<th>'.&mt('Download').'</th>' |
.'<th>'.&mt('Download').'</th>' |
Line 1715 sub recently_generated {
|
Line 1718 sub recently_generated {
|
.'<th>'.&mt('File Size (Bytes)').'</th>' |
.'<th>'.&mt('File Size (Bytes)').'</th>' |
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
.$zip_result |
.$zip_result |
.&Apache::loncommon::end_data_table() |
.&Apache::loncommon::end_data_table(); |
); |
|
} |
} |
if ($pdf_result) { |
if ($pdf_result) { |
$r->print('<h3>'.&mt('Recently generated printouts')."</h3>\n" |
$output .='<h3>'.&mt('Recently generated printouts')."</h3>\n" |
.&Apache::loncommon::start_data_table() |
.&Apache::loncommon::start_data_table() |
.&Apache::loncommon::start_data_table_header_row() |
.&Apache::loncommon::start_data_table_header_row() |
.'<th>'.&mt('Download').'</th>' |
.'<th>'.&mt('Download').'</th>' |
Line 1727 sub recently_generated {
|
Line 1729 sub recently_generated {
|
.'<th>'.&mt('File Size (Bytes)').'</th>' |
.'<th>'.&mt('File Size (Bytes)').'</th>' |
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
.$pdf_result |
.$pdf_result |
.&Apache::loncommon::end_data_table() |
.&Apache::loncommon::end_data_table(); |
); |
|
} |
} |
|
return $output; |
} |
} |
|
|
# |
# |
Line 2211 ENDPART
|
Line 2213 ENDPART
|
&Apache::lonxml::remember_problem_counter(); |
&Apache::lonxml::remember_problem_counter(); |
if ($flag_latex_header_remove eq 'NO') { |
if ($flag_latex_header_remove eq 'NO') { |
$texversion.=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); # RF |
$texversion.=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); # RF |
$flag_latex_header_remove = 'YES'; |
unless (($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only') || |
|
(($i==0) && |
|
(($urlp=~/\.page$/) || |
|
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_in_page') || |
|
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_resources_in_page')))) { |
|
|
|
$flag_latex_header_remove = 'YES'; |
|
} |
} |
} |
$texversion.=&ssi_with_retries($urlp, $ssi_retry_count, %form); |
$texversion.=&ssi_with_retries($urlp, $ssi_retry_count, %form); |
if ($urlp=~/\.page$/) { |
if ($urlp=~/\.page$/) { |
Line 2232 ENDPART
|
Line 2241 ENDPART
|
&Apache::lonxml::restore_problem_counter(); |
&Apache::lonxml::restore_problem_counter(); |
my $answer=&ssi_with_retries($urlp, $ssi_retry_count, %answerform); |
my $answer=&ssi_with_retries($urlp, $ssi_retry_count, %answerform); |
|
|
|
if ($urlp =~ /\.page$/) { |
|
$answer =~ s/\\end{document}(\d*)$//; |
|
} |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/; |
if ($urlp =~ /\.page$/) { |
|
my @probs = split(/\\keephidden{ENDOFPROBLEM}/,$texversion); |
|
my $lastprob = pop(@probs); |
|
$texversion = join('\keephidden{ENDOFPROBLEM}',@probs). |
|
$answer.'\keephidden{ENDOFPROBLEM}'.$lastprob; |
|
} else { |
|
$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/; |
|
} |
} else { |
} else { |
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library)$/) { |
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/) { |
$texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$texversion =~ s/\\begin{document}//; |
# $texversion =~ s/\\begin{document}//; |
my $title = &Apache::lonnet::gettitle($master_seq[$i]); |
my $title = &Apache::lonnet::gettitle($master_seq[$i]); |
$title = &Apache::lonxml::latex_special_symbols($title); |
$title = &Apache::lonxml::latex_special_symbols($title); |
my $body ='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm '; |
my $body ='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm '; |
Line 2805 sub print_resources {
|
Line 2824 sub print_resources {
|
$i++; |
$i++; |
|
|
if ( !($type eq 'problems' && |
if ( !($type eq 'problems' && |
($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library)$/)) ) { |
($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) ) { |
my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline); |
my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline); |
if (&Apache::lonnet::allowed('bre',$res_url)) { |
if (&Apache::lonnet::allowed('bre',$res_url)) { |
if ($res_url!~m|^ext/| |
if ($res_url!~m|^ext/| |
Line 2814 sub print_resources {
|
Line 2833 sub print_resources {
|
&Apache::lonxml::remember_problem_counter(); |
&Apache::lonxml::remember_problem_counter(); |
|
|
my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
|
if ($res_url =~ /\.page$/) { |
|
if ($remove_latex_header eq 'NO') { |
|
if (!($rendered =~ /\\begin\{document\}/)) { |
|
$rendered = &print_latex_header().$rendered; |
|
} |
|
} |
|
if ($remove_latex_header eq 'YES') { |
|
$rendered = &latex_header_footer_remove($rendered); |
|
} else { |
|
$rendered =~ s/\\end{document}\d*//; |
|
} |
|
} |
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || |
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || |
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) { |
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) { |
# Use a copy of the hash so we don't pervert it on future loop passes. |
# Use a copy of the hash so we don't pervert it on future loop passes. |
Line 2831 sub print_resources {
|
Line 2862 sub print_resources {
|
|
|
|
|
my $header =&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
my $header =&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$header =~ s/\\begin{document}//; #<<<<< |
unless ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only') { |
|
$header =~ s/\\begin{document}//; #<<<<< |
|
} |
my $title = &Apache::lonnet::gettitle($curresline); |
my $title = &Apache::lonnet::gettitle($curresline); |
$title = &Apache::lonxml::latex_special_symbols($title); |
$title = &Apache::lonxml::latex_special_symbols($title); |
my $body ='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm '; |
my $body ='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm '; |
Line 2892 sub print_resources {
|
Line 2925 sub print_resources {
|
if (&Apache::loncommon::connection_aborted($r)) { last; } |
if (&Apache::loncommon::connection_aborted($r)) { last; } |
} |
} |
|
|
|
if ($syllabus_first) { |
|
$current_output =~ s/\\\\ Last updated:/Last updated:/ |
|
} |
my $courseidinfo = &get_course(); |
my $courseidinfo = &get_course(); |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} |
if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} |
Line 2903 sub print_resources {
|
Line 2938 sub print_resources {
|
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.'}'; |
$header_line = $header_start.'{'.$header_line.'}'; |
if ($current_output=~/\\documentclass/ && (!$syllabus_first)) { |
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$header_line$namepostfix}\\vskip 5 mm /; |
} elsif ($syllabus_first) { |
|
|
|
$current_output =~ s/\\\\ Last updated:/Last updated:/ |
|
} else { |
} else { |
my $blankpages = |
my $blankpages = |
'\clearpage\strut\clearpage'x$helper->{'VARS'}->{'EMPTY_PAGES'}; |
'\clearpage\strut\clearpage'x$helper->{'VARS'}->{'EMPTY_PAGES'}; |
Line 3943 PROBTYPE
|
Line 3975 PROBTYPE
|
return $helper; |
return $helper; |
} |
} |
|
|
$r->print($helper->display()); |
my $footer; |
if ($helper->{STATE} eq 'START') { |
if ($helper->{STATE} eq 'START') { |
&recently_generated($r); |
my $prtspool=$r->dir_config('lonPrtDir'); |
|
$footer = &recently_generated($prtspool); |
} |
} |
|
$r->print($helper->display($footer)); |
&Apache::lonhelper::unregisterHelperTags(); |
&Apache::lonhelper::unregisterHelperTags(); |
|
|
return OK; |
return OK; |