2016-01-30 20:28:43 +00:00
|
|
|
|
<?php
|
2021-03-05 03:08:47 +00:00
|
|
|
|
/**
|
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
|
*
|
|
|
|
|
* @created 30th April, 2015
|
2022-07-09 15:45:08 +00:00
|
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
|
|
|
use Joomla\CMS\Layout\LayoutHelper;
|
|
|
|
|
use Joomla\CMS\Router\Route;
|
|
|
|
|
Html::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
|
|
|
|
Html::_('behavior.formvalidator');
|
|
|
|
|
Html::_('formbehavior.chosen', 'select');
|
|
|
|
|
Html::_('behavior.keepalive');
|
|
|
|
|
use Joomla\CMS\Session\Session;
|
|
|
|
|
use VDM\Joomla\Utilities\StringHelper;
|
2017-02-02 11:54:07 +00:00
|
|
|
|
|
|
|
|
|
$this->app->input->set('hidemainmenu', false);
|
2024-03-02 20:10:30 +00:00
|
|
|
|
$selectNotice = '<h3>' . Text::_('COM_COMPONENTBUILDER_HI') . ' ' . $this->user->name . '</h3>';
|
|
|
|
|
$selectNotice .= '<p>' . Text::_('COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE') . '</p>';
|
2021-02-19 23:53:14 +00:00
|
|
|
|
|
|
|
|
|
// set the noticeboard options
|
2021-03-05 03:08:47 +00:00
|
|
|
|
$noticeboardOptions = array('vdm', 'pro');
|
|
|
|
|
?>
|
|
|
|
|
<?php if ($this->canDo->get('compiler.access')): ?>
|
2020-02-04 23:18:34 +00:00
|
|
|
|
|
2016-01-30 20:28:43 +00:00
|
|
|
|
<script type="text/javascript">
|
2024-03-02 20:10:30 +00:00
|
|
|
|
Joomla.submitbutton = function(task, key) {
|
|
|
|
|
if (task === '') {
|
2016-01-30 20:28:43 +00:00
|
|
|
|
return false;
|
|
|
|
|
} else {
|
2024-03-02 20:10:30 +00:00
|
|
|
|
var component = document.getElementById('component_id').value;
|
2016-01-30 20:28:43 +00:00
|
|
|
|
var isValid = true;
|
2022-10-20 14:40:18 +00:00
|
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
|
if (component === '' && task === 'compiler.compiler') {
|
2016-01-30 20:28:43 +00:00
|
|
|
|
isValid = false;
|
|
|
|
|
}
|
2024-03-02 20:10:30 +00:00
|
|
|
|
if (isValid) {
|
|
|
|
|
document.getElementById('form').style.display = 'none';
|
2020-02-04 23:18:34 +00:00
|
|
|
|
var form = document.getElementById('adminForm');
|
2024-03-02 20:10:30 +00:00
|
|
|
|
if (task === 'compiler.installCompiledModule' || task === 'compiler.installCompiledPlugin') {
|
2019-08-12 21:30:31 +00:00
|
|
|
|
form.install_item_id.value = key;
|
|
|
|
|
}
|
2017-08-05 11:10:08 +00:00
|
|
|
|
form.task.value = task;
|
2021-03-04 06:13:05 +00:00
|
|
|
|
setTimeout(function() {
|
|
|
|
|
form.submit();
|
|
|
|
|
}, 100);
|
2024-03-02 20:10:30 +00:00
|
|
|
|
|
|
|
|
|
if (task === 'compiler.compiler') {
|
|
|
|
|
let component_name = document.querySelector("#component_id option:checked").textContent;
|
|
|
|
|
document.querySelectorAll(".component-name").forEach(elem => {
|
|
|
|
|
elem.textContent = component_name;
|
|
|
|
|
});
|
2021-02-19 00:35:54 +00:00
|
|
|
|
setTimeout(function() {
|
2024-03-02 20:10:30 +00:00
|
|
|
|
document.getElementById('compiler').style.display = 'block';
|
|
|
|
|
document.getElementById('compiling').style.display = 'block';
|
2021-02-19 00:35:54 +00:00
|
|
|
|
setTimeout(function() {
|
2024-03-02 20:10:30 +00:00
|
|
|
|
document.getElementById('compiler-spinner').style.display = 'block';
|
|
|
|
|
document.getElementById('compiler-notice').style.display = 'block';
|
2021-02-19 00:35:54 +00:00
|
|
|
|
}, 100);
|
|
|
|
|
}, 100);
|
2024-03-02 20:10:30 +00:00
|
|
|
|
} else if (task === 'compiler.clearTmp') {
|
|
|
|
|
document.getElementById('clear').style.display = 'block';
|
|
|
|
|
document.getElementById('loading').style.display = 'block';
|
|
|
|
|
} else if (task === 'compiler.getCompilerAnimations') {
|
|
|
|
|
document.getElementById('get-compiler-animations').style.display = 'block';
|
|
|
|
|
document.getElementById('loading').style.display = 'block';
|
2016-01-30 20:28:43 +00:00
|
|
|
|
} else {
|
2024-03-02 20:10:30 +00:00
|
|
|
|
document.getElementById('loading').style.display = 'block';
|
2016-01-30 20:28:43 +00:00
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
2024-03-02 20:10:30 +00:00
|
|
|
|
document.querySelectorAll('.notice').forEach(elem => {
|
|
|
|
|
elem.style.display = 'block';
|
|
|
|
|
});
|
2016-01-30 20:28:43 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Add spindle-wheel for importations:
|
2024-03-02 20:10:30 +00:00
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
2019-07-08 16:05:54 +00:00
|
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
|
// get page body
|
|
|
|
|
var outerBodyDiv = document.querySelector('body');
|
|
|
|
|
|
|
|
|
|
// start loading spinner
|
|
|
|
|
var loadingDiv = document.createElement('div');
|
|
|
|
|
loadingDiv.id = 'loading';
|
|
|
|
|
|
|
|
|
|
// Set CSS properties individually
|
|
|
|
|
loadingDiv.style.background = "rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat";
|
|
|
|
|
loadingDiv.style.top = (outerBodyDiv.getBoundingClientRect().top + window.pageYOffset) + "px";
|
|
|
|
|
loadingDiv.style.left = (outerBodyDiv.getBoundingClientRect().left + window.pageXOffset) + "px";
|
|
|
|
|
loadingDiv.style.width = outerBodyDiv.offsetWidth + "px";
|
|
|
|
|
loadingDiv.style.height = outerBodyDiv.offsetHeight + "px";
|
|
|
|
|
loadingDiv.style.position = 'fixed';
|
|
|
|
|
loadingDiv.style.opacity = '0.80';
|
|
|
|
|
loadingDiv.style.msFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
|
|
|
|
loadingDiv.style.filter = "alpha(opacity=80)";
|
|
|
|
|
loadingDiv.style.display = 'none';
|
|
|
|
|
|
|
|
|
|
// add to page body
|
|
|
|
|
outerBodyDiv.appendChild(loadingDiv);
|
|
|
|
|
|
|
|
|
|
// waiting compiler overlay
|
|
|
|
|
var compilingDiv = document.createElement('div');
|
|
|
|
|
compilingDiv.id = 'compiling';
|
|
|
|
|
|
|
|
|
|
// Set CSS properties individually
|
|
|
|
|
compilingDiv.style.background = "rgba(16, 164, 230, .4)";
|
|
|
|
|
compilingDiv.style.top = (outerBodyDiv.getBoundingClientRect().top + window.pageYOffset) + "px";
|
|
|
|
|
compilingDiv.style.left = (outerBodyDiv.getBoundingClientRect().left + window.pageXOffset) + "px";
|
|
|
|
|
compilingDiv.style.width = outerBodyDiv.offsetWidth + "px";
|
|
|
|
|
compilingDiv.style.height = outerBodyDiv.offsetHeight + "px";
|
|
|
|
|
compilingDiv.style.position = 'fixed';
|
|
|
|
|
compilingDiv.style.opacity = '0.40';
|
|
|
|
|
compilingDiv.style.msFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
|
|
|
|
|
compilingDiv.style.filter = "alpha(opacity=40)";
|
|
|
|
|
compilingDiv.style.display = 'none';
|
|
|
|
|
|
|
|
|
|
// add to page
|
|
|
|
|
outerBodyDiv.appendChild(compilingDiv);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<?php if(!empty( $this->sidebar)): ?>
|
2017-03-03 21:53:18 +00:00
|
|
|
|
<div id="j-sidebar-container" class="span2">
|
|
|
|
|
<?php echo $this->sidebar; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="j-main-container" class="span10">
|
2017-02-02 11:54:07 +00:00
|
|
|
|
<?php else : ?>
|
2017-03-03 21:53:18 +00:00
|
|
|
|
<div id="j-main-container">
|
2016-01-30 20:28:43 +00:00
|
|
|
|
<?php endif; ?>
|
2023-05-02 00:10:55 +00:00
|
|
|
|
<?php if (StringHelper::check($this->SuccessMessage)): ?>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div class="alert alert-success">
|
|
|
|
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
|
|
|
<?php echo $this->SuccessMessage; ?>
|
|
|
|
|
</div>
|
2021-03-04 06:13:05 +00:00
|
|
|
|
<?php endif; ?>
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<form action="<?php echo Route::_('index.php?option=com_componentbuilder&view=compiler'); ?>"
|
2022-10-20 14:40:18 +00:00
|
|
|
|
method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
|
|
|
|
<div id="form" >
|
|
|
|
|
<div class="span4">
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<h3><?php echo Text::_('COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT'); ?></h3>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div id="compilerForm">
|
|
|
|
|
<div>
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<span class="notice" style="display:none; color:red;"><?php echo Text::_('COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT'); ?></span><br />
|
2023-02-12 19:15:41 +00:00
|
|
|
|
<?php if ($this->form): ?>
|
|
|
|
|
<?php echo $this->form->renderFieldset('builder'); ?>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<?php endif; ?>
|
2017-02-17 18:35:18 +00:00
|
|
|
|
</div>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<br />
|
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
<button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span>
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<?php echo Text::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT'); ?>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
</button>
|
|
|
|
|
<input type="hidden" name="install_item_id" value="0">
|
|
|
|
|
<input type="hidden" name="version" value="3" />
|
2017-02-17 18:35:18 +00:00
|
|
|
|
</div>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="span7">
|
2023-02-12 19:15:41 +00:00
|
|
|
|
<div id="advance-details"><?php echo $this->form->renderFieldset('advanced'); ?></div>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div id="component-details"><?php echo $selectNotice; ?></div>
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<?php echo LayoutHelper::render('jcbnoticeboardtabs', array('id' => 'noticeboard' , 'active' => $noticeboardOptions[array_rand($noticeboardOptions)])); ?>
|
2020-02-04 23:18:34 +00:00
|
|
|
|
</div>
|
2017-02-17 18:35:18 +00:00
|
|
|
|
</div>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div id="get-compiler-animations" style="display:none;">
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<h1><?php echo Text::_('COM_COMPONENTBUILDER_PLEASE_WAIT'); ?></h1>
|
|
|
|
|
<h4><?php echo Text::_('COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION'); ?> <span class="loading-dots">.</span></h4>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div class="clearfix"></div>
|
2017-02-17 18:35:18 +00:00
|
|
|
|
</div>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div id="clear" style="display:none;">
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<h1><?php echo Text::_('COM_COMPONENTBUILDER_PLEASE_WAIT'); ?></h1>
|
|
|
|
|
<h4><?php echo Text::_('COM_COMPONENTBUILDER_REMOVING_ALL_ZIP_PACKAGES_FROM_THE_TEMPORARY_FOLDER_OF_THE_JOOMLA_INSTALL'); ?> <span class="loading-dots">.</span></h4>
|
2021-02-19 00:35:54 +00:00
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
</div>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div id="compiler" style="display:none;">
|
|
|
|
|
<div id="compiler-spinner" class="span4" style="display:none;">
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<h3><?php echo Text::sprintf('COM_COMPONENTBUILDER_S_PLEASE_WAIT', $this->user->name); ?></h3>
|
|
|
|
|
<p style="font-size: smaller;"><?php echo Text::_('COM_COMPONENTBUILDER_THIS_MAY_TAKE_A_WHILE_DEPENDING_ON_THE_SIZE_OF_YOUR_PROJECT'); ?></p>
|
|
|
|
|
<p><b><span class="component-name"><?php echo Text::_('COM_COMPONENTBUILDER_THE_COMPONENT'); ?></span></b> <?php echo Text::_('COM_COMPONENTBUILDER_IS_BEING_COMPILED'); ?> <span class="loading-dots">.</span></p>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div style="text-align: center;"><?php echo ComponentbuilderHelper::getDynamicContent('builder-gif', $this->builder_gif_size); ?></div>
|
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="compiler-notice" class="span7" style="display:none;">
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<?php echo LayoutHelper::render('jcbnoticeboard' . $noticeboardOptions[array_rand($noticeboardOptions)], null); ?>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<div><?php echo ComponentbuilderHelper::getDynamicContent('banner', '728-90'); ?></div>
|
|
|
|
|
</div>
|
2021-02-19 00:35:54 +00:00
|
|
|
|
</div>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
<input type="hidden" name="task" value="" />
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<?php echo Html::_('form.token'); ?>
|
2022-10-20 14:40:18 +00:00
|
|
|
|
</form>
|
2017-03-03 21:53:18 +00:00
|
|
|
|
</div>
|
|
|
|
|
<script type="text/javascript">
|
2017-02-17 18:35:18 +00:00
|
|
|
|
// token
|
2024-03-02 20:10:30 +00:00
|
|
|
|
var token = '<?php echo Session::getFormToken(); ?>';
|
|
|
|
|
var all_is_good = '<?php echo Text::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME'); ?>';
|
|
|
|
|
jQuery('#compilerForm').on('change', '#component_id', function (e) {
|
|
|
|
|
var componentSelect = document.getElementById('component_id');
|
|
|
|
|
if (componentSelect) {
|
|
|
|
|
var component = componentSelect.value;
|
|
|
|
|
if (component === "") {
|
|
|
|
|
document.getElementById('component-details').innerHTML = "<?php echo $selectNotice; ?>";
|
|
|
|
|
document.getElementById("noticeboard").style.display = 'block';
|
|
|
|
|
document.querySelectorAll('.notice').forEach(function (elem) {
|
|
|
|
|
elem.style.display = 'block';
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
getComponentDetails(component);
|
|
|
|
|
document.getElementById("noticeboard").style.display = 'none';
|
|
|
|
|
document.querySelectorAll('.notice').forEach(function (elem) {
|
|
|
|
|
elem.style.display = 'none';
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2018-02-27 12:17:38 +00:00
|
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
document.querySelectorAll(".loading-dots").forEach(function(loading_dots) {
|
|
|
|
|
let x = 0;
|
|
|
|
|
let intervalId = setInterval(function() {
|
|
|
|
|
if (!loading_dots.classList.contains("loading-dots")) {
|
|
|
|
|
clearInterval(intervalId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let dots = ".".repeat(x % 8);
|
|
|
|
|
loading_dots.textContent = dots;
|
|
|
|
|
x++;
|
|
|
|
|
}, 500);
|
|
|
|
|
});
|
2018-02-27 12:17:38 +00:00
|
|
|
|
});
|
|
|
|
|
|
2017-02-17 18:35:18 +00:00
|
|
|
|
<?php
|
2024-03-02 20:10:30 +00:00
|
|
|
|
$app = Factory::getApplication();
|
2017-02-17 18:35:18 +00:00
|
|
|
|
?>
|
|
|
|
|
function JRouter(link) {
|
|
|
|
|
<?php
|
2020-01-03 01:41:55 +00:00
|
|
|
|
if ($app->isClient('site'))
|
2017-02-17 18:35:18 +00:00
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
|
echo 'var url = "'. \Joomla\CMS\Uri\Uri::root() . '";';
|
2017-02-17 18:35:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
echo 'var url = "";';
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
return url+link;
|
2018-02-27 12:17:38 +00:00
|
|
|
|
}
|
2020-02-04 23:18:34 +00:00
|
|
|
|
</script>
|
2021-03-05 03:08:47 +00:00
|
|
|
|
<?php else: ?>
|
2024-03-02 20:10:30 +00:00
|
|
|
|
<h1><?php echo Text::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
|
2021-03-05 03:08:47 +00:00
|
|
|
|
<?php endif; ?>
|