From db4cfa7df62d5911bc5a0edcdc59236c39aede08 Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 11 Jun 2015 19:32:11 +0200 Subject: [ticket/13740] Add navigation bar support for the installer Also added various UI elements and texts. [ci skip] PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 61 ++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 9 deletions(-) (limited to 'phpBB/assets/javascript') diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index a9a315c0d5..eafcd78f47 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -95,6 +95,45 @@ interceptFormSubmit($form); } + /** + * Handles navigation status updates + * + * @param navObj + */ + function updateNavbarStatus(navObj) { + var navID, $stage, $stageListItem, $active; + $active = $('#activemenu'); + + if (navObj.hasOwnProperty('finished')) { + // This should be an Array + var navItems = navObj.finished; + + for (var i = 0; i < navItems.length; i++) { + navID = 'installer-stage-' + navItems[i]; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && $active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stage.addClass('completed'); + } + } + + if (navObj.hasOwnProperty('active')) { + navID = 'installer-stage-' + navObj.active; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && !$active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stageListItem.attr('id', 'activemenu'); + } + } + /** * Renders progress bar * @@ -166,6 +205,10 @@ if (responseObject.hasOwnProperty('progress')) { setProgress(responseObject.progress); } + + if (responseObject.hasOwnProperty('nav')) { + updateNavbarStatus(responseObject.nav); + } } /** @@ -231,6 +274,14 @@ }, 10); } + /** + * Resets the polling timer + */ + function resetPolling() { + clearInterval(pollTimer); + nextReadPosition = 0; + } + /** * Sets up timer for processing the streamed HTTP response * @@ -240,15 +291,7 @@ resetPolling(); pollTimer = setInterval(function () { pollContent(xhReq); - }, 500); - } - - /** - * Resets the polling timer - */ - function resetPolling() { - clearInterval(pollTimer); - nextReadPosition = 0; + }, 250); } /** -- cgit v1.2.1