--- loncom/homework/lonhomework.pm 2023/11/07 12:26:00 1.379 +++ loncom/homework/lonhomework.pm 2023/11/17 17:02:21 1.380 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.379 2023/11/07 12:26:00 raeburn Exp $ +# $Id: lonhomework.pm,v 1.380 2023/11/17 17:02:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -163,9 +163,19 @@ sub get_target { return ('web','answer'); } elsif (($env{'form.problemmode'} eq 'saveedit') || ($env{'form.problemmode'} eq 'undo')) { - return ('modified','no_output_web','edit'); + my %editors = &Apache::loncommon::permitted_editors(); + if ($editors{'edit'}) { + return ('modified','no_output_web','edit'); + } else { + return ('web'); + } } elsif ($env{'form.problemmode'} eq 'edit') { - return ('no_output_web','edit'); + my %editors = &Apache::loncommon::permitted_editors(); + if ($editors{'edit'}) { + return ('no_output_web','edit'); + } else { + return ('web'); + } } else { return ('web'); } @@ -964,18 +974,26 @@ sub analyze_header { {'bread_crumbs' => $brcrum,}) .&Apache::loncommon::head_subbox( &Apache::loncommon::CSTR_pageheader()); + my %lt = &Apache::lonlocal::texthash( + edit => 'Edit', + editxml => 'EditXML', + ); $result .= '
'. ''. &Apache::structuretags::remember_problem_state().' -
- - -
+
'; + my %editors = &Apache::loncommon::permitted_editors(); + foreach my $item ('editxml','edit') { + next unless ($editors{$item}); + $result .= ''. + "\n"; + } + $result .= + '

@@ -1708,7 +1726,13 @@ sub handler { ($env{'form.problemmode'} eq 'saveeditxml') || ($env{'form.problemmode'} eq 'saveviewxml') || ($env{'form.problemmode'} eq 'undoxml')) { - &editxmlmode($request,$file); + my %editors = &Apache::loncommon::permitted_editors(); + if (($editors{'xml'}) || ($env{'form.problemmode'} eq 'saveviewxml') || ($env{'form.problemmode'} eq 'undoxml')) { + &editxmlmode($request,$file); + } else { + &update_construct_style(); + &renderpage($request,$file); + } } elsif ($env{'form.problemmode'} eq 'calcanswers') { &analyze($request,$file); } else {