diff --git a/build/build.xml b/build/build.xml index e27e7f783a..5bc712fc55 100644 --- a/build/build.xml +++ b/build/build.xml @@ -142,6 +142,7 @@ + @@ -287,6 +288,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpBB/adm/style/acp_help_phpbb.html b/phpBB/adm/style/acp_help_phpbb.html new file mode 100644 index 0000000000..48a4595913 --- /dev/null +++ b/phpBB/adm/style/acp_help_phpbb.html @@ -0,0 +1,61 @@ + + + + +

{L_ACP_HELP_PHPBB}

+ +
+
+ +
+

Send statistics

+

{L_EXPLAIN_SEND_STATISTICS}

+
+ +
+
+ +
+ {providers.NAME} + +
+
{providers.values.KEY}
+
{providers.values.VALUE}
+
+ +
+ +
+
+
+
+
+ checked="checked" /> + +
+
{L_SEND_STATISTICS_LONG}
+
+
+ +
+

+ + + +

+ {S_FORM_TOKEN} +
+
+
+
+
+

+ + +

+
+
+ + diff --git a/phpBB/adm/style/acp_send_statistics.html b/phpBB/adm/style/acp_send_statistics.html deleted file mode 100644 index 480e438e1f..0000000000 --- a/phpBB/adm/style/acp_send_statistics.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - -

{L_SEND_STATISTICS}

- -

{L_EXPLAIN_SEND_STATISTICS}

- - - - - -
- -

{L_DONT_SEND_STATISTICS}

- -

{L_EXPLAIN_SHOW_STATISTICS}

- -

- -
- -

- -

- - -
- {providers.NAME} - -
-
{providers.values.KEY}
-
{providers.values.VALUE}
-
- -
- -
-

- - -

-
- -
-

{L_THANKS_SEND_STATISTICS}

« {L_GO_ACP_MAIN}

