version 1.429, 2006/03/14 23:24:46
|
version 1.456, 2006/07/07 21:55:05
|
Line 42 use Apache::lonratedt;
|
Line 42 use Apache::lonratedt;
|
use POSIX qw(strftime); |
use POSIX qw(strftime); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Carp; |
use Carp; |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
my %perm; |
my %perm; |
|
my %parmhash; |
|
|
|
|
|
# Format a header according to a format. |
|
# |
|
|
|
# Substitutions: |
|
# %a - Assignment name. |
|
# %c - Course name. |
|
# %n - Student name. |
|
# |
|
sub format_page_header { |
|
my ($format, $assignment, $course, $student) = @_; |
|
|
|
# Default format? |
|
|
|
if ($format eq '') { |
|
$format = "\\textbf{$student} $course \\hfill \\thepage \\\\ \\textit{$assignment}"; |
|
|
|
} else { |
|
$format =~ s/%a/$assignment/g; |
|
$format =~ s/%c/$course/g; |
|
$format =~ s/%n/$student/g; |
|
} |
|
|
|
|
|
return $format; |
|
|
|
} |
|
|
# |
# |
# Convert a numeric code to letters |
# Convert a numeric code to letters |
Line 700 sub get_name {
|
Line 731 sub get_name {
|
if (!defined($udom)) { $udom=$env{'user.domain'}; } |
if (!defined($udom)) { $udom=$env{'user.domain'}; } |
my $plainname=&Apache::loncommon::plainname($uname,$udom); |
my $plainname=&Apache::loncommon::plainname($uname,$udom); |
if ($plainname=~/^\s*$/) { $plainname=$uname.'@'.$udom; } |
if ($plainname=~/^\s*$/) { $plainname=$uname.'@'.$udom; } |
$plainname=&Apache::lonxml::latex_special_symbols($plainname,'header'); |
$plainname=&Apache::lonxml::latex_special_symbols($plainname,'header'); |
return $plainname; |
return $plainname; |
} |
} |
|
|
sub get_course { |
sub get_course { |
my $courseidinfo; |
my $courseidinfo; |
if (defined($env{'request.course.id'})) { |
if (defined($env{'request.course.id'})) { |
$courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header'); |
$courseidinfo = &Apache::lonxml::latex_special_symbols(&unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header'); |
} |
} |
return $courseidinfo; |
return $courseidinfo; |
} |
} |
Line 715 sub get_course {
|
Line 746 sub get_course {
|
sub page_format_transformation { |
sub page_format_transformation { |
my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment,$tableofcontents,$indexlist,$selectionmade) = @_; |
my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment,$tableofcontents,$indexlist,$selectionmade) = @_; |
my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin); |
my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin); |
|
|
if ($selectionmade eq '4') { |
if ($selectionmade eq '4') { |
$assignment='Problems from the Whole Course'; |
$assignment='Problems from the Whole Course'; |
} else { |
} else { |
$assignment=&Apache::lonxml::latex_special_symbols($assignment,'header'); |
$assignment=&Apache::lonxml::latex_special_symbols($assignment,'header'); |
} |
} |
($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin) = &page_format($papersize,$layout,$numberofcolumns,$topmargin); |
($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin) = &page_format($papersize,$layout,$numberofcolumns,$topmargin); |
|
|
|
|
my $name = &get_name(); |
my $name = &get_name(); |
my $courseidinfo = &get_course(); |
my $courseidinfo = &get_course(); |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
|
my $header_text = $parmhash{'print_header_format'}; |
|
$header_text = &format_page_header($header_text, $assignment, |
|
$courseidinfo, $name); |
my $topmargintoinsert = ''; |
my $topmargintoinsert = ''; |
if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';} |
if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';} |
my $fancypagestatement=''; |
my $fancypagestatement=''; |
if ($numberofcolumns eq '2') { |
if ($numberofcolumns eq '2') { |
$fancypagestatement="\\fancyhead{}\\fancyhead[LO]{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}"; |
$fancypagestatement="\\fancyhead{}\\fancyhead[LO]{$header_text}"; |
} else { |
} else { |
$fancypagestatement="\\rhead{}\\chead{}\\lhead{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}"; |
$fancypagestatement="\\rhead{}\\chead{}\\lhead{$header_text}"; |
} |
} |
if ($layout eq 'album') { |
if ($layout eq 'album') { |
$text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\n\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\n\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\addtolength{\\headheight}{\\baselineskip}\n\\pagestyle{fancy}$fancypagestatement\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}\n /; |
$text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\n\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\n\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\addtolength{\\headheight}{\\baselineskip}\n\\pagestyle{fancy}$fancypagestatement\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}\n /; |
Line 1022 sub output_data {
|
Line 1059 sub output_data {
|
my ($r,$helper,$rparmhash) = @_; |
my ($r,$helper,$rparmhash) = @_; |
my %parmhash = %$rparmhash; |
my %parmhash = %$rparmhash; |
my $resources_printed = ''; |
my $resources_printed = ''; |
my $html=&Apache::lonxml::xmlbegin(); |
my $js = <<ENDPART; |
my $bodytag=&Apache::loncommon::bodytag('Preparing Printout'); |
<script type="text/javascript"> |
$r->print(<<ENDPART); |
|
$html |
|
<head> |
|
<script type="text/javascript" language="Javascript"> |
|
var editbrowser; |
var editbrowser; |
function openbrowser(formname,elementname,only,omit) { |
function openbrowser(formname,elementname,only,omit) { |
var url = '/res/?'; |
var url = '/res/?'; |
Line 1051 $html
|
Line 1084 $html
|
editbrowser.focus(); |
editbrowser.focus(); |
} |
} |
</script> |
</script> |
<title>LON-CAPA output for printing</title> |
|
</head> |
|
$bodytag |
|
<p> |
|
Please stand by while processing your print request, this may take some time ... |
|
</p> |
|
ENDPART |
ENDPART |
|
|
|
my $start_page = &Apache::loncommon::start_page('Preparing Printout',$js); |
|
my $msg = &mt('Please stand by while processing your print request, this may take some time ...'); |
|
|
|
$r->print($start_page."\n<p>\n$msg\n</p>\n"); |
|
|
# fetch the pagebreaks and store them in the course environment |
# fetch the pagebreaks and store them in the course environment |
# The page breaks will be pulled into the hash %page_breaks which is |
# The page breaks will be pulled into the hash %page_breaks which is |
Line 1329 ENDPART
|
Line 1359 ENDPART
|
$resources_printed .= $urlp.':'; |
$resources_printed .= $urlp.':'; |
|
|
&Apache::lonxml::remember_problem_counter(); |
&Apache::lonxml::remember_problem_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 1377 ENDPART
|
Line 1406 ENDPART
|
my $courseidinfo = &get_course(); |
my $courseidinfo = &get_course(); |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
$prevassignment=$assignment; |
$prevassignment=$assignment; |
|
my $header_text = $parmhash{'print_header_format'}; |
|
$header_text = &format_page_header($header_text, |
|
$assignment, |
|
$courseidinfo, |
|
$name); |
if ($numberofcolumns eq '1') { |
if ($numberofcolumns eq '1') { |
$result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm '; |
$result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{'.$header_text.'}} \vskip 5 mm '; |
} else { |
} else { |
$result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm '; |
$result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{'.$header_text.'}} \vskip 5 mm '; |
} |
} |
} |
} |
$result .= $texversion; |
$result .= $texversion; |
Line 1471 ENDPART
|
Line 1505 ENDPART
|
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75'); |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75'); |
my $student_counter=-1; |
my $student_counter=-1; |
my $i = 0; |
my $i = 0; |
my ($junku, $junkd, $last_section) = split /:/,$students[0]; |
my $last_section = (split(/:/,$students[0]))[2]; |
foreach my $person (@students) { |
foreach my $person (@students) { |
|
|
my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; |
my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; |
Line 1481 ENDPART
|
Line 1515 ENDPART
|
} |
} |
$student_counter++; |
$student_counter++; |
if ($split_on_sections) { |
if ($split_on_sections) { |
my $this_section; |
my $this_section = (split(/:/,$person))[2]; |
($junku, $junkd, $this_section) = split /:/,$person; |
|
if ($this_section ne $last_section) { |
if ($this_section ne $last_section) { |
$i++; |
$i++; |
$last_section = $this_section; |
$last_section = $this_section; |
Line 1568 ENDPART
|
Line 1601 ENDPART
|
} |
} |
my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'}; |
my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'}; |
my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'}); |
my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'}); |
|
&adjust_number_to_print($helper); |
my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'}; |
my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'}; |
if ($number_per_page eq '0' || $number_per_page eq 'all') { |
if ($number_per_page eq '0' || $number_per_page eq 'all') { |
$number_per_page=$num_todo; |
$number_per_page=$num_todo; |
Line 1679 ENDPART
|
Line 1713 ENDPART
|
$selectionmade, |
$selectionmade, |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
} |
} |
#changes page's parameters for the one column output |
|
if ($numberofcolumns == 1) { |
if ($numberofcolumns == 1) { |
$result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /; |
$result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /; |
$result =~ s/\\textheight\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /; |
$result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /; |
$result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; |
$result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; |
$result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; |
$result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; |
} |
} |
Line 1741 ENDPART
|
Line 1774 ENDPART
|
my $URLback=''; #link to original document |
my $URLback=''; #link to original document |
if ($helper->{'VARS'}->{'construction'} ne '1') { |
if ($helper->{'VARS'}->{'construction'} ne '1') { |
#prints published resource |
#prints published resource |
$URLback=&Apache::lonnet::escape('/adm/flip?postdata=return:'); |
$URLback=&escape('/adm/flip?postdata=return:'); |
} else { |
} else { |
#prints resource from the construction space |
#prints resource from the construction space |
$URLback='/'.$helper->{'VARS'}->{'filename'}; |
$URLback='/'.$helper->{'VARS'}->{'filename'}; |
Line 1771 ENDPART
|
Line 1804 ENDPART
|
"cgi.$identifier.coursedom" => $cdom, |
"cgi.$identifier.coursedom" => $cdom, |
"cgi.$identifier.resources" => $resources_printed); |
"cgi.$identifier.resources" => $resources_printed); |
|
|
$r->print(<<FINALEND); |
my $end_page = &Apache::loncommon::end_page(); |
|
$r->print(<<FINALEND); |
<br /> |
<br /> |
<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" /> |
<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" /> |
<a href="/cgi-bin/printout.pl?$identifier">Continue</a> |
<a href="/cgi-bin/printout.pl?$identifier">Continue</a> |
</body> |
$end_page |
</html> |
|
FINALEND |
FINALEND |
} |
} |
|
|
Line 1810 sub print_resources {
|
Line 1843 sub print_resources {
|
$namepostfix="\\\\Name: "; |
$namepostfix="\\\\Name: "; |
$fullname = "CODE - ".$moreenv->{'CODE'}; |
$fullname = "CODE - ".$moreenv->{'CODE'}; |
} |
} |
|
# Fullname may have special latex characters that need \ prefixing: |
|
# |
|
|
my $i = 0; |
my $i = 0; |
#goes through all resources, checks if they are available for |
#goes through all resources, checks if they are available for |
#current student, and produces output |
#current student, and produces output |
Line 1818 sub print_resources {
|
Line 1854 sub print_resources {
|
my %page_breaks = &get_page_breaks($helper); |
my %page_breaks = &get_page_breaks($helper); |
my @format_array = split(/\|/,$helper->{'VARS'}->{'FORMAT'}); |
my @format_array = split(/\|/,$helper->{'VARS'}->{'FORMAT'}); |
my $columns_in_format = $format_array[1]; |
my $columns_in_format = $format_array[1]; |
|
# |
|
# end each student with a |
|
# Special that allows the post processor to even out the page |
|
# counts later. Nasty problem this... it would be really |
|
# nice to put the special in as a postscript comment |
|
# e.g. \special{ps:\ENDOFSTUDENTSTAMP} unfortunately, |
|
# The special gets passed the \ and dvips puts it in the output file |
|
# so we will just rely on prntout.pl to strip ENDOFSTUDENTSTAMP from the |
|
# postscript. Each ENDOFSTUDENTSTAMP will go on a line by itself. |
|
# |
|
|
foreach my $curresline (@{$master_seq}) { |
foreach my $curresline (@{$master_seq}) { |
if (defined $page_breaks{$curresline}) { |
if (defined $page_breaks{$curresline}) { |
Line 1897 sub print_resources {
|
Line 1943 sub print_resources {
|
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} |
if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} |
my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header'); |
my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header'); |
|
my $HeaderLine = $parmhash{'print_header_format'}; |
|
$HeaderLine = format_page_header($HeaderLine, $currentassignment, $courseidinfo, $fullname); |
|
&Apache::lonnet::logthis("Hdr format: $HeaderLine"); |
if ($current_output=~/\\documentclass/) { |
if ($current_output=~/\\documentclass/) { |
if ($columns_in_format == 1) { |
if ($columns_in_format == 1) { |
$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /; |
$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{$HeaderLine$namepostfix}}\\vskip 5 mm /; |
} else { |
} else { |
$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fancyhead[LO]{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /; |
$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fancyhead[LO]{$HeaderLine$namepostfix}}\\vskip 5 mm /; |
|
|
} |
} |
} else { |
} else { |
my $blankpages = ''; |
my $blankpages = ''; |
for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';} |
for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';} |
if ($columns_in_format == 1) { |
if ($columns_in_format == 1) { |
$current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output; |
$current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\lhead{'.$HeaderLine.'}'.$namepostfix.'} \vskip 5 mm '.$current_output; |
} else { |
} else { |
$current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output; |
$current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{'.$HeaderLine.'}'.$namepostfix.'} \vskip 5 mm '.$current_output; |
} |
} |
} |
} |
|
# |
|
# Close the student bracketing. |
|
# |
|
$current_output .= "\n\\special{ps:ENDOFSTUDENTSTAMP}\n"; |
return ($current_output,$fullname, $printed); |
return ($current_output,$fullname, $printed); |
|
|
} |
} |
Line 1931 sub handler {
|
Line 1984 sub handler {
|
} |
} |
|
|
|
|
my %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'}); |
%parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'}); |
|
|
|
|
|
|
Line 2242 ALL_PROBLEMS
|
Line 2295 ALL_PROBLEMS
|
</resource> |
</resource> |
</state> |
</state> |
<state name="PRINT_FORMATTING" title="How should results be printed?"> |
<state name="PRINT_FORMATTING" title="How should results be printed?"> |
<nextstate>NUMBER_PER_PDF</nextstate> |
|
<message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message> |
<message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message> |
<choices variable="EMPTY_PAGES"> |
<choices variable="EMPTY_PAGES"> |
<choice computer='0'>Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)</choice> |
<choice computer='0'>Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)</choice> |
Line 2250 ALL_PROBLEMS
|
Line 2302 ALL_PROBLEMS
|
<choice computer='2'>Add two empty pages/column after each student\'s assignment</choice> |
<choice computer='2'>Add two empty pages/column after each student\'s assignment</choice> |
<choice computer='3'>Add three empty pages/column after each student\'s assignment</choice> |
<choice computer='3'>Add three empty pages/column after each student\'s assignment</choice> |
</choices> |
</choices> |
</state> |
|
<state name="NUMBER_PER_PDF" title="Number printed at once"> |
|
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<message><hr width='33%' /><b>How do you want assignments split into PDF files? </b></message> |
<message><hr width='33%' /><b>How do you want assignments split into PDF files? </b></message> |
<choices variable="SPLIT_PDFS"> |
<choices variable="SPLIT_PDFS"> |
<choice computer="all">All assignments in a single PDF file</choice> |
<choice computer="all">All assignments in a single PDF file</choice> |
<choice computer="sections">Each PDF contains exactly one section</choice> |
<choice computer="sections">Each PDF contains exactly one section</choice> |
<choice computer="oneper">Each PDF contains exactly one assignment</choice> |
<choice computer="oneper">Each PDF contains exactly one assignment</choice> |
<choice computer="usenumber">Specify Number:</choice> |
<choice computer="usenumber" relatedvalue="NUMBER_TO_PRINT"> |
|
Specify the number of assignments per PDF:</choice> |
</choices> |
</choices> |
<string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string> |
|
</state> |
</state> |
RESOURCE_SELECTOR |
RESOURCE_SELECTOR |
|
|
Line 2271 RESOURCE_SELECTOR
|
Line 2321 RESOURCE_SELECTOR
|
<choice computer='0'>Sort by section then student</choice> |
<choice computer='0'>Sort by section then student</choice> |
<choice computer='1'>Sort by students across sections.</choice> |
<choice computer='1'>Sort by students across sections.</choice> |
</choices> |
</choices> |
|
<message><br /><hr /><br /> </message> |
<student multichoice='1' variable="STUDENTS" nextstate="SELECT_PROBLEMS" coursepersonnel="1"/> |
<student multichoice='1' variable="STUDENTS" nextstate="SELECT_PROBLEMS" coursepersonnel="1"/> |
</state> |
</state> |
$resource_selector |
$resource_selector |
Line 2296 CHOOSE_STUDENTS
|
Line 2347 CHOOSE_STUDENTS
|
} |
} |
} |
} |
|
|
my $code_selection = "<choice></choice>\n"; |
my $code_selection; |
foreach my $code (sort {uc($a) cmp uc($b)} (keys(%codes_to_print))) { |
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); |
} |
} |
$code_selection .= ' <choice computer="'.$choice.'">'.$code."</choice>\n"; |
push(@{$helper->{DATA}{ALL_CODE_CHOICES}},[$code,$choice]); |
} |
} |
|
if (%codes_to_print) { |
|
$code_selection .=' |
|
<message><b>Choose single code from list</b></message> |
|
<message></td><td></message> |
|
<dropdown variable="CODE_SELECTED_FROM_LIST" multichoice="0" allowempty="0"> |
|
<choice></choice> |
|
<exec> |
|
push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); |
|
</exec> |
|
</dropdown> |
|
<message></td></tr><tr><td colspan="2"><hr width=\'33%\' /></td></tr><tr><td></message> |
|
'.$/; |
|
|
|
} |
|
|
|
|
open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
my $codechoice=''; |
my $codechoice=''; |
foreach my $line (<FH>) { |
foreach my $line (<FH>) { |
Line 2358 CHOOSE_STUDENTS
|
Line 2425 CHOOSE_STUDENTS
|
</validator> |
</validator> |
</string> |
</string> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
|
$code_selection |
|
|
|
|
<message><b>Reprint a set of saved CODEs:</b></message> |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message></td><td></message> |
<message></td><td></message> |
<dropdown variable="REUSE_OLD_CODES"> |
<dropdown variable="REUSE_OLD_CODES"> |
Line 2397 CHOOSE_ANON1
|
Line 2467 CHOOSE_ANON1
|
<choice computer='2'>Add two empty pages/column after each student\'s assignment</choice> |
<choice computer='2'>Add two empty pages/column after each student\'s assignment</choice> |
<choice computer='3'>Add three empty pages/column after each student\'s assignment</choice> |
<choice computer='3'>Add three empty pages/column after each student\'s assignment</choice> |
</choices> |
</choices> |
</state> |
|
<state name="NUMBER_PER_PDF" title="Number assignments per pdf"> |
|
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<message><hr width='33%' /><b>How do you want assignments split into PDF files? </b></message> |
<message><hr width='33%' /><b>How do you want assignments split into PDF files? </b></message> |
<choices variable="SPLIT_PDFS"> |
<choices variable="SPLIT_PDFS"> |
<choice computer="all">All assignments in a single PDF file</choice> |
<choice computer="all">All assignments in a single PDF file</choice> |
<choice computer="sections">Each PDF contains exactly one section</choice> |
<choice computer="sections">Each PDF contains exactly one section</choice> |
<choice computer="oneper">Each PDF contains exactly one assignment</choice> |
<choice computer="oneper">Each PDF contains exactly one assignment</choice> |
<choice computer="usenumber">Specify Number:</choice> |
<choice computer="usenumber" relatedvalue="NUMBER_TO_PRINT"> |
|
Specify the number of assignments per PDF:</choice> |
</choices> |
</choices> |
<string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string> |
|
</state> |
</state> |
RESOURCE_SELECTOR |
RESOURCE_SELECTOR |
|
|
Line 2417 RESOURCE_SELECTOR
|
Line 2485 RESOURCE_SELECTOR
|
<choice computer='0'>Sort by section then student</choice> |
<choice computer='0'>Sort by section then student</choice> |
<choice computer='1'>Sort by students across sections.</choice> |
<choice computer='1'>Sort by students across sections.</choice> |
</choices> |
</choices> |
|
<message><br /><hr /><br /></message> |
<student multichoice='1' variable="STUDENTS" nextstate="SELECT_RESOURCES" coursepersonnel="1" /> |
<student multichoice='1' variable="STUDENTS" nextstate="SELECT_RESOURCES" coursepersonnel="1" /> |
|
|
</state> |
</state> |
Line 2464 CHOOSE_STUDENTS1
|
Line 2533 CHOOSE_STUDENTS1
|
</validator> |
</validator> |
</string> |
</string> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
|
$code_selection |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message></td><td></message> |
<message></td><td></message> |
<dropdown variable="REUSE_OLD_CODES"> |
<dropdown variable="REUSE_OLD_CODES"> |
Line 2872 sub render {
|
Line 2942 sub render {
|
$result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />'; |
$result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />'; |
} |
} |
|
|
|
my $width = 18; |
|
my $format = $helper->{VARS}->{$self->{'formatvar'}}; |
|
if (substr($format, 2, 1) ne '1') { |
|
$width = 9; |
|
} |
|
|
$result .= <<ELEMENTHTML; |
$result .= <<ELEMENTHTML; |
|
|
<p>How should the column be formatted?</p> |
<p>How should the column be formatted?</p> |
Line 2879 sub render {
|
Line 2955 sub render {
|
<table cellpadding='3'> |
<table cellpadding='3'> |
<tr> |
<tr> |
<td align='right'><b>Width</b>:</td> |
<td align='right'><b>Width</b>:</td> |
<td align='left'><input type='text' name='$var.width' value='18' size='4'></td> |
<td align='left'><input type='text' name='$var.width' value='$width' size='4'></td> |
<td align='left'> |
<td align='left'> |
<select name='$var.widthunit'> |
<select name='$var.widthunit'> |
<option>cm</option><option>in</option> |
<option>cm</option><option>in</option> |