--- loncom/homework/lonhomework.pm 2020/01/15 05:14:17 1.344.2.10.2.1 +++ loncom/homework/lonhomework.pm 2024/07/08 01:13:59 1.344.2.11 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.344.2.10.2.1 2020/01/15 05:14:17 raeburn Exp $ +# $Id: lonhomework.pm,v 1.344.2.11 2024/07/08 01:13:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -850,7 +850,7 @@ STATE sub analyze_header { my ($request) = @_; - my $js = &Apache::structuretags::setmode_javascript(); + my $js = &Apache::lonxml::setmode_javascript(); # Breadcrumbs my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), @@ -1083,7 +1083,7 @@ sub editxmlmode { my $js = &Apache::edit::js_change_detection(). &Apache::loncommon::resize_textarea_js(). - &Apache::structuretags::setmode_javascript(). + &Apache::lonxml::setmode_javascript(). &Apache::lonhtmlcommon::dragmath_js("EditMathPopup"); # Breadcrumbs @@ -1200,7 +1200,7 @@ sub editxmlmode { # Render the page in whatever target desired. # sub renderpage { - my ($request,$file,$targets,$return_string,$donebuttonmsg) = @_; + my ($request,$file,$targets,$return_string) = @_; my @targets = @{$targets || [&get_target()]}; &Apache::lonhomework::showhashsubset(\%env,'form.'); @@ -1251,11 +1251,6 @@ sub renderpage { if ($target eq 'analyze') { $result=&Apache::lonnet::hashref2str(\%Apache::lonhomework::analyze); undef(%Apache::lonhomework::analyze); - } elsif ($target eq 'web') { - if ($donebuttonmsg) { - $result =~ s{}{}; - $result.= &Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($donebuttonmsg,1))."\n"; - } } #my $td=&tv_interval($t0); #if ( $Apache::lonxml::debug) { @@ -1471,70 +1466,6 @@ sub update_construct_style { } } -# -# Sets interval for current user so time left will be zero, either for the entire folder -# containing the current resource, or just the resource, depending on value of first item -# in interval array retrieved from EXT("resource.0.interval"); -# -sub zero_timer { - my ($symb) = @_; - my ($hastimeleft,$first_access,$now); - my @interval=&Apache::lonnet::EXT("resource.0.interval",$symb); - if (@interval > 1) { - if ($interval[1] eq 'course') { - return ('fail',&mt('Ending of timed events not supported for intervals set course-wide')); - } else { - my $now = time; - my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb); - if ($first_access > 0) { - my ($timelimit,$donesuffix) = split(/_/,$interval[0],2); - if ($donesuffix =~ /^done(?:|\:[^\:]+\:)(.*)$/) { - my ($dummy,$proctor,$secret) = split(/_/,$1); - if (($proctor) && ($secret ne '')) { - my $key = $env{'form.LC_interval_done_proctorpass'}; - $key =~ s/^\s+//; - $key =~ s/\s+$//; - if ($env{'form.LC_interval_done_proctorpass'} ne $secret) { - return ('fail', - &mt('Incorrect key entered by proctor')); - } - } - if ($first_access+$timelimit > $now) { - my $done_time = $now - $first_access; - my $snum = 1; - if ($interval[1] eq 'map') { - $snum = 2; - } - my $result = - &Apache::lonparmset::storeparm_by_symb_inner($symb,'0_interval', - $snum,$done_time, - 'date_interval', - $env{'user.name'}, - $env{'user.domain'}); - if ($result eq '') { - # Record action in "User Notes" - &Apache::lonmsg::store_instructor_comment( - 'Pressed Done button for symb:
'.$symb, - $env{'user.name'}, $env{'user.domain'}); - return ('ok'); - } else { - return ('fail',&mt('Error ending timed event: [_1]',$result)); - } - } else { - return ('fail',&mt('Timed event already ended')); - } - } else { - return ('fail',&mt('Timed event can not be ended before the time limit')); - } - } else { - return ('fail',&mt('Timer not yet started for this timed event')); - } - } - } else { - return ('fail',&mt('No timer in use')); - } - return(); -} sub handler { #my $t0 = [&gettimeofday()]; @@ -1591,17 +1522,9 @@ sub handler { &newproblem($request); } } else { - # Set the event timer to zero if the "done button" was clicked. The button is - # part of the doneButton form created in lonmenu.pm - my ($donebuttonresult,$donemsg); - if ($symb && $env{'form.LC_interval_done'} eq 'true') { - ($donebuttonresult,$donemsg) = &zero_timer($symb); - undef($env{'form.LC_interval_done'}); - undef($env{'form.LC_interval_done_proctorpass'}); - } # just render the page normally outside of construction space &Apache::lonxml::debug("not construct"); - &renderpage($request,$file,undef,undef,$donemsg); + &renderpage($request,$file); } #my $td=&tv_interval($t0); #&Apache::lonxml::debug("Spent $td seconds processing");