[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /publisher lonpublisher.pm

raeburn raeburn@source.lon-capa.org
Thu, 13 Aug 2009 05:35:34 -0000


raeburn		Thu Aug 13 05:35:34 2009 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/publisher	lonpublisher.pm 
  Log:
  - Backport 1.261 and part of 1.262.  
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.258 loncom/publisher/lonpublisher.pm:1.258.2.1
--- loncom/publisher/lonpublisher.pm:1.258	Thu May 14 11:13:49 2009
+++ loncom/publisher/lonpublisher.pm	Thu Aug 13 05:35:33 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.258 2009/05/14 11:13:49 bisitz Exp $
+# $Id: lonpublisher.pm,v 1.258.2.1 2009/08/13 05:35:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1641,7 +1641,8 @@
         my $srcf=$2;
         my $srct=$3;
         my $srcd=$1;
-        unless ($srcd=~/^\/home\/httpd\/html\/res/) {
+        my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'};
+        unless ($srcd=~/^\Q$docroot\E\/res/) {
             print $logfile "\nPANIC: Target dir is ".$srcd;
             $r->print(
 	 "<span class=\"LC_error\">".&mt('Invalid target directory, FAIL')."</span>");
@@ -1769,14 +1770,15 @@
         my $thissrcdir=$thissrc;
         $thissrcdir=~s/\/[^\/]+$/\//;
         
-        
-        $r->print(
-           '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
-           &mt('View Published Version').'</font></a>'.
-           '<p><a href="'.$thissrc.'"><font size="+2">'.
+        unless ($env{'request.role'} =~ /^aa/) {
+            $r->print(
+               '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
+               $&mt('View Published Version').'</font></a>');
+        }
+        $r->print('<p><a href="'.$thissrc.'"><font size="+2">'.
 		  &mt('Back to Source').'</font></a></p>'.
-           '<p><a href="'.$thissrcdir.
-                   '"><font size="+2">'.
+                  '<p><a href="'.$thissrcdir.
+                  '"><font size="+2">'.
 		  &mt('Back to Source Directory').'</font></a></p>');
     }
     return 1;