DHCP: Add search box for static leases
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 28 May 2015 12:49:41 +0000 (14:49 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 28 May 2015 12:49:41 +0000 (14:49 +0200)
html/cgi-bin/dhcp.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl

index 9a7d983..e75207a 100644 (file)
@@ -857,12 +857,31 @@ print <<END
 </tr>
 </table>
 </form>
+<hr />
 END
 ;
 #Edited line number (KEY2) passed until cleared by 'save' or 'remove' or 'new sort order'
 
+# Search for static leases
+my $search_query = $dhcpsettings{'q'};
+
+if (scalar @current2 >= 10) {
+       print <<END;
+               <form method="POST" action="#search">
+                       <a name="search"></a>
+                       <table width='100%'>
+                               <tr>
+                                       <td>
+                                               <input type="text" name="q" value="$search_query">
+                                               <input type="submit" value="$Lang::tr{'search'}">
+                                       </td>
+                               </tr>
+                       </table>
+               </form>
+END
+}
+
 print <<END
-<hr />
 <table width='100%' class='tbl'>
 <tr>
     <th width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FETHER'><b>$Lang::tr{'mac address'}</b></a></th>
@@ -918,6 +937,11 @@ foreach my $line (@current2) {
        $gdesc = $Lang::tr{'click to enable'}; 
     }
 
+    # Skip all entries that do not match the search query
+    if ($search_query ne "") {
+       next if (!grep(/$search_query/, @temp));
+    }
+
     if ($dhcpsettings{'KEY2'} eq $key) {
        print "<tr>";
        $col="bgcolor='${Header::colouryellow}'";
index defb632..8adefdf 100644 (file)
 'save settings' => 'Einstellungen speichern',
 'save-adv-options' => 'Erweiterte Optionen speichern',
 'script name' => 'Skriptname:',
+'search' => 'Suchen',
 'secondary dns' => 'Sekundärer DNS:',
 'secondary ntp server' => 'Sekundärer NTP-Server',
 'secondary wins server address' => 'Sekundäre WINS-Server Adresse',
index 80c0552..43601c8 100644 (file)
 'save settings' => 'Save settings',
 'save-adv-options' => 'Save advanced options',
 'script name' => 'Script name:',
+'search' => 'Search',
 'secondary dns' => 'Secondary DNS:',
 'secondary ntp server' => 'Secondary NTP server',
 'secondary wins server address' => 'Secondary WINS server address',