--- loncom/xml/lonxml.pm 2023/11/27 23:24:05 1.564 +++ loncom/xml/lonxml.pm 2024/04/14 17:12:28 1.570 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.564 2023/11/27 23:24:05 raeburn Exp $ +# $Id: lonxml.pm,v 1.570 2024/04/14 17:12:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1613,8 +1613,9 @@ FULLPAGE my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit', 'vi' => 'Save and View', 'dv' => 'Discard Edits and View', - 'un' => 'undo', - 'ed' => 'Edit'); + 'un' => 'Undo', + 'ed' => 'Edit', + 'ew' => 'Edit with Daxe'); my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont'); my $textarea_events = &Apache::edit::element_change_detection(); my $form_events = &Apache::edit::form_change_detection(); @@ -1622,7 +1623,7 @@ FULLPAGE if ($filetype eq 'html') { $htmlerror=&verify_html($filecontents); if ($htmlerror) { - $htmlerror=''.$htmlerror.''; + $htmlerror=(' 'x3).' '.$htmlerror.''; } if (&Apache::lonhtmlcommon::htmlareabrowser()) { unless ($textareaclass) { @@ -1630,14 +1631,30 @@ FULLPAGE } } } - my $undo; + my ($undo,$daxebutton,%onclick); + foreach my $item ('discard','undo','daxe') { + $onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"'; + } + foreach my $item ('saveedit','saveview') { + $onclick{$item} = 'onclick="is_submit=true;setmode(this.form,'."'$item'".')"'; + } unless ($uri =~ m{^/uploaded/}) { - $undo = ''."\n"; + $undo = ''."\n"; + } + $initialize .= &setmode_javascript(); + if ($filetype eq 'html') { + my %editors = &Apache::loncommon::permitted_editors(); + if ($editors{'daxe'}) { + $daxebutton = ''."\n"; + } } my $editfooter=(<
+
$filename @@ -1645,13 +1662,13 @@ $initialize $xml_help
-
- - $undo $htmlerror $deps_button $dragmath_button -
- - + + +
+
+ + $undo $deps_button $daxebutton $dragmath_button $htmlerror

$spelllink @@ -1661,7 +1678,7 @@ $initialize
ENDFOOTER - return ($editfooter,$add_to_onload,$add_to_onresize);; + return ($editfooter,$add_to_onload,$add_to_onresize); } sub setmode_javascript { @@ -1685,15 +1702,65 @@ ENDSCRIPT } sub seteditor_javascript { + my ($is_course_doc,$is_supp,$supp_path,$supp_title) = @_; + my $symb; + if ($is_course_doc) { + if (!$is_supp) { + ($symb) = &Apache::lonnet::whichuser(); + if ($symb) { + $symb = &escape($symb); + } + } + } return <<"ENDSCRIPT";