From 97a888c0db3ad3e73fbd6d74aed1628023d790c2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 19 Feb 2019 12:54:12 -0500 Subject: [PATCH] get rid of js that just does the form submit. Upgrade the button from an input to a button. Use 0 and 1 instead of accept and decline, which allows us to pre-select the current value of ZM_TELEMETRY_DATA. So that if you had previously declined, you won't accidentally accept. This fixes the reported error that choosing decline would cause the setting to not be saved and the privacy popup to happen again. --- web/includes/actions/privacy.php | 10 +++++----- web/skins/classic/views/js/privacy.js | 10 ---------- web/skins/classic/views/privacy.php | 27 +++++++++++++-------------- 3 files changed, 18 insertions(+), 29 deletions(-) delete mode 100644 web/skins/classic/views/js/privacy.js diff --git a/web/includes/actions/privacy.php b/web/includes/actions/privacy.php index 99bbd7150..f3a805773 100644 --- a/web/includes/actions/privacy.php +++ b/web/includes/actions/privacy.php @@ -19,18 +19,18 @@ // if ( !canEdit('System') ) { - Warning("Need System permissions to update privacy"); + Warning('Need System permissions to update privacy'); return; } -if ( ($action == 'privacy') && isset($_REQUEST['option']) ) { - switch( $_REQUEST['option'] ) { - case 'decline' : +if ( ($action == 'privacy') && isset($_POST['option']) ) { + switch( $_POST['option'] ) { + case '0' : dbQuery("UPDATE Config SET Value = '0' WHERE Name = 'ZM_SHOW_PRIVACY'"); dbQuery("UPDATE Config SET Value = '0' WHERE Name = 'ZM_TELEMETRY_DATA'"); $redirect = '?view=console'; break; - case 'accept' : + case '1' : dbQuery("UPDATE Config SET Value = '0' WHERE Name = 'ZM_SHOW_PRIVACY'"); dbQuery("UPDATE Config SET Value = '1' WHERE Name = 'ZM_TELEMETRY_DATA'"); $redirect = '?view=console'; diff --git a/web/skins/classic/views/js/privacy.js b/web/skins/classic/views/js/privacy.js deleted file mode 100644 index bbf17f864..000000000 --- a/web/skins/classic/views/js/privacy.js +++ /dev/null @@ -1,10 +0,0 @@ -function submitForm( element ) { - var form = element.form; - if ( form.option.selectedIndex == 0 ) { - form.view.value = currentView; - } else { - form.view.value = 'none'; - } - form.submit(); -} - diff --git a/web/skins/classic/views/privacy.php b/web/skins/classic/views/privacy.php index 21c0bdb59..d82e4327f 100644 --- a/web/skins/classic/views/privacy.php +++ b/web/skins/classic/views/privacy.php @@ -18,20 +18,19 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -if ( !canEdit( 'System' ) ) -{ - $view = "error"; - return; +if ( !canEdit('System') ) { + $view = 'error'; + return; } $options = array( - "accept" => translate('Accept'), - "decline" => translate('Decline'), + '1' => translate('Accept'), + '0' => translate('Decline'), ); $focusWindow = true; -xhtmlHeaders(__FILE__, translate('Privacy') ); +xhtmlHeaders(__FILE__, translate('Privacy')); ?>
@@ -41,31 +40,31 @@ xhtmlHeaders(__FILE__, translate('Privacy') );
- +

-
+

-
+

-
+

-
+

-

+

- +