+ var PROTOCOLS_WITH_PORTS = ["TCP", "UDP"];
+
+ var update_protocol = function() {
+ var protocol = \$("#protocol").val();
+
+ if (protocol === undefined)
+ return;
+
+ // Check if a template is/should be used.
+ if (protocol === "template") {
+ \$("#PROTOCOL_TEMPLATE").show();
+ } else {
+ \$("#PROTOCOL_TEMPLATE").hide();
+ }
+
+ // Check if we are dealing with a protocol, that knows ports.
+ if (\$.inArray(protocol, PROTOCOLS_WITH_PORTS) >= 0) {
+ \$("#PROTOCOL_PORTS").show();
+ } else {
+ \$("#PROTOCOL_PORTS").hide();
+ }
+
+ // Handle ICMP.
+ if (protocol === "ICMP") {
+ \$("#PROTOCOL_ICMP_TYPES").show();
+ } else {
+ \$("#PROTOCOL_ICMP_TYPES").hide();
+ }
+ };
+