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

www www at source.lon-capa.org
Sat Nov 5 17:49:26 EDT 2011


www		Sat Nov  5 21:49:26 2011 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Bug #6527 - actually detect that we are in construction space
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.601 loncom/interface/lonprintout.pm:1.602
--- loncom/interface/lonprintout.pm:1.601	Wed Oct 26 02:09:42 2011
+++ loncom/interface/lonprintout.pm	Sat Nov  5 21:49:25 2011
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.601 2011/10/26 02:09:42 www Exp $
+# $Id: lonprintout.pm,v 1.602 2011/11/05 21:49:25 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1808,6 +1808,7 @@
 
 sub print_page_in_course {
     my ($helper, $rparmhash, $currentURL, $resources) = @_;
+
     my %parmhash       = %$rparmhash;
     my @page_resources = @$resources;
     my $mode = $helper->{'VARS'}->{'LATEX_TYPE'};
@@ -1864,8 +1865,10 @@
 	}
 	# these resources go through the XML transformer:
 
-	elsif ($resource_src =~ /\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/)  {		
+	elsif ($resource_src =~ /\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/)  {
+
 	    my $urlp = &Apache::lonnet::clutter($resource_src);
+
 	    my %form;
 	    my %moreenv;
 
@@ -1927,10 +1930,9 @@
 			$texversion.='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm ';
 			$texversion.=&path_to_problem($urlp,$LaTeXwidth);
 		    } else {
-			$texversion.='\vskip 0 mm \noindent\textbf{Prints from construction space - there is no title.}\vskip 0 mm ';
-			my $URLpath=$urlp;
-			#$URLpath=~s/~([^\/]+)/public_html\/$1\/$1/;
-			$texversion.=&path_to_problem($URLpath,$LaTeXwidth);
+			$texversion.='\vskip 0 mm \noindent\textbf{'.
+                        &mt("Printing from Construction Space: No Title").'}\vskip 0 mm ';
+			$texversion.=&path_to_problem($urlp,$LaTeXwidth);
 		    }
 		    $texversion.='\vskip 1 mm '.$answer.'\end{document}';
 		}
@@ -2275,6 +2277,7 @@
 		my $domain       = $env{'user.domain'};	# Constr. space only on local
 		my $user         = $env{'user.name'};
 # FIXME: the substitutions below do not seem to make sense
+
 		$sequence_url    =~ s/^\/res\/$domain/\/home/;
 		$sequence_url    =~ s/^(\/home\/$user)/$1\/public_html/;
 #		$sequence_url    =~ s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
@@ -2335,6 +2338,7 @@
 
 sub output_data {
     my ($r,$helper,$rparmhash) = @_;
+
     my %parmhash = %$rparmhash;
     $ssi_error = 0;		# This will be set nonzero by failing ssi's.
     $resources_printed = '';
@@ -2450,11 +2454,11 @@
 	} else {
 
             #prints resource from the construction space
-	    $currentURL='/'.$helper->{'VARS'}->{'filename'};
-	    if ($currentURL=~/([^?]+)/) {$currentURL=$1;}
+	    $currentURL=$helper->{'VARS'}->{'filename'};
 	    $cleanURL=$currentURL;
 	}
 	$selectionmade = 1;
+      
 	if ($cleanURL!~m|^/adm/|
 	    && $cleanURL=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
 	    my $rndseed=time;
@@ -2494,6 +2498,7 @@
 
 	    if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 	       ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
+
 		$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 		$form{'grade_target'}='answer';
 		$form{'answer_output_mode'}='tex';
@@ -2515,11 +2520,10 @@
 			$texversion.='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm ';
 			$texversion.=&path_to_problem($cleanURL,$LaTeXwidth);
 		    } else {
-			$texversion.='\vskip 0 mm \noindent\textbf{Prints from construction space - there is no title.}\vskip 0 mm ';
-			my $URLpath=$cleanURL;
-# FIXME: unclear URL path, not sure when this would occur
-			$URLpath=~s/~([^\/]+)/public_html\/$1\/$1/;
-			$texversion.=&path_to_problem($URLpath,$LaTeXwidth);
+			$texversion.='\vskip 0 mm \noindent\textbf{'.
+                        &mt("Printing from Construction Space: No Title").'}\vskip 0 mm ';
+
+			$texversion.=&path_to_problem($cleanURL,$LaTeXwidth);
 		    }
 		    $texversion.='\vskip 1 mm '.$answer.'\end{document}';
 		}
@@ -2554,6 +2558,7 @@
             #printing content of sequence from the construction space	
 
 # FIXME: unclear how this would work
+
 	    $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
 	    $result .= &print_construction_sequence($currentURL, $helper, %form,
 						    $LaTeXwidth);
@@ -3475,8 +3480,6 @@
     
     &init_perm();
 
-
-
     my $helper = printHelper($r);
     if (!ref($helper)) {
 	return $helper;
@@ -3640,8 +3643,8 @@
     }
 
     # Detect whether we're coming from construction space
-    if ($env{'form.postdata'}=~/^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/) {
-        $helper->{VARS}->{'filename'} = "~$1/$2";
+    if ($env{'form.postdata'}=~m{^/priv}) {
+        $helper->{VARS}->{'filename'} = $env{'form.postdata'};
         $helper->{VARS}->{'construction'} = 1;
     } else {
         if ($env{'form.postdata'}) {




More information about the LON-CAPA-cvs mailing list