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/prefs.php | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'classes/pref/prefs.php') 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 { -- cgit v1.2.3-54-g00ecf