Diff for /loncom/interface/lonprintout.pm between versions 1.601 and 1.602

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

Removed from v.1.601  
changed lines
  Added in v.1.602


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>