version 1.432, 2006/03/21 18:43:49
|
version 1.438, 2006/05/24 10:49:04
|
Line 1022 sub output_data {
|
Line 1022 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 $headtag = &Apache::loncommon::headtag('Preparing Printout'); |
<script type="text/javascript"> |
my $end_headtag = &Apache::loncommon::endheadtag(); |
|
my $bodytag = &Apache::loncommon::bodytag('Preparing Printout'); |
|
$r->print(<<ENDPART); |
|
$html |
|
$headtag |
|
<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 1053 $headtag
|
Line 1047 $headtag
|
editbrowser.focus(); |
editbrowser.focus(); |
} |
} |
</script> |
</script> |
$end_headtag |
|
$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 1330 ENDPART
|
Line 1322 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 1679 ENDPART
|
Line 1670 ENDPART
|
$selectionmade, |
$selectionmade, |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
} |
} |
#changes page's parameters for the one column output |
&Apache::lonnet::logthis("Resetting page e.g. height -> $helper->{'VARS'}->{'pagesize.height'}"); |
if ($numberofcolumns == 1) { |
&Apache::lonnet::logthis("Before: $result \n--------------------------\n"); |
$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'} /; |
} |
|
|
&Apache::lonnet::logthis("After: $result \n----------------------------------\n"); |
|
|
#-- writing .tex file in prtspool |
#-- writing .tex file in prtspool |
my $temp_file; |
my $temp_file; |
Line 2242 ALL_PROBLEMS
|
Line 2234 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 2241 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" relateddefault="all"> |
|
Specify Number:</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 2260 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 2304 CHOOSE_STUDENTS
|
Line 2294 CHOOSE_STUDENTS
|
} |
} |
push(@{$helper->{DATA}{ALL_CODE_CHOICES}},[$code,$choice]); |
push(@{$helper->{DATA}{ALL_CODE_CHOICES}},[$code,$choice]); |
} |
} |
$code_selection .= |
if (%codes_to_print) { |
' |
$code_selection .=' |
<exec> |
<exec> |
push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); |
push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); |
</exec> |
</exec> |
'.$/; |
'.$/; |
|
} |
|
|
|
|
open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
Line 2411 CHOOSE_ANON1
|
Line 2402 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" relateddefault="all"> |
|
Specify Number:</choice> |
</choices> |
</choices> |
<string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string> |
|
</state> |
</state> |
RESOURCE_SELECTOR |
RESOURCE_SELECTOR |
|
|
Line 2431 RESOURCE_SELECTOR
|
Line 2420 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 2892 sub render {
|
Line 2882 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 2899 sub render {
|
Line 2895 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> |
Line 2940 sub preprocess {
|
Line 2936 sub preprocess {
|
my $helper = Apache::lonhelper::getHelper(); |
my $helper = Apache::lonhelper::getHelper(); |
|
|
my $format = $helper->{VARS}->{$self->{'formatvar'}}; |
my $format = $helper->{VARS}->{$self->{'formatvar'}}; |
if (substr($format, 2, 1) ne '1') { |
# if (substr($format, 2, 1) ne '1') { |
$helper->changeState($self->{NEXTSTATE}); |
# $helper->changeState($self->{NEXTSTATE}); |
} |
# } |
|
|
return 1; |
return 1; |
} |
} |