--- loncom/interface/lonprintout.pm 2003/05/06 13:50:23 1.152 +++ loncom/interface/lonprintout.pm 2003/05/06 20:50:04 1.155 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.152 2003/05/06 13:50:23 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.155 2003/05/06 20:50:04 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1350,24 +1350,6 @@ ENDPART } my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format_new($papersize,$laystyle,$numberofcolumns); 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; if ($textwidth=~/(\d+)\s*cm/) { $LaTeXwidth = $1*10; @@ -1377,15 +1359,14 @@ ENDPART $LaTeXwidth = $1*25.4; } $LaTeXwidth.=' mm'; - - + if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') { #-- single document - problem, page, html, xml, ... my $currentURL; - if (defined $helper->{'VARS'}->{'url'}) { - $currentURL=$helper->{'VARS'}->{'url'}; - } else { + if (not defined $helper->{'VARS'}->{'construction'}) { $currentURL=$helper->{'VARS'}->{'postdata'}; + } else { + $currentURL=$helper->{'VARS'}->{'construction'}; } $selectionmade = 1; if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { @@ -1509,6 +1490,7 @@ ENDPART #prints selected problems from the subdirectory $selectionmade = 6; my @list_of_files=split /\|\|\|/, $helper->{'VARS'}->{'FILES'}; + @list_of_files=sort @list_of_files; my $flag_latex_header_remove = 'NO'; for (my $i=0;$i<=$#list_of_files;$i++) { my $urlp = $list_of_files[$i]; @@ -1599,12 +1581,12 @@ sub handler { return $result; } $helper = $result; - - -# my $key; -# foreach $key (keys %{$helper->{'VARS'}}) { -# $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'
'); -# } + + +# my $key; +# foreach $key (keys %{$helper->{'VARS'}}) { +# $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'
'); +# } # return OK; @@ -1712,6 +1694,7 @@ sub printHelper { # This will persistently load in the data we want from the # very first screen. if ($ENV{'form.postdata'}) { + if ($ENV{'form.postdata'}!~/\/res\//) {$helper->{VARS}->{'construction'} = $ENV{'form.postdata'};} $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($ENV{'form.postdata'}); } if ($ENV{'form.symb'}) { @@ -1719,6 +1702,7 @@ sub printHelper { } if ($ENV{'form.url'}) { $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'}); + } @@ -1741,7 +1725,17 @@ sub printHelper { # "Delete everything after the last slash." $subdir =~ s|/[^/]+$||; - $subdir = '/home/httpd/html/res'.$subdir; #needs additional work for the construction space + if (not defined $helper->{VARS}->{'construction'}) { + $subdir = '/home/httpd/html/res'.$subdir; + } else { + $helper->{VARS}->{'construction'}=~/^([^\/]+)\/\/([^\/]+)(.*)\/[^\/]*$/; + $subdir = $3; + $subdir=~/\/~([^\/]+)\/(.*)$/; + $subdir = '/home/'.$1.'/public_html/'.$2; + } +#### $r->print('Dir: '.$subdir.' '); +#### return OK; + # What can be printed is a very dynamic decision based on # lots of factors. So we need to dynamically build this list. @@ -1758,22 +1752,22 @@ sub printHelper { my $paramHash; # We can always print the current screen. - push @{$printChoices}, ["$resourceTitle (exactly what was on the screen)", 'current_document', 'PAGESIZE']; + push @{$printChoices}, ["Current resource $resourceTitle (prints what you just saw on the screen)", 'current_document', 'PAGESIZE']; # If we're in a sequence... - if ($helper->{VARS}->{'postdata'} =~ /\/res\//) { + if (not defined $helper->{'VARS'}->{'construction'}) { # Allow problems from sequence - push @{$printChoices}, ["Problems from $sequenceTitle", 'map_problems', 'CHOOSE_PROBLEMS']; + push @{$printChoices}, ["Problem(s) from $sequenceTitle", 'map_problems', 'CHOOSE_PROBLEMS']; # Allow all resources from sequence - push @{$printChoices}, ["Problems and pages from $sequenceTitle", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML']; + push @{$printChoices}, ["Everything (problem(s), page(s), html/xml file(s)) from $sequenceTitle", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML']; my $isProblem = '$res->is_problem();'; my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; my $isNotMap = '!$res->is_map();'; my $symb = '$res->symb();'; my $helperFragment = < - Select problems to print: + + (mark them then click "next" button)
PAGESIZE return $isProblem @@ -1782,8 +1776,8 @@ sub printHelper {
- - Select resources to print: + + (mark them then click "next" button)
PAGESIZE return $isNotMap; @@ -1799,15 +1793,15 @@ HELPERFRAGMENT # If the user is priviledged, allow them to print all # 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\//)) { - push @{$printChoices}, ['All problems in course (may take a lot of time)', 'all_problems', 'ALL_PROBLEMS']; + push @{$printChoices}, ['Problems in this course', 'all_problems', 'ALL_PROBLEMS']; push @{$printChoices}, ["Problems from $sequenceTitle for selected students", 'problems_for_students', 'CHOOSE_STUDENTS']; my $isProblem = '$res->is_problem();'; my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; my $symb = '$res->symb();'; &Apache::lonxml::xmlparse($r, 'helper', < - Select problems to print: + + (mark them then click "next" button)
PAGESIZE return $isProblemOrMap @@ -1816,33 +1810,34 @@ HELPERFRAGMENT
- - Select the students you wish to print the problems for: + + (do not forget to select assignment itself - make another selection below)
+
Select resources for the assignment
return $isProblem $map return $symb - How should the results be printed? +
How should the results be printed?
- Print all problems with no blank space between them - Put each student's problems on a new page (add pagefeed after each student) - Seperate each student's problems with a full blank page - Seperate each student's problems with two full blank pages + Print students assignments without separations (as uniform flow) + Start student assignment from new page (add pagefeed after each student) + Add one emty page after each student assignment + Add two emty page after each student assignment
CHOOSE_STUDENTS } # 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)/)) { - push @{$printChoices}, ["Problems from $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; + 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 current subdirectory $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; my $f = '$filename'; my $xmlfrag = < - Select problems you wish to print from $subdir + + (mark them then click "next" button)
PAGESIZE return '$subdir'; @@ -1859,9 +1854,9 @@ CHOOSE_FROM_SUBDIR } # 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->{MESSAGE_TEXT} = "What do you want to print?"; + $paramHash->{MESSAGE_TEXT} = ""; Apache::lonhelper::message->new(); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'PRINT_TYPE'; @@ -1956,19 +1951,19 @@ sub render { $result .= <How should the printing be formatted?

+

What page format do you prefer?

- - + + -
LayoutColumnsPage layoutNumber of columns Paper type
- Landscape
- Portrait + Landscape
+ Portrait
+