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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 11 May 2004 06:37:39 -0000


albertel		Tue May 11 02:37:39 2004 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - correct links for /uploaded style documents.
  
  - correct links for /showdoc/ing of /uploaded files
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.126 loncom/interface/londocs.pm:1.127
--- loncom/interface/londocs.pm:1.126	Tue May 11 02:12:45 2004
+++ loncom/interface/londocs.pm	Tue May 11 02:37:39 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.126 2004/05/11 06:12:45 albertel Exp $
+# $Id: londocs.pm,v 1.127 2004/05/11 06:37:39 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -585,6 +585,17 @@
 	   &Apache::lonnet::declutter($url));
 	(undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
 	$url=&Apache::lonnet::clutter($url);
+	if ($url=~/^\/*uploaded\//) {
+	    $url=~/\.(\w+)$/;
+	    my $embstyle=&Apache::loncommon::fileembstyle($1);
+	    if (($embstyle eq 'img') || ($embstyle eq 'emb')) {
+		$url='/adm/wrapper'.$url;
+	    } elsif ($embstyle eq 'ssi') {
+		#do nothing with these
+	    } elsif ($url!~/\.(sequence|page)$/) {
+		$url='/adm/coursedocs/showdoc'.$url;
+	    }
+	}
 	$url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
     }
     my $parameterset=' ';
@@ -1048,7 +1059,7 @@
 	$ENV{'form.folder'}=pop(@folderpath);
     } 
     if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
-       $showdoc=$1;
+       $showdoc='/'.$1;
     }
     unless ($showdoc) { # got called from remote
        $forcestandard=($ENV{'form.folder'}=~/^default_/);