]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - server-bans/index.php
Add a link to patreon on the footer
[irc/unrealircd/unrealircd-webpanel.git] / server-bans / index.php
index 902e7ac8d0bf045b35c96578b6fffd1757b2c216..cdb5bf71f3827b19968deb0547f86190b8c9c1e0 100644 (file)
@@ -96,7 +96,7 @@ if (!empty($_POST))
 ?>
 <h4>Server Bans Overview</h4>
 Here are all your network bans, from K-Lines to G-Lines, it's all here.<br><br>
-
+Click on an entry to edit it.
 <!-- Top add button -->
 <p><div class="btn btn-primary" onclick="add_ban()" <?php echo (current_user_can(PERMISSION_SERVER_BAN_ADD)) ? "" : "disabled"; ?>>
 Add Ban</div></p></table>
@@ -104,7 +104,7 @@ Add Ban</div></p></table>
 <!-- Add/edit ban -->
        <div class="modal fade" id="ban_add" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
-               <form method="post">
+               <form id="ban_add_form" method="post">
                        <input name="edit_existing" type="hidden" id="edit_existing" value="">
                        <div class="modal-content">
                                <div class="modal-header">
@@ -114,7 +114,7 @@ Add Ban</div></p></table>
                                </div>
                                <div class="modal-body">
                                        <div class="form-group">
-                                               <label for="ban_host">IP / Host</label>
+                                               <label for="ban_host" id="iphost_label">IP / Host</label>
                                                <input name="ban_host" type="text" class="form-control" id="ban_host" aria-describedby="ban_host_help" value="" required>
                                                <small id="ban_host_help" class="form-text text-muted">IP or host on which the ban is applied.</small>
                                        </div>
@@ -159,7 +159,7 @@ Add Ban</div></p></table>
        <!-- The banlist table -->
        <form method="post">
        <table id="data_list" class="table-striped display responsive nowrap" style="width:100%">
-       <thead>
+       <thead class="table-primary">
                <th scope="col"><input type="checkbox" label='selectall' onClick="toggle_tkl(this)" /></th>
                <th scope="col">Mask</th>
                <th scope="col">Type</th>
@@ -198,6 +198,18 @@ Add Ban</div></p></table>
        </div></form></div></div>
 
 <script>
+let form = document.getElementById("ban_add_form");
+let submitban =document.getElementById("do_add_ban");
+form.addEventListener("submit", (e) => {
+       let bantype = document.getElementById("ban_type");
+       let banhost = document.getElementById("ban_host");
+       if ((bantype.value === "zline" || bantype.value === "gzline") && banhost.value.includes("@"))
+       {
+               e.preventDefault();
+               document.getElementById("iphost_label").innerHTML = `IP / Host <span class="card alert-danger" style="color:red">Value for (G)Z-Lines MUST be a host or IP.</span>`;
+       }
+});
+
 let data_list_table = null;
 
 $(document).ready( function () {
@@ -213,7 +225,7 @@ $(document).ready( function () {
                },
                'columns': [
                        { 'data': 'Select', 'responsivePriority': 1 },
-                       { 'data': 'Mask', 'responsivePriority': 2 },
+                       { 'data': 'Mask', 'responsivePriority': 2, 'className':'virtuallink' },
                        { 'data': 'Type', 'responsivePriority': 3 },
                        { 'data': 'Duration', 'responsivePriority': 4 },
                        { 'data': 'Reason', 'responsivePriority': 5, 'render': DataTable.render.ellipsis(50, false) },
@@ -299,10 +311,12 @@ $(document).ready( function () {
                $('#ban_reason').val("");
                $('#ban_soft').prop('checked', false);
                $('#do_del_ban').hide();
+               $('#ban_add_title').html("Add server ban");
+               $('#do_add_ban').html("Add Ban");
                $('#ban_add').modal('show');
        }
 
-
+       
 </script>
 
 <?php require_once '../inc/footer.php'; ?>