version 1.155, 2003/05/06 20:50:04
|
version 1.156, 2003/05/07 19:00:56
|
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 1718 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; |
|
|
if (!$resourceTitle) { # if the resource doesn't have a title, use the filename |
# Get the resource name from construction space |
my $url = $helper->{VARS}->{'postdata'}; |
if ($helper->{VARS}->{'construction'}) { |
$resourceTitle = substr($url, rindex($url, '/') + 1); |
$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 |
|
my $url = $helper->{VARS}->{'postdata'}; |
|
$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 defined $helper->{VARS}->{'construction'}) { |
Line 1750 sub printHelper {
|
Line 1774 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 (!defined($helper->{'VARS'}->{'construction'})) { |
# 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 |