--- loncom/interface/lonprintout.pm 2006/07/03 13:48:41 1.455
+++ loncom/interface/lonprintout.pm 2006/07/20 03:47:09 1.466
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.455 2006/07/03 13:48:41 albertel Exp $
+# $Id: lonprintout.pm,v 1.466 2006/07/20 03:47:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,6 +47,7 @@ use LONCAPA;
my %perm;
my %parmhash;
+my $resources_printed;
# Format a header according to a format.
@@ -626,7 +627,7 @@ my %page_formats=
'2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm']
},
'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']
},
},
@@ -682,12 +683,12 @@ my %page_formats=
},
'a4' => {
'book' => {
- '1' => ['176 mm','272 mm','-40 pt in','-60 pt','-0.5 in'],
- '2' => [ '91 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' => [ '9.1 cm','27.2 cm','-0.55 in','-0.83 in','-0.5 in']
},
'album' => {
- '1' => ['8.5 in','7.7 in','-40 pt in','-60 pt','0 in'],
- '2' => ['3.9 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','-0.55 in','-0.83 in','0 in']
},
},
'a5' => {
@@ -1055,10 +1056,110 @@ sub get_page_breaks {
return %page_breaks;
}
+# Output a sequence (recursively if neeed)
+# from construction space.
+# Parameters:
+# url = URL of the sequence to print.
+# helper - Reference to the helper hash.
+# form - Copy of the format hash.
+# LaTeXWidth
+# Returns:
+# Text to add to the printout.
+# NOTE if the first element of the outermost sequence
+# is itself a sequence, the outermost caller may need to
+# prefix the latex with the page headers stuff.
+#
+sub print_construction_sequence {
+ my ($currentURL, $helper, %form, $LaTeXwidth) = @_;
+ my $result;
+ my $rndseed=time;
+ if ($helper->{'VARS'}->{'curseed'}) {
+ $rndseed=$helper->{'VARS'}->{'curseed'};
+ }
+ my $errtext=&Apache::lonratedt::mapread($currentURL);
+ #
+ # These make this all support recursing for subsequences.
+ #
+ my @order = @Apache::lonratedt::order;
+ my @resources = @Apache::lonratedt::resources;
+ for (my $member=0;$member<=$#order;$member++) {
+ $resources[$order[$member]]=~/^([^:]*):([^:]*):/;
+ my $urlp=$2;
+ if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
+ my $texversion='';
+ if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
+ $form{'problem_split'}=$parmhash{'problem_stream_switch'};
+ $form{'suppress_tries'}=$parmhash{'suppress_tries'};
+ $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
+ $form{'rndseed'}=$rndseed;
+ $resources_printed .=$urlp.':';
+ $texversion=&Apache::lonnet::ssi($urlp,%form);
+ }
+ if((($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
+ ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) &&
+ ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) {
+ # Don't permanently modify %$form...
+ my %answerform = %form;
+ $answerform{'grade_target'}='answer';
+ $answerform{'answer_output_mode'}='tex';
+ $answerform{'rndseed'}=$rndseed;
+ $answerform{'problem_split'}=$parmhash{'problem_stream_switch'};
+ if ($urlp=~/\/res\//) {$env{'request.state'}='published';}
+ $resources_printed .= $urlp.':';
+ my $answer=&Apache::lonnet::ssi($urlp,%answerform);
+ if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
+ $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
+ } else {
+ # If necessary, encapsulate answer in minipage:
+
+ $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
+ my $body ='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm ';
+ $body.=&path_to_problem($urlp,$LaTeXwidth);
+ $body.='\vskip 1 mm '.$answer.'\end{document}';
+ $body = &encapsulate_minipage($body);
+ $texversion.=$body;
+ }
+ }
+ $texversion = &latex_header_footer_remove($texversion);
+
+ if ($helper->{'VARS'}->{'TABLE_INDEX'} eq 'yes') {
+ $texversion=&IndexCreation($texversion,$urlp);
+ }
+ if ($helper->{'VARS'}->{'CONSTR_RESOURSE_URL'} eq 'yes') {
+ $texversion=~s/(\\addcontentsline\{toc\}\{subsection\}\{[^\}]*\})/$1 URL: \\verb|$urlp| \\strut\\\\\\strut /;
+ }
+ $result.=$texversion;
+
+ } elsif ($urlp=~/\.(sequence|page)$/) {
+
+ # header:
+
+ $result.='\strut\newline\noindent Sequence/page '.$urlp.'\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent ';
+
+ # IF sequence, recurse:
+
+ if ($urlp =~ /\.sequence$/) {
+ my $sequence_url = $urlp;
+ my $domain = $env{'user.domain'}; # Constr. space only on local
+ my $user = $env{'user.name'};
+
+ $sequence_url =~ s/^\/res\/$domain/\/home/;
+ $sequence_url =~ s/^(\/home\/$user)/$1\/public_html/;
+# $sequence_url =~ s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
+ $result .= &print_construction_sequence($sequence_url,
+ $helper, %form,
+ $LaTeXwidth);
+ }
+ }
+ }
+ if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;}
+ return $result;
+}
+
sub output_data {
my ($r,$helper,$rparmhash) = @_;
my %parmhash = %$rparmhash;
- my $resources_printed = '';
+ $resources_printed = '';
my $js = <
var editbrowser;
@@ -1232,71 +1333,16 @@ ENDPART
} elsif ($cleanURL!~m|^/adm/|
&& $currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') {
#printing content of sequence from the construction space
- my $flag_latex_header_remove = 'NO';
- my $rndseed=time;
- if ($helper->{'VARS'}->{'curseed'}) {
- $rndseed=$helper->{'VARS'}->{'curseed'};
- }
$currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
- my $errtext=&Apache::lonratedt::mapread($currentURL);
- for (my $member=0;$member<=$#Apache::lonratedt::order;$member++) {
- $Apache::lonratedt::resources[$Apache::lonratedt::order[$member]]=~/^([^:]*):([^:]*):/;
- my $urlp=$2;
- if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
- my $texversion='';
- if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
- $form{'problem_split'}=$parmhash{'problem_stream_switch'};
- $form{'suppress_tries'}=$parmhash{'suppress_tries'};
- $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
- $form{'rndseed'}=$rndseed;
- $resources_printed .=$urlp.':';
- $texversion=&Apache::lonnet::ssi($urlp,%form);
- }
- if((($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
- ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) &&
- ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) {
- # Don't permanently modify %$form...
- my %answerform = %form;
- $answerform{'grade_target'}='answer';
- $answerform{'answer_output_mode'}='tex';
- $answerform{'rndseed'}=$rndseed;
- $answerform{'problem_split'}=$parmhash{'problem_stream_switch'};
- if ($urlp=~/\/res\//) {$env{'request.state'}='published';}
- $resources_printed .= $urlp.':';
- my $answer=&Apache::lonnet::ssi($urlp,%answerform);
- if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
- $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
- } else {
- # If necessary, encapsulate answer in minipage:
-
- $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
- my $body ='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm ';
- $body.=&path_to_problem($urlp,$LaTeXwidth);
- $body.='\vskip 1 mm '.$answer.'\end{document}';
- $body = &encapsulate_minipage($body);
- $texversion.=$body;
- }
- }
- if ($flag_latex_header_remove ne 'NO') {
- $texversion = &latex_header_footer_remove($texversion);
- } else {
- $texversion =~ s/\\end{document}//;
- }
- if ($helper->{'VARS'}->{'TABLE_INDEX'} eq 'yes') {
- $texversion=&IndexCreation($texversion,$urlp);
- }
- if ($helper->{'VARS'}->{'CONSTR_RESOURSE_URpL'} eq 'yes') {
- $texversion=~s/(\\addcontentsline\{toc\}\{subsection\}\{[^\}]*\})/$1 URL: \\verb|$urlp| \\strut\\\\\\strut /;
- }
- $result.=$texversion;
- $flag_latex_header_remove = 'YES';
- } elsif ($urlp=~/\.(sequence|page)$/) {
- $result.='\strut\newline\noindent Sequence/page '.$urlp.'\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent ';
- }
- }
- if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;}
- $result .= '\end{document}';
- } elsif ($cleanURL=~/\/(smppg|grppg|syllabus|aboutme|bulletinboard)$/) {
+ $result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
+ $result .= &print_construction_sequence($currentURL, $helper, %form,
+ $LaTeXwidth);
+ $result .= '\end{document}';
+ if (!($result =~ /\\begin\{document\}/)) {
+ $result = &print_latex_header() . $result;
+ }
+ # End construction space sequence.
+ } elsif ($cleanURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;}
$resources_printed .= $currentURL.':';
@@ -1419,7 +1465,7 @@ ENDPART
}
$result .= $texversion;
$flag_latex_header_remove = 'YES';
- } elsif ($urlp=~/\/(smppg|grppg|syllabus|aboutme|bulletinboard)$/) {
+ } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;}
$resources_printed .= $urlp.':';
@@ -1713,12 +1759,12 @@ ENDPART
$selectionmade,
$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/\\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/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
- }
+ #}
#-- writing .tex file in prtspool
my $temp_file;
@@ -1914,7 +1960,7 @@ sub print_resources {
$rendered =~ s/\\end{document}//;
}
$current_output .= $rendered;
- } elsif ($res_url=~/\/(smppg|grppg|syllabus|aboutme|bulletinboard)$/) {
+ } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$printed .= $curresline.':';
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
@@ -1945,7 +1991,6 @@ sub print_resources {
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 ($columns_in_format == 1) {
$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{$HeaderLine$namepostfix}}\\vskip 5 mm /;
@@ -2019,7 +2064,7 @@ sub init_perm {
$perm{'pav'}=&Apache::lonnet::allowed('pav',
$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'}) {
$perm{'pfo'}=&Apache::lonnet::allowed('pfo',
$env{'request.course.id'}.'/'.$env{'request.course.sec'});
@@ -2181,7 +2226,7 @@ sub printHelper {
my $paramHash;
if ($resourceTitle) {
- push @{$printChoices}, ["$resourceTitle (".&mt('what you just saw on the screen').")", 'current_document', 'PAGESIZE'];
+ push @{$printChoices}, ["$resourceTitle (".&mt('the resource you just saw on the screen').")", 'current_document', 'PAGESIZE'];
}
# Useful filter strings
@@ -2196,40 +2241,44 @@ sub printHelper {
$helper->declareVar('SEQUENCE');
+ # If we're in a sequence...
+ my $start_new_option;
+ if ($perm{'pav'}) {
+ $start_new_option =
+ "before selected').
+ "' variable='FINISHPAGE' />";
+ }
- # If we're in a sequence...
if (($helper->{'VARS'}->{'construction'} ne '1') &&
$helper->{VARS}->{'postdata'} &&
$helper->{VARS}->{'assignment'}) {
# Allow problems from sequence
- push @{$printChoices}, ["".&mt('Problems')." ".&mt('in')." $sequenceTitle", 'map_problems', 'CHOOSE_PROBLEMS'];
+ push @{$printChoices}, [&mt('Selected Problems in folder [_1]',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS'];
# Allow all resources from sequence
- push @{$printChoices}, ["".&mt('Resources')." ".&mt('in')." $sequenceTitle", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
+ push @{$printChoices}, [&mt('Selected Resources in folder [_1]',$sequenceTitle), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
my $helperFragment = <
- (mark them then click "next" button) PAGESIZEreturn $isProblem;$mapreturn $symbFilter;
-
+ $start_new_option
- (mark them then click "next" button) PAGESIZEreturn $isNotMap;$mapreturn $symbFilter;
-
+ $start_new_option
HELPERFRAGMENT
@@ -2240,37 +2289,35 @@ HELPERFRAGMENT
# If the user has pfo (print for otheres) allow them to print all
# problems and resources in the entier course, optionally for selected students
if ($perm{'pfo'} &&
- ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|grppg|aboutme|bulletinboard)$/)) {
+ ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) {
- push @{$printChoices}, ['Problems from entire course', 'all_problems', 'ALL_PROBLEMS'];
- push @{$printChoices}, ['Resources from entire course', 'all_resources', 'ALL_RESOURCES'];
+ push @{$printChoices}, ['Selected Problems from entire course', 'all_problems', 'ALL_PROBLEMS'];
+ push @{$printChoices}, ['Selected Resources from entire course', 'all_resources', 'ALL_RESOURCES'];
&Apache::lonxml::xmlparse($r, 'helper', <
- (mark them then click "next" button) PAGESIZEreturn $isProblemOrMap;return $isNotMap;return $symbFilter;
-
+ $start_new_option
- (Mark them then click "next" button) PAGESIZEreturn $isNotMap; return $symbFilter;
-
+ $start_new_option
ALL_PROBLEMS
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, ["".&mt('Problems')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('selected students')."", 'problems_for_students', 'CHOOSE_STUDENTS'];
- push @{$printChoices}, ["".&mt('Problems')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('anonymous students')."", 'problems_for_anon', 'CHOOSE_ANON1'];
+ push @{$printChoices}, [&mt("Selected Problems from folder [_1] for selected students",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS'];
+ push @{$printChoices}, [&mt("Selected Problems from folder [_1] for anonymous students",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1'];
}
# resource_selector will hold a few states that:
@@ -2291,7 +2338,7 @@ ALL_PROBLEMS
return $isProblem;$mapreturn $symbFilter;
-
+ $start_new_option
@@ -2441,8 +2488,8 @@ CHOOSE_ANON1
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, ["".&mt('Resources')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('selected students')."", 'resources_for_students', 'CHOOSE_STUDENTS1'];
- push @{$printChoices}, ["".&mt('Resources')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('anonymous students')."", 'resources_for_anon', 'CHOOSE_ANON2'];
+ push @{$printChoices}, [&mt("Selected Resources from folder [_1] for selected students",$sequenceTitle), 'resources_for_students', 'CHOOSE_STUDENTS1'];
+ push @{$printChoices}, [&mt("Selected Resources from folder [_1] for anonymous students",$sequenceTitle), 'resources_for_anon', 'CHOOSE_ANON2'];
}
@@ -2455,7 +2502,7 @@ CHOOSE_ANON1
return $isNotMap;$mapreturn $symbFilter;
-
+ $start_new_option
@@ -2548,12 +2595,12 @@ CHOOSE_ANON2
# FIXME: That RE should come from a library somewhere.
if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $perm{'pav'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') {
- push @{$printChoices}, ["".&mt('Problems')." ".&mt('from current subdirectory')." $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
+ push @{$printChoices}, [&mt("Selected Problems from current subdirectory [_1]",$subdir), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
my $f = '$filename';
my $xmlfrag = <
- (mark them then click "next" button)
+
PAGESIZEreturn '$subdir';
@@ -2574,7 +2621,7 @@ CHOOSE_FROM_SUBDIR
# Allow the user to select any sequence in the course, feed it to
# another resource selector for that sequence
if (!$helper->{VARS}->{'construction'}) {
- push @$printChoices, ["Resources from selected sequence in course",
+ push @$printChoices, ["Selected Resources from selected folder in course",
'select_sequences', 'CHOOSE_SEQUENCE'];
my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'};
#Escape apostrophes and backslashes for Perl
@@ -2596,10 +2643,10 @@ CHOOSE_FROM_SUBDIR
PAGESIZE
- return $isProblem
+ return $isNotMapreturn '$escapedSequenceName';return $symbFilter;
-
+ $start_new_option
CHOOSE_FROM_ANY_SEQUENCE
@@ -2925,8 +2972,7 @@ sub new {
# $helper->{VARS} to figure out whether the columns are one or two
$self->{'formatvar'} = shift;
- # The state to transition to after selection, or after discovering
- # the cols are not set to 1
+
$self->{NEXTSTATE} = shift;
bless($self);
return $self;
@@ -2939,51 +2985,82 @@ sub render {
my $var = $self->{'variable'};
if (defined $self->{ERROR_MSG}) {
- $result .= ' ' . $self->{ERROR_MSG} . ' ';
+ $result .= ' ' . $self->{ERROR_MSG} . ' ';
}
- my $width = 18;
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'} .= '
+
+
+
How should each column be formatted?
Width:
-
+
Height:
-
+
Left margin:
-
+
-
Hint: Some instructors like to leave scratch space for the student by
-making the width much smaller than the width of the page.
+
ELEMENTHTML
@@ -2996,9 +3073,6 @@ sub preprocess {
my $helper = Apache::lonhelper::getHelper();
my $format = $helper->{VARS}->{$self->{'formatvar'}};
- if (substr($format, 2, 1) ne '1') {
- $helper->changeState($self->{NEXTSTATE});
- }
return 1;
}
@@ -3020,13 +3094,13 @@ sub postprocess {
# /^-?[0-9]+(\.[0-9]*)?$/ -> optional minus, at least on digit, followed
# 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. \n";
}
- if ($height !~ /^-?[0-9]+(\.[0-9]*)?$/) {
+ if ($height !~ /^-?[0-9]*(\.[0-9]*)?$/) {
$error .= "Invalid height; please type only a number. \n";
}
- if ($lmargin !~ /^-?[0-9]+(\.[0-9]*)?$/) {
+ if ($lmargin !~ /^-?[0-9]*(\.[0-9]*)?$/) {
$error .= "Invalid left margin; please type only a number. \n";
}