--- rat/lonpage.pm 2017/02/20 18:29:33 1.121 +++ rat/lonpage.pm 2017/09/11 12:30:55 1.124 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Page Handler # -# $Id: lonpage.pm,v 1.121 2017/02/20 18:29:33 raeburn Exp $ +# $Id: lonpage.pm,v 1.124 2017/09/11 12:30:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -185,6 +185,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}; @@ -442,6 +443,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; @@ -746,7 +749,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('{'src_'.$rid}); @@ -951,7 +954,6 @@ sub get_buttons { my ($cfile,$home,$switchserver,$forceedit,$forceview) = &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,$hash->{'src_'.$rid},$symb); if ($cfile ne '') { - my $hostname = $r->hostname(); my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver, $forceedit,1,$symb,undef, &escape($env{'form.title'}),