--- rat/lonpage.pm 2016/10/29 05:29:39 1.119
+++ rat/lonpage.pm 2017/09/29 19:18:18 1.125
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Page Handler
#
-# $Id: lonpage.pm,v 1.119 2016/10/29 05:29:39 raeburn Exp $
+# $Id: lonpage.pm,v 1.125 2017/09/29 19:18:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,6 +42,7 @@ use Apache::lonlocal;
use Apache::lonmenu;
use Apache::lonhomework;
use Apache::lonparmset;
+use Apache::lonenc();
use HTML::TokeParser;
use GDBM_File;
use Apache::lonsequence;
@@ -185,6 +186,7 @@ sub handler {
my $fn=$env{'request.course.fn'};
if (-e "$fn.db") {
my %buttonshide;
+ my $hostname = $r->hostname();
if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {
# ------------------------------------------------------------------- Hash tied
my $firstres=$hash{'map_start_'.$requrl};
@@ -301,6 +303,7 @@ sub handler {
$lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
foreach (@colcont) {
my $src=$hash{'src_'.$_};
+ my $plainsrc = $src;
my ($extension)=($src=~/\.(\w+)$/);
$cellexternal{$_}=($hash{'ext_'.$_} eq 'true:');
if ($hash{'encrypted_'.$_}) {
@@ -441,6 +444,8 @@ ENDEXT
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/(\Qthis.form.elements['\E)(HW(?:VAL|CHK)_[^']+\'\]\.(?:value=\'|checked))/$1$prefix$2/gsi;
if ($hastimer) {
$output=~
s/\<(input[^\>]+name=\Q"$prefix\Eaccessbutton"[^\>]+)(?:\Qdocument.markaccess.submit();\E)([^\>]*)\>/\<$1pageTimer(this.form,'$prefix')$2\>/gsi;
@@ -474,11 +479,11 @@ ENDEXT
$output=~
s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;
unless ($hastimer) {
- if ($src =~ /$LONCAPA::assess_re/) {
+ if ($plainsrc =~ /$LONCAPA::assess_re/) {
%Apache::lonhomework::history =
&Apache::lonnet::restore($symb,$courseid,$domain,$name);
my $type = 'problem';
- if ($src =~ /\.task$/) {
+ if ($extension eq 'task') {
$type = 'Task';
}
my ($status,$accessmsg,$slot_name,$slot) =
@@ -745,7 +750,7 @@ ENDEXT
my $avespan=$lcm/($#colcont+1);
for ($j=0;$j<=$#colcont;$j++) {
my $rid=$colcont[$j];
- my $metainfo =&get_buttons(\%hash,$rid,\%buttonshide).'
';
+ my $metainfo =&get_buttons(\%hash,$rid,\%buttonshide,$hostname).'
';
unless (($target eq 'tex') || ($target eq 'tex_answer')) {
$r->print('