Resolves gh-53 with stable export & import of fully mapped components. Key export & import encryption and forced update switch, with error and waring messages has been added.

This commit is contained in:
2017-03-28 16:57:59 +02:00
parent 8b522f44d9
commit f61bb46073
196 changed files with 1172 additions and 899 deletions

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.8
@build 27th March, 2017
@version 2.3.9
@build 28th March, 2017
@created 30th April, 2015
@package Component Builder
@subpackage default.php
@ -143,8 +143,6 @@ jQuery(document).ready(function($) {
.css("display", "none")
.appendTo(outerDiv);
});
</script>
<?php $formats = ($this->dataType === 'smart_package') ? '.zip' : '.csv .xls .ods'; ?>
@ -195,9 +193,17 @@ jQuery(document).ready(function($) {
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php elseif ($this->hasPackage && $this->dataType === 'smart_package') : ?>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'advanced')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'advanced', JText::_('Smart JCB Components Import', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'advanced', JText::_('Import Components', true)); ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_COMPONENTBUILDER_HERE_YOU_CAN_ADD'); ?></legend>
<legend><?php echo JText::_('COM_COMPONENTBUILDER_SMART_PACKAGE_OPTIONS'); ?></legend>
<?php if ($this->formPackage): ?>
<?php foreach ($this->formPackage as $field): ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label;?></div>
<div class="controls"><?php echo $field->input;?></div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<div class="form-actions">
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_CONTINUE'); ?>" onclick="Joomla.continueExtImport()" />
</div>
@ -261,3 +267,15 @@ jQuery(document).ready(function($) {
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
<script type="text/javascript">
jQuery('#adminForm').on('change', '#haskey',function (e)
{
e.preventDefault();
var haskey = jQuery("#haskey input[type='radio']:checked").val();
if (haskey == 1) {
jQuery("#sleutle").closest('.control-group').show();
} else {
jQuery("#sleutle").closest('.control-group').hide();
}
});
</script>

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.8
@build 27th March, 2017
@version 2.3.9
@build 28th March, 2017
@created 30th April, 2015
@package Component Builder
@subpackage view.html.php
@ -40,6 +40,8 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
protected $hasHeader = 0;
protected $dataType;
public $formPackage;
public function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
@ -87,10 +89,50 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
{
$this->dataType = $session->get('dataType_VDM_IMPORTINTO', null);
}
// set form only if smart package
if ($this->dataType === 'smart_package')
{
$this->formPackage = $this->getForm();
}
// Display the template
parent::display($tpl);
}
public function getForm()
{
jimport('joomla.form.form');
$radio1 = JFormHelper::loadFieldType('radio',true);
// Switch to force local update
$xml = '<field label="'.JText::_('COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE').'" description="'.JText::_('COM_COMPONENTBUILDER_SHOULD_WE_FORCE_THE_UPDATE_OF_ALL_LOCAL_DATA_EVEN_IF_IT_IS_NEWER_THEN_THE_DATA_BEING_IMPORTED').'" name="force_update" type="radio" class="btn-group btn-group-yesno" default="0" filter="INT">';
$xml .= '<option value="1">'.JText::_('COM_COMPONENTBUILDER_YES').'</option> <option value="0">'.JText::_('COM_COMPONENTBUILDER_NO').'</option>';
$xml .= "</field>";
// prepare the xml
$force = new SimpleXMLElement($xml);
// set components to form
$radio1->setup($force,0);
$radio2 = JFormHelper::loadFieldType('radio',true);
// has key
$xml = '<field label="'.JText::_('COM_COMPONENTBUILDER_USE_KEY').'" description="'.JText::_('COM_COMPONENTBUILDER_DOES_THIS_PACKAGE_REQUIRE_A_KEY_TO_INSTALL').'" name="haskey" type="radio" class="btn-group btn-group-yesno" default="1" filter="INT">';
$xml .= '<option value="1">'.JText::_('COM_COMPONENTBUILDER_YES').'</option> <option value="0">'.JText::_('COM_COMPONENTBUILDER_NO').'</option>';
$xml .= "</field>";
// prepare the xml
$license = new SimpleXMLElement($xml);
// set components to form
$radio2->setup($license,1);
$text1 = JFormHelper::loadFieldType('text',true);
// add the key
$xml = '<field label="'.JText::_('COM_COMPONENTBUILDER_KEY').'" description="'.JText::_('COM_COMPONENTBUILDER_THE_KEY_OF_THIS_PACKAGE').'" name="sleutle" type="text" class="text_area" filter="STRING" hint="add key here" />';
// prepare the xml
$sleutle = new SimpleXMLElement($xml);
// set components to form
$text1->setup($sleutle,'');
return array($radio1,$radio2,$text1);
}
/**
* Setting the toolbar
*/