-
- - diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index e1668bf70b..bcf01fe597 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -2583,3 +2583,111 @@ fieldset.permissions .padding { line-height: 25px; font-weight: bold; } + +.send-stats-row { + margin: 15px 0; +} + +.send-stats-row:before { + display: table; + content: " "; +} + +.send-stats-tile { + position: relative; + padding: 14px; + margin-bottom: 20px; + background-color: #eff0f2; + border-radius: 6px; + box-shadow: rgba(0,0,0,0.3) 1px 1px 5px; +} + +.send-stats-tile h2 { + margin-top: 0; + text-align: center; + padding-bottom: 1em; +} + +.send-stats-tile i { + padding-right: 0.3em; +} + +.icon { + font-family: FontAwesome; + font-style: normal; +} + +.send-stats-data-row { + background: #f9f9f9; + border-radius: 6px; + border: #DEDEDE 1px solid; + padding: 10px; + border-top-width: 0; + border-top-right-radius: 0; + border-top-left-radius: 0; +} + +.send-stats-data-hidden .configlist { + display: none; +} + +.send-stats-data-only-row { + border-radius: 6px !important; + border-bottom-width: 1px !important; +} + +.send-stats-data-hidden { + padding: 0; + border: none; +} + +.send-stats-row > .send-stats-data-row:first-child { + background-color: #d9edf7; + border-bottom-width: 0; + border-top-right-radius: 6px; + border-top-left-radius: 6px; + border-top-width: 1px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +.send-stats-settings dt, .send-stats-settings dd { + min-width: 25px; +} + +.send-stats-settings dd { + line-height: 1.5em; +} + +.send-stats-settings input { + display: none; +} + +.send-stats-settings input[type=checkbox] + label:before { + content: "\f096"; + font-family: FontAwesome; + font-size: 1.5em; +} + +.send-stats-settings input[type=checkbox]:checked + label:before { + content: "\f14a"; + color: #3c763d; +} + +.send-stats-data-row a:hover span { + text-decoration: underline; +} + +.send-stats-data-row a { + text-decoration: none; + cursor: default; +} + +.send-stats-data-row i { + padding-left: 6px; +} + +.configlist { + word-wrap: break-word; + word-break: break-all; +} diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 253fd46a62..551c78a4a3 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -243,8 +243,16 @@ function parse_document(container) parse_document($('body')); - // Hide configlist and success message in send statistics page - phpbb.toggleDisplay('configlist', -1); - phpbb.toggleDisplay('questionnaire-thanks', -1); + $('#questionnaire-form').css('display', 'none'); + var $triggerConfiglist = $('#trigger-configlist'); + + $triggerConfiglist.on('click', function () { + var $configlist = $('#configlist'); + $configlist.closest('.send-stats-data-row').toggleClass('send-stats-data-hidden'); + $configlist.closest('.send-stats-row').find('.send-stats-data-row:first-child').toggleClass('send-stats-data-only-row'); + $(this).find('i').toggleClass('fa-angle-down fa-angle-up'); + }); + + $('#configlist').closest('.send-stats-data-row').addClass('send-stats-data-hidden'); }); })(jQuery); diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 3c1c57505b..d5154b2a61 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -4,6 +4,101 @@ 'use strict'; + +phpbb.prepareSendStats = function () { + var $form = $('#acp_help_phpbb'); + var $dark = $('#darkenwrapper'); + var $loadingIndicator; + + $form.on('submit', function (event) { + var $this = $(this), + currentTime = Math.floor(new Date().getTime() / 1000), + statsTime = parseInt($this.find('input[name=help_send_statistics_time]').val(), 10); + + event.preventDefault(); + $this.unbind('submit'); + + // Skip ajax request if form is submitted too early or send stats + // checkbox is not checked + if (!$this.find('input[name=help_send_statistics]').is(':checked') || + statsTime > currentTime) { + $form.find('input[type=submit]').click(); + setTimeout(function () { + $form.find('input[type=submit]').click(); + }, 300); + return; + } + + /** + * Handler for AJAX errors + */ + function errorHandler(jqXHR, textStatus, errorThrown) { + if (typeof console !== 'undefined' && console.log) { + console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); + } + phpbb.clearLoadingTimeout(); + var errorText = ''; + + if (typeof errorThrown === 'string' && errorThrown.length > 0) { + errorText = errorThrown; + } else { + errorText = $dark.attr('data-ajax-error-text-' + textStatus); + if (typeof errorText !== 'string' || !errorText.length) { + errorText = $dark.attr('data-ajax-error-text'); + } + } + phpbb.alert($dark.attr('data-ajax-error-title'), errorText); + } + + /** + * This is a private function used to handle the callbacks, refreshes + * and alert. It calls the callback, refreshes the page if necessary, and + * displays an alert to the user and removes it after an amount of time. + * + * It cannot be called from outside this function, and is purely here to + * avoid repetition of code. + * + * @param {object} res The object sent back by the server. + */ + function returnHandler(res) { + phpbb.clearLoadingTimeout(); + + // If a confirmation is not required, display an alert and call the + // callbacks. + $dark.fadeOut(phpbb.alertTime); + + if ($loadingIndicator) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + + var $sendStatisticsSuccess = $('', { + type: 'hidden', + name: 'send_statistics_response', + value: res + }); + $sendStatisticsSuccess.appendTo('p.submit-buttons'); + + // Finish actual form submission + $form.find('input[type=submit]').click(); + } + + $loadingIndicator = phpbb.loadingIndicator(); + + $.ajax({ + url: $this.attr('data-ajax-action').replace('&', '&'), + type: 'POST', + data: 'systemdata=' + encodeURIComponent($this.find('input[name=systemdata]').val()), + success: returnHandler, + error: errorHandler, + cache: false + }).always(function() { + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + }); + }); +}; + /** * The following callbacks are for reording items. row_down * is triggered when an item is moved down, and row_up is triggered when @@ -225,6 +320,10 @@ $(function() { $(this).attr('data-clicked', true); }); } + + if ($('#acp_help_phpbb')) { + phpbb.prepareSendStats(); + } }); diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index f227f729fd..1e8de766ff 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -7,6 +7,7 @@ {META} {PAGE_TITLE} +