[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Wed, 07 May 2003 19:00:56 -0000
bowersj2 Wed May 7 15:00:56 2003 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Merging some stuff between me and Alex.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.155 loncom/interface/lonprintout.pm:1.156
--- loncom/interface/lonprintout.pm:1.155 Tue May 6 16:50:04 2003
+++ loncom/interface/lonprintout.pm Wed May 7 15:00:56 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.155 2003/05/06 20:50:04 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.156 2003/05/07 19:00:56 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1689,14 +1689,28 @@
my $helper = Apache::lonhelper::helper->new("Printing Wizard");
$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
# 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'});
- }
+ # Detect whether we're coming from construction space
+ if ($ENV{'form.postdata'} =~ /http:\/\// ) {
+ $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'}) {
$helper->{VARS}->{'symb'} = $ENV{'form.symb'};
}
@@ -1704,25 +1718,35 @@
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
}
-
my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu;
$helper->{VARS}->{'assignment'} = $sequenceTitle;
+
# Extract map
my $symb = $helper->{VARS}->{'symb'};
- my ($map, $id, $url) = split(/___/, $symb);
- $helper->{VARS}->{'postdata'} = Apache::lonnet::clutter($url);
+ my ($map, $id, $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
- my $url = $helper->{VARS}->{'postdata'};
- $resourceTitle = substr($url, rindex($url, '/') + 1);
+ 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();
- my $subdir = &Apache::lonnet::filelocation("", $url);
-
# "Delete everything after the last slash."
$subdir =~ s|/[^/]+$||;
if (not defined $helper->{VARS}->{'construction'}) {
@@ -1750,12 +1774,15 @@
# the helper by hand.
my $printChoices = [];
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 (not defined $helper->{'VARS'}->{'construction'}) {
+ if (!defined($helper->{'VARS'}->{'construction'})) {
# Allow problems from sequence
push @{$printChoices}, ["Problem(s) from <b>$sequenceTitle</b>", 'map_problems', 'CHOOSE_PROBLEMS'];
# Allow all resources from sequence