\E)/
$1$idprefix$2$3$4/g;
+ $output=~
+ s/(\Q
)/$1$idprefix$2$3$4/g;
+ if ($nuploads) {
+ $output=~
+ s/\<(input[^\>]+name=\"\Q$prefix\EHWFILE[^\>]+)\s*id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\)]*)\>/\<$1 id="$prefix$2" $3\>/gsi;
+ ($turninpaths{$prefix},$multiresps{$prefix}) =
+ &Apache::loncommon::get_turnedin_filepath($symb,$env{'user.name'},$env{'user.domain'});
+ if ($turninparent eq '') {
+ $turninparent = $turninpaths{$prefix};
+ $turninparent =~ s{(/[^/]+)$}{};
+ }
+ }
+ $output=~
+ s/\<((?:input|select)[^\>]+\Qjavascript:setSubmittedPart\E)\(\s*[\'\"]([^\'\"]+)[\'\"]*\s*\)/\<$1('$2','$prefix')/gsi;
+ $output=~
+ s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;
+ unless ($hastimer) {
+ if ($plainsrc =~ /$LONCAPA::assess_re/) {
+ %Apache::lonhomework::history =
+ &Apache::lonnet::restore($symb,$courseid,$domain,$name);
+ my $type = 'problem';
+ if ($extension eq 'task') {
+ $type = 'Task';
+ }
+ my ($status,$accessmsg,$slot_name,$slot) =
+ &Apache::lonhomework::check_slot_access('0',$type,$symb);
+ undef(%Apache::lonhomework::history);
+ my $probstatus = &Apache::lonnet::EXT("resource.0.problemstatus",$symb);
+ if (($status eq 'CAN_ANSWER') || (($status eq 'CANNOT_ANSWER') &&
+ (($probstatus eq 'no') || ($probstatus eq 'no_feedback_ever')))) {
+ my ($slothastime,$timerhastime);
+ if ($slot_name ne '') {
+ if (ref($slot) eq 'HASH') {
+ if (($slot->{'starttime'} < $now) &&
+ ($slot->{'endtime'} > $now)) {
+ $slothastime = $now - $slot->{'endtime'};
+ }
+ }
+ }
+ my $duedate = &Apache::lonnet::EXT("resource.0.duedate",$symb);
+ my @interval=&Apache::lonnet::EXT("resource.0.interval",$symb);
+ if (@interval > 1) {
+ my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);
+ if ($first_access > 0) {
+ my $timeremains = $first_access+$interval[0] - $now;
+ if ($timeremains > 0) {
+ $timerhastime = $timeremains;
+ }
+ }
+ }
+ if (($duedate && $duedate > $now) ||
+ (!$duedate && $timerhastime > 0) ||
+ ($slot_name ne '' && $slothastime)) {
+ if ((@interval > 1 && $timerhastime) ||
+ ($type eq 'Task' && $slothastime)) {
+ $countdowndisp{$symb} = 'inline';
+ if ((@interval > 1) && ($timerhastime)) {
+ $hastimeleft{$symb} = $timerhastime;
+ } else {
+ $hastimeleft{$symb} = $slothastime;
+ }
+ } else {
+ $hastimeleft{$symb} = $duedate - $now;
+ $countdowndisp{$symb} = 'none';
+ }
+ }
+ }
+ }
+ }
+ }
+ $thisdir=~s/\/[^\/]*$//;
+ foreach (@rlinks) {
+ unless (($_=~/^https?\:\/\//i) ||
+ ($_=~/^\//) ||
+ ($_=~/^javascript:/i) ||
+ ($_=~/^mailto:/i) ||
+ ($_=~/^\#/)) {
+ my $newlocation=
+ &Apache::lonnet::hreflocation($thisdir,$_);
+ $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
+ }
+ }
+# -------------------------------------------------- Deal with Applet codebases
+ $output=~s/(\ |