--- loncom/homework/lonhomework.pm 2024/02/21 19:57:06 1.344.2.10.4.6 +++ loncom/homework/lonhomework.pm 2024/02/27 17:10:23 1.344.2.10.4.7 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.344.2.10.4.6 2024/02/21 19:57:06 raeburn Exp $ +# $Id: lonhomework.pm,v 1.344.2.10.4.7 2024/02/27 17:10:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -162,9 +162,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'); } @@ -881,18 +891,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 .= + '

@@ -1135,7 +1153,8 @@ sub editxmlmode { $result .= '
    '; - unless ($env{'environment.nocodemirror'}) { + my $nocodemirror = &Apache::loncommon::nocodemirror(); + unless ($nocodemirror) { # dropdown menus $result .= Apache::lonmenu::create_submenu("#", "", &mt("Problem Templates"), template_dropdown_datastructure()); @@ -1167,7 +1186,7 @@ sub editxmlmode { '
    '; my $resource = $env{'request.ambiguous'}; - unless($env{'environment.nocodemirror'}){ + unless ($nocodemirror) { $result .= '