[PATCH] Cobbler - webui - re-enable random mac js

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Attached is a small patch that re-enables the "Random" link in the
WebUI to generate a random MAC address when clicked.

The patch is against a up2date git devel branch.

Regards,
Tim

-- 
Tim Verhoeven - tim.verhoeven.be@xxxxxxxxx - 0479 / 88 11 83

Hoping the problem  magically goes away  by ignoring it is the
"microsoft approach to programming" and should never be allowed.
(Linus Torvalds)
--- a/webui_templates/system_edit.tmpl	2007-12-05 19:34:18.000000000 +0100
+++ b/webui_templates/system_edit.tmpl	2007-12-18 15:33:02.000000000 +0100
@@ -29,7 +29,7 @@
     }
 }
 #else
-function get_random_mac()
+function get_random_mac(field)
 {
     xmlHttp = new XMLHttpRequest();
     xmlHttp.open("GET", "$base_url?mode=random_mac", true);
@@ -38,7 +38,7 @@
             var mac_field = document.getElementById("macaddress")
             var result = xmlHttp.responseText;
             if (result.charAt(2) == ':' && result.charAt(5) == ':') {
-                mac_field.value = result;
+                document.getElementById(field).value = result;
             }
         }
     };
@@ -277,9 +277,7 @@
                value="$macaddress"
         />
 
-        ## #if not $system
-        ##     <a href="javascript: get_random_mac()" style="font-size: 0.8em;">random</a>   
-        ## #end if
+        <a href="javascript: get_random_mac('macaddress-$interface')" style="font-size: 0.8em;">Random MAC</a>   
 
         <p class="context-tip">Example: AA:BB:CC:DD:EE:FF</p>
         </td>
--- a/cobbler/webui/CobblerWeb.py	2007-12-18 10:50:09.000000000 +0100
+++ b/cobbler/webui/CobblerWeb.py	2007-12-18 15:25:17.000000000 +0100
@@ -685,7 +685,7 @@
             'message2' : "Cobbler config has been applied to filesystem."
         }) 
 
-    def random_mac(self):
+    def random_mac(self, **spam):
         if not self.__xmlrpc_setup():
             return self.xmlrpc_auth_failure()
         mac = self.remote.get_random_mac()
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux