version 1.154, 2003/05/06 20:09:49
|
version 1.155, 2003/05/06 20:50:04
|
Line 1350 ENDPART
|
Line 1350 ENDPART
|
} |
} |
my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format_new($papersize,$laystyle,$numberofcolumns); |
my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format_new($papersize,$laystyle,$numberofcolumns); |
my $assignment = $ENV{'form.assignment'}; |
my $assignment = $ENV{'form.assignment'}; |
# if ($choice eq 'Subdirectory print') { |
|
# if ($ENV{'form.layout'} eq '') {$layout = 'CAPA';} |
|
# if ($ENV{'form.papersize'} eq '') {$papersize = 'Letter [8 1/2x11 in]';} |
|
# if ($ENV{'form.numberofcolumns'} eq '') {$numberofcolumns = 2;} |
|
# } |
|
# if (($choice eq 'Standard LaTeX output for current document') && |
|
# ($ENV{'form.url'}=~m|^/~|)) { |
|
# if ($ENV{'form.layout'} eq '') {$layout = 'CAPA';} |
|
# if ($ENV{'form.papersize'} eq '') {$papersize = 'Letter [8 1/2x11 in]';} |
|
# if ($ENV{'form.numberofcolumns'} eq '') {$numberofcolumns = 2;} |
|
# } |
|
|
|
|
|
# my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns); |
|
# if ($numberofcolumns == 1) { |
|
# $textwidth=$ENV{'form.width'}; |
|
# $textheight=$ENV{'form.height'}; |
|
# } |
|
my $LaTeXwidth; |
my $LaTeXwidth; |
if ($textwidth=~/(\d+)\s*cm/) { |
if ($textwidth=~/(\d+)\s*cm/) { |
$LaTeXwidth = $1*10; |
$LaTeXwidth = $1*10; |
Line 1378 ENDPART
|
Line 1360 ENDPART
|
} |
} |
$LaTeXwidth.=' mm'; |
$LaTeXwidth.=' mm'; |
|
|
|
|
if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') { |
if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') { |
#-- single document - problem, page, html, xml, ... |
#-- single document - problem, page, html, xml, ... |
my $currentURL; |
my $currentURL; |
Line 1771 sub printHelper {
|
Line 1752 sub printHelper {
|
my $paramHash; |
my $paramHash; |
# We can always print the current screen. |
# We can always print the current screen. |
|
|
push @{$printChoices}, ["<b>$resourceTitle</b> (exactly what was on the screen)", 'current_document', 'PAGESIZE']; |
push @{$printChoices}, ["Current resource <b>$resourceTitle</b> (prints what you just saw on the screen)", 'current_document', 'PAGESIZE']; |
|
|
# If we're in a sequence... |
# If we're in a sequence... |
if (not defined $helper->{'VARS'}->{'construction'}) { |
if (not defined $helper->{'VARS'}->{'construction'}) { |
# Allow problems from sequence |
# Allow problems from sequence |
push @{$printChoices}, ["Problems from <b>$sequenceTitle</b>", 'map_problems', 'CHOOSE_PROBLEMS']; |
push @{$printChoices}, ["Problem(s) from <b>$sequenceTitle</b>", 'map_problems', 'CHOOSE_PROBLEMS']; |
# Allow all resources from sequence |
# Allow all resources from sequence |
push @{$printChoices}, ["Problems and pages from <b>$sequenceTitle</b>", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML']; |
push @{$printChoices}, ["Everything (problem(s), page(s), html/xml file(s)) from <b>$sequenceTitle</b>", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML']; |
|
|
my $isProblem = '$res->is_problem();'; |
my $isProblem = '$res->is_problem();'; |
my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; |
my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; |
my $isNotMap = '!$res->is_map();'; |
my $isNotMap = '!$res->is_map();'; |
my $symb = '$res->symb();'; |
my $symb = '$res->symb();'; |
my $helperFragment = <<HELPERFRAGMENT; |
my $helperFragment = <<HELPERFRAGMENT; |
<state name="CHOOSE_PROBLEMS" title="Select Problems"> |
<state name="CHOOSE_PROBLEMS" title="Select Problem(s) to print"> |
<message>Select problems to print:</message> |
<message>(mark them then click "next" button) <br /></message> |
<resource variable="RESOURCES" multichoice="1" toponly='1'> |
<resource variable="RESOURCES" multichoice="1" toponly='1'> |
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<filterfunc>return $isProblem</filterfunc> |
<filterfunc>return $isProblem</filterfunc> |
Line 1795 sub printHelper {
|
Line 1776 sub printHelper {
|
</resource> |
</resource> |
</state> |
</state> |
|
|
<state name="CHOOSE_PROBLEMS_HTML" title="Select Resources"> |
<state name="CHOOSE_PROBLEMS_HTML" title="Select Resource(s) to print"> |
<message>Select resources to print:</message> |
<message>(mark them then click "next" button) <br /></message> |
<resource variable="RESOURCES" multichoice="1" toponly='1'> |
<resource variable="RESOURCES" multichoice="1" toponly='1'> |
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<filterfunc>return $isNotMap;</filterfunc> |
<filterfunc>return $isNotMap;</filterfunc> |
Line 1812 HELPERFRAGMENT
|
Line 1793 HELPERFRAGMENT
|
# If the user is priviledged, allow them to print all |
# If the user is priviledged, allow them to print all |
# problems in the course, optionally for selected students |
# problems in the course, optionally for selected students |
if (($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) and ($helper->{VARS}->{'postdata'}=~/\/res\//)) { |
if (($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) and ($helper->{VARS}->{'postdata'}=~/\/res\//)) { |
push @{$printChoices}, ['<b>All problems</b> in course (may take a lot of time)', 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, ['<b>Problems</b> in this course', 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, ["Problems from <b>$sequenceTitle</b> for selected students", 'problems_for_students', 'CHOOSE_STUDENTS']; |
push @{$printChoices}, ["Problems from <b>$sequenceTitle</b> for selected students", 'problems_for_students', 'CHOOSE_STUDENTS']; |
|
|
my $isProblem = '$res->is_problem();'; |
my $isProblem = '$res->is_problem();'; |
my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; |
my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; |
my $symb = '$res->symb();'; |
my $symb = '$res->symb();'; |
&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS); |
&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS); |
<state name="ALL_PROBLEMS" title="Select Problems"> |
<state name="ALL_PROBLEMS" title="Select Problem(s) to print"> |
<message>Select problems to print:</message> |
<message>(mark them then click "next" button) <br /></message> |
<resource variable="RESOURCES" multichoice="1"> |
<resource variable="RESOURCES" multichoice="1"> |
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<filterfunc>return $isProblemOrMap</filterfunc> |
<filterfunc>return $isProblemOrMap</filterfunc> |
Line 1829 HELPERFRAGMENT
|
Line 1810 HELPERFRAGMENT
|
</resource> |
</resource> |
</state> |
</state> |
|
|
<state name="CHOOSE_STUDENTS" title="Choose Students"> |
<state name="CHOOSE_STUDENTS" title="Choose Students whose assignments you want to print"> |
<message>Select the students you wish to print the problems for:</message> |
<message>(do not forget to select assignment itself - make another selection below) <br /></message> |
<student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" /> |
<student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" /> |
|
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
<resource variable="RESOURCES" multichoice="1"> |
<resource variable="RESOURCES" multichoice="1"> |
<filterfunc>return $isProblem</filterfunc> |
<filterfunc>return $isProblem</filterfunc> |
<mapurl>$map</mapurl> |
<mapurl>$map</mapurl> |
<valuefunc>return $symb</valuefunc> |
<valuefunc>return $symb</valuefunc> |
</resource> |
</resource> |
<message>How should the results be printed?</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'>Print students assignments without separations (as uniform flow)</choice> |
<choice computer='0'>Print students assignments without separations (as uniform flow)</choice> |
<choice computer='1'>Start student assignment from new page (add pagefeed after each student)</choice> |
<choice computer='1'>Start student assignment from new page (add pagefeed after each student)</choice> |
Line 1850 CHOOSE_STUDENTS
|
Line 1832 CHOOSE_STUDENTS
|
|
|
# FIXME: That RE should come from a library somewhere. |
# 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'}) { |
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'}) { |
push @{$printChoices}, ["Problems from <b>$subdir</b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; |
push @{$printChoices}, ["Problems from current subdirectory <b>$subdir</b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; |
|
|
my $f = '$filename'; |
my $f = '$filename'; |
my $xmlfrag = <<CHOOSE_FROM_SUBDIR; |
my $xmlfrag = <<CHOOSE_FROM_SUBDIR; |
<state name="CHOOSE_FROM_SUBDIR" title="Select Files"> |
<state name="CHOOSE_FROM_SUBDIR" title="Select File(s) from <b><small>$subdir</small></b> to print"> |
<message>Select problems you wish to print from <b>$subdir</b></message> |
<message>(mark them then click "next" button) <br /></message> |
<files variable="FILES" multichoice='1'> |
<files variable="FILES" multichoice='1'> |
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<filechoice>return '$subdir';</filechoice> |
<filechoice>return '$subdir';</filechoice> |
Line 1872 CHOOSE_FROM_SUBDIR
|
Line 1854 CHOOSE_FROM_SUBDIR
|
} |
} |
|
|
# Generate the first state, to select which resources get printed. |
# Generate the first state, to select which resources get printed. |
Apache::lonhelper::state->new("START", "Selecting Resources to Print"); |
Apache::lonhelper::state->new("START", "What do you want to print? Make a choice."); |
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash->{MESSAGE_TEXT} = "What do you want to print?"; |
$paramHash->{MESSAGE_TEXT} = ""; |
Apache::lonhelper::message->new(); |
Apache::lonhelper::message->new(); |
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash->{'variable'} = 'PRINT_TYPE'; |
$paramHash->{'variable'} = 'PRINT_TYPE'; |
Line 1969 sub render {
|
Line 1951 sub render {
|
|
|
$result .= <<STATEHTML; |
$result .= <<STATEHTML; |
|
|
<p>How should the printing be formatted?</p> |
<p><big><i><b>What page format do you prefer?</b></i></big></p> |
<table cellpadding="3"> |
<table cellpadding="3"> |
<tr> |
<tr> |
<td align="center"><b>Layout</b></td> |
<td align="center"><b>Page layout</b></td> |
<td align="center"><b>Columns</b></td> |
<td align="center"><b>Number of columns</b></td> |
<td align="center"><b>Paper type</b></td> |
<td align="center"><b>Paper type</b></td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td> |
<td> |
<input type="radio" name="${var}.layout" value="L" checked='1' /> Landscape<br /> |
<input type="radio" name="${var}.layout" value="L" /> Landscape<br /> |
<input type="radio" name="${var}.layout" value="P" /> Portrait |
<input type="radio" name="${var}.layout" value="P" checked='1' /> Portrait |
</td> |
</td> |
<td> |
<td align="center"> |
<select name="${var}.cols"> |
<select name="${var}.cols"> |
STATEHTML |
STATEHTML |
|
|