[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 21 Aug 2006 22:53:22 -0000


foxr		Mon Aug 21 18:53:22 2006 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Support printing a directory of resource space.. need work now back on 
  directory of course.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.479 loncom/interface/lonprintout.pm:1.480
--- loncom/interface/lonprintout.pm:1.479	Mon Aug 14 18:20:20 2006
+++ loncom/interface/lonprintout.pm	Mon Aug 21 18:53:19 2006
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.479 2006/08/14 22:20:20 foxr Exp $
+# $Id: lonprintout.pm,v 1.480 2006/08/21 22:53:19 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1051,16 +1051,20 @@
 #    my $helpervars = Dumper($helper->{'VARS'});
 #    &Apache::lonnet::logthis("Dump of helper vars:\n $helpervars");
 #}
+#sub dump_env {
+#    my $envvars = Dumper(\%env);
+#    &Apache::lonnet::logthis("Dump of env: \n $envvars");
+#}
 
-sub get_page_breaks  {
-    my ($helper) = @_;
-    my %page_breaks;
-
-    foreach my $break (split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'}) {
-	$page_breaks{$break} = 1;
-    }
-    return %page_breaks;
-}
+#sub get_page_breaks  {
+#    my ($helper) = @_;
+#    my %page_breaks;
+#
+#    foreach my $break (split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'}) {
+#	$page_breaks{$break} = 1;
+#    }
+#    return %page_breaks;
+#}
 
 #  Output a sequence (recursively if neeed)
 #  from construction space.
@@ -2154,7 +2158,6 @@
 	}
 	
     }
-
     
     # This will persistently load in the data we want from the
     # very first screen.
@@ -2193,15 +2196,20 @@
 
     # 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);
-    } elsif ($env{'form.postdata'} =~ /^\/res\//) { # Get resource name from res space.
-	$helper->{VARS}->{'postdata'} = $env{'form.postdata'};
-
-    } elsif (!$helper->{VARS}->{'postdata'}) {
+    } elsif ($env{'form.postdata'} =~ /^\/res\// ) {
+        $subdir = substr($env{'form.postdata'},
+                         0, rindex($env{'form.postdata'}, '/') + 1);
+    } elsif ((defined $helper->{VARS}->{'postdata'}) &&
+	     ($helper->{VARS}->{'postdata'} =~  /^\/res\//)){
+        $subdir = substr($helper->{VARS}->{'postdata'},
+                         0, rindex($helper->{VARS}->{'postdata'}, '/') + 1);
+    } else {     #    (!$helper->{VARS}->{'postdata'}) {
         ($map, $id, $url) = &Apache::lonnet::decode_symb($symb);
         $helper->{VARS}->{'postdata'} = 
 	    &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));
@@ -2220,7 +2228,7 @@
 
     my $userCanSeeHidden = Apache::lonnavmaps::advancedUser();
 
-    Apache::lonhelper::registerHelperTags();
+    &Apache::lonhelper::registerHelperTags();
 
     # "Delete everything after the last slash."
     $subdir =~ s|/[^/]+$||;
@@ -2619,7 +2627,6 @@
     $resource_selector
 CHOOSE_ANON2
 }
-
     # 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