[LON-CAPA-cvs] cvs: loncom /interface filetypes.tab /lonnet/perl lonnet.pm rat lonuserstate.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 10 Jan 2006 21:41:40 -0000


albertel		Tue Jan 10 16:41:40 2006 EDT

  Modified files:              
    /loncom/interface	filetypes.tab 
    /rat	lonuserstate.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - reverting back to using /adm/coursedocs/showdoc/ to display all unk style resources
  - adding new embed style 'wrp' to force /adm/wrapper/ing of 'wrp' files
  - symbs don't include /adm/wrapper/ or /adm/coursedocs/showdoc/
  - decluttered urls don't include /adm/wrapper/ or /adm/coursedocs/showdoc/
  - cluttered urls _do_ include /adm/wrapper/ or /adm/coursedocs/showdoc/
  
  
  
Index: loncom/interface/filetypes.tab
diff -u loncom/interface/filetypes.tab:1.24 loncom/interface/filetypes.tab:1.25
--- loncom/interface/filetypes.tab:1.24	Wed Apr  6 22:03:33 2005
+++ loncom/interface/filetypes.tab	Tue Jan 10 16:41:16 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # file extension description file
 #
-# $Id: filetypes.tab,v 1.24 2005/04/07 02:03:33 albertel Exp $
+# $Id: filetypes.tab,v 1.25 2006/01/10 21:41:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -42,6 +42,16 @@
 # 
 #    unk          "Unknown" embedding - use the default "unknown.gif" icon
 #    hdn          "Hidden" embedding - reserved internally for LON-CAPA
+#    ign          "Ignore" embedding -
+#    emb          "Embed" embedding - normally /adm/wrapper but when
+#                                      in a .page use <embed> to include it
+#    img          "Image" embedding - normally /adm/wrapper but when
+#                                      in a .page use <img> to include it
+#    wrp          "Wrap" - display using /adm/wrapper 
+#    prv          "Private" - like ssi, but always published private
+#    rat          "rat" - ?
+#    ssi          "Serve Side Include" - embeded by calling 
+#                                        &Apache::lonnet::ssi()
 #
 # Note on embedding values note given above:  Check the source to see
 # what happens with the embedding values, don't assume that this documentation
@@ -1962,7 +1972,7 @@
 pda             unk     Bitmap Graphic
 pdb             unk     Protein Data Base file
 pdd             unk     Adobe PhotoDeluxe Image
-pdf             ign     Printer Description
+pdf             wrp     Printer Description
 pdg             unk     PrintShop Deluxe File
 pdi             unk     MS Powerpoint File
 pdl             unk     Borland C++ Project Description Language
@@ -3238,7 +3248,7 @@
 jpg		img	JPEG Image Document
 eps		ign	Encapsulated Postscript Document
 jpeg		img	JPEG Image Document
-pdf		ign	Portable Data Format Document
+pdf		wrp	Portable Data Format Document
 tex		ssi	TeX Document
 txt		emb	Text (Plain) Document
 text		emb	Text (Plain) Document
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.98 rat/lonuserstate.pm:1.99
--- rat/lonuserstate.pm:1.98	Tue Nov 15 13:27:52 2005
+++ rat/lonuserstate.pm	Tue Jan 10 16:41:29 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construct and maintain state and binary representation of course for user
 #
-# $Id: lonuserstate.pm,v 1.98 2005/11/15 18:27:52 albertel Exp $
+# $Id: lonuserstate.pm,v 1.99 2006/01/10 21:41:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -166,8 +166,7 @@
                         } elsif ($turi=~/^\/*uploaded\//) { # uploaded
 			    if (($embstyle eq 'img') 
 				|| ($embstyle eq 'emb')
-				|| ($embstyle eq 'ign')
-				|| ($embstyle eq 'unk')) {
+				|| ($embstyle eq 'wrp')) {
                                 $turi='/adm/wrapper'.$turi;
 			    } elsif ($embstyle eq 'ssi') {
 				#do nothing with these
@@ -178,7 +177,9 @@
 			    my $mapdir=$uri;
 			    $mapdir=~s/[^\/]+$//;
 			    $turi=&Apache::lonnet::hreflocation($mapdir,$turi);
-			    if (($embstyle eq 'img') || ($embstyle eq 'emb')) {
+			    if (($embstyle eq 'img') 
+				|| ($embstyle eq 'emb')
+				|| ($embstyle eq 'wrp')) {
 				$turi='/adm/wrapper'.$turi;
 			    }
                         }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.693 loncom/lonnet/perl/lonnet.pm:1.694
--- loncom/lonnet/perl/lonnet.pm:1.693	Tue Jan 10 11:08:10 2006
+++ loncom/lonnet/perl/lonnet.pm	Tue Jan 10 16:41:39 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.693 2006/01/10 16:08:10 albertel Exp $
+# $Id: lonnet.pm,v 1.694 2006/01/10 21:41:39 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3412,7 +3412,8 @@
     my $filename=$uriparts[$#uriparts];
     my $pathname=$uri;
     $pathname=~s|/\Q$filename\E$||;
-    $pathname=~s/^adm\/wrapper\///;    
+    $pathname=~s/^adm\/wrapper\///;
+    $pathname=~s/^adm\/coursedocs\/showdoc\///;
     #Trying to find the conditional for the file
     my $match=($env{'acc.res.'.$env{'request.course.id'}.'.'.$pathname}=~
 	       /\&\Q$filename\E\:([\d\|]+)\&/);
@@ -5036,7 +5037,8 @@
     # if it is a non metadata possible uri return quickly
     if (($uri eq '') || 
 	(($uri =~ m|^/*adm/|) && 
-	     ($uri !~ m|^adm/includes|) && ($uri !~ m|/bulletinboard$|)) ||
+	     ($uri !~ m|^adm/includes|) && ($uri !~ m|/bulletinboard$|)
+	  && ($uri !~ m|^adm/coursedocs/|) && ($uri !~ m|^adm/wrapper/|)) ||
         ($uri =~ m|/$|) || ($uri =~ m|/.meta$|) || ($uri =~ /^~/) ||
 	($uri =~ m|home/[^/]+/public_html/|)) {
 	return undef;
@@ -5354,6 +5356,7 @@
     my $thisfn=$thisurl;
 # wrapper not part of symbs
     $thisfn=~s/^\/adm\/wrapper//;
+    $thisfn=~s/^\/adm\/coursedocs\/showdoc\///;
     $thisfn=&declutter($thisfn);
 # direct jump to resource in page or to a sequence - will construct own symbs
     if ($thisfn=~/\.(page|sequence)$/) { return 1; }
@@ -5408,6 +5411,7 @@
 # remove wrapper
 
     $symb=~s/(\_\_\_\d+\_\_\_)adm\/wrapper\/(res\/)*/$1/;
+    $symb=~s/(\_\_\_\d+\_\_\_)adm\/coursedocs\/showdoc\/(res\/)*/$1/;
     return $symb;
 }
 
@@ -6142,6 +6146,8 @@
     $thisfn=~s/^\///;
     $thisfn=~s/^res\///;
     $thisfn=~s/\?.+$//;
+    $thisfn=~s|adm/wrapper/||;
+    $thisfn=~s|adm/coursedocs/showdoc/||;
     return $thisfn;
 }
 
@@ -6152,6 +6158,20 @@
     unless ($thisfn=~/^\/(uploaded|editupload|adm|userfiles|ext|raw|priv|public)\//) { 
        $thisfn='/res'.$thisfn; 
     }
+    if ($thisfn !~m|/adm|) {
+	my ($ext) = ($thisfn =~ /\.(\w+)$/);
+	my $embstyle=&Apache::loncommon::fileembstyle($ext);
+	if (($embstyle eq 'img') 
+	    || ($embstyle eq 'emb')
+	    || ($embstyle eq 'wrp')) {
+	    $thisfn='/adm/wrapper'.$thisfn;
+	} elsif ($embstyle eq 'ssi') {
+	    #do nothing with these
+	} elsif ($thisfn!~/\.(sequence|page)$/) {
+	    $thisfn='/adm/coursedocs/showdoc'.$thisfn;
+	}
+    }
+
     return $thisfn;
 }