[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm /lonnet/perl lonnet.pm rat lonpage.pm

raeburn raeburn at source.lon-capa.org
Fri Nov 30 15:48:34 EST 2012


raeburn		Fri Nov 30 20:48:34 2012 EDT

  Modified files:              
    /rat	lonpage.pm 
    /loncom/interface	lonprintout.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Support use of external resources in uploaded .page ("Composite page")
    via iframes. 
  
  
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.98 rat/lonpage.pm:1.99
--- rat/lonpage.pm:1.98	Fri Nov 30 18:16:53 2012
+++ rat/lonpage.pm	Fri Nov 30 20:48:20 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.98 2012/11/30 18:16:53 raeburn Exp $
+# $Id: lonpage.pm,v 1.99 2012/11/30 20:48:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -227,6 +227,7 @@
                   my %ssialink=();
      
                   my %cellemb=();
+                  my %cellexternal=();
 
                   my $allscript='';
                   my $allmeta='';
@@ -244,13 +245,20 @@
                       $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
                       foreach (@colcont) {
                           my $src=$hash{'src_'.$_};
-			  my ($extension)=($src=~/\.(\w+)$/);
+                          my ($extension)=($src=~/\.(\w+)$/);
+			  $cellexternal{$_}=($hash{'ext_'.$_} eq 'true:');
 			  if ($hash{'encrypted_'.$_}) {
 			      $src=&Apache::lonenc::encrypted($src);
 			  }
                           $cellemb{$_}=
 			      &Apache::loncommon::fileembstyle($extension);
-                          if ($cellemb{$_} eq 'ssi') {
+                          if ($cellexternal{$_}) {
+                              unless (($target eq 'tex') || ($target eq 'tex_answer')) {
+                                  $ssibody{$_} = <<ENDEXT;
+<iframe src="$src" width="100%">No iframe support!</iframe>
+ENDEXT
+                              }
+                          } elsif ($cellemb{$_} eq 'ssi') {
 # --------------------------------------------------------- This is an SSI cell
 			      my ($mapid,$resid)=split(/\./,$_);
 			      my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$src);
@@ -477,7 +485,7 @@
 			    unless (($target eq 'tex') || ($target eq 'tex_answer')) {
 				$r->print('<td colspan="'.$avespan.'"');
 			    }
-                              if ($cellemb{$rid} eq 'ssi') {
+                              if (($cellemb{$rid} eq 'ssi') || ($cellexternal{$rid})) {
 				  unless (($target eq 'tex') || ($target eq 'tex_answer')) {
 				      if ($ssibgcolor{$rid}) {
 					  $r->print(' bgcolor="'.
@@ -499,7 +507,10 @@
 				      }             
 				      $r->print('>');
 				  }
-                                  $r->print($ssibody{$rid});	
+                                  unless (($cellexternal{$rid}) && 
+                                          ($target eq 'tex') && ($target eq 'tex_answer')) {
+                                      $r->print($ssibody{$rid});
+                                  }
 				  unless (($target eq 'tex') || ($target eq 'tex_answer')) {
 				      $r->print('</font>');
                                   }
@@ -595,6 +606,7 @@
 	$esrc=&Apache::lonenc::encrypted($esrc);
     }
     if ($hash->{'src_'.$rid} !~ m-^/uploaded/-
+        && $hash->{'src_'.$rid} !~ m{^https?://}
 	&& !$env{'request.enc'}
 	&& ($env{'request.role.adv'}
 	    || !$hash->{'encrypted_'.$rid})) { 
@@ -603,7 +615,8 @@
 	    '<img src="/adm/lonMisc/cat_button.png" class="LC_icon" />'.
 	    '</a>';
     }
-    if ($hash->{'src_'.$rid} !~ m{^/uploaded/}) {
+    if (($hash->{'src_'.$rid} !~ m{^/uploaded/}) &&
+        ($hash->{'src_'.$rid} !~ m{^https?://})) {
         $metainfo .= '<a href="/adm/evaluate?postdata='.
 	    &escape($esrc).
 	    '" target="LONcatInfo">'.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.623 loncom/interface/lonprintout.pm:1.624
--- loncom/interface/lonprintout.pm:1.623	Fri Nov 30 20:38:01 2012
+++ loncom/interface/lonprintout.pm	Fri Nov 30 20:48:27 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.623 2012/11/30 20:38:01 raeburn Exp $
+# $Id: lonprintout.pm,v 1.624 2012/11/30 20:48:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2140,6 +2140,8 @@
 	    my @page_resources = $navmap->retrieveResources($resource_src);
 	    $result           .= &print_page_in_course($helper, $rparmhash, 
 						       $resource_src, \@page_resources);
+        } elsif ($resource->ext()) {
+            $result .= &unsupported($currentURL,$mode,$symb);
 	}
 	# these resources go through the XML transformer:
 
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1203 loncom/lonnet/perl/lonnet.pm:1.1204
--- loncom/lonnet/perl/lonnet.pm:1.1203	Fri Nov 30 16:50:30 2012
+++ loncom/lonnet/perl/lonnet.pm	Fri Nov 30 20:48:34 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1203 2012/11/30 16:50:30 raeburn Exp $
+# $Id: lonnet.pm,v 1.1204 2012/11/30 20:48:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -10504,10 +10504,21 @@
 
     if (tie(%bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
                             &GDBM_READER(),0640)) {
+        my $noclutter;
         if (($thisurl =~ m{^/adm/wrapper/ext/}) || ($thisurl =~ m{^ext/})) {
             $thisurl =~ s/\?.+$//;
+            if ($map =~ m{^uploaded/.+\.page$}) {
+                $thisurl =~ s{^(/adm/wrapper|)/ext/}{http://};
+                $thisurl =~ s{^\Qhttp://https://\E}{https://};
+                $noclutter = 1;
+            }
+        }
+        my $ids;
+        if ($noclutter) {
+            $ids=$bighash{'ids_'.$thisurl};
+        } else {
+            $ids=$bighash{'ids_'.&clutter($thisurl)};
         }
-        my $ids=$bighash{'ids_'.&clutter($thisurl)};
         unless ($ids) {
             my $idkey = 'ids_'.($thisurl =~ m{^/}? '' : '/').$thisurl;  
             $ids=$bighash{$idkey};




More information about the LON-CAPA-cvs mailing list