- md5
- 882ccefe35814e5a95b7ca6c65aee7ef
- sha1
- 4a50d034d859dd82fc3b34b799ea04b10d9e1a39
- sha256
- a495194d88c480d779f81265b7232bbf34d4697ba3492f468c8988b8617d0458
/**
* @package Joomla.Installation
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/Joomla.setlanguage=function(l){var o=Joomla.serialiseForm(l);return Joomla.removeMessages(),document.body.appendChild(document.createElement("joomla-core-loader")),Joomla.request({url:Joomla.baseUrl,method:"POST",data:o,perform:!0,onSuccess:function(t,a){t=JSON.parse(t),Joomla.replaceTokens(t.token);var e=document.querySelector("joomla-core-loader");t.messages&&Joomla.renderMessages(t.messages),t.error?(e.parentNode.removeChild(e),Joomla.renderMessages({error:[t.message]})):(e.parentNode.removeChild(e),Joomla.goToPage(t.data.view,!0))},onError:function(t){var a=document.querySelector("joomla-core-loader");a.parentNode.removeChild(a);try{var e=JSON.parse(t.responseText);Joomla.replaceTokens(e.token),alert(e.message)}catch{}}}),!1},Joomla.checkInputs=function(){document.getElementById("jform_admin_password2").value=document.getElementById("jform_admin_password").value,document.getElementById("progress-text").classList.remove("error"),document.getElementById("progress-text").setAttribute("role","status"),document.getElementById("progress-text").innerText=Joomla.Text._("INSTL_IN_PROGRESS"),document.getElementById("progressbar").setAttribute("value",0);var l=["#jform_site_name","#jform_admin_user","#jform_admin_email","#jform_admin_password","#jform_db_type","#jform_db_host","#jform_db_user","#jform_db_name"];if(Joomla.checkFormField(l)){Joomla.checkDbCredentials();return}var o=l.map(function(t){return document.querySelector(t)}).filter(function(t){return t&&t.classList.contains("invalid")})[0];o&&(document.getElementById("installStep3").classList.remove("active"),o.closest(".j-install-step").classList.add("active"),o.focus())},Joomla.checkDbCredentials=function(){const l=document.getElementById("progressbar"),o=document.getElementById("progress-text");var t=document.getElementById("adminForm"),a=Joomla.serialiseForm(t);Joomla.removeMessages(),document.getElementById("installStep1").classList.remove("active"),document.getElementById("installStep2").classList.remove("active"),document.getElementById("installStep3").classList.remove("active"),document.getElementById("installStep4").classList.add("active"),o.innerText=Joomla.Text._("INSTL_IN_PROGRESS"),Joomla.request({method:"POST",url:Joomla.installationBaseUrl+"?task=installation.dbcheck&format=json",data:a,perform:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},onSuccess:function(e,n){try{e=JSON.parse(e)}catch{return o.setAttribute("role","alert"),o.classList.add("error"),o.innerText=e,console.error("Error in DB Check Endpoint"),console.error(e),Joomla.renderMessages({error:[Joomla.Text._("INSTL_DATABASE_RESPONSE_ERROR")]}),!1}e.messages&&Joomla.renderMessages(e.messages),Joomla.replaceTokens(e.token),e.error?(document.getElementById("installStep3").classList.add("active"),document.getElementById("installStep4").classList.remove("active"),o.innerText=Joomla.Text._("INSTL")):e.data&&e.data.validated===!0&&(l.setAttribute("value",parseInt(l.getAttribute("value"))+1),o.innerText=Joomla.Text._("INSTL_IN_PROGRESS"),Joomla.install(["create","populate1","populate2","populate3","custom1","custom2","config"],t))},onError:function(e){var n={};try{n=JSON.parse(e.responseText)}catch{}n.token&&Joomla.replaceTokens(n.token),n.message?Joomla.renderMessages({error:[n.message]}):Joomla.renderMessages(Joomla.ajaxErrorsMessages(e)),o.setAttribute("role","alert"),o.classList.add("error"),o.innerText=n.message||Joomla.Text._("INSTL"),document.getElementById("installStep3").classList.add("active"),document.getElementById("installStep4").classList.remove("active")}})},(function(){sessionStorage&&sessionStorage.getItem("installation-data")&&Joomla.extend(this.options,sessionStorage.getItem("installation-data")),Joomla.pageInit();var l=document.querySelector(".nav-steps.hidden");l&&l.classList.remove("hidden"),document.getElementById("jform_site_name")&&document.getElementById("jform_site_name").focus();const o=document.getElementById("languageForm"),t=document.getElementById("languageSelect");if(o&&t){const a=t.content.getElementById("jform_language");if(a){o.addEventListener("change",function(n){n.target.id==="jform_language"&&(n.target.closest("dialog").close(),Joomla.setlanguage(o))});const e=document.getElementById("languageForm-current");e&&(e.innerText=a.options[a.selectedIndex].text)}}document.getElementById("step1")&&document.getElementById("step1").addEventListener("click",function(a){a.preventDefault(),Joomla.checkFormField(["#jform_site_name"])&&(document.getElementById("languageForm")&&document.getElementById("languageForm").classList.add("hidden"),document.getElementById("installStep2")&&(document.getElementById("installStep2").classList.add("active"),document.getElementById("installStep1").classList.remove("active"),document.getElementById("jform_admin_user")&&document.getElementById("jform_admin_user").focus()))}),document.getElementById("step2")&&(document.getElementById("step2").addEventListener("click",function(a){a.preventDefault(),Joomla.checkFormField(["#jform_admin_user","#jform_admin_email","#jform_admin_password"])&&document.getElementById("installStep3")&&(document.getElementById("installStep3").classList.add("active"),document.getElementById("installStep2").classList.remove("active"),document.getElementById("setupButton").classList.remove("hidden"),Joomla.makeRandomDbPrefix(),document.getElementById("jform_db_type")&&document.getElementById("jform_db_type").focus())}),document.getElementById("setupButton").addEventListener("click",function(a){a.preventDefault(),a.stopPropagation(),Joomla.checkInputs()}))})();
The same content is in 8 releases, Joomla 6.2.0-beta1 to 6.2.1. See them all, or every version of this file.