version 1.400, 2005/12/06 03:58:14
|
version 1.406, 2005/12/15 18:36:23
|
Line 844 sub print_latex_header {
|
Line 844 sub print_latex_header {
|
|
|
sub path_to_problem { |
sub path_to_problem { |
my ($urlp,$colwidth)=@_; |
my ($urlp,$colwidth)=@_; |
|
$urlp=&Apache::lonnet::clutter($urlp); |
|
|
my $newurlp = ''; |
my $newurlp = ''; |
$colwidth=~s/\s*mm\s*$//; |
$colwidth=~s/\s*mm\s*$//; |
#characters average about 2 mm in width |
#characters average about 2 mm in width |
if (length($urlp)*2 > $colwidth) { |
if (length($urlp)*2 > $colwidth) { |
my @elements = split '/',$urlp; |
my @elements = split('/',$urlp); |
my $curlength=0; |
my $curlength=0; |
foreach my $element (@elements) { |
foreach my $element (@elements) { |
|
if ($element eq '') { next; } |
if ($curlength+(length($element)*2) > $colwidth) { |
if ($curlength+(length($element)*2) > $colwidth) { |
$newurlp .= '|\vskip -1 mm \noindent \verb|'; |
$newurlp .= '|\vskip -1 mm \verb|'; |
$curlength=0; |
$curlength=length($element)*2; |
} else { |
} else { |
$curlength+=length($element)*2; |
$curlength+=length($element)*2; |
} |
} |
Line 1005 $html
|
Line 1008 $html
|
<title>LON-CAPA output for printing</title> |
<title>LON-CAPA output for printing</title> |
</head> |
</head> |
$bodytag |
$bodytag |
|
<p> |
Please stand by while processing your print request, this may take some time ... |
Please stand by while processing your print request, this may take some time ... |
|
</p> |
ENDPART |
ENDPART |
|
|
|
|
Line 1098 ENDPART
|
Line 1103 ENDPART
|
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonxml::init_counter(); |
&Apache::lonxml::init_counter(); |
|
&Apache::lonxml::store_counter(); |
$resources_printed .= $currentURL.':'; |
$resources_printed .= $currentURL.':'; |
$texversion.=&Apache::lonnet::ssi($currentURL,%form); |
$texversion.=&Apache::lonnet::ssi($currentURL,%form); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
Line 1109 ENDPART
|
Line 1115 ENDPART
|
$form{'grade_target'}='answer'; |
$form{'grade_target'}='answer'; |
$form{'answer_output_mode'}='tex'; |
$form{'answer_output_mode'}='tex'; |
$form{'rndseed'}=$rndseed; |
$form{'rndseed'}=$rndseed; |
|
if ($helper->{'VARS'}->{'probstatus'} eq 'exam') { |
|
$form{'problemtype'}='exam'; |
|
} |
$resources_printed .= $currentURL.':'; |
$resources_printed .= $currentURL.':'; |
my $answer=&Apache::lonnet::ssi($currentURL,%form); |
my $answer=&Apache::lonnet::ssi($currentURL,%form); |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
Line 1177 ENDPART
|
Line 1186 ENDPART
|
} else { |
} else { |
$texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$texversion.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm '; |
$texversion.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm '; |
$texversion.=&path_to_problem ($currentURL,$LaTeXwidth); |
$texversion.=&path_to_problem($urlp,$LaTeXwidth); |
$texversion.='\vskip 1 mm '.$answer.'\end{document}'; |
$texversion.='\vskip 1 mm '.$answer.'\end{document}'; |
} |
} |
} |
} |
Line 1237 ENDPART
|
Line 1246 ENDPART
|
my $prevassignment=''; |
my $prevassignment=''; |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonxml::init_counter(); |
&Apache::lonxml::init_counter(); |
|
&Apache::lonxml::store_counter(); |
for (my $i=0;$i<=$#master_seq;$i++) { |
for (my $i=0;$i<=$#master_seq;$i++) { |
|
|
# Note due to document structure, not allowed to put \newpage |
# Note due to document structure, not allowed to put \newpage |
Line 1257 ENDPART
|
Line 1267 ENDPART
|
my $texversion=''; |
my $texversion=''; |
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { |
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { |
$resources_printed .= $urlp.':'; |
$resources_printed .= $urlp.':'; |
|
my $pre_counter=$env{'form.counter'}; |
$texversion.=&Apache::lonnet::ssi($urlp,%form); |
$texversion.=&Apache::lonnet::ssi($urlp,%form); |
if ($urlp=~/\.page$/) { |
if ($urlp=~/\.page$/) { |
($texversion,my $number_of_columns_page) = &page_cleanup($texversion); |
($texversion,my $number_of_columns_page) = &page_cleanup($texversion); |
Line 1264 ENDPART
|
Line 1275 ENDPART
|
$texversion =~ s/\\end{document}\d*/\\end{document}/; |
$texversion =~ s/\\end{document}\d*/\\end{document}/; |
$flag_page_in_sequence = 'YES'; |
$flag_page_in_sequence = 'YES'; |
} |
} |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my ($envfile) = ($env{'user.environment'} =~m|/([^/]+)\.id$| ); |
my $envfile=$env{'user.environment'}; |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
$envfile=~/\/([^\/]+)\.id$/; |
$envfile); |
$envfile=$1; |
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile); |
|
my $current_counter=$env{'form.counter'}; |
my $current_counter=$env{'form.counter'}; |
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')) { |
Line 1277 ENDPART
|
Line 1286 ENDPART
|
$answerform{'grade_target'}='answer'; |
$answerform{'grade_target'}='answer'; |
$answerform{'answer_output_mode'}='tex'; |
$answerform{'answer_output_mode'}='tex'; |
$resources_printed .= $urlp.':'; |
$resources_printed .= $urlp.':'; |
|
&Apache::lonnet::appenv(('form.counter' => $pre_counter)); |
my $answer=&Apache::lonnet::ssi($urlp,%answerform); |
my $answer=&Apache::lonnet::ssi($urlp,%answerform); |
&Apache::lonnet::appenv(('form.counter' => $current_counter)); |
&Apache::lonnet::appenv(('form.counter' => $current_counter)); |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
Line 1706 sub print_resources {
|
Line 1716 sub print_resources {
|
#current student, and produces output |
#current student, and produces output |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonxml::init_counter(); |
&Apache::lonxml::init_counter(); |
|
&Apache::lonxml::store_counter(); |
my %page_breaks = &get_page_breaks($helper); |
my %page_breaks = &get_page_breaks($helper); |
|
|
foreach my $curresline (@{$master_seq}) { |
foreach my $curresline (@{$master_seq}) { |
Line 1722 sub print_resources {
|
Line 1732 sub print_resources {
|
if (&Apache::lonnet::allowed('bre',$res_url)) { |
if (&Apache::lonnet::allowed('bre',$res_url)) { |
if ($res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { |
if ($res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { |
$printed .= $curresline.':'; |
$printed .= $curresline.':'; |
|
my $pre_counter=$env{'form.counter'}; |
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my ($envfile) = |
my $envfile=$env{'user.environment'}; |
( $env{'user.environment'} =~ m|/([^/]+)\.id$| ); |
$envfile=~/\/([^\/]+)\.id$/; |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
$envfile=$1; |
$envfile); |
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile); |
|
my $current_counter=$env{'form.counter'}; |
my $current_counter=$env{'form.counter'}; |
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')) { |
Line 1735 sub print_resources {
|
Line 1745 sub print_resources {
|
my %answerenv = %{$moreenv}; |
my %answerenv = %{$moreenv}; |
$answerenv{'answer_output_mode'}='tex'; |
$answerenv{'answer_output_mode'}='tex'; |
$answerenv{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; |
$answerenv{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; |
|
&Apache::lonnet::appenv(('form.counter' => $pre_counter)); |
my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$env{'request.course.id'},%answerenv); |
my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$env{'request.course.id'},%answerenv); |
&Apache::lonnet::appenv(('form.counter' => $current_counter)); |
&Apache::lonnet::appenv(('form.counter' => $current_counter)); |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { |
Line 1742 sub print_resources {
|
Line 1753 sub print_resources {
|
} else { |
} else { |
$rendered=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$rendered=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$rendered.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($curresline).'}\vskip 0 mm '; |
$rendered.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($curresline).'}\vskip 0 mm '; |
$rendered.=&path_to_problem ($curresline,$LaTeXwidth); |
$rendered.=&path_to_problem($res_url,$LaTeXwidth); |
$rendered.='\vskip 1 mm '.$ansrendered; |
$rendered.='\vskip 1 mm '.$ansrendered; |
} |
} |
} |
} |
Line 1755 sub print_resources {
|
Line 1766 sub print_resources {
|
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { |
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { |
$printed .= $curresline.':'; |
$printed .= $curresline.':'; |
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my ($envfile) = |
my $envfile=$env{'user.environment'}; |
( $env{'user.environment'} = ~m|/([^/]+)\.id$| ); |
$envfile=~/\/([^\/]+)\.id$/; |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
$envfile=$1; |
$envfile); |
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile); |
|
my $current_counter=$env{'form.counter'}; |
my $current_counter=$env{'form.counter'}; |
if ($remove_latex_header eq 'YES') { |
if ($remove_latex_header eq 'YES') { |
$rendered = &latex_header_footer_remove($rendered); |
$rendered = &latex_header_footer_remove($rendered); |
Line 2162 CHOOSE_STUDENTS
|
Line 2172 CHOOSE_STUDENTS
|
my %all_codes = &Apache::lonnet::get('CODEs', |
my %all_codes = &Apache::lonnet::get('CODEs', |
\@names, $cdom,$cnum); |
\@names, $cdom,$cnum); |
my %code_values; |
my %code_values; |
my @all_code_array; |
my %codes_to_print; |
foreach my $key (keys %all_codes) { |
foreach my $key (keys(%all_codes)) { |
%code_values = &Apache::grades::get_codes($key, $cdom, $cnum); |
%code_values = &Apache::grades::get_codes($key, $cdom, $cnum); |
foreach my $key (keys %code_values) { |
foreach my $key (keys(%code_values)) { |
push (@all_code_array, "$key"); |
$codes_to_print{$key} = 1; |
} |
} |
} |
} |
|
|
my $code_selection = "<choice></choice>\n"; |
my $code_selection = "<choice></choice>\n"; |
foreach my $code (sort {uc($a) cmp uc($b)} @all_code_array) { |
foreach my $code (sort {uc($a) cmp uc($b)} (keys(%codes_to_print))) { |
my $choice = $code; |
my $choice = $code; |
if ($code =~ /^[A-Z]+$/) { # Alpha code |
if ($code =~ /^[A-Z]+$/) { # Alpha code |
$choice = &letters_to_num($code); |
$choice = &letters_to_num($code); |
Line 2387 CHOOSE_FROM_SUBDIR
|
Line 2397 CHOOSE_FROM_SUBDIR
|
<valuefunc>return $urlValue;</valuefunc> |
<valuefunc>return $urlValue;</valuefunc> |
<choicefunc>return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },0,0); |
<choicefunc>return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },0,0); |
</choicefunc> |
</choicefunc> |
<option text='Newpage' variable='FINISHPAGE' /> |
|
</resource> |
</resource> |
</state> |
</state> |
<state name="CHOOSE_FROM_ANY_SEQUENCE" title="Select Resources To Print"> |
<state name="CHOOSE_FROM_ANY_SEQUENCE" title="Select Resources To Print"> |