[LON-CAPA-cvs] cvs: rat /client parameter.html

raeburn raeburn at source.lon-capa.org
Sat Jun 28 09:55:44 EDT 2025


raeburn		Sat Jun 28 13:55:44 2025 EDT

  Modified files:              
    /rat/client	parameter.html 
  Log:
  - Append 'return false' to  onclick actions when adding or removing IP textbox.
    Add some line feeds for readability when viewing javascript source.
  
  
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.94 rat/client/parameter.html:1.95
--- rat/client/parameter.html:1.94	Thu Jun 26 01:28:48 2025
+++ rat/client/parameter.html	Sat Jun 28 13:55:43 2025
@@ -5,7 +5,7 @@
 The LearningOnline Network with CAPA
 Parameter Input Window
 //
-// $Id: parameter.html,v 1.94 2025/06/26 01:28:48 raeburn Exp $
+// $Id: parameter.html,v 1.95 2025/06/28 13:55:43 raeburn Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -643,11 +643,11 @@
     if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
         var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
         var ipDiv = frame.document.createElement('div');
-        ipDiv.innerHTML = '<input type="text" size="10" name="setip'+iptype+'" onblur="parent.ipstringeval();" />'+
-                          '<a href="#" onclick="parent.removeIpRule(this,\''+iptype+'\')">Remove</a>';
-        frame.document.getElementById('LC_string_ipacc_inner_'+iptype).appendChild(ipDiv);
+        ipDiv.innerHTML = '<input type="text" size="12" name="setip'+iptype+'" onblur="parent.ipstringeval();" />'+"\n"+
+                          '<a href="#" onclick="parent.removeIpRule(this,\''+iptype+'\');return false;">Remove</a>';
+        innerDiv.appendChild(ipDiv);
     }
-    return false;
+    return;
 }
 
 function removeIpRule(caller,iptype) {
@@ -655,9 +655,12 @@
     if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
         var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
         var divToRemove = caller.closest('div');
-        innerDiv.removeChild(divToRemove);
-        ipstringeval();
+        if (divToRemove) {
+            innerDiv.removeChild(divToRemove);
+            ipstringeval();
+        }
     }
+    return;
 }
 
 function radiostringeval(newval) {
@@ -1177,20 +1180,20 @@
             }
             var curripaccess = [currallow,currdeny];
             tablestart('IP Number/Name');
-            choicewrite('<tr><th>Allow from</th><th>Deny from</th></tr><tr>');
+            choicewrite('<tr><th>Allow from</th><th>Deny from</th></tr><tr>'+"\n");
             var acctypes = ['allow','deny'];
             for (var i=0; i<acctypes.length; i++) {
-                choicewrite('<td valign="top">'+
-                            '<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'+acctypes[i]+'">'+
-                            '<div class="LC_string_ipacc_inner" id="LC_string_ipacc_inner_'+acctypes[i]+'">');
+                choicewrite(['<td valign="top">',
+                             '<div>',
+                             '<div id="LC_string_ipacc_inner_'+acctypes[i]+'">'].join("\n"));
                 for (var j=0; j<curripaccess[i].length; j++) {
-                    choicewrite('<div><input type="text" size="10" name="setip'+acctypes[i]+'" value="'+curripaccess[i][j]+'" onblur="parent.ipstringeval();" />');
-                    choicewrite('<a href="#" onclick="parent.removeIpRule(this,\''+acctypes[i]+'\')">Remove</a>');
-                    choicewrite('</div>');
+                    choicewrite(['<div><input type="text" size="12" name="setip'+acctypes[i]+'" value="'+curripaccess[i][j]+'" onblur="parent.ipstringeval();" />',
+                                 '<a href="#" onclick="parent.removeIpRule(this,\''+acctypes[i]+'\');return false;">Remove</a>',
+                                 '</div>'].join("\n"));
                 }
-                choicewrite('</div><button onclick="parent.addIpRule(\''+acctypes[i]+'\');">Add item</button>');
+                choicewrite('</div><button onclick="parent.addIpRule(\''+acctypes[i]+'\');return false;">Add item</button>'+"\n");
             }
-            choicewrite('</div></td></tr></table>');
+            choicewrite('</div></td></tr></table>'+"\n");
         }
         if (pscat=='fileext') {
             tablestart('Allowed File Extensions');




More information about the LON-CAPA-cvs mailing list