From b027916f9e316b7892796a81171d00a6def68901 Mon Sep 17 00:00:00 2001 From: Casper Date: Thu, 17 Jun 2021 15:06:25 +0200 Subject: [PATCH] webadmin 1.8.2 --- modules/webadmin/files/webadmin.js | 101 ++++- modules/webadmin/files/webadmin2.js | 138 +++++++ modules/webadmin/tmpl/add_edit_chan.tmpl | 29 +- modules/webadmin/tmpl/add_edit_network.tmpl | 197 +++++---- modules/webadmin/tmpl/add_edit_user.tmpl | 406 ++++++++++--------- modules/webadmin/tmpl/del_network.tmpl | 11 +- modules/webadmin/tmpl/del_user.tmpl | 11 +- modules/webadmin/tmpl/encoding_settings.tmpl | 14 +- modules/webadmin/tmpl/index.tmpl | 3 +- modules/webadmin/tmpl/listusers.tmpl | 108 ++--- modules/webadmin/tmpl/settings.tmpl | 170 ++++---- modules/webadmin/tmpl/traffic.tmpl | 41 +- 12 files changed, 773 insertions(+), 456 deletions(-) create mode 100644 modules/webadmin/files/webadmin2.js diff --git a/modules/webadmin/files/webadmin.js b/modules/webadmin/files/webadmin.js index 824b7f0..0ea93dd 100644 --- a/modules/webadmin/files/webadmin.js +++ b/modules/webadmin/files/webadmin.js @@ -11,6 +11,91 @@ function floodprotection_change() { } } +function make_sortable_table(table) { + if (table.rows.length >= 1) { // Ensure that the table at least contains a row for the headings + var headings = table.rows[0].getElementsByTagName("th"); + for (var i = 0; i < headings.length; i++) { + // This function acts to scope the i variable, so we can pass it off + // as the column_index, otherwise column_index would just be the max + // value of i, every single time. + (function (i) { + var heading = headings[i]; + if (!heading.classList.contains("ignore-sort")) { + heading.addEventListener("click", function () { // Bind a click event to the heading + sort_table(this, i, table, headings); + }); + } + })(i); + } + } +} + +function sort_table(clicked_column, column_index, table, headings) { + for (var i = 0; i < headings.length; i++) { + if (headings[i] != clicked_column) { + headings[i].classList.remove("sorted"); + headings[i].classList.remove("reverse-sorted"); + } + } + var reverse = false; + clicked_column.classList.toggle("reverse"); + if (clicked_column.classList.contains("sorted")) { + reverse = true; + clicked_column.classList.remove("sorted"); + clicked_column.classList.add("reverse-sorted"); + } else { + clicked_column.classList.remove("reverse-sorted"); + clicked_column.classList.add("sorted"); + } + + // This array will contain tuples in the form [(value, row)] where value + // is extracted from the column to be sorted by + var rows_and_sortable_value = []; + for (var i = 1, row; row = table.rows[i]; i++) { + for (var j = 0, col; col = row.cells[j]; j++) { + // If we're at the column index we want to sort by + if (j === column_index) { + var cell = row.getElementsByTagName("td")[j]; + var value = cell.innerHTML; + rows_and_sortable_value.push([value, row]); + } + } + } + + rows_and_sortable_value.sort(function (a, b) { + // If both values are integers, sort by that else as strings + if (isInt(a[0]) && isInt(b[0])) { + return a[0] - b[0]; + } else { + return b[0].localeCompare(a[0]); + } + }); + if (reverse) { + rows_and_sortable_value.reverse(); + } + + var parent = table.rows[1].parentNode; + for (var i = 0; i < rows_and_sortable_value.length; i++) { + // Remove the existing entry for the row from the table + parent.removeChild(rows_and_sortable_value[i][1]); + // Insert at the first position, before the first child + parent.insertBefore(rows_and_sortable_value[i][1], parent.firstChild); + } +} + +function isInt(value) { + return !isNaN(value) && (function (x) { + return (x | 0) === x; + })(parseFloat(value)) +} + +function make_sortable() { + var tables = document.querySelectorAll("table.sortable"); + for (var i = 0; i < tables.length; i++) { + make_sortable_table(tables[i]); + } +} + function serverlist_init($) { function serialize() { var text = ""; @@ -19,7 +104,7 @@ function serverlist_init($) { var port = $(".servers_row_port", $(this)).val(); var ssl = $(".servers_row_ssl", $(this)).is(":checked"); var pass = $(".servers_row_pass", $(this)).val(); - if (host.length == 0) return; + if (host == undefined) return; text += host; text += " "; if (ssl) text += "+"; @@ -76,12 +161,9 @@ function serverlist_init($) { $("#servers_plain").hide(); $("#servers_js").show(); - })(); -} - +}; -/* Broken. Work is in progress... Hang in there cowboy/girl... function ctcpreplies_init($) { function serialize() { var text = ""; @@ -104,13 +186,13 @@ function ctcpreplies_init($) { } row.append( $("").append($("").val(request) - .addClass("ctcpreplies_row_request") + .addClass("form-control ctcpreplies_row_request") .attr({"type":"text","list":"ctcpreplies_list"})), $("").append($("").val(response) - .addClass("ctcpreplies_row_response") + .addClass("form-control ctcpreplies_row_response") .attr({"type":"text","placeholder":"Empty value means this CTCP request will be ignored"})), - $("").append($(" +
+ checked="checked" /> + + +
- - + + +
+ +
+ + +
+
+
+ + +
- +
- When these certificates are encountered, checks for hostname, expiration date, CA are skipped +
@@ -143,38 +174,41 @@
- +
checked="checked" /> - You might enable the flood protection. This prevents `excess flood' errors, which occur, when your IRC bot is command flooded or spammed. After changing this, reconnect ZNC to server +
- +
- value="" value="1.00" disabled="disabled" /> - The number of seconds per line. After changing this, reconnect ZNC to server + " value="" value="1.00" disabled="disabled" /> + +
- +
- value="" value="4" disabled="disabled" /> - Defines the number of lines, which can be sent immediately. After changing this, reconnect ZNC to server + value="" value="4" disabled="disabled" /> + +
- +
- - Defines the delay in seconds, until channels are joined after getting connected + + +
@@ -185,9 +219,10 @@
- +
+
@@ -195,21 +230,21 @@
- You will be able to add + modify channels here after you created the network.
+
- + - - - - - - + + + + + + - + @@ -217,7 +252,9 @@
Add SaveNameCurModesDefModesBufferCountOptions <- Add a channel (opens in same page)
- Edit Del + + +
@@ -243,12 +280,12 @@ - - - - - - + + + + + + @@ -299,7 +336,7 @@
-

Module

+

@@ -309,8 +346,8 @@
diff --git a/modules/webadmin/tmpl/add_edit_user.tmpl b/modules/webadmin/tmpl/add_edit_user.tmpl index eb79d28..550be21 100644 --- a/modules/webadmin/tmpl/add_edit_user.tmpl +++ b/modules/webadmin/tmpl/add_edit_user.tmpl @@ -1,29 +1,35 @@ + + + + - + + +
@@ -36,7 +42,7 @@
- +
@@ -46,31 +52,37 @@ - + " autocomplete="off" />
- +
- + " autocomplete="off">
- +
- + ">
+
+ +
+ " checked="checked" disabled="disabled" />
+
- +
- -
Leave empty to allow connections from all IPs. Otherwise, one entry per line, wildcards * and ? are available.
+ +
Otherwise, one entry per line, wildcards * and ? are available." ?>
@@ -78,47 +90,47 @@
-
Nick, AltNick, Ident, RealName and QuitMsg can be left empty to use default values.
+
- +
- + ">
- +
- + ">
- +
- + ">
- -
- + +
+ "> +
-
- -
- -
- + +
+ +
+ "> +
-
- +
@@ -147,9 +158,9 @@
- +
- + ">
@@ -160,14 +171,14 @@
StatusNameArgumentsDescriptionGlobalNetworks
- + - - - - + + + + - + @@ -176,7 +187,7 @@ @@ -187,21 +198,35 @@
Add NameClientsCurrent ServerIRC Nick <- Add a network (opens in same page)
- Edit Delete + Edit
- You will be able to add + modify networks here after you have clonedcreated the user.
+ +
+ +
+
+ + +
+ +
+ +
+
+ + - - - - - - + + + + + + @@ -210,6 +235,9 @@ @@ -251,23 +279,41 @@ -
+
- +
- -
Empty = use standard value
+ "> +
- +
- -
Empty = use standard value
+ " /> +
-
+
+
+ +
+ +
+ " /> +
+
+
+ +
+ +
+ " /> +
+
+
+
@@ -276,8 +322,8 @@
StatusNameArgumentsDescriptionGlobalNetworks
checked="checked" disabled="disabled" /> + + checked="checked" /> +
- - + + @@ -300,153 +346,145 @@
-
Any of the following text boxes can be left empty to use their default value.
-
- -
- -
This setting is ignored in new IRC clients, which use server-time. If your client supports server-time, change timestamp format in client settings instead.
+
+
+ +
+ +
+
-
- -
- -
- -
E.g. Europe/Berlin or GMT-6
+ +
+ +
+ "> +
Europe/Berlin, or GMT-6" ?>
+
-
- - -
- -
- - Character encoding used between IRC client and ZNC. After changing this, reconnect client to ZNC + + +
+ +
+ + +
-
- - - -
- -
- + + + +
+ +
+ " /> +
-
- -
- -
- + +
+ +
+ " /> +
-
- -
- -
- disabled="disabled" /> + +
+ +
+ " disabled="disabled" /> +
-
- -
- -
- + +
+ +
+ "/> +
-
- +
- -
- -
One reply per line. Example: TIME Buy a watch! — Some variable-like strings can be found here
-
-
- -
- -
- 1 ?> - - -

No other skins found!

- -
-
-
- - -
- - -
- -
- + +
+ 1 ?> + + +

+ +
-
- - -
- + +
+ +
+ + + +

ZNC is compiled without i18n support!

+ +
+
+
diff --git a/modules/webadmin/tmpl/del_network.tmpl b/modules/webadmin/tmpl/del_network.tmpl index f6fc4c8..05b1fc5 100644 --- a/modules/webadmin/tmpl/del_network.tmpl +++ b/modules/webadmin/tmpl/del_network.tmpl @@ -1,22 +1,23 @@ +
-
Confirm Network Deletion
+
-

Are you absolutely sure you want to delete "" network, ?

+


- + - + " />
- + " />
diff --git a/modules/webadmin/tmpl/del_user.tmpl b/modules/webadmin/tmpl/del_user.tmpl index a1c3399..13e98f5 100644 --- a/modules/webadmin/tmpl/del_user.tmpl +++ b/modules/webadmin/tmpl/del_user.tmpl @@ -1,22 +1,23 @@ +
-
Confirm User Deletion
+
-

Are you absolutely sure you want to delete ""?

+


-
+ - + " />
- + " />
diff --git a/modules/webadmin/tmpl/encoding_settings.tmpl b/modules/webadmin/tmpl/encoding_settings.tmpl index 711c99e..253e8d0 100644 --- a/modules/webadmin/tmpl/encoding_settings.tmpl +++ b/modules/webadmin/tmpl/encoding_settings.tmpl @@ -1,33 +1,35 @@ + +    
- disabled="disabled" /> + UTF-8, or ISO-8859-15" ?>" value="" list="encoding_list" disabled="disabled" />
@@ -53,4 +55,4 @@ jQuery("input:radio[name=encoding_utf]").change(updateEncodingLegacy); updateEncodingLegacy(); - \ No newline at end of file + diff --git a/modules/webadmin/tmpl/index.tmpl b/modules/webadmin/tmpl/index.tmpl index f6d62f8..9cd5428 100644 --- a/modules/webadmin/tmpl/index.tmpl +++ b/modules/webadmin/tmpl/index.tmpl @@ -1,10 +1,11 @@ +
Webadmin
-

Welcome to the ZNC webadmin module.
All changes you make will be in effect immediately after you submitted them.

+


diff --git a/modules/webadmin/tmpl/listusers.tmpl b/modules/webadmin/tmpl/listusers.tmpl index e7320a4..0209867 100644 --- a/modules/webadmin/tmpl/listusers.tmpl +++ b/modules/webadmin/tmpl/listusers.tmpl @@ -1,60 +1,70 @@ +
List of Users
-
- -
- There are no users defined. Click here if you would like to add one. -
- - -
-
-
- - - - +
+ +
+ here if you would like to add one." "ModPath TOP" ?>
+ + +
+ +
+
StatusFlag Title
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
+
- - -
- - - - - - - - - - - - - - - - - - - - - - - + + + - + \ No newline at end of file diff --git a/modules/webadmin/tmpl/settings.tmpl b/modules/webadmin/tmpl/settings.tmpl index edd4c14..857bdbf 100644 --- a/modules/webadmin/tmpl/settings.tmpl +++ b/modules/webadmin/tmpl/settings.tmpl @@ -1,12 +1,13 @@ +
@@ -16,14 +17,15 @@ - - - - - - - - + + + + + + + + + @@ -70,8 +72,10 @@ - + "/> + + " value="" /> @@ -116,7 +120,7 @@ - +
PortBindHostSSLIPv4IPv6IRCWebURIPrefix
"/>
@@ -128,93 +132,95 @@
- +
- -
- -
Default for new users only.
+ +
+ "/> +
+
-
- -
- -
- + +
+ +
+ "/> +
-
- -
- -
- + +
+ +
+ " /> +
-
- -
- -
- + +
+ +
+ " /> +
-
- -
- -
- + +
+ +
+ " /> +
-
- -
- -
-
- checked="checked" /> - -
Disallow IP changing during each web session
+ +
+ +
+
+ checked="checked" /> + +
+
-
- -
- -
-
- checked="checked" /> - -
Hide version number from non-ZNC users
+ +
+ +
+
+ checked="checked" /> + +
+
-
- + +
+ +
+
+ checked="checked" /> + +
+
+
+
+
- +
-
"Message of the Day", sent to all ZNC users on connect.
-
+
+
-
- -
- -
One host name or IP entry per line.
-
-
@@ -222,12 +228,12 @@ - - - - - - + + + + + + @@ -283,7 +289,7 @@ diff --git a/modules/webadmin/tmpl/traffic.tmpl b/modules/webadmin/tmpl/traffic.tmpl index de5f743..b2a467d 100644 --- a/modules/webadmin/tmpl/traffic.tmpl +++ b/modules/webadmin/tmpl/traffic.tmpl @@ -1,8 +1,9 @@ +
-
Traffic Information
+
@@ -58,10 +59,10 @@
StatusNameArgumentsDescriptionGlobalNetworks
- + - + - + - + - + - +
Uptime -
+
">
@@ -69,52 +70,52 @@
Total Users -
+
">
Total Networks -
+
">
Attached Networks -
+
">
Total Client Connections -
+
">
Total IRC Connections -
+
">
@@ -140,10 +141,10 @@ - - - - + + + + @@ -158,19 +159,19 @@ - + - + - +