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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Thu, 11 Oct 2007 22:49:50 -0000


albertel		Thu Oct 11 18:49:50 2007 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm printout.pl lonprintout.pm 
  Log:
  - BUG#5397, eliminate the extra 'Return to last resource' link in prt mode 
    (and enable the standard 'return to resource link') preserver the 
    extra return link for use soley in construction space and update the text 
    to say this
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.227 loncom/interface/lonmenu.pm:1.228
--- loncom/interface/lonmenu.pm:1.227	Tue Sep 11 19:37:58 2007
+++ loncom/interface/lonmenu.pm	Thu Oct 11 18:49:49 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.227 2007/09/11 23:37:58 albertel Exp $
+# $Id: lonmenu.pm,v 1.228 2007/10/11 22:49:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -121,9 +121,7 @@
 	    $navmaps=(<<ENDNAV);
 <a href="/adm/navmaps?postdata=$escurl&amp;postsymb=$escsymb" target="_top">$lt{'nav'}</a>
 ENDNAV
-            if (($env{'request.noversionuri'}=~/^\/adm\//) &&
-         ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
-         ($env{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
+            if (&show_return_link()) {
                 my $escreload=&escape('return:');
                 $reloadlink=(<<ENDRELOAD);
 <a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a>
@@ -196,7 +194,7 @@
 	    $navmaps=(<<ENDNAV);
 <td><a href="$link" target="_top">$lt{'nav'}</a></td>
 ENDNAV
-my $is_group = (&Apache::loncommon::course_type() eq 'Group');
+            my $is_group = (&Apache::loncommon::course_type() eq 'Group');
 	    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
                 my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'};
 		$docs=(<<ENDDOCS);
@@ -208,16 +206,11 @@
 <td><a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></td>
 ENDGROUPS
             }
-	    if (
-		($env{'request.noversionuri'}=~m[^/(res|public)/] &&
-		 $env{'request.symb'} eq '')
-		||
-		(($env{'request.noversionuri'}=~/^\/adm\//) &&
-		 ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
-		 ($env{'request.noversionuri'}!~
-		        m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
-		  )
-		 ) {
+	    foreach my $key (sort(keys(%env))) {
+		next if ($key !~ /^request/);
+		&Apache::lonnet::logthis("$key =>".$env{$key});
+	    }
+	    if (&show_return_link()) {
                 my $escreload=&escape('return:');
                 $reloadlink=(<<ENDRELOAD);
 <td><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></td>
@@ -274,6 +267,19 @@
     }
 }
 
+sub show_return_link {
+    return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
+	     $env{'request.symb'} eq '')
+	    ||
+	    ($env{'request.noversionuri'}=~ m{^/cgi-bin/printout.pl})
+	    ||
+	    (($env{'request.noversionuri'}=~/^\/adm\//) &&
+	     ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
+	     ($env{'request.noversionuri'}!~
+	      m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
+	     ));
+}
+
 # ====================================== This gets called in the header section
 
 sub registerurl {
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.127 loncom/interface/printout.pl:1.128
--- loncom/interface/printout.pl:1.127	Fri Sep 21 17:11:20 2007
+++ loncom/interface/printout.pl	Thu Oct 11 18:49:49 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
 #
-# $Id: printout.pl,v 1.127 2007/09/21 21:11:20 albertel Exp $
+# $Id: printout.pl,v 1.128 2007/10/11 22:49:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -166,7 +166,7 @@
 my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')};
  &Apache::lonlocal::get_language_handle();
  &Apache::loncommon::content_type(undef,'text/html');
-
+$env{'request.noversionuri'} = '/cgi-bin/printout.pl';
   print(&Apache::loncommon::start_page('Creating PDF'));
 
   my $identifier = $ENV{'QUERY_STRING'};
@@ -187,9 +187,10 @@
   if ($student_names=~/_END_/) {  
       @names_pack=split(/_ENDPERSON_/,$student_names);
   }
-
-print "<a href=\"$backref\"><b>Return</b></a> to last resource.<br /><br />";
-
+  if ($backref) {
+      print('<p>'.&mt("[_1]Return[_2] to editing resource.",
+		      "<a href=\"$backref\"><b>","</b></a>").'</p>');
+  }
   my $figfile = $texfile;
   $figfile =~ s/^(.*_printout)_\d+_\d+_\d+\.tex/$1\.dat/;
   my $duefile = $texfile;
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.509 loncom/interface/lonprintout.pm:1.510
--- loncom/interface/lonprintout.pm:1.509	Sat Sep  8 19:41:49 2007
+++ loncom/interface/lonprintout.pm	Thu Oct 11 18:49:49 2007
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.509 2007/09/08 23:41:49 albertel Exp $
+# $Id: lonprintout.pm,v 1.510 2007/10/11 22:49:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1969,10 +1969,7 @@
     }
 
     my $URLback=''; #link to original document
-    if ($helper->{'VARS'}->{'construction'} ne '1') {
-	#prints published resource
-	$URLback=&escape('/adm/flip?postdata=return:');
-    } else {
+    if ($helper->{'VARS'}->{'construction'} eq '1') {
 	#prints resource from the construction space
 	$URLback='/'.$helper->{'VARS'}->{'filename'};
 	if ($URLback=~/([^?]+)/) {