]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/fwhosts.cgi
Firewall: Jquery with errors for michael...
[people/teissler/ipfire-2.x.git] / html / cgi-bin / fwhosts.cgi
index 2d4c69f6a5d388ec8deb6d49234a7805d5748d6e..9369c22d104976d1786b1bc2716c2dc8202a6357 100755 (executable)
@@ -99,7 +99,47 @@ print<<END;
                        }
                        \$('#' + id).prop("checked", true);
                });
+               // When protokol is not ICMP hide icmp-types
+               if ( \$("#PROT").val() === 'ICMP') {
+                       \$('PROTOKOLL').hide();
+               }
+               // When protocol dropdown is changed, check if we selected icmp - then show icmp-types
+               \$("#prt").change(function(){
+                       if ( \$("#PROT").val() === 'ICMP' ){
+                               \$('PROTOKOLL').show();
+                       }
+                       else{
+                               \$('PROTOKOLL').hide();
+                       }
+               });
        });
+function hide_elements(){
+       var elementNames = hide_elements.arguments;
+       for (var i=0; i<elementNames.length; i++)
+       {
+               var elementName = elementNames[i];
+               document.getElementById(elementName).style.display='none';
+       }
+}
+function getdropdown(){
+       d = document.getElementById("PROT").value;
+       if ( d == 'ICMP' )
+       {
+               document.getElementById('PROTOKOLL').style.display='block';
+       }
+       else
+       {
+               document.getElementById('PROTOKOLL').style.display='none';
+       }
+       if(document.getElementById('PROTOKOLL').style.display== "block" )
+       {
+               document.getElementById('PORT').style.display='none';
+       }
+       if(document.getElementById('PROTOKOLL').style.display== "none" )
+       {
+               document.getElementById('PORT').style.display='block';
+       }
+}
 </script>
 END
 
@@ -1304,9 +1344,9 @@ sub addservice
                $fwhostsettings{'oldsrvicmp'} = $fwhostsettings{'ICMP'};
        }
        print<<END;
-       <table width='100%' border='0'><form method='post'>
+       <div id='prt'><table width='100%' border='0'><form method='post'>
        <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost srv_name'}:</td><td><input type='text' name='SRV_NAME' id='textbox1' value='$fwhostsettings{'SRV_NAME'}' size='24'><script>document.getElementById('textbox1').focus()</script></td></tr>
-       <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost prot'}:</td><td><select name='PROT'>
+       <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost prot'}:</td><td><select name='PROT' id='PROT' >
 END
        foreach ("TCP","UDP","ICMP")
        {
@@ -1318,8 +1358,8 @@ END
                }
        }
        print<<END;
-       </select></td></tr>
-       <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost icmptype'}</td><td><select name='ICMP_TYPES'>
+       </select></td></tr></table></div>
+       <div id='PROTOKOLL' class='noscript'><table width=100%' border='0'><tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost icmptype'}</td><td><select name='ICMP_TYPES'>
 END
        &General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes);
        print"<option>All ICMP-Types</option>";
@@ -1331,9 +1371,9 @@ END
                }
        }
        print<<END;
-       </select></td></tr>
-       <tr><td width='10%'>$Lang::tr{'fwhost port'}:</td><td><input type='text' name='SRV_PORT' value='$fwhostsettings{'SRV_PORT'}' maxlength='11' size='24'></td></tr>
-       <tr><td colspan='6'><br><hr></td></tr>
+       </select></td></tr></table></div>
+       <div id='PORT' class='noscript'><table width='100%' border='0'><tr><td width='10%'>$Lang::tr{'fwhost port'}:</td><td><input type='text' name='SRV_PORT' value='$fwhostsettings{'SRV_PORT'}' maxlength='11' size='24'></td></tr></table></div>
+       <table width='100%' border='0'><tr><td colspan='6'><br><hr></td></tr>
        <tr><td colspan='6' align='right'>
 END
        if ($fwhostsettings{'updatesrv'} eq 'on')
@@ -1357,6 +1397,9 @@ END
        
        
 END
+       #if ($fwhostsettings{'PROT'} ne 'ICMP'){
+                       #print"<script language='JavaScript'>hide_elements('PROTOKOLL');</script>";
+               #}
        &Header::closebox();
        &viewtableservice;
 }
@@ -1740,7 +1783,7 @@ sub viewtableservicegrp
                                }
                        }
                        print"<td align='center'>$port</td><td align='center'>$protocol</td><td width='1%'><form method='post'>";
-                       if ($number gt '1'){
+                       if ($delflag gt '1'){
                                print"<input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} />";
                        }
                        print"<input type='hidden' name='ACTION' value='delgrpservice'><input type='hidden' name='updatesrvgrp' value='$fwhostsettings{'updatesrvgrp'}'><input type='hidden' name='delsrvfromgrp' value='$grpname,$remark,$customservicegrp{$key}[2],$customservicegrp{$key}[3]'></form></td></tr>";