[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm

raeburn raeburn at source.lon-capa.org
Fri Sep 8 14:02:24 EDT 2023


raeburn		Fri Sep  8 18:02:24 2023 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  - Sanity checking
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.535 loncom/interface/lonmenu.pm:1.536
--- loncom/interface/lonmenu.pm:1.535	Sat Jul 15 03:34:40 2023
+++ loncom/interface/lonmenu.pm	Fri Sep  8 18:02:23 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.535 2023/07/15 03:34:40 raeburn Exp $
+# $Id: lonmenu.pm,v 1.536 2023/09/08 18:02:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2349,23 +2349,27 @@
     return <<"END";
 
 function toggleViewAsUser(change) {
-    var seluserid = document.getElementById('LC_selectuser');
-    var currstyle = seluserid.style.display;
-    if (change == 'off') {
-        document.userview.elements['LC_viewas'].value = '';
-        document.userview.elements['vuname'].value = '';
-        document.userview.elements['vid'].value = '';
-        document.userview.submit();
-        return;
-    }
-    if (currstyle == 'inline') {
-        seluserid.style.display = 'none';
-        document.getElementById('usexpand').innerHTML='► ';
-        document.getElementById('uscollapse').innerHTML='';
-    } else {
-        seluserid.style.display = 'inline';
-        document.getElementById('usexpand').innerHTML='';
-        document.getElementById('uscollapse').innerHTML='◄ ';
+    if (document.getElementById('LC_selectuser')) {
+        var seluserid = document.getElementById('LC_selectuser');
+        var currstyle = seluserid.style.display;
+        if (change == 'off') {
+            document.userview.elements['LC_viewas'].value = '';
+            document.userview.elements['vuname'].value = '';
+            document.userview.elements['vid'].value = '';
+            document.userview.submit();
+            return;
+        }
+        if ((document.getElementById('usexpand')) && (document.getElementById('uscollapse'))) {
+            if (currstyle == 'inline') {
+                seluserid.style.display = 'none';
+                document.getElementById('usexpand').innerHTML='► ';
+                document.getElementById('uscollapse').innerHTML='';
+            } else {
+                seluserid.style.display = 'inline';
+                document.getElementById('usexpand').innerHTML='';
+                document.getElementById('uscollapse').innerHTML='◄ ';
+            }
+        }
     }
     return;
 }




More information about the LON-CAPA-cvs mailing list