--- rat/lonpage.pm 2011/07/28 02:53:33 1.95 +++ rat/lonpage.pm 2014/09/14 15:21:47 1.105 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Page Handler # -# $Id: lonpage.pm,v 1.95 2011/07/28 02:53:33 raeburn Exp $ +# $Id: lonpage.pm,v 1.105 2014/09/14 15:21:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use strict; use Apache::Constants qw(:common :http); use Apache::lonnet; use Apache::loncommon(); +use Apache::lonhtmlcommon; use Apache::lonxml(); use Apache::lonlocal; use Apache::lonmenu; @@ -214,6 +215,10 @@ sub handler { my $lcm=1; my $contents=0; my $nforms=0; + my $nuploads=0; + my %turninpaths; + my %multiresps; + my $turninparent; my %ssibody=(); my %ssibgcolor=(); @@ -223,6 +228,7 @@ sub handler { my %ssialink=(); my %cellemb=(); + my %cellexternal=(); my $allscript=''; my $allmeta=''; @@ -240,18 +246,26 @@ sub handler { $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{$_} = <No iframe support! +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); my $prefix=$_.'_'; + my $idprefix= join('_',($mapid,$resid,'')); my %posthash=('request.prefix' => $prefix, 'LONCAPA_INTERNAL_no_discussion' => 'true', 'symb' => $symb); @@ -352,9 +366,28 @@ sub handler { $nforms++; $output=~s/\]*\>//gsi; $output=~s/\<\/form[^\>]*\>//gsi; + if ($output=~/\]+name\s*=\s*[\'\"]*HWFILE/) { + $nuploads++; + } $output=~ s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi; $output=~ + s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi; + $output=~ + s/(\Q