- md5
- 301e0864417be15987ba4675dc20389a
- sha1
- dc2420ebcecd43eff4e9d24fca0cfc671fbaa87d
- sha256
- e26a0dd41e0dff11bb225a2783bbdd7e678f5754d3e7dea3c6519f41887b5b55
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
/**
* @package Joomla.Installation
* @copyright Copyright (C) 2005 - 2020 Open Source Matters. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla = window.Joomla || {};
// @TODO FTP???
Joomla.installation = Joomla.installation || {};
// Initialize the installation data
Joomla.installation.data = {
// FTP
ftpUsername: "",
ftpPassword: "",
ftpHost: "",
ftpPort: 21,
ftpRoot: "/",
};
/**
* Method to detect the FTP root via AJAX request.
*
* @param el The page element requesting the event
*/
Joomla.installation.detectFtpRoot = function(el) {
var data, task, form = document.getElementById('ftpForm');
data = Joomla.serialiseForm(form); //'format: json&' +
el.setAttribute('disabled', 'disabled');
task = 'detectftproot';
Joomla.request({
type: "POST",
url : Joomla.installationBaseUrl + '?task=' + task + '&format=json',
data: data,
perform: true,
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
onSuccess: function(response, xhr){
var r = JSON.parse(response);
if (r) {
Joomla.replaceTokens(r.token)
console.log(r.messages.error)
if (r.messages && !r.messages.error) {
if (r.data && r.data.root) {
document.getElementById('jform_ftp_host').value += r.data.root;
}
} else {
alert(r.messages.warning);
}
}
el.removeAttribute('disabled');
},
onError: function(xhr){
try {
var r = JSON.parse(xhr.responseText);
Joomla.replaceTokens(r.token);
alert(xhr.status + ': ' + r.message);
} catch (e) {
alert(xhr.status + ': ' + xhr.statusText);
}
}
});
};
if (document.getElementById('showFtp')) {
// @TODO FTP??
document.getElementById('showFtp').classList.add('hidden');
document.getElementById('showFtp').addEventListener('click', function(e) {
e.preventDefault();
if (document.getElementById('ftpOptions')) {
document.getElementById('ftpOptions').classList.remove('hidden');
document.getElementById('ftpOptions').scrollIntoView();
}
})
}
if (document.getElementById('verifybutton')) {
document.getElementById('verifybutton').addEventListener('click', function(e) {
e.preventDefault();
// @TODO FTP??
//onclick="Install.verifyFtpSettings(this);"
var ftpForm = document.getElementById('ftpForm');
if (ftpForm) {
Joomla.installation.data.ftpUsername = document.getElementById('jform_ftp_user').value;
Joomla.installation.data.ftpPassword = document.getElementById('jform_ftp_pass').value;
Joomla.installation.data.ftpHost = document.getElementById('jform_ftp_host').value;
Joomla.installation.data.ftpPort = document.getElementById('jform_ftp_port').value;
var p, data = [];
for(p in Joomla.installation.data) {
data.push(Joomla.installation.data[p])
}
sessionStorage.setItem('installData', JSON.stringify(data));
// get it back: JSON.parse(sessionStorage.installData)
}
});
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.