Added owner and key control to export & import of components, also added buy and package link building to global options gh-53
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.9
|
||||
@build 28th March, 2017
|
||||
@build 30th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage default.php
|
||||
@ -58,7 +58,7 @@ JHtml::_('behavior.keepalive');
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
<?php elseif ($this->dataType === 'smart_package'): ?>
|
||||
<?php elseif ($this->hasPackage && $this->dataType === 'smart_package'): ?>
|
||||
Joomla.continueExtImport = function()
|
||||
{
|
||||
var form = document.getElementById('adminForm');
|
||||
@ -91,7 +91,7 @@ JHtml::_('behavior.keepalive');
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
Joomla.submitbutton3 = function()
|
||||
Joomla.submitbuttonDir = function()
|
||||
{
|
||||
var form = document.getElementById('adminForm');
|
||||
// do field validation
|
||||
@ -105,11 +105,9 @@ JHtml::_('behavior.keepalive');
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
Joomla.submitbutton4 = function()
|
||||
Joomla.submitbuttonUrl = function()
|
||||
{
|
||||
var form = document.getElementById('adminForm');
|
||||
|
||||
|
||||
// do field validation
|
||||
if (form.import_url.value == "" || form.import_url.value == "http://")
|
||||
{
|
||||
@ -158,7 +156,6 @@ jQuery(document).ready(function($) {
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif;?>
|
||||
|
||||
<?php if ($this->hasPackage && ComponentbuilderHelper::checkArray($this->headerList) && ComponentbuilderHelper::checkArray($this->headers)) : ?>
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => $this->activeTab)); ?>
|
||||
|
||||
@ -192,8 +189,26 @@ jQuery(document).ready(function($) {
|
||||
</fieldset>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php elseif ($this->hasPackage && $this->dataType === 'smart_package') : ?>
|
||||
<?php
|
||||
if (isset($this->packageInfo['name']) && ComponentbuilderHelper::checkArray($this->packageInfo['name']))
|
||||
{
|
||||
$cAmount = count($this->packageInfo['name']);
|
||||
$comP = ($cAmount == 1) ? 'Component' : 'Components';
|
||||
}
|
||||
else
|
||||
{
|
||||
$cAmount = 1;
|
||||
$comP = 'Component';
|
||||
}
|
||||
$hasOwner = (isset($this->packageInfo['getKeyFrom']) && ComponentbuilderHelper::checkArray($this->packageInfo['getKeyFrom'])) ? true:false;
|
||||
$class1 = ($hasOwner) ? 'span6' : 'span12';
|
||||
?>
|
||||
<h3 style="color: #1F73BA;"><?php echo JText::_('COM_COMPONENTBUILDER_CONFIRMATION_STEP_BEFORE_IMPORTING'); ?></h3>
|
||||
<p style="color: #1F73BA;"><?php echo JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ONLY_CONTINUE_THIS_IMPORT_IF_YOU_HAVE_BACKUP_YOUR_COMPONENTS_AND_INSURED_THAT_THE_PACKAGE_OWNER_IS_REPUTABLE'); ?></p>
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'advanced')); ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'advanced', JText::_('Import Components', true)); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'advanced', JText::sprintf('COM_COMPONENTBUILDER_IMPORT_S', $comP)); ?>
|
||||
<div class="<?php echo $class1; ?>">
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo JText::_('COM_COMPONENTBUILDER_SMART_PACKAGE_OPTIONS'); ?></legend>
|
||||
<?php if ($this->formPackage): ?>
|
||||
@ -208,11 +223,102 @@ jQuery(document).ready(function($) {
|
||||
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_CONTINUE'); ?>" onclick="Joomla.continueExtImport()" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php if (!$hasOwner): ?>
|
||||
<p style="color: #922924;"><?php echo JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($hasOwner): ?>
|
||||
<div class="well span6">
|
||||
<?php
|
||||
$ownerDetails = '<h2 class="module-title nav-header">' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '</h2>';
|
||||
$ownerDetails .= '<ul>';
|
||||
if (isset($this->packageInfo['getKeyFrom']['company']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['company']))
|
||||
{
|
||||
$owner = $this->packageInfo['getKeyFrom']['company'];
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $this->packageInfo['getKeyFrom']['company']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($this->packageInfo['getKeyFrom']['owner']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['owner']))
|
||||
{
|
||||
if (!isset($owner))
|
||||
{
|
||||
$owner = $this->packageInfo['getKeyFrom']['owner'];
|
||||
}
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $this->packageInfo['getKeyFrom']['owner']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($this->packageInfo['getKeyFrom']['website']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['website']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $this->packageInfo['getKeyFrom']['website']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($this->packageInfo['getKeyFrom']['email']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['email']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $this->packageInfo['getKeyFrom']['email']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($this->packageInfo['getKeyFrom']['license']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['license']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $this->packageInfo['getKeyFrom']['license']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($this->packageInfo['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['copyright']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $this->packageInfo['getKeyFrom']['copyright']) . '</li>';
|
||||
}
|
||||
$ownerDetails .= '</ul>';
|
||||
|
||||
// provide some details to how the user can get a key
|
||||
if (isset($this->packageInfo['getKeyFrom']['buy_link']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['buy_link']))
|
||||
{
|
||||
$ownerDetails .= '<hr />';
|
||||
$ownerDetails .= JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $this->packageInfo['getKeyFrom']['buy_link'], $owner, $owner);
|
||||
}
|
||||
|
||||
// return the owner details
|
||||
if (!isset($owner))
|
||||
{
|
||||
$ownerDetails = '<h2 style="color: #922924;">' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '</h2>';
|
||||
$ownerDetails .= '<p style="color: #922924;">' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '</p>';
|
||||
}
|
||||
echo $ownerDetails;
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php if (isset($this->packageInfo['name']) && ComponentbuilderHelper::checkArray($this->packageInfo['name'])) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'info', JText::sprintf('COM_COMPONENTBUILDER_S_BEING_IMPORTED', $comP)); ?>
|
||||
<?php $class2 = ($cAmount == 1) ? 'span12' : 'span6'; ?>
|
||||
<?php $counter = 1; foreach ($this->packageInfo['name'] as $key => $value): ?>
|
||||
<?php if ($cAmount > 1 && $counter == 3) { echo '</div>'; $counter = 1;} ?>
|
||||
<?php if ($cAmount > 1 && $counter == 1) { echo '<div>'; } ?>
|
||||
<div class="well well-small <?php echo $class2; ?>">
|
||||
<h2 class="module-title nav-header"><?php echo JText::sprintf('COM_COMPONENTBUILDER_BSB_EMCOMPONENT_DETAILSEM', $value . ' v' . $this->packageInfo['component_version'][$key]); ?></h2>
|
||||
<p><?php echo $this->packageInfo['short_description'][$key]; ?></p>
|
||||
<ul>
|
||||
<li><?php echo JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANY_NAMEEM_BSB', $this->packageInfo['companyname'][$key]); ?></li>
|
||||
<li><?php echo JText::sprintf('COM_COMPONENTBUILDER_EMAUTHOREM_BSB', $this->packageInfo['author'][$key]); ?></li>
|
||||
<li><?php echo JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $this->packageInfo['email'][$key]); ?></li>
|
||||
<li><?php echo JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $this->packageInfo['website'][$key]); ?></li>
|
||||
</ul>
|
||||
<h2 class="nav-header"><?php echo JText::_('COM_COMPONENTBUILDER_LICENSE'); ?></h2>
|
||||
<p><?php echo $this->packageInfo['license'][$key]; ?></p>
|
||||
<h2 class="nav-header"><?php echo JText::_('COM_COMPONENTBUILDER_COPYRIGHT'); ?></h2>
|
||||
<p><?php echo $this->packageInfo['copyright'][$key]; ?></p>
|
||||
</div>
|
||||
<?php $counter++; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||||
<input type="hidden" name="gettype" value="continue" />
|
||||
<?php else: ?>
|
||||
<?php if ($this->dataType === 'smart_package'): ?>
|
||||
<h1 style="color: #922924;"><?php echo JText::_('COM_COMPONENTBUILDER_BACKUP_LOCAL_DATA_FIRST'); ?></h1>
|
||||
<p style="color: #922924;"><?php echo JText::_('COM_COMPONENTBUILDER_ALWAYS_INSURE_THAT_YOU_HAVE_YOUR_LOCAL_COMPONENTS_BACKED_UP_BY_MAKING_AN_EXPORT_OF_ALL_YOUR_LOCAL_COMPONENTS_BEFORE_IMPORTING_ANY_NEW_COMPONENTS_SMALLMAKE_BSUREB_TO_MOVE_THIS_ZIPPED_BACKUP_PACKAGE_OUT_OF_THE_TMP_FOLDER_BEFORE_DOING_AN_IMPORTSMALLBR_IF_YOU_ARE_IMPORTING_A_PACKAGE_OF_A_THREERD_PARTY_JCB_PACKAGE_DEVELOPER_BMAKE_SURE_IT_IS_A_REPUTABLE_JCB_PACKAGE_DEVELOPERSB'); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'upload')); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'upload', JText::_('COM_COMPONENTBUILDER_IMPORT_FROM_UPLOAD', true)); ?>
|
||||
@ -240,12 +346,11 @@ jQuery(document).ready(function($) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton3()" /> <small><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_FORMATS_ACCEPTED'); ?> (<?php echo $formats; ?>)</small>
|
||||
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbuttonDir()" /> <small><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_FORMATS_ACCEPTED'); ?> (<?php echo $formats; ?>)</small>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'url', JText::_('COM_COMPONENTBUILDER_IMPORT_FROM_URL', true)); ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_UPDATE_DATA'); ?></legend>
|
||||
@ -256,7 +361,7 @@ jQuery(document).ready(function($) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton4()" /> <small><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_FORMATS_ACCEPTED'); ?> (<?php echo $formats; ?>)</small>
|
||||
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbuttonUrl()" /> <small><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_FORMATS_ACCEPTED'); ?> (<?php echo $formats; ?>)</small>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.9
|
||||
@build 28th March, 2017
|
||||
@build 30th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage view.html.php
|
||||
@ -39,8 +39,8 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
|
||||
protected $headers;
|
||||
protected $hasHeader = 0;
|
||||
protected $dataType;
|
||||
|
||||
public $formPackage;
|
||||
protected $packageInfo;
|
||||
protected $formPackage;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
@ -92,6 +92,7 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
|
||||
// set form only if smart package
|
||||
if ($this->dataType === 'smart_package')
|
||||
{
|
||||
$this->packageInfo = json_decode($session->get('smart_package_info', false), true);
|
||||
$this->formPackage = $this->getForm();
|
||||
}
|
||||
// Display the template
|
||||
@ -101,7 +102,7 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
|
||||
public function getForm()
|
||||
{
|
||||
jimport('joomla.form.form');
|
||||
|
||||
$form = array();
|
||||
$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">';
|
||||
@ -111,26 +112,41 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
|
||||
$force = new SimpleXMLElement($xml);
|
||||
// set components to form
|
||||
$radio1->setup($force,0);
|
||||
// add to form
|
||||
$form[] = $radio1;
|
||||
|
||||
$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,'');
|
||||
if (!$this->packageInfo || (isset($this->packageInfo['getKeyFrom']) && ComponentbuilderHelper::checkArray($this->packageInfo['getKeyFrom'])))
|
||||
{
|
||||
// set required field
|
||||
$required = 'required="true"';
|
||||
if (!$this->packageInfo)
|
||||
{
|
||||
$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);
|
||||
$required = ''; // change required field
|
||||
// add to form
|
||||
$form[] = $radio2;
|
||||
}
|
||||
|
||||
$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" '.$required.' />';
|
||||
// prepare the xml
|
||||
$sleutle = new SimpleXMLElement($xml);
|
||||
// set components to form
|
||||
$text1->setup($sleutle,'');
|
||||
// add to form
|
||||
$form[] = $text1;
|
||||
}
|
||||
|
||||
return array($radio1,$radio2,$text1);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user