[LON-CAPA-cvs] cvs: rat / lonpage.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 12 Nov 2004 00:21:14 -0000


albertel		Thu Nov 11 19:21:14 2004 EDT

  Modified files:              
    /rat	lonpage.pm 
  Log:
  - encrypturl works well on .page resources now
  
  
  
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.60 rat/lonpage.pm:1.61
--- rat/lonpage.pm:1.60	Mon Sep 13 21:21:49 2004
+++ rat/lonpage.pm	Thu Nov 11 19:21:14 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.60 2004/09/14 01:21:49 raeburn Exp $
+# $Id: lonpage.pm,v 1.61 2004/11/12 00:21:14 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -232,9 +232,13 @@
                       $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
                       foreach (@colcont) {
                           my $src=$hash{'src_'.$_};
-                          $src=~/\.(\w+)$/;
+			  my ($extension)=($src=~/\.(\w+)$/);
+			  if ($hash{'encrypted_'.$_}) {
+			      $src=&Apache::lonenc::encrypted($src);
+			  }
                           $metalink{$_}=$src.'.meta';
-                          $cellemb{$_}=Apache::loncommon::fileembstyle($1);
+                          $cellemb{$_}=
+			      &Apache::loncommon::fileembstyle($extension);
                           if ($cellemb{$_} eq 'ssi') {
 # --------------------------------------------------------- This is an SSI cell
 			      my $prefix=$_.'_';
@@ -257,8 +261,7 @@
                                }
 			      }
                               my $output=Apache::lonnet::ssi($src,%posthash);
-			      $output=~
-	    s/\/\/ BEGIN LON\-CAPA Internal.+\/\/ END LON\-CAPA Internal\s//gs;
+			      $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+// END LON-CAPA Internal\s*(-->)?\s||gs;
                               if ($target eq 'tex') {
 				  $output =~ s/^([^&]+)\\begin{document}//;
 				  $output =~ s/\\end{document}//;
@@ -397,7 +400,8 @@
 # ------------------------------------------------------------------ Start form
 			  if ($nforms) {
 			      $r->print('<form method="post" action="'.
-					$requrl.'">');
+					&Apache::lonenc::check_encrypt($requrl)
+					.'">');
 			  }
 		      } elsif ($target eq 'tex') {
 			  $r->print('\documentclass{article}
@@ -433,8 +437,12 @@
                                   '<img src="/adm/lonMisc/cat_button.gif" border=0>'.
                                   '</img></a>';
                               }
+			      my $esrc=$hash{'src_'.$rid};
+			      if ($hash{'encrypted_'.$rid}) {
+				  $esrc=&Apache::lonenc::encrypted($esrc);
+			      }
                               $metainfo .= '<a href="/adm/evaluate?postdata='.
-	&Apache::lonnet::escape(&Apache::lonnet::declutter($hash{'src_'.$rid})).
+		    &Apache::lonnet::escape(&Apache::lonnet::declutter($esrc)).
                                   '" target="LONcatInfo">'.
                                   '<img src="/adm/lonMisc/eval_button.gif" border=0>'.
                                   '</img></a>';