[LON-CAPA-cvs] cvs: loncom /homework daxepage.pm /xml lonxml.pm

raeburn raeburn at source.lon-capa.org
Sat Mar 30 21:50:18 EDT 2024


raeburn		Sun Mar 31 01:50:18 2024 EDT

  Modified files:              
    /loncom/homework	daxepage.pm 
    /loncom/xml	lonxml.pm 
  Log:
  - Support "Save and Edit", "Save and View", and "Discard and View" buttons
    above Daxe Editor iframe, when editing HTML file in Daxe, for consistency
    with UI for standard "Text" Editor for this type of file.
  
  
Index: loncom/homework/daxepage.pm
diff -u loncom/homework/daxepage.pm:1.13 loncom/homework/daxepage.pm:1.14
--- loncom/homework/daxepage.pm:1.13	Mon Mar 25 17:29:23 2024
+++ loncom/homework/daxepage.pm	Sun Mar 31 01:50:18 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Page with Daxe on the left side and the preview on the right side
 #
-# $Id: daxepage.pm,v 1.13 2024/03/25 17:29:23 raeburn Exp $
+# $Id: daxepage.pm,v 1.14 2024/03/31 01:50:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,6 +73,7 @@
                                           'noif' => 'No iframe support.',
                                           'show' => 'Show content in pop-up window',
                                           'save' => 'Save',
+                                          'text' => 'Text Editor', 
                                           'oeds' => 'other editors',
                                           'othe' => 'other editor',
                                           'edit' => 'Save and Edit',
@@ -86,7 +87,7 @@
     my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&save=/daxesave'.
                   '&file='.$filearg;
     my $headjs = &Apache::loncommon::iframe_wrapper_headjs().
-                 &listener_js($lang,$filearg).
+                 &listener_js($lang,$filearg,$is_assess).
                  &toggle_LCmenus_js().&saveandview_js().
                  &Apache::edit::js_change_detection();
 
@@ -119,7 +120,7 @@
                        '<span class="LC_nobreak">';
         if ($is_not_assess) {
             $editheader .= '<input type="hidden" name="editmode" value="" />'."\n".
-                           '<input type="button" name="editordefault" value="'.$lt{'edit'}.
+                           '<input type="button" name="editordefault" value="'.$lt{'text'}.
                            '" onclick="seteditmode(this.form,'."'edit'".');" />'."\n";
         } else {
             if ($editors{'edit'}) {
@@ -160,7 +161,7 @@
 }
 
 sub listener_js {
-    my ($lang,$filearg) = @_;
+    my ($lang,$filearg,$is_assess) = @_;
     return <<"ENDJS";
 <script type="text/javascript">
 //<![CDATA[
@@ -171,9 +172,14 @@
 
 eventer(messageEvent,function(e) {
     var reqdOrigin = window.location.protocol+'//'+window.location.hostname;
+    var is_assess = '$is_assess';
     if (e.origin == reqdOrigin) {
         if (e.data == '$filearg') {
-            setmode(document.daxeedit,'view');
+            if (is_assess) {
+                setmode(document.daxeedit,'view');
+            } else {
+                seteditmode(document.daxeedit,'view');
+            }
         } else if ((e.data == 'userlclang') || (e.data == 'userlang')) {
             window.myIframe = document.getElementById("lcdiframe").contentWindow;
             window.myIframe.postMessage(e.data+':$lang',reqdOrigin);
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.568 loncom/xml/lonxml.pm:1.569
--- loncom/xml/lonxml.pm:1.568	Thu Jan 25 23:37:14 2024
+++ loncom/xml/lonxml.pm	Sun Mar 31 01:50:18 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.568 2024/01/25 23:37:14 raeburn Exp $
+# $Id: lonxml.pm,v 1.569 2024/03/31 01:50:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1710,7 +1710,11 @@
         var url = new URL(document.location.href);
         window.location = url.protocol+'//'+url.hostname+'/daxepage'+url.pathname;
     } else {
-        form.editmode.value = editor;
+        if (editor == 'edit') {
+            form.editmode.value = editor;
+        } else {
+            form.editmode.value = '';
+        }
         form.submit();
     }
 }




More information about the LON-CAPA-cvs mailing list