From 0a43128e600c64ca728cdd86f07e98d9872d0082 Mon Sep 17 00:00:00 2001 From: dgt41 Date: Wed, 23 Aug 2017 16:37:18 +0300 Subject: [PATCH] js fixes --- installation/template/js/setup.js | 20 ++++++++++++++++---- installation/template/js/template.js | 2 +- installation/view/setup/tmpl/default.php | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/installation/template/js/setup.js b/installation/template/js/setup.js index 15e7ce21a6da0..f4a799a2ecf4d 100644 --- a/installation/template/js/setup.js +++ b/installation/template/js/setup.js @@ -222,7 +222,9 @@ Joomla.installation = function(_container, _base) { view = ''; // Merge options from the session storage - Joomla.extend(this.options, sessionStorage.getItem('installation-data')); + if (sessionStorage && sessionStorage.getItem('installation-data')) { + Joomla.extend(this.options, sessionStorage.getItem('installation-data')); + } Joomla.pageInit(); var el = document.querySelector('.nav-steps.hidden'); @@ -271,7 +273,7 @@ Joomla.checkFormField = function(fields) { Joomla.checkInputs = function() { document.getElementById('jform_admin_password2').value = document.getElementById('jform_admin_password').value; - document.getElementById('jform_db_prefix').value = Joomla.makeRandomDbPrefix(); + Joomla.makeRandomDbPrefix(); var inputs = [].slice.call(document.querySelectorAll('input[type="password"], input[type="text"], input[type="email"], select')), state = true; @@ -279,7 +281,14 @@ Joomla.checkInputs = function() { if (!item.valid) state = false; }); + // Reveal everything + document.getElementById('installStep1').classList.add('active'); + document.getElementById('installStep2').classList.add('active'); + document.getElementById('installStep3').classList.add('active'); + + if (Joomla.checkFormField(['#jform_site_name', '#jform_admin_user', '#jform_admin_email', '#jform_admin_password', '#jform_db_type', '#jform_db_host', '#jform_db_user', '#jform_db_name'])) { +console.log('hdfgh') Install.checkDbCredentials(); } }; @@ -335,7 +344,6 @@ window.Install = new Joomla.installation( document.getElementById('installStep2').classList.add('active'); document.getElementById('step1').parentNode.removeChild(document.getElementById('step1')); document.getElementById('installStep1').classList.remove('active'); - document.querySelector('li[data-step="2"]').classList.add('active'); Joomla.scrollTo(document.getElementById('installStep2'), document.getElementById('installStep2').offsetTop); // Focus to the next field @@ -356,7 +364,6 @@ window.Install = new Joomla.installation( document.getElementById('installStep3').classList.add('active'); document.getElementById('step2').parentNode.removeChild(document.getElementById('step2')); document.getElementById('installStep2').classList.remove('active'); - document.querySelector('li[data-step="3"]').classList.add('active'); Joomla.scrollTo(document.getElementById('installStep3'), document.getElementById('installStep3').offsetTop); document.getElementById('setupButton').style.display = 'block'; @@ -367,6 +374,11 @@ window.Install = new Joomla.installation( } } }) + + document.getElementById('setupButton').addEventListener('click', function(e) { + e.preventDefault(); + Joomla.checkInputs(); + }) } })(); diff --git a/installation/template/js/template.js b/installation/template/js/template.js index 53f30e1978c41..a4d62d1b38224 100644 --- a/installation/template/js/template.js +++ b/installation/template/js/template.js @@ -36,7 +36,7 @@ Joomla.installation = Joomla.installation || {}; // Initialize the FTP installation data - if (sessionStorage.getItem('installData')) { + if (sessionStorage && sessionStorage.getItem('installation-data')) { var data = sessionStorage.getItem('installData').split(','); Joomla.installation.data = { ftpUsername: data[0], diff --git a/installation/view/setup/tmpl/default.php b/installation/view/setup/tmpl/default.php index ae5305c504b91..aa9bcba6cf3e3 100644 --- a/installation/view/setup/tmpl/default.php +++ b/installation/view/setup/tmpl/default.php @@ -98,7 +98,7 @@ form->getInput('db_old'); ?>
- +