Add search field, this may make things easier to find!

This commit is contained in:
Mark Schouten 2014-07-03 16:05:01 +02:00
parent 816790ce4e
commit 57a3929f10
3 changed files with 30 additions and 4 deletions

3
.gitmodules vendored
View file

@ -4,3 +4,6 @@
[submodule "jtable"] [submodule "jtable"]
path = jtable path = jtable
url = https://github.com/hikalkan/jtable.git url = https://github.com/hikalkan/jtable.git
[submodule "addclear"]
path = js/addclear
url = https://github.com/skorecky/Add-Clear.git

View file

@ -34,6 +34,7 @@ if (!is_logged_in() and isset($_POST['formname']) && $_POST['formname'] == "logi
<script src="jquery-ui/ui/jquery.ui.resizable.js" type="text/javascript"></script> <script src="jquery-ui/ui/jquery.ui.resizable.js" type="text/javascript"></script>
<script src="jquery-ui/ui/jquery.ui.dialog.js" type="text/javascript"></script> <script src="jquery-ui/ui/jquery.ui.dialog.js" type="text/javascript"></script>
<script src="jtable/lib/jquery.jtable.min.js" type="text/javascript"></script> <script src="jtable/lib/jquery.jtable.min.js" type="text/javascript"></script>
<script src="js/addclear/addclear.js" type="text/javascript"></script>
</head> </head>
<? <?
@ -52,16 +53,16 @@ if (!is_logged_in()) {
<form action="index.php" method="post"> <form action="index.php" method="post">
<table> <table>
<tr> <tr>
<td class="label">Gebruikersnaam:</td> <td class="label">Username:</td>
<td><input id="username" type="text" name="username"/></td> <td><input id="username" type="text" name="username"/></td>
</tr> </tr>
<tr> <tr>
<td class="label">Wachtwoord:</td> <td class="label">Password:</td>
<td><input type="password" name="password"/></td> <td><input type="password" name="password"/></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><input type="submit" name="submit" value="Inloggen"/></td> <td><input type="submit" name="submit" value="Log me in!"/></td>
</tr> </tr>
</table> </table>
<input type="hidden" name="formname" value="loginform"/> <input type="hidden" name="formname" value="loginform"/>
@ -117,7 +118,13 @@ if (isset($templatelist)) {
</ul> </ul>
</div> </div>
<div id="zones"> <div id="zones">
<div class="tables" id="MasterZones"></div> <div class="tables" id="MasterZones">
<div class="searchbar" id="searchbar">
<form>
<input type="text" id="domsearch" name="domsearch" placeholder="Search...."/>
</form>
</div>
</div>
<div class="tables" id="SlaveZones"></div> <div class="tables" id="SlaveZones"></div>
</div> </div>
<? if (is_adminuser()) { ?> <? if (is_adminuser()) { ?>
@ -473,6 +480,15 @@ $(document).ready(function () {
} }
} }
}); });
$('#domsearch').addClear({
onClear: function() { $('#MasterZones').jtable('load'); }
});
$('#domsearch').on('input', function (e) {
e.preventDefault();
$('#MasterZones').jtable('load', {
domsearch: $('#domsearch').val()
});
});
$('#MasterZones').jtable('load'); $('#MasterZones').jtable('load');
}); });
</script> </script>

View file

@ -182,6 +182,13 @@ if ($action == "list" or $action== "listslaves") {
if (check_owner($zone['name']) === FALSE) if (check_owner($zone['name']) === FALSE)
continue; continue;
if (isset($_POST['domsearch'])) {
$q = $_POST['domsearch'];
if (!preg_match("/$q/", $zone['name']) == 1) {
continue;
}
}
$zone['name'] = htmlspecialchars($zone['name']); $zone['name'] = htmlspecialchars($zone['name']);
$zone['owner'] = get_zone_owner($zone['name']); $zone['owner'] = get_zone_owner($zone['name']);
if ($action == "listslaves" and $zone['kind'] == "Slave") { if ($action == "listslaves" and $zone['kind'] == "Slave") {