--- loncom/xml/lonxml.pm	2023/07/22 22:41:45	1.562
+++ loncom/xml/lonxml.pm	2023/11/28 01:33:14	1.565
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.562 2023/07/22 22:41:45 raeburn Exp $
+# $Id: lonxml.pm,v 1.565 2023/11/28 01:33:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1645,14 +1645,14 @@ $initialize
         $xml_help
       </td></tr>
     </table>
-    <div>
-      <input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" />
-      $undo $htmlerror $deps_button $dragmath_button
-    </div>
     <div style="float:right">
       <input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" />
       <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />
     </div>
+    <div>
+      <input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" />
+      $undo $htmlerror $deps_button $dragmath_button
+    </div>
   </div>
   <textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br />$spelllink
   <div id="LC_aftertextarea">
@@ -1664,6 +1664,44 @@ ENDFOOTER
       return ($editfooter,$add_to_onload,$add_to_onresize);;
 }
 
+sub setmode_javascript {
+    return <<"ENDSCRIPT";
+<script type="text/javascript">
+// <![CDATA[
+function setmode(form,probmode) {
+    if (probmode == 'daxe') {
+        var url = new URL(document.location.href);
+        window.location = url.protocol+'//'+url.hostname+'/daxepage'+url.pathname;
+    } else {
+        var initial = form.problemmode.value;
+        form.problemmode.value = probmode;
+        form.submit();
+        form.problemmode.value = initial;
+    }
+}
+// ]]>
+</script>
+ENDSCRIPT
+}
+
+sub seteditor_javascript {
+    return <<"ENDSCRIPT";
+<script type="text/javascript">
+// <![CDATA[
+function seteditmode(form,editor) {
+    if (editor == 'daxe') {
+        var url = new URL(document.location.href);
+        window.location = url.protocol+'//'+url.hostname+'/daxepage'+url.pathname;
+    } else {
+        form.editmode.value = editor;
+        form.submit();
+    }
+}
+// ]]>
+</script>
+ENDSCRIPT
+}
+
 sub get_target {
   my $viewgrades=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
   if ( $env{'request.state'} eq 'published') {