version 1.155, 2003/05/06 20:50:04
|
version 1.162, 2003/05/12 18:47:07
|
Line 1363 ENDPART
|
Line 1363 ENDPART
|
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; |
if (not defined $helper->{'VARS'}->{'construction'}) { |
if ($helper->{'VARS'}->{'construction'} ne '1') { |
|
#prins published resource |
$currentURL=$helper->{'VARS'}->{'postdata'}; |
$currentURL=$helper->{'VARS'}->{'postdata'}; |
} else { |
} else { |
$currentURL=$helper->{'VARS'}->{'construction'}; |
#prins resource from the construction space |
|
$currentURL=$helper->{'VARS'}->{'filename'}; |
|
$currentURL=~s/\/home\//\/~/; |
|
$currentURL=~s/public_html\///; |
} |
} |
$selectionmade = 1; |
$selectionmade = 1; |
if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { |
if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { |
my %moreenv; |
my %moreenv; |
$moreenv{'form.grade_target'}='tex'; |
$moreenv{'form.grade_target'}='tex'; |
if (&Apache::lonnet::allowed('bre',$currentURL)) { |
$moreenv{'request.filename'}=$currentURL; |
$currentURL=~s/http:\/\/[^\/]+//; |
$moreenv{'form.textwidth'}=$LaTeXwidth; |
} |
&Apache::lonnet::appenv(%moreenv); |
$moreenv{'request.filename'}=$currentURL; |
my $texversion=&Apache::lonnet::ssi($currentURL); |
$moreenv{'form.textwidth'}=$LaTeXwidth; |
&Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter'); |
&Apache::lonnet::appenv(%moreenv); |
$result .= $texversion; |
my $texversion=&Apache::lonnet::ssi($currentURL); |
if ($currentURL=~m/\.page\s*$/) { |
&Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter'); |
($result,$number_of_columns) = &page_cleanup($result); |
$result .= $texversion; |
} |
if ($currentURL=~m/\.page\s*$/) { |
} else { |
($result,$number_of_columns) = &page_cleanup($result); |
|
} |
|
} else { |
|
# $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: '; |
# $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: '; |
# if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) { |
# if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) { |
# $result.=$1; |
# $result.=$1; |
Line 1392 ENDPART
|
Line 1393 ENDPART
|
# $result.=$ENV{'form.url'}; |
# $result.=$ENV{'form.url'}; |
# } |
# } |
# $result.=' \end{document}' |
# $result.=' \end{document}' |
} |
} |
|
|
|
|
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or |
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')) { |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')) { |
Line 1583 sub handler {
|
Line 1582 sub handler {
|
$helper = $result; |
$helper = $result; |
|
|
|
|
# my $key; |
|
# foreach $key (keys %{$helper->{'VARS'}}) { |
my $key; |
# $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<br />'); |
foreach $key (keys %{$helper->{'VARS'}}) { |
# } |
$r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-<br />'); |
# return OK; |
} |
|
return OK; |
|
|
|
|
&output_data_new($r,$helper); |
&output_data_new($r,$helper); |
Line 1689 sub printHelper {
|
Line 1689 sub printHelper {
|
|
|
my $helper = Apache::lonhelper::helper->new("Printing Wizard"); |
my $helper = Apache::lonhelper::helper->new("Printing Wizard"); |
$helper->declareVar('symb'); |
$helper->declareVar('symb'); |
$helper->declareVar('postdata'); |
$helper->declareVar('postdata'); |
|
$helper->declareVar('filename'); |
|
$helper->declareVar('construction'); |
|
|
# This will persistently load in the data we want from the |
# This will persistently load in the data we want from the |
# very first screen. |
# very first screen. |
if ($ENV{'form.postdata'}) { |
# Detect whether we're coming from construction space |
if ($ENV{'form.postdata'}!~/\/res\//) {$helper->{VARS}->{'construction'} = $ENV{'form.postdata'};} |
if ($ENV{'form.postdata'} =~ /http:\/\// ) { |
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($ENV{'form.postdata'}); |
$ENV{'form.postdata'} =~ /http:\/\/[a-zA-Z.]+\/~([a-zA-Z0-9]+)\/(.*)/; |
|
$helper->{VARS}->{'filename'} = "/home/$1/public_html/$2"; |
|
$helper->{VARS}->{'construction'} = 1; |
|
} else { |
|
if ($ENV{'form.postdata'}) { |
|
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($ENV{'form.postdata'}); |
|
} |
|
if ($ENV{'form.symb'}) { |
|
$helper->{VARS}->{'symb'} = $ENV{'form.symb'}; |
|
} |
|
if ($ENV{'form.url'}) { |
|
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'}); |
|
} |
} |
} |
|
|
if ($ENV{'form.symb'}) { |
if ($ENV{'form.symb'}) { |
$helper->{VARS}->{'symb'} = $ENV{'form.symb'}; |
$helper->{VARS}->{'symb'} = $ENV{'form.symb'}; |
} |
} |
Line 1704 sub printHelper {
|
Line 1719 sub printHelper {
|
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'}); |
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'}); |
|
|
} |
} |
|
|
|
|
my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu; |
my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu; |
$helper->{VARS}->{'assignment'} = $sequenceTitle; |
$helper->{VARS}->{'assignment'} = $sequenceTitle; |
|
|
|
|
# Extract map |
# Extract map |
my $symb = $helper->{VARS}->{'symb'}; |
my $symb = $helper->{VARS}->{'symb'}; |
my ($map, $id, $url) = split(/___/, $symb); |
my ($map, $id, $url); |
$helper->{VARS}->{'postdata'} = Apache::lonnet::clutter($url); |
my $subdir; |
|
|
|
# Get the resource name from construction space |
|
if ($helper->{VARS}->{'construction'}) { |
|
$resourceTitle = substr($helper->{VARS}->{'filename'}, |
|
rindex($helper->{VARS}->{'filename'}, '/')+1); |
|
$subdir = substr($helper->{VARS}->{'filename'}, |
|
0, rindex($helper->{VARS}->{'filename'}, '/') + 1); |
|
} else { |
|
($map, $id, $url) = split(/___/, $symb); |
|
$helper->{VARS}->{'postdata'} = Apache::lonnet::clutter($url); |
|
|
if (!$resourceTitle) { # if the resource doesn't have a title, use the filename |
if (!$resourceTitle) { # if the resource doesn't have a title, use the filename |
my $url = $helper->{VARS}->{'postdata'}; |
my $url = $helper->{VARS}->{'postdata'}; |
$resourceTitle = substr($url, rindex($url, '/') + 1); |
$resourceTitle = substr($url, rindex($url, '/') + 1); |
|
} |
|
$subdir = &Apache::lonnet::filelocation("", $url); |
} |
} |
|
|
Apache::lonhelper::registerHelperTags(); |
Apache::lonhelper::registerHelperTags(); |
|
|
my $subdir = &Apache::lonnet::filelocation("", $url); |
|
|
|
# "Delete everything after the last slash." |
# "Delete everything after the last slash." |
$subdir =~ s|/[^/]+$||; |
$subdir =~ s|/[^/]+$||; |
if (not defined $helper->{VARS}->{'construction'}) { |
if (not $helper->{VARS}->{'construction'}) { |
$subdir = '/home/httpd/html/res'.$subdir; |
$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 |
# What can be printed is a very dynamic decision based on |
Line 1750 sub printHelper {
|
Line 1768 sub printHelper {
|
# the helper by hand. |
# the helper by hand. |
my $printChoices = []; |
my $printChoices = []; |
my $paramHash; |
my $paramHash; |
# We can always print the current screen. |
|
|
|
push @{$printChoices}, ["Current resource <b>$resourceTitle</b> (prints what you just saw on the screen)", 'current_document', 'PAGESIZE']; |
if ($resourceTitle) { |
|
push @{$printChoices}, ["<b>$resourceTitle</b> (prints what you just saw on the screen)", 'current_document', 'PAGESIZE']; |
|
} |
|
|
|
$r->print($helper->{VARS}->{'postdata'}); |
|
|
# If we're in a sequence... |
# If we're in a sequence... |
if (not defined $helper->{'VARS'}->{'construction'}) { |
if ($helper->{'VARS'}->{'construction'} ne '1') { |
# Allow problems from sequence |
# Allow problems from sequence |
push @{$printChoices}, ["Problem(s) 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 |
Line 1863 CHOOSE_FROM_SUBDIR
|
Line 1884 CHOOSE_FROM_SUBDIR
|
$helper->declareVar('PRINT_TYPE'); |
$helper->declareVar('PRINT_TYPE'); |
$paramHash->{CHOICES} = $printChoices; |
$paramHash->{CHOICES} = $printChoices; |
Apache::lonhelper::choices->new(); |
Apache::lonhelper::choices->new(); |
|
|
|
if ($ENV{'request.role.adv'}) { |
|
$paramHash = Apache::lonhelper::getParamHash(); |
|
$paramHash->{MESSAGE_TEXT} = "<br /><big><b><i>Next option is available only for advanced users:</i></b></big><br />"; |
|
Apache::lonhelper::message->new(); |
|
$paramHash = Apache::lonhelper::getParamHash(); |
|
$paramHash->{'variable'} = 'ANSWER_TYPE'; |
|
$helper->declareVar('ANSWER_TYPE'); |
|
$paramHash->{CHOICES} = [ |
|
['Print without answer', '1'], |
|
['Print with answers', '0'] ]; |
|
Apache::lonhelper::choices->new(); |
|
} |
|
|
Apache::lonprintout::page_format_state->new("FORMAT"); |
Apache::lonprintout::page_format_state->new("FORMAT"); |
|
|
# Generate the PAGESIZE state which will offer the user the margin |
# Generate the PAGESIZE state which will offer the user the margin |