From 660a1bbe011fef5f0fa6bb0af43521fed7598cc7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Feb 2021 13:44:56 +0300 Subject: * switch to xhr.post() almost everywhere * call App.handlerpcjson() automatically on json request (if possible) * show net/log indicators in prefs --- classes/pref/feeds.php | 3 +-- classes/pref/prefs.php | 42 ++++++++++++++++++++---------------------- classes/rpc.php | 8 ++++++++ 3 files changed, 29 insertions(+), 24 deletions(-) (limited to 'classes') diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 761a0a087..97c529d07 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -832,8 +832,7 @@ class Pref_Feeds extends Handler_Protected { print " "; - print_feed_cat_select("cat_id", false, - 'disabled="1" dojoType="fox.form.Select"'); + print \Controls\select_feeds_cats("cat_id", null, ['disabled' => '1']); $this->batch_edit_cbox("cat_id"); diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index fecec6d91..2ea2e9f01 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -295,8 +295,8 @@ class Pref_Prefs extends Handler_Protected { evt.preventDefault(); if (this.validate()) { Notify.progress('Saving data...', true); - xhrPost("backend.php", this.getValues(), (transport) => { - Notify.info(transport.responseText); + xhr.post("backend.php", this.getValues(), (reply) => { + Notify.info(reply); }) } @@ -351,16 +351,16 @@ class Pref_Prefs extends Handler_Protected { evt.preventDefault(); if (this.validate()) { Notify.progress('Saving data...', true); - xhrPost("backend.php", this.getValues(), (transport) => { + xhr.post("backend.php", this.getValues(), (reply) => { Notify.close(); - if (transport.responseText.indexOf('ERROR: ') == 0) { + if (reply.indexOf('ERROR: ') == 0) { App.byId('pwd_change_infobox').innerHTML = - transport.responseText.replace('ERROR: ', ''); + reply.replace('ERROR: ', ''); } else { App.byId('pwd_change_infobox').innerHTML = - transport.responseText.replace('ERROR: ', ''); + reply.replace('ERROR: ', ''); const warn = App.byId('default_pass_warning'); if (warn) Element.hide(warn); @@ -456,11 +456,11 @@ class Pref_Prefs extends Handler_Protected { evt.preventDefault(); if (this.validate()) { Notify.progress('Saving data...', true); - xhrPost("backend.php", this.getValues(), (transport) => { + xhr.post("backend.php", this.getValues(), (reply) => { Notify.close(); - if (transport.responseText.indexOf('ERROR: ') == 0) { - Notify.error(transport.responseText.replace('ERROR: ', '')); + if (reply.indexOf('ERROR: ') == 0) { + Notify.error(reply.replace('ERROR: ', '')); } else { window.location.reload(); } @@ -515,11 +515,11 @@ class Pref_Prefs extends Handler_Protected { evt.preventDefault(); if (this.validate()) { Notify.progress('Saving data...', true); - xhrPost("backend.php", this.getValues(), (transport) => { + xhr.post("backend.php", this.getValues(), (reply) => { Notify.close(); - if (transport.responseText.indexOf('ERROR:') == 0) { - Notify.error(transport.responseText.replace('ERROR:', '')); + if (reply.indexOf('ERROR:') == 0) { + Notify.error(reply.replace('ERROR:', '')); } else { window.location.reload(); } @@ -797,16 +797,14 @@ class Pref_Prefs extends Handler_Protected { @@ -1023,8 +1021,8 @@ class Pref_Prefs extends Handler_Protected { diff --git a/classes/rpc.php b/classes/rpc.php index 0fd06da4d..c4a1887c7 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -64,6 +64,14 @@ class RPC extends Handler_Protected { print json_encode(array("message" => "UPDATE_COUNTERS")); } + function getRuntimeInfo() { + $reply = [ + 'runtime-info' => $this->make_runtime_info() + ]; + + print json_encode($reply); + } + function getAllCounters() { @$seq = (int) $_REQUEST['seq']; -- cgit v1.2.3-54-g00ecf