version 1.462, 2006/07/17 13:54:36
|
version 1.469, 2006/07/31 10:32:00
|
Line 1
|
Line 1
|
|
# |
# The LearningOnline Network |
# The LearningOnline Network |
# Printout |
# Printout |
# |
# |
Line 627 my %page_formats=
|
Line 628 my %page_formats=
|
'2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm'] |
'2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm'] |
}, |
}, |
'album' => { |
'album' => { |
'1' => [ '8.8 in', '6.8 in','-40 pt in', '-60 pt','1 cm'], |
'1' => [ '8.8 in', '6.8 in','-0.55 in', '-0.83 in','1 cm'], |
'2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in'] |
'2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in'] |
}, |
}, |
}, |
}, |
Line 683 my %page_formats=
|
Line 684 my %page_formats=
|
}, |
}, |
'a4' => { |
'a4' => { |
'book' => { |
'book' => { |
'1' => ['176 mm','272 mm','-40 pt in','-60 pt','-0.5 in'], |
'1' => ['17.6 cm','27.2 cm','-0.55 in','-0.83 in','-0.5 in'], |
'2' => [ '91 mm','272 mm','-40 pt in','-60 pt','-0.5 in'] |
'2' => [ '9.1 cm','27.2 cm','-0.55 in','-0.83 in','-0.5 in'] |
}, |
}, |
'album' => { |
'album' => { |
'1' => ['8.5 in','7.7 in','-40 pt in','-60 pt','0 in'], |
'1' => ['8.5 in','7.7 in','-0.55 in','-0.83 in','0 in'], |
'2' => ['3.9 in','7.7 in','-40 pt in','-60 pt','0 in'] |
'2' => ['3.9 in','7.7 in','-0.55 in','-0.83 in','0 in'] |
}, |
}, |
}, |
}, |
'a5' => { |
'a5' => { |
Line 1082 sub print_construction_sequence {
|
Line 1083 sub print_construction_sequence {
|
# |
# |
my @order = @Apache::lonratedt::order; |
my @order = @Apache::lonratedt::order; |
my @resources = @Apache::lonratedt::resources; |
my @resources = @Apache::lonratedt::resources; |
&Apache::lonnet::logthis("mapread for $currentURL returned: $errtext"); |
|
for (my $member=0;$member<=$#order;$member++) { |
for (my $member=0;$member<=$#order;$member++) { |
$resources[$order[$member]]=~/^([^:]*):([^:]*):/; |
$resources[$order[$member]]=~/^([^:]*):([^:]*):/; |
my $urlp=$2; |
my $urlp=$2; |
&Apache::lonnet::logthis("Processing $urlp from sequence ($member)"); |
|
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { |
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { |
my $texversion=''; |
my $texversion=''; |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') { |
if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') { |
Line 1133 sub print_construction_sequence {
|
Line 1132 sub print_construction_sequence {
|
$result.=$texversion; |
$result.=$texversion; |
|
|
} elsif ($urlp=~/\.(sequence|page)$/) { |
} elsif ($urlp=~/\.(sequence|page)$/) { |
&Apache::lonnet::logthis("elsif just strutting stuff"); |
|
|
|
# header: |
# header: |
|
|
Line 1337 ENDPART
|
Line 1335 ENDPART
|
&& $currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') { |
&& $currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') { |
#printing content of sequence from the construction space |
#printing content of sequence from the construction space |
$currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|; |
$currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|; |
&Apache::lonnet::logthis("Sequence from constrution space. ouptput is:"); |
|
&Apache::lonnet::logthis($result); |
|
$result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$result .= &print_construction_sequence($currentURL, $helper, %form, |
$result .= &print_construction_sequence($currentURL, $helper, %form, |
$LaTeXwidth); |
$LaTeXwidth); |
&Apache::lonnet::logthis("Back from construction space print"); |
|
$result .= '\end{document}'; |
$result .= '\end{document}'; |
if (!($result =~ /\\begin\{document\}/)) { |
if (!($result =~ /\\begin\{document\}/)) { |
&Apache::lonnet::logthis("inserting header"); |
|
$result = &print_latex_header() . $result; |
$result = &print_latex_header() . $result; |
} |
} |
# End construction space sequence. |
# End construction space sequence. |
Line 1766 ENDPART
|
Line 1760 ENDPART
|
$selectionmade, |
$selectionmade, |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
} |
} |
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'} /; |
} |
#} |
|
|
#-- writing .tex file in prtspool |
#-- writing .tex file in prtspool |
my $temp_file; |
my $temp_file; |
Line 2071 sub init_perm {
|
Line 2065 sub init_perm {
|
$perm{'pav'}=&Apache::lonnet::allowed('pav', |
$perm{'pav'}=&Apache::lonnet::allowed('pav', |
$env{'request.course.id'}.'/'.$env{'request.course.sec'}); |
$env{'request.course.id'}.'/'.$env{'request.course.sec'}); |
} |
} |
$perm{'pfo'}=&Apache::lonnet::allowed('pav',$env{'request.course.id'}); |
$perm{'pfo'}=&Apache::lonnet::allowed('pfo',$env{'request.course.id'}); |
if (!$perm{'pfo'}) { |
if (!$perm{'pfo'}) { |
$perm{'pfo'}=&Apache::lonnet::allowed('pfo', |
$perm{'pfo'}=&Apache::lonnet::allowed('pfo', |
$env{'request.course.id'}.'/'.$env{'request.course.sec'}); |
$env{'request.course.id'}.'/'.$env{'request.course.sec'}); |
Line 2248 sub printHelper {
|
Line 2242 sub printHelper {
|
|
|
$helper->declareVar('SEQUENCE'); |
$helper->declareVar('SEQUENCE'); |
|
|
|
# If we're in a sequence... |
|
|
|
my $start_new_option; |
|
if ($perm{'pav'}) { |
|
$start_new_option = |
|
"<option text='".&mt('Start new page<br />before selected'). |
|
"' variable='FINISHPAGE' />"; |
|
} |
|
|
# If we're in a sequence... |
|
my $startnew=&mt('Start new page<br />before selected'); |
|
if (($helper->{'VARS'}->{'construction'} ne '1') && |
if (($helper->{'VARS'}->{'construction'} ne '1') && |
|
|
$helper->{VARS}->{'postdata'} && |
$helper->{VARS}->{'postdata'} && |
Line 2260 sub printHelper {
|
Line 2259 sub printHelper {
|
push @{$printChoices}, [&mt('Selected <b>Problems</b> in folder <b><i>[_1]</i></b>',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS']; |
push @{$printChoices}, [&mt('Selected <b>Problems</b> in folder <b><i>[_1]</i></b>',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS']; |
# Allow all resources from sequence |
# Allow all resources from sequence |
push @{$printChoices}, [&mt('Selected <b>Resources</b> in folder <b><i>[_1]</i></b>',$sequenceTitle), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML']; |
push @{$printChoices}, [&mt('Selected <b>Resources</b> in folder <b><i>[_1]</i></b>',$sequenceTitle), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML']; |
|
|
my $helperFragment = <<HELPERFRAGMENT; |
my $helperFragment = <<HELPERFRAGMENT; |
<state name="CHOOSE_PROBLEMS" title="Select Problem(s) to print"> |
<state name="CHOOSE_PROBLEMS" title="Select Problem(s) to print"> |
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
Line 2268 sub printHelper {
|
Line 2268 sub printHelper {
|
<filterfunc>return $isProblem;</filterfunc> |
<filterfunc>return $isProblem;</filterfunc> |
<mapurl>$map</mapurl> |
<mapurl>$map</mapurl> |
<valuefunc>return $symbFilter;</valuefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<option text='$startnew' variable='FINISHPAGE' /> |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
|
|
Line 2279 sub printHelper {
|
Line 2279 sub printHelper {
|
<filterfunc>return $isNotMap;</filterfunc> |
<filterfunc>return $isNotMap;</filterfunc> |
<mapurl>$map</mapurl> |
<mapurl>$map</mapurl> |
<valuefunc>return $symbFilter;</valuefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<option text='$startnew' variable='FINISHPAGE' /> |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
HELPERFRAGMENT |
HELPERFRAGMENT |
Line 2302 HELPERFRAGMENT
|
Line 2302 HELPERFRAGMENT
|
<filterfunc>return $isProblemOrMap;</filterfunc> |
<filterfunc>return $isProblemOrMap;</filterfunc> |
<choicefunc>return $isNotMap;</choicefunc> |
<choicefunc>return $isNotMap;</choicefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<option text='$startnew' variable='FINISHPAGE' /> |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
<state name="ALL_RESOURCES" title="Select Resource(s) to print"> |
<state name="ALL_RESOURCES" title="Select Resource(s) to print"> |
Line 2311 HELPERFRAGMENT
|
Line 2311 HELPERFRAGMENT
|
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<filterfunc>return $isNotMap; </filterfunc> |
<filterfunc>return $isNotMap; </filterfunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<option text='$startnew' variable='FINISHPAGE' /> |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
ALL_PROBLEMS |
ALL_PROBLEMS |
Line 2339 ALL_PROBLEMS
|
Line 2339 ALL_PROBLEMS
|
<filterfunc>return $isProblem;</filterfunc> |
<filterfunc>return $isProblem;</filterfunc> |
<mapurl>$map</mapurl> |
<mapurl>$map</mapurl> |
<valuefunc>return $symbFilter;</valuefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<option text='$startnew' variable='FINISHPAGE' /> |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
<state name="PRINT_FORMATTING" title="How should results be printed?"> |
<state name="PRINT_FORMATTING" title="How should results be printed?"> |
Line 2413 CHOOSE_STUDENTS
|
Line 2413 CHOOSE_STUDENTS
|
push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); |
push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); |
</exec> |
</exec> |
</dropdown> |
</dropdown> |
<message></td></tr><tr><td colspan="2"><hr width=\'33%\' /></td></tr><tr><td></message> |
<message></td></tr><tr><td></message> |
'.$/; |
'.$/; |
|
|
} |
} |
Line 2433 CHOOSE_STUDENTS
|
Line 2433 CHOOSE_STUDENTS
|
$codechoice='<choice computer="default">Default</choice>'; |
$codechoice='<choice computer="default">Default</choice>'; |
} |
} |
&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON1); |
&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON1); |
<state name="CHOOSE_ANON1" title="Select Students and Resources"> |
<state name="CHOOSE_ANON1" title="Specify CODEd Assignments"> |
<nextstate>SELECT_PROBLEMS</nextstate> |
<nextstate>SELECT_PROBLEMS</nextstate> |
<message><table><tr><td><b>Number of anonymous assignments to print:</b></td><td></message> |
<message><h4>Fill out one of the forms below</h4></message> |
|
<message><br /><hr /> <br /></message> |
|
<message><h3>Generate new CODEd Assignments</h3></message> |
|
<message><table><tr><td><b>Number of CODEd assignments to print:</b></td><td></message> |
<string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5"> |
<string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5"> |
<validator> |
<validator> |
if (((\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'}+0) < 1) && |
if (((\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'}+0) < 1) && |
Line 2457 CHOOSE_STUDENTS
|
Line 2460 CHOOSE_STUDENTS
|
<dropdown variable="CODE_OPTION" multichoice="0" allowempty="0"> |
<dropdown variable="CODE_OPTION" multichoice="0" allowempty="0"> |
$codechoice |
$codechoice |
</dropdown> |
</dropdown> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
<message></td></tr><tr><td colspan="2"></td></tr><tr><td></message> |
<message></td></tr><tr><td></message> |
<message></td></tr><tr><td></table></message> |
<message><b>Enter a CODE to print:</b></td><td></message> |
<message><br /><hr /><h3>Print a Specific Code </h3><br /><table></message> |
|
<message><tr><td><b>Enter a CODE to print:</b></td><td></message> |
<string variable="SINGLE_CODE" size="10"> |
<string variable="SINGLE_CODE" size="10"> |
<validator> |
<validator> |
if(!\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'} && |
if(!\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'} && |
Line 2472 CHOOSE_STUDENTS
|
Line 2476 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></message> |
$code_selection |
$code_selection |
|
<message></td></tr></table></message> |
|
<message><hr /><h3>Reprint a Set of Saved Codes</h3><table><tr><td></message> |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message><b>Select saved CODEs:</b></message> |
<message></td><td></message> |
<message></td><td></message> |
<dropdown variable="REUSE_OLD_CODES"> |
<dropdown variable="REUSE_OLD_CODES"> |
$namechoice |
$namechoice |
</dropdown> |
</dropdown> |
<message></td></tr></table></message> |
<message></td></tr></table></message> |
<message><hr width='33%' /></message> |
|
</state> |
</state> |
$resource_selector |
$resource_selector |
CHOOSE_ANON1 |
CHOOSE_ANON1 |
Line 2503 CHOOSE_ANON1
|
Line 2506 CHOOSE_ANON1
|
<filterfunc>return $isNotMap;</filterfunc> |
<filterfunc>return $isNotMap;</filterfunc> |
<mapurl>$map</mapurl> |
<mapurl>$map</mapurl> |
<valuefunc>return $symbFilter;</valuefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<option text='$startnew' variable='FINISHPAGE' /> |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
<state name="PRINT_FORMATTING" title="Format of the print job"> |
<state name="PRINT_FORMATTING" title="Format of the print job"> |
Line 2644 CHOOSE_FROM_SUBDIR
|
Line 2647 CHOOSE_FROM_SUBDIR
|
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
closeallpages="1"> |
closeallpages="1"> |
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<filterfunc>return $isProblem</filterfunc> |
<filterfunc>return $isNotMap</filterfunc> |
<mapurl evaluate='1'>return '$escapedSequenceName';</mapurl> |
<mapurl evaluate='1'>return '$escapedSequenceName';</mapurl> |
<valuefunc>return $symbFilter;</valuefunc> |
<valuefunc>return $symbFilter;</valuefunc> |
<option text='$startnew' variable='FINISHPAGE' /> |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
CHOOSE_FROM_ANY_SEQUENCE |
CHOOSE_FROM_ANY_SEQUENCE |
Line 2973 sub new {
|
Line 2976 sub new {
|
# $helper->{VARS} to figure out whether the columns are one or two |
# $helper->{VARS} to figure out whether the columns are one or two |
$self->{'formatvar'} = shift; |
$self->{'formatvar'} = shift; |
|
|
# The state to transition to after selection, or after discovering |
|
# the cols are not set to 1 |
|
$self->{NEXTSTATE} = shift; |
$self->{NEXTSTATE} = shift; |
bless($self); |
bless($self); |
|
|
return $self; |
return $self; |
} |
} |
|
|
Line 2986 sub render {
|
Line 2989 sub render {
|
my $result = ''; |
my $result = ''; |
my $var = $self->{'variable'}; |
my $var = $self->{'variable'}; |
|
|
|
|
|
|
if (defined $self->{ERROR_MSG}) { |
if (defined $self->{ERROR_MSG}) { |
$result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />'; |
$result .= '<br /><span class="LC_error">' . $self->{ERROR_MSG} . '</span><br />'; |
} |
} |
|
|
my $width = 18; |
|
my $format = $helper->{VARS}->{$self->{'formatvar'}}; |
my $format = $helper->{VARS}->{$self->{'formatvar'}}; |
if (substr($format, 2, 1) ne '1') { |
|
$width = 9; |
# Use format to get sensible defaults for the margins: |
|
|
|
|
|
my ($laystyle, $cols, $papersize) = split(/\|/, $format); |
|
($papersize) = split(/ /, $papersize); |
|
|
|
|
|
if ($laystyle eq 'L') { |
|
$laystyle = 'album'; |
|
} else { |
|
$laystyle = 'book'; |
|
} |
|
|
|
|
|
my %size; |
|
($size{'width_and_units'}, |
|
$size{'height_and_units'}, |
|
$size{'margin_and_units'})= |
|
&Apache::lonprintout::page_format($papersize, $laystyle, $cols); |
|
|
|
foreach my $dimension ('width','height','margin') { |
|
($size{$dimension},$size{$dimension.'_unit'}) = |
|
split(/ +/, $size{$dimension.'_and_units'},2); |
|
|
|
foreach my $unit ('cm','in') { |
|
$size{$dimension.'_options'} .= '<option '; |
|
if ($size{$dimension.'_unit'} eq $unit) { |
|
$size{$dimension.'_options'} .= 'selected="selected" '; |
|
} |
|
$size{$dimension.'_options'} .= '>'.$unit.'</option>'; |
|
} |
} |
} |
|
|
$result .= <<ELEMENTHTML; |
$result .= <<ELEMENTHTML; |
|
|
<p>How should the column be formatted?</p> |
|
|
|
|
<p>How should each column be formatted?</p> |
|
|
<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='$width' size='4'></td> |
<td align='left'><input type='text' name='$var.width' value="$size{'width'}" size='4' /></td> |
<td align='left'> |
<td align='left'> |
<select name='$var.widthunit'> |
<select name='$var.widthunit'> |
<option>cm</option><option>in</option> |
$size{'width_options'} |
</select> |
</select> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td align='right'><b>Height</b>:</td> |
<td align='right'><b>Height</b>:</td> |
<td align='left'><input type='text' name="$var.height" value="25.9" size='4'></td> |
<td align='left'><input type='text' name="$var.height" value="$size{'height'}" size='4' /></td> |
<td align='left'> |
<td align='left'> |
<select name='$var.heightunit'> |
<select name='$var.heightunit'> |
<option>cm</option><option>in</option> |
$size{'height_options'} |
</select> |
</select> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td align='right'><b>Left margin</b>:</td> |
<td align='right'><b>Left margin</b>:</td> |
<td align='left'><input type='text' name='$var.lmargin' value='-1.5' size='4'></td> |
<td align='left'><input type='text' name='$var.lmargin' value="$size{'margin'}" size='4' /></td> |
<td align='left'> |
<td align='left'> |
<select name='$var.lmarginunit'> |
<select name='$var.lmarginunit'> |
<option>cm</option><option>in</option> |
$size{'margin_options'} |
</select> |
</select> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
|
|
<p>Hint: Some instructors like to leave scratch space for the student by |
<!--<p>Hint: Some instructors like to leave scratch space for the student by |
making the width much smaller than the width of the page.</p> |
making the width much smaller than the width of the page.</p>--> |
|
|
ELEMENTHTML |
ELEMENTHTML |
|
|
Line 3044 sub preprocess {
|
Line 3080 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') { |
|
$helper->changeState($self->{NEXTSTATE}); |
# If the user does not have 'pav' privilege, set default widths and |
|
# on to the next state right away. |
|
# |
|
if (!$perm{'pav'}) { |
|
my $var = $self->{'variable'}; |
|
my $format = $helper->{VARS}->{$self->{'formatvar'}}; |
|
|
|
my ($laystyle, $cols, $papersize) = split(/\|/, $format); |
|
($papersize) = split(/ /, $papersize); |
|
|
|
|
|
if ($laystyle eq 'L') { |
|
$laystyle = 'album'; |
|
} else { |
|
$laystyle = 'book'; |
|
} |
|
# Figure out some good defaults for the print out and set them: |
|
|
|
my %size; |
|
($size{'width'}, |
|
$size{'height'}, |
|
$size{'lmargin'})= |
|
&Apache::lonprintout::page_format($papersize, $laystyle, $cols); |
|
|
|
foreach my $dim ('width', 'height', 'lmargin') { |
|
my ($value, $units) = split(/ /, $size{$dim}); |
|
|
|
&Apache::lonnet::logthis("$dim : $value : $units"); |
|
|
|
$helper->{VARS}->{"$var.".$dim} = $value; |
|
$helper->{VARS}->{"$var.".$dim.'unit'} = $units; |
|
|
|
} |
|
|
|
|
|
# Transition to the next state |
|
|
|
$helper->changeState($self->{NEXTSTATE}); |
} |
} |
|
|
return 1; |
return 1; |
Line 3068 sub postprocess {
|
Line 3141 sub postprocess {
|
# /^-?[0-9]+(\.[0-9]*)?$/ -> optional minus, at least on digit, followed |
# /^-?[0-9]+(\.[0-9]*)?$/ -> optional minus, at least on digit, followed |
# by an optional period, followed by digits, ending the string |
# by an optional period, followed by digits, ending the string |
|
|
if ($width !~ /^-?[0-9]+(\.[0-9]*)?$/) { |
if ($width !~ /^-?[0-9]*(\.[0-9]*)?$/) { |
$error .= "Invalid width; please type only a number.<br />\n"; |
$error .= "Invalid width; please type only a number.<br />\n"; |
} |
} |
if ($height !~ /^-?[0-9]+(\.[0-9]*)?$/) { |
if ($height !~ /^-?[0-9]*(\.[0-9]*)?$/) { |
$error .= "Invalid height; please type only a number.<br />\n"; |
$error .= "Invalid height; please type only a number.<br />\n"; |
} |
} |
if ($lmargin !~ /^-?[0-9]+(\.[0-9]*)?$/) { |
if ($lmargin !~ /^-?[0-9]*(\.[0-9]*)?$/) { |
$error .= "Invalid left margin; please type only a number.<br />\n"; |
$error .= "Invalid left margin; please type only a number.<br />\n"; |
} |
} |
|
|