--- loncom/homework/structuretags.pm 2023/09/10 18:12:53 1.578
+++ loncom/homework/structuretags.pm 2024/01/13 12:07:13 1.583
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.578 2023/09/10 18:12:53 raeburn Exp $
+# $Id: structuretags.pm,v 1.583 2024/01/13 12:07:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -297,7 +297,7 @@ sub homework_js {
}
return &Apache::loncommon::resize_textarea_js().
&Apache::loncommon::colorfuleditor_js().
- &setmode_javascript().
+ &Apache::lonxml::setmode_javascript().
<<"JS";
-ENDSCRIPT
-}
-
sub page_start {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name,
$extra_head)=@_;
@@ -445,7 +430,7 @@ sub page_start {
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
my %textarea_args;
if (($env{'request.state'} ne 'construct') ||
- ($env{'environment.nocodemirror'})) {
+ (&Apache::loncommon::nocodemirror())) {
%textarea_args = (
dragmath => 'math',
);
@@ -835,13 +820,18 @@ sub problem_edit_action_button {
sub problem_edit_buttons {
my ($mode)=@_;
+ my %editors = &Apache::loncommon::permitted_editors();
# Buttons that save
my $result = '
';
if ($mode eq 'editxml') {
- $result.=&problem_edit_action_button('subsaveedit','saveeditxml','s','Save and EditXML');
+ if ($editors{'xml'}) {
+ $result.=&problem_edit_action_button('subsaveedit','saveeditxml','s','Save and EditXML');
+ }
$result.=&problem_edit_action_button('subsaveview','saveviewxml','v','Save and View');
} else {
- $result.=&problem_edit_action_button('subsaveedit','saveedit','s','Save and Edit');
+ if ($editors{'edit'}) {
+ $result.=&problem_edit_action_button('subsaveedit','saveedit','s','Save and Edit');
+ }
$result.=&problem_edit_action_button('subsaveview','saveview','v','Save and View');
}
$result.="\n
\n";
@@ -849,13 +839,23 @@ sub problem_edit_buttons {
$result .= ''.
&problem_edit_action_button('subdiscview','discard','d','Discard Edits and View',1);
if ($mode eq 'editxml') {
- $result.=&problem_edit_action_button('subedit','edit','e','Edit',1);
+ if ($editors{'edit'}) {
+ $result.=&problem_edit_action_button('subedit','edit','e','Edit',1);
+ }
+ if ($editors{'daxe'}) {
+ $result.=&problem_edit_action_button('subdaxe','daxe','w','Edit with Daxe',1);
+ }
$result.=&problem_edit_action_button('subundo','undoxml','u','Undo',1);
- if ($env{'environment.nocodemirror'}) {
+ if (&Apache::loncommon::nocodemirror()) {
$result.=&Apache::lonhtmlcommon::dragmath_button("LC_editxmltext",1);
}
} else {
- $result.=&problem_edit_action_button('subeditxml','editxml','x','EditXML',1);
+ if ($editors{'xml'}) {
+ $result.=&problem_edit_action_button('subeditxml','editxml','x','EditXML',1);
+ }
+ if ($editors{'daxe'}) {
+ $result.=&problem_edit_action_button('subdaxe','daxe','w','Edit with Daxe',1);
+ }
$result.=&problem_edit_action_button('subundo','undo','u','Undo',1);
}
$result.="\n
";
@@ -927,6 +927,7 @@ sub option {
sub problem_web_to_edit_header {
my ($rndseed)=@_;
+ my %editors = &Apache::loncommon::permitted_editors();
my $result .= '