328 lines
13 KiB
PHP
328 lines
13 KiB
PHP
|
<?php
|
||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||
|
Agence Agerix
|
||
|
/-------------------------------------------------------------------------------------------------------/
|
||
|
|
||
|
@version 1.x.x
|
||
|
@build 2nd June, 2022
|
||
|
@created 12th December, 2020
|
||
|
@package Extension Distributor
|
||
|
@subpackage edit.php
|
||
|
@author Emmanuel Danan <https://agerix.fr>
|
||
|
@copyright Copyright (C) 2021. All Rights Reserved.
|
||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||
|
|
||
|
/------------------------------------------------------------------------------------------------------*/
|
||
|
|
||
|
// No direct access to this file
|
||
|
defined('_JEXEC') or die('Restricted access');
|
||
|
|
||
|
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||
|
JHtml::_('behavior.formvalidator');
|
||
|
JHtml::_('formbehavior.chosen', 'select');
|
||
|
JHtml::_('behavior.keepalive');
|
||
|
$componentParams = $this->params; // will be removed just use $this->params instead
|
||
|
?>
|
||
|
<script type="text/javascript">
|
||
|
// waiting spinner
|
||
|
var outerDiv = jQuery('body');
|
||
|
jQuery('<div id="loading"></div>')
|
||
|
.css("background", "rgba(255, 255, 255, .8) url('components/com_extensiondistributor/assets/images/import.gif') 50% 15% no-repeat")
|
||
|
.css("top", outerDiv.position().top - jQuery(window).scrollTop())
|
||
|
.css("left", outerDiv.position().left - jQuery(window).scrollLeft())
|
||
|
.css("width", outerDiv.width())
|
||
|
.css("height", outerDiv.height())
|
||
|
.css("position", "fixed")
|
||
|
.css("opacity", "0.80")
|
||
|
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
|
||
|
.css("filter", "alpha(opacity = 80)")
|
||
|
.css("display", "none")
|
||
|
.appendTo(outerDiv);
|
||
|
jQuery('#loading').show();
|
||
|
// when page is ready remove and show
|
||
|
jQuery(window).load(function() {
|
||
|
jQuery('#extensiondistributor_loader').fadeIn('fast');
|
||
|
jQuery('#loading').hide();
|
||
|
});
|
||
|
</script>
|
||
|
<div id="extensiondistributor_loader" style="display: none;">
|
||
|
<form action="<?php echo JRoute::_('index.php?option=com_extensiondistributor&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||
|
|
||
|
<?php echo JLayoutHelper::render('package.details_above', $this); ?>
|
||
|
<div class="form-horizontal">
|
||
|
|
||
|
<?php echo JHtml::_('bootstrap.startTabSet', 'packageTab', array('active' => 'details')); ?>
|
||
|
|
||
|
<?php echo JHtml::_('bootstrap.addTab', 'packageTab', 'details', JText::_('COM_EXTENSIONDISTRIBUTOR_PACKAGE_DETAILS', true)); ?>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
<div class="span6">
|
||
|
<?php echo JLayoutHelper::render('package.details_left', $this); ?>
|
||
|
</div>
|
||
|
<div class="span6">
|
||
|
<?php echo JLayoutHelper::render('package.details_right', $this); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||
|
|
||
|
<?php echo JHtml::_('bootstrap.addTab', 'packageTab', 'configuration', JText::_('COM_EXTENSIONDISTRIBUTOR_PACKAGE_CONFIGURATION', true)); ?>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
<div class="span6">
|
||
|
<?php echo JLayoutHelper::render('package.configuration_left', $this); ?>
|
||
|
</div>
|
||
|
<div class="span6">
|
||
|
<?php echo JLayoutHelper::render('package.configuration_right', $this); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||
|
|
||
|
<?php echo JHtml::_('bootstrap.addTab', 'packageTab', 'files', JText::_('COM_EXTENSIONDISTRIBUTOR_PACKAGE_FILES', true)); ?>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
<div class="span12">
|
||
|
<?php echo JLayoutHelper::render('package.files_left', $this); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||
|
|
||
|
<?php echo JHtml::_('bootstrap.addTab', 'packageTab', 'releases', JText::_('COM_EXTENSIONDISTRIBUTOR_PACKAGE_RELEASES', true)); ?>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
</div>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
<div class="span12">
|
||
|
<?php echo JLayoutHelper::render('package.releases_fullwidth', $this); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||
|
|
||
|
<?php echo JHtml::_('bootstrap.addTab', 'packageTab', 'script', JText::_('COM_EXTENSIONDISTRIBUTOR_PACKAGE_SCRIPT', true)); ?>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
</div>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
<div class="span12">
|
||
|
<?php echo JLayoutHelper::render('package.script_fullwidth', $this); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||
|
|
||
|
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
|
||
|
<?php $this->tab_name = 'packageTab'; ?>
|
||
|
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
|
||
|
|
||
|
<?php if ($this->canDo->get('core.edit.created_by') || $this->canDo->get('core.edit.created') || $this->canDo->get('core.edit.state') || ($this->canDo->get('core.delete') && $this->canDo->get('core.edit.state'))) : ?>
|
||
|
<?php echo JHtml::_('bootstrap.addTab', 'packageTab', 'publishing', JText::_('COM_EXTENSIONDISTRIBUTOR_PACKAGE_PUBLISHING', true)); ?>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
<div class="span6">
|
||
|
<?php echo JLayoutHelper::render('package.publishing', $this); ?>
|
||
|
</div>
|
||
|
<div class="span6">
|
||
|
<?php echo JLayoutHelper::render('package.metadata', $this); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||
|
<?php endif; ?>
|
||
|
|
||
|
<?php if ($this->canDo->get('core.admin')) : ?>
|
||
|
<?php echo JHtml::_('bootstrap.addTab', 'packageTab', 'permissions', JText::_('COM_EXTENSIONDISTRIBUTOR_PACKAGE_PERMISSION', true)); ?>
|
||
|
<div class="row-fluid form-horizontal-desktop">
|
||
|
<div class="span12">
|
||
|
<fieldset class="adminform">
|
||
|
<div class="adminformlist">
|
||
|
<?php foreach ($this->form->getFieldset('accesscontrol') as $field): ?>
|
||
|
<div>
|
||
|
<?php echo $field->label; echo $field->input;?>
|
||
|
</div>
|
||
|
<div class="clearfix"></div>
|
||
|
<?php endforeach; ?>
|
||
|
</div>
|
||
|
</fieldset>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||
|
<?php endif; ?>
|
||
|
|
||
|
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||
|
|
||
|
<div>
|
||
|
<input type="hidden" name="task" value="package.edit" />
|
||
|
<?php echo JHtml::_('form.token'); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
// #jform_add_php_method_uninstall listeners for add_php_method_uninstall_vvvvvvv function
|
||
|
jQuery('#jform_add_php_method_uninstall').on('keyup',function()
|
||
|
{
|
||
|
var add_php_method_uninstall_vvvvvvv = jQuery("#jform_add_php_method_uninstall input[type='radio']:checked").val();
|
||
|
vvvvvvv(add_php_method_uninstall_vvvvvvv);
|
||
|
|
||
|
});
|
||
|
jQuery('#adminForm').on('change', '#jform_add_php_method_uninstall',function (e)
|
||
|
{
|
||
|
e.preventDefault();
|
||
|
var add_php_method_uninstall_vvvvvvv = jQuery("#jform_add_php_method_uninstall input[type='radio']:checked").val();
|
||
|
vvvvvvv(add_php_method_uninstall_vvvvvvv);
|
||
|
|
||
|
});
|
||
|
|
||
|
// #jform_add_php_postflight_install listeners for add_php_postflight_install_vvvvvvw function
|
||
|
jQuery('#jform_add_php_postflight_install').on('keyup',function()
|
||
|
{
|
||
|
var add_php_postflight_install_vvvvvvw = jQuery("#jform_add_php_postflight_install input[type='radio']:checked").val();
|
||
|
vvvvvvw(add_php_postflight_install_vvvvvvw);
|
||
|
|
||
|
});
|
||
|
jQuery('#adminForm').on('change', '#jform_add_php_postflight_install',function (e)
|
||
|
{
|
||
|
e.preventDefault();
|
||
|
var add_php_postflight_install_vvvvvvw = jQuery("#jform_add_php_postflight_install input[type='radio']:checked").val();
|
||
|
vvvvvvw(add_php_postflight_install_vvvvvvw);
|
||
|
|
||
|
});
|
||
|
|
||
|
// #jform_add_php_postflight_update listeners for add_php_postflight_update_vvvvvvx function
|
||
|
jQuery('#jform_add_php_postflight_update').on('keyup',function()
|
||
|
{
|
||
|
var add_php_postflight_update_vvvvvvx = jQuery("#jform_add_php_postflight_update input[type='radio']:checked").val();
|
||
|
vvvvvvx(add_php_postflight_update_vvvvvvx);
|
||
|
|
||
|
});
|
||
|
jQuery('#adminForm').on('change', '#jform_add_php_postflight_update',function (e)
|
||
|
{
|
||
|
e.preventDefault();
|
||
|
var add_php_postflight_update_vvvvvvx = jQuery("#jform_add_php_postflight_update input[type='radio']:checked").val();
|
||
|
vvvvvvx(add_php_postflight_update_vvvvvvx);
|
||
|
|
||
|
});
|
||
|
|
||
|
// #jform_add_php_preflight_install listeners for add_php_preflight_install_vvvvvvy function
|
||
|
jQuery('#jform_add_php_preflight_install').on('keyup',function()
|
||
|
{
|
||
|
var add_php_preflight_install_vvvvvvy = jQuery("#jform_add_php_preflight_install input[type='radio']:checked").val();
|
||
|
vvvvvvy(add_php_preflight_install_vvvvvvy);
|
||
|
|
||
|
});
|
||
|
jQuery('#adminForm').on('change', '#jform_add_php_preflight_install',function (e)
|
||
|
{
|
||
|
e.preventDefault();
|
||
|
var add_php_preflight_install_vvvvvvy = jQuery("#jform_add_php_preflight_install input[type='radio']:checked").val();
|
||
|
vvvvvvy(add_php_preflight_install_vvvvvvy);
|
||
|
|
||
|
});
|
||
|
|
||
|
// #jform_add_php_preflight_uninstall listeners for add_php_preflight_uninstall_vvvvvvz function
|
||
|
jQuery('#jform_add_php_preflight_uninstall').on('keyup',function()
|
||
|
{
|
||
|
var add_php_preflight_uninstall_vvvvvvz = jQuery("#jform_add_php_preflight_uninstall input[type='radio']:checked").val();
|
||
|
vvvvvvz(add_php_preflight_uninstall_vvvvvvz);
|
||
|
|
||
|
});
|
||
|
jQuery('#adminForm').on('change', '#jform_add_php_preflight_uninstall',function (e)
|
||
|
{
|
||
|
e.preventDefault();
|
||
|
var add_php_preflight_uninstall_vvvvvvz = jQuery("#jform_add_php_preflight_uninstall input[type='radio']:checked").val();
|
||
|
vvvvvvz(add_php_preflight_uninstall_vvvvvvz);
|
||
|
|
||
|
});
|
||
|
|
||
|
// #jform_add_php_preflight_update listeners for add_php_preflight_update_vvvvvwa function
|
||
|
jQuery('#jform_add_php_preflight_update').on('keyup',function()
|
||
|
{
|
||
|
var add_php_preflight_update_vvvvvwa = jQuery("#jform_add_php_preflight_update input[type='radio']:checked").val();
|
||
|
vvvvvwa(add_php_preflight_update_vvvvvwa);
|
||
|
|
||
|
});
|
||
|
jQuery('#adminForm').on('change', '#jform_add_php_preflight_update',function (e)
|
||
|
{
|
||
|
e.preventDefault();
|
||
|
var add_php_preflight_update_vvvvvwa = jQuery("#jform_add_php_preflight_update input[type='radio']:checked").val();
|
||
|
vvvvvwa(add_php_preflight_update_vvvvvwa);
|
||
|
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
var bar = document.getElementById('js-progressbar');
|
||
|
|
||
|
UIkit.upload('.js-upload', {
|
||
|
|
||
|
url: 'index.php?option=com_extensiondistributor&task=extension.uploadFile&type=jcb&<?= JSession::getFormToken() ?>=1',
|
||
|
multiple: true,
|
||
|
type: 'json',
|
||
|
mime: 'application/zip',
|
||
|
msgInvalidMime: 'Only ZIP files (%s)',
|
||
|
maxSize: 32000,
|
||
|
msgInvalidSize: 'The file is too large. (Max. %s Ko)',
|
||
|
|
||
|
beforeSend: function () {
|
||
|
console.log('beforeSend', arguments);
|
||
|
},
|
||
|
beforeAll: function () {
|
||
|
jQuery("#upload-response").html('<div id="upload-response-inner"></div>');
|
||
|
console.log('beforeAll', arguments);
|
||
|
},
|
||
|
load: function () {
|
||
|
console.log('load', arguments);
|
||
|
},
|
||
|
error: function () {
|
||
|
console.log('error', arguments);
|
||
|
},
|
||
|
complete: function () {
|
||
|
console.log('complete', arguments);
|
||
|
var response = arguments[0].response;
|
||
|
if (response === null) {
|
||
|
jQuery("#upload-response-inner").append('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>File too large</div>');
|
||
|
} else if (response.error) {
|
||
|
jQuery("#upload-response-inner").append('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>'+response.packagename+' : '+response.error+'</div>');
|
||
|
} else {
|
||
|
jQuery("#upload-response-inner").append('<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button>'+response.packagename+' successfully uploaded'+'</div>');
|
||
|
jQuery('#jform_file').append('<option value="'+response.packagename+'" selected="selected">'+response.packagename+'</option>');
|
||
|
jQuery("#jform_file").trigger("liszt:updated");
|
||
|
}
|
||
|
},
|
||
|
|
||
|
loadStart: function (e) {
|
||
|
console.log('loadStart', arguments);
|
||
|
|
||
|
bar.removeAttribute('hidden');
|
||
|
bar.max = e.total;
|
||
|
bar.value = e.loaded;
|
||
|
},
|
||
|
|
||
|
progress: function (e) {
|
||
|
console.log('progress', arguments);
|
||
|
|
||
|
bar.max = e.total;
|
||
|
bar.value = e.loaded;
|
||
|
},
|
||
|
|
||
|
loadEnd: function (e) {
|
||
|
console.log('loadEnd', arguments);
|
||
|
|
||
|
bar.max = e.total;
|
||
|
bar.value = e.loaded;
|
||
|
},
|
||
|
fail: function () {
|
||
|
console.log('fail', arguments);
|
||
|
jQuery("#upload-response").html('<div id="upload-response-inner"></div>');
|
||
|
jQuery("#upload-response-inner").html('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>'+arguments[0]+'</div>').delay(2000).fadeOut('slow');
|
||
|
},
|
||
|
|
||
|
completeAll: function () {
|
||
|
console.log('completeAll', arguments);
|
||
|
|
||
|
jQuery("#upload-response-inner").delay(4000).fadeOut('slow');
|
||
|
|
||
|
setTimeout(function () {
|
||
|
bar.setAttribute('hidden', 'hidden');
|
||
|
}, 2000);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
</script>
|