2017-03-27 12:38:51 +00:00
< ? php
2021-03-05 03:08:47 +00:00
/**
* @ package Joomla . Component . Builder
*
* @ created 30 th 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
*/
2024-03-09 19:47:28 +00:00
use Joomla\CMS\Factory ;
use Joomla\CMS\Language\Text ;
use Joomla\CMS\Router\Route ;
use Joomla\CMS\HTML\HTMLHelper as Html ;
2023-10-18 07:26:30 +00:00
use VDM\Joomla\Utilities\ArrayHelper ;
2024-08-01 21:00:32 +00:00
use Joomla\CMS\Uri\Uri ;
2021-03-05 03:08:47 +00:00
2024-03-09 19:47:28 +00:00
// No direct access to this file
defined ( '_JEXEC' ) or die ;
Html :: _ ( 'jquery.framework' );
Html :: _ ( 'bootstrap.tooltip' );
Html :: _ ( 'script' , 'system/core.js' , false , true );
Html :: _ ( 'behavior.keepalive' );
2017-03-27 12:38:51 +00:00
?>
< script type = " text/javascript " >
2019-09-10 16:47:39 +00:00
< ? php if ( isset ( $this -> hasPackage ) && $this -> hasPackage && $this -> dataType === 'smart_package' ) : ?>
2018-03-24 01:36:07 +00:00
Joomla . continueExtImport = function ()
2017-03-27 12:38:51 +00:00
{
var form = document . getElementById ( 'adminForm' );
2018-03-24 01:36:07 +00:00
jQuery ( '#loading' ) . css ( 'display' , 'block' );
form . gettype . value = 'continue-ext' ;
form . submit ();
2017-03-27 12:38:51 +00:00
};
2018-03-24 01:36:07 +00:00
Joomla . cancelImport = function ()
2017-03-27 12:38:51 +00:00
{
var form = document . getElementById ( 'adminForm' );
2018-03-24 01:36:07 +00:00
jQuery ( '#loading' ) . css ( 'display' , 'block' );
form . gettype . value = 'cancel-ext' ;
form . submit ();
2017-03-27 12:38:51 +00:00
};
< ? php else : ?>
2018-05-04 20:27:49 +00:00
Joomla . submitbutton = function ( task )
2017-03-27 12:38:51 +00:00
{
2018-07-12 16:35:38 +00:00
if ( 'joomla_component.refresh' === task ){
2017-03-27 12:38:51 +00:00
jQuery ( '#loading' ) . css ( 'display' , 'block' );
2018-05-04 20:27:49 +00:00
// clear the history
jQuery . jStorage . flush ();
// now start the update
autoJCBpackageInfo ();
2018-07-12 16:35:38 +00:00
// also clear the session memory around the component list
Joomla . submitform ( task );
2018-05-04 20:27:49 +00:00
} else {
var form = document . getElementById ( 'adminForm' );
// do field validation
if ( form . import_package . value == " " )
{
2024-03-09 19:47:28 +00:00
alert ( " <?php echo Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_SELECT_A_FILE', true); ?> " );
2018-05-04 20:27:49 +00:00
}
else
{
jQuery ( '#loading' ) . css ( 'display' , 'block' );
form . gettype . value = 'upload' ;
form . submit ();
}
2017-03-27 12:38:51 +00:00
}
};
2017-03-30 21:19:12 +00:00
Joomla . submitbuttonDir = function ()
2017-03-27 12:38:51 +00:00
{
var form = document . getElementById ( 'adminForm' );
// do field validation
if ( form . import_directory . value == " " ){
2024-03-09 19:47:28 +00:00
alert ( " <?php echo Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY', true); ?> " );
2017-03-27 12:38:51 +00:00
}
else
{
jQuery ( '#loading' ) . css ( 'display' , 'block' );
form . gettype . value = 'folder' ;
form . submit ();
}
};
2017-03-30 21:19:12 +00:00
Joomla . submitbuttonUrl = function ()
2017-03-27 12:38:51 +00:00
{
var form = document . getElementById ( 'adminForm' );
// do field validation
if ( form . import_url . value == " " || form . import_url . value == " http:// " )
{
2024-03-09 19:47:28 +00:00
alert ( " <?php echo Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL', true); ?> " );
2017-03-27 12:38:51 +00:00
}
else
{
jQuery ( '#loading' ) . css ( 'display' , 'block' );
form . gettype . value = 'url' ;
form . submit ();
}
};
2018-03-21 02:45:51 +00:00
Joomla . submitbuttonVDM = function ()
{
var form = document . getElementById ( 'adminForm' );
// do field validation
if ( form . vdm_package . value == " " || form . vdm_package . value == " http:// " )
{
2024-03-09 19:47:28 +00:00
alert ( " <?php echo Text::_('COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_YOUR_WOULD_LIKE_TO_IMPORT', true); ?> " );
2018-03-21 02:45:51 +00:00
}
else
{
// set the url
form . import_url . value = form . vdm_package . value ;
jQuery ( '#loading' ) . css ( 'display' , 'block' );
2018-05-02 01:38:42 +00:00
jQuery ( '#noticeboard' ) . show ();
jQuery ( '#installer-import' ) . hide ();
2018-03-24 01:36:07 +00:00
form . checksum . value = 'vdm' ;
2018-03-21 02:45:51 +00:00
form . gettype . value = 'url' ;
form . submit ();
}
};
2018-05-01 22:17:38 +00:00
Joomla . submitbuttonJCB = function ()
{
var form = document . getElementById ( 'adminForm' );
// do field validation
if ( form . jcb_package . value == " " || form . jcb_package . value == " http:// " )
{
2024-03-09 19:47:28 +00:00
alert ( " <?php echo Text::_('COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_YOUR_WOULD_LIKE_TO_IMPORT', true); ?> " );
2018-05-01 22:17:38 +00:00
}
else
{
// set the url
form . import_url . value = form . jcb_package . value ;
jQuery ( '#loading' ) . css ( 'display' , 'block' );
2018-05-02 01:38:42 +00:00
jQuery ( '#noticeboard' ) . show ();
jQuery ( '#installer-import' ) . hide ();
2018-05-01 22:17:38 +00:00
form . checksum . value = 'jcb' ;
form . gettype . value = 'url' ;
form . submit ();
}
};
2017-03-27 12:38:51 +00:00
< ? php endif ; ?>
// Add spindle-wheel for importations:
jQuery ( document ) . ready ( function ( $ ) {
2021-02-19 00:35:54 +00:00
2024-03-09 19:47:28 +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 );
2017-03-27 12:38:51 +00:00
});
</ script >
2018-03-24 01:36:07 +00:00
< ? php $formats = ( $this -> dataType === 'smart_package' ) ? '.zip' : 'none' ; ?>
2018-05-02 01:38:42 +00:00
< div class = " clearfix " >
2024-03-09 19:47:28 +00:00
< form enctype = " multipart/form-data " action = " <?php echo Route::_('index.php?option=com_componentbuilder&view=import_joomla_components');?> " method = " post " name = " adminForm " id = " adminForm " class = " form-horizontal form-validate " >
2017-03-27 12:38:51 +00:00
< ? php if ( ! empty ( $this -> sidebar )) : ?>
< div id = " j-sidebar-container " class = " span2 " >
< ? php echo $this -> sidebar ; ?>
</ div >
< div id = " j-main-container " class = " span10 " >
< ? php else : ?>
< div id = " j-main-container " >
< ? php endif ; ?>
2018-05-02 01:38:42 +00:00
< div id = " noticeboard " class = " well well-small " style = " display: none; " >
2024-03-09 19:47:28 +00:00
< h2 class = " module-title nav-header " >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_VDM_NOTICE_BOARD' ); ?> <span class="vdm-new-notice" style="display:none; color:red;"> (<?php echo Text::_('COM_COMPONENTBUILDER_NEW_NOTICE'); ?>)</span></h2>
< div class = " noticeboard-md " >< small >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING' ); ?> <span class="loading-dots">.</span></small></div>
2018-05-02 01:38:42 +00:00
< div style = " text-align:right; " >< small >< a href = " https://github.com/Llewellynvdm " target = " _blank " style = " color:gray " >& lt ; & lt ; ewe & gt ; & gt ; yn </ a ></ small ></ div >
</ div >
< div id = " installer-import " >
2019-09-10 16:47:39 +00:00
< ? php if ( isset ( $this -> hasPackage ) && $this -> hasPackage && $this -> dataType === 'smart_package' ) : ?>
2017-03-30 21:19:12 +00:00
< ? php
2023-10-18 07:26:30 +00:00
if ( isset ( $this -> packageInfo [ 'name' ]) && ArrayHelper :: check ( $this -> packageInfo [ 'name' ]))
2017-03-30 21:19:12 +00:00
{
$cAmount = count ( $this -> packageInfo [ 'name' ]);
$comP = ( $cAmount == 1 ) ? 'Component' : 'Components' ;
}
else
{
$cAmount = 1 ;
$comP = 'Component' ;
}
2023-10-18 07:26:30 +00:00
$hasOwner = ( isset ( $this -> packageInfo [ 'getKeyFrom' ]) && ArrayHelper :: check ( $this -> packageInfo [ 'getKeyFrom' ])) ? true : false ;
2017-03-30 21:19:12 +00:00
$class1 = ( $hasOwner ) ? 'span6' : 'span12' ;
?>
2024-03-09 19:47:28 +00:00
< h3 style = " color: #1F73BA; " >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_CONFIRMATION_STEP_BEFORE_IMPORTING' ); ?> </h3>
< p style = " color: #1F73BA; " >< ? php echo Text :: _ ( '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 Html :: _ ( 'bootstrap.startTabSet' , 'jcbImportTab' , array ( 'active' => 'advanced' )); ?>
2017-03-30 21:19:12 +00:00
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.addTab' , 'jcbImportTab' , 'advanced' , Text :: sprintf ( 'COM_COMPONENTBUILDER_IMPORT_S' , $comP )); ?>
2017-03-30 21:19:12 +00:00
< div class = " <?php echo $class1 ; ?> " >
2017-03-27 12:38:51 +00:00
< fieldset class = " uploadform " >
2024-03-09 19:47:28 +00:00
< legend >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_SMART_PACKAGE_OPTIONS' ); ?> </legend>
2017-03-28 14:57:59 +00:00
< ? 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 ; ?>
2017-03-27 12:38:51 +00:00
< div class = " form-actions " >
2018-03-24 01:36:07 +00:00
< div class = " btn-group " >
2024-03-09 19:47:28 +00:00
< input class = " btn btn-primary " type = " button " value = " <?php echo Text::_('COM_COMPONENTBUILDER_IMPORT_CONTINUE'); ?> " onclick = " Joomla.continueExtImport() " />
< input class = " btn " type = " button " value = " <?php echo Text::_('COM_COMPONENTBUILDER_CANCEL'); ?> " onclick = " Joomla.cancelImport() " />
2018-03-24 01:36:07 +00:00
</ div >
2017-03-27 12:38:51 +00:00
</ div >
</ fieldset >
2017-03-30 21:19:12 +00:00
< ? php if ( ! $hasOwner ) : ?>
2024-03-09 19:47:28 +00:00
< p style = " color: #922924; " >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE' ); ?> </p>
2017-03-30 21:19:12 +00:00
< ? php endif ; ?>
</ div >
< ? php if ( $hasOwner ) : ?>
< div class = " well span6 " >
2023-02-27 12:27:41 +00:00
< ? php echo \VDM\Joomla\Componentbuilder\Package\Factory :: _ ( 'Display.Details' ) -> owner ( $this -> packageInfo ); ?>
2017-03-30 21:19:12 +00:00
</ div >
< ? php endif ; ?>
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTab' ); ?>
2017-03-30 21:19:12 +00:00
2023-10-18 07:26:30 +00:00
< ? php if ( isset ( $this -> packageInfo [ 'name' ]) && ArrayHelper :: check ( $this -> packageInfo [ 'name' ])) : ?>
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.addTab' , 'jcbImportTab' , 'info' , Text :: sprintf ( 'COM_COMPONENTBUILDER_S_BEING_IMPORTED' , $comP )); ?>
2023-02-27 12:27:41 +00:00
< ? php echo \VDM\Joomla\Componentbuilder\Package\Factory :: _ ( 'Display.Details' ) -> components ( $this -> packageInfo ); ?>
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTab' ); ?>
2017-03-30 21:19:12 +00:00
< ? php endif ; ?>
2017-03-27 12:38:51 +00:00
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTabSet' ); ?>
2017-03-27 12:38:51 +00:00
< input type = " hidden " name = " gettype " value = " continue " />
< ? php else : ?>
2017-03-30 21:19:12 +00:00
< ? php if ( $this -> dataType === 'smart_package' ) : ?>
2024-03-09 19:47:28 +00:00
< h1 style = " color: #922924; " >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_BACKUP_LOCAL_DATA_FIRST' ); ?> </h1>
< p style = " color: #922924; " >< ? php echo Text :: sprintf ( '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_A_SFIND_OUT_WHYA' , 'href="https://vdm.bz/jcb-package-import-safety" target="_blank" title="Watch tutorial"' ); ?> </p>
2017-03-30 21:19:12 +00:00
< ? php endif ; ?>
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.startTabSet' , 'jcbImportTab' , array ( 'active' => 'upload' )); ?>
2017-03-27 12:38:51 +00:00
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.addTab' , 'jcbImportTab' , 'upload' , Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_FROM_UPLOAD' , true )); ?>
2017-03-27 12:38:51 +00:00
< fieldset class = " uploadform " >
2024-03-09 19:47:28 +00:00
< legend >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_UPDATE_DATA' ); ?> </legend>
2017-03-27 12:38:51 +00:00
< div class = " control-group " >
2024-03-09 19:47:28 +00:00
< label for = " import_package " class = " control-label " >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_SELECT_FILE' ); ?> </label>
2017-03-27 12:38:51 +00:00
< div class = " controls " >
< input class = " input_box " id = " import_package " name = " import_package " type = " file " size = " 57 " />
</ div >
</ div >
< div class = " form-actions " >
2024-03-09 19:47:28 +00:00
< input class = " btn btn-primary " type = " button " value = " <?php echo Text::_('COM_COMPONENTBUILDER_IMPORT_UPLOAD_BOTTON'); ?> " onclick = " Joomla.submitbutton() " />& nbsp ; & nbsp ; & nbsp ; < small >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_FORMATS_ACCEPTED' ); ?> (<?php echo $formats; ?>)</small>
2017-03-27 12:38:51 +00:00
</ div >
</ fieldset >
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTab' ); ?>
2017-03-27 12:38:51 +00:00
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.addTab' , 'jcbImportTab' , 'directory' , Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_FROM_DIRECTORY' , true )); ?>
2017-03-27 12:38:51 +00:00
< fieldset class = " uploadform " >
2024-03-09 19:47:28 +00:00
< legend >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_UPDATE_DATA' ); ?> </legend>
2017-03-27 12:38:51 +00:00
< div class = " control-group " >
2024-03-09 19:47:28 +00:00
< label for = " import_directory " class = " control-label " >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_DIRECTORY' ); ?> </label>
2017-03-27 12:38:51 +00:00
< div class = " controls " >
< input type = " text " id = " import_directory " name = " import_directory " class = " span5 input_box " size = " 70 " value = " <?php echo $this->state ->get('import.directory'); ?> " />
</ div >
</ div >
< div class = " form-actions " >
2024-03-09 19:47:28 +00:00
< input type = " button " class = " btn btn-primary " value = " <?php echo Text::_('COM_COMPONENTBUILDER_IMPORT_GET_BOTTON'); ?> " onclick = " Joomla.submitbuttonDir() " />& nbsp ; & nbsp ; & nbsp ; < small >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_FORMATS_ACCEPTED' ); ?> (<?php echo $formats; ?>)</small>
2017-03-27 12:38:51 +00:00
</ div >
</ fieldset >
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTab' ); ?>
2017-03-27 12:38:51 +00:00
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.addTab' , 'jcbImportTab' , 'url' , Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_FROM_URL' , true )); ?>
2017-03-27 12:38:51 +00:00
< fieldset class = " uploadform " >
2024-03-09 19:47:28 +00:00
< legend >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_UPDATE_DATA' ); ?> </legend>
2017-03-27 12:38:51 +00:00
< div class = " control-group " >
2024-03-09 19:47:28 +00:00
< label for = " import_url " class = " control-label " >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_URL' ); ?> </label>
2017-03-27 12:38:51 +00:00
< div class = " controls " >
< input type = " text " id = " import_url " name = " import_url " class = " span5 input_box " size = " 70 " value = " http:// " />
</ div >
</ div >
< div class = " form-actions " >
2024-03-09 19:47:28 +00:00
< input type = " button " class = " btn btn-primary " value = " <?php echo Text::_('COM_COMPONENTBUILDER_IMPORT_GET_BOTTON'); ?> " onclick = " Joomla.submitbuttonUrl() " />& nbsp ; & nbsp ; & nbsp ; < small >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_IMPORT_FORMATS_ACCEPTED' ); ?> (<?php echo $formats; ?>)</small>
2017-03-27 12:38:51 +00:00
</ div >
</ fieldset >
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTab' ); ?>
2018-03-21 02:45:51 +00:00
2023-10-18 07:26:30 +00:00
< ? php if ( isset ( $this -> vdmPackages ) && ArrayHelper :: check ( $this -> vdmPackages )) : ?>
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.addTab' , 'jcbImportTab' , 'url_vdm' , Text :: _ ( 'COM_COMPONENTBUILDER_VDM_PACKAGES' , true )); ?>
2018-05-02 01:38:42 +00:00
< div class = " span12 " id = " vdm_packages_installer " >
2018-03-21 05:57:44 +00:00
< div class = " alert alert-success " >
2024-03-09 19:47:28 +00:00
< p >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_ALL_OF_THESE_PACKAGES_ARE_A_FULLY_DEVELOPEDMAPPED_COMPONENTS_FOR_JCB_THEY_CAN_BE_SEEN_AS_DEMO_CONTENT_OR_BASE_IMAGES_FROM_WHICH_TO_START_YOUR_PROJECTBR_ALWAYS_MAKE_SURE_YOU_ARE_ON_THE_LATEST_VERSION_OF_JCB_BEFORE_IMPORTING_ANY_OF_THESE_PACKAGES_SHOULD_ANY_OF_THEM_FAIL_TO_IMPORT_A_S_PLEASE_LET_US_KNOWA' , 'href="https://www.joomlacomponentbuilder.com/package-support" target="_blank" title="Should any of these packages fail to import please let us know, some need a key of course."' ); ?> </p>
< p >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_BGET_PACKAGEB_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE_A_S_GET_A_KEY_TODAYA' , 'href="https://github.com/vdm-io/JCB-Packages" target="_blank" title="gitHub Reposetory"' , 'href="http://vdm.bz/jcb-packages" target="_blank" title="get a key to import the paid packages."' ); ?> </p>
< p >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_HOW_TO_GET_A_S_FREE_KEYSA_FROM_VDM' , 'href="https://vdm.bz/how-to-get-free-vdm-package-keys" target="_blank" title="see how easy it is to get access keys from VDM"' ); ?> </p>
2018-03-21 05:57:44 +00:00
</ div >
2018-05-01 22:17:38 +00:00
< fieldset class = " uploadform " >
2024-03-09 19:47:28 +00:00
< legend >< ? php echo Text :: _ ( " COM_COMPONENTBUILDER_PACKAGES_FROM_VAST_DEVELOPMENT_METHOD " ); ?> </legend>
2018-05-01 22:17:38 +00:00
< ? php foreach ( $this -> vdmPackages 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 ; ?>
< div class = " form-actions " >
2024-03-09 19:47:28 +00:00
< input type = " button " class = " btn btn-primary " value = " <?php echo Text::_('COM_COMPONENTBUILDER_GET_PACKAGE'); ?> " onclick = " Joomla.submitbuttonVDM() " />& nbsp ; & nbsp ; & nbsp ; < small >< span class = " icon-shield " > </ span >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_OFFICIAL_VDM_PACKAGES' ); ?> </small>
2018-05-01 22:17:38 +00:00
</ div >
2024-03-09 19:47:28 +00:00
< div class = " control-group " >< small >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_A_S_SPAN_CLASSICONFLAG_SPANREPORT_BROKEN_PACKAGEA' , 'href="https://www.joomlacomponentbuilder.com/package-support" target="_blank" title="Should any of these packages fail to import please let us know"' ); ?> </small></div>
2018-05-01 22:17:38 +00:00
</ fieldset >
</ div >
2018-05-02 01:38:42 +00:00
< div id = " vdm_packages_display " >
2018-05-01 22:17:38 +00:00
< div id = " vdm_packages_details " >
</ div >< br />
< div id = " vdm_package_owner_details " >
2018-03-21 02:45:51 +00:00
</ div >
2018-05-01 22:17:38 +00:00
</ div >
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTab' ); ?>
2018-05-01 22:17:38 +00:00
< ? php endif ; ?>
2023-10-18 07:26:30 +00:00
< ? php if ( isset ( $this -> jcbPackages ) && ArrayHelper :: check ( $this -> jcbPackages )) : ?>
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.addTab' , 'jcbImportTab' , 'url_jcb' , Text :: _ ( 'COM_COMPONENTBUILDER_JCB_COMMUNITY_PACKAGES' , true )); ?>
2018-05-02 01:38:42 +00:00
< div class = " span12 " id = " jcb_packages_installer " >
2018-05-01 22:17:38 +00:00
< div class = " alert alert-success " >
2024-03-09 19:47:28 +00:00
< p >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_ALL_OF_THESE_PACKAGES_ARE_A_FULLY_DEVELOPEDMAPPED_COMPONENTS_FOR_JCB_THEY_CAN_BE_SEEN_AS_DEMO_CONTENT_OR_BASE_IMAGES_FROM_WHICH_TO_START_YOUR_PROJECTBR_ALWAYS_MAKE_SURE_YOU_ARE_ON_THE_LATEST_VERSION_OF_JCB_BEFORE_IMPORTING_ANY_OF_THESE_PACKAGES_SHOULD_ANY_OF_THEM_FAIL_TO_IMPORT_A_S_PLEASE_LET_US_KNOWA' , 'href="https://www.joomlacomponentbuilder.com/package-support" target="_blank" title="Should any of these packages fail to import please let us know, some need a key of course."' ); ?> </p>
< p >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_BGET_PACKAGEB_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE' , 'href="https://github.com/vdm-io/JCB-Community-Packages" target="_blank" title="gitHub Reposetory"' ); ?> </p>
< p >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_ADD_YOUR_OWN_JCB_PACKAGES_TO_THE_COMMUNITY_A_S_GITHUBA_REPOSITORYBR_WATCH_THIS_A_S_TUTORIALA_TO_SEE_HOW' , 'href="https://github.com/vdm-io/JCB-Community-Packages" target="_blank" title="gitHub Reposetory"' , 'href="https://vdm.bz/add-jcb-community-package" target="_blank" title="watch the quick tutorial on how to add your own packages to this list of community packages"' ); ?> </p>
2018-05-01 22:17:38 +00:00
</ div >
< fieldset class = " uploadform " >
2024-03-09 19:47:28 +00:00
< legend >< ? php echo Text :: _ ( " COM_COMPONENTBUILDER_PACKAGES_FROM_JCB_COMMUNITY " ); ?> </legend>
2018-05-01 22:17:38 +00:00
< ? php foreach ( $this -> jcbPackages 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 ; ?>
< div class = " form-actions " >
2024-03-09 19:47:28 +00:00
< input type = " button " class = " btn btn-primary " value = " <?php echo Text::_('COM_COMPONENTBUILDER_GET_PACKAGE'); ?> " onclick = " Joomla.submitbuttonJCB() " />& nbsp ; & nbsp ; & nbsp ; < small >< span class = " icon-shield " > </ span >< ? php echo Text :: _ ( 'COM_COMPONENTBUILDER_COMMUNITY_PACKAGES' ); ?> </small>
2018-05-01 22:17:38 +00:00
</ div >
2024-03-09 19:47:28 +00:00
< div class = " control-group " >< small >< ? php echo Text :: sprintf ( 'COM_COMPONENTBUILDER_A_S_SPAN_CLASSICONFLAG_SPANREPORT_BROKEN_PACKAGEA' , 'href="https://www.joomlacomponentbuilder.com/package-support" target="_blank" title="Should any of these packages fail to import please let us know"' ); ?> </small></div>
2018-05-01 22:17:38 +00:00
</ fieldset >
</ div >
2018-05-02 01:38:42 +00:00
< div id = " jcb_packages_display " >
2018-05-01 22:17:38 +00:00
< div id = " jcb_packages_details " >
</ div >< br />
< div id = " jcb_package_owner_details " >
</ div >
</ div >
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTab' ); ?>
2018-03-21 02:45:51 +00:00
< ? php endif ; ?>
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'bootstrap.endTabSet' ); ?>
2017-03-27 12:38:51 +00:00
< input type = " hidden " name = " gettype " value = " upload " />
2018-03-24 01:36:07 +00:00
< input type = " hidden " name = " checksum " value = " 0 " />
2017-03-27 12:38:51 +00:00
< ? php endif ; ?>
< input type = " hidden " name = " task " value = " import_joomla_components.import " />
2024-03-09 19:47:28 +00:00
< ? php echo Html :: _ ( 'form.token' ); ?>
2018-05-02 01:38:42 +00:00
</ div >
2017-03-27 12:38:51 +00:00
</ form >
</ div >
2017-03-28 14:57:59 +00:00
< script type = " text/javascript " >
2023-10-18 07:26:30 +00:00
< ? php if (( isset ( $this -> vdmPackages ) && $this -> vdmPackages && ArrayHelper :: check ( $this -> vdmPackages )) || ( isset ( $this -> jcbPackages ) && $this -> jcbPackages && ArrayHelper :: check ( $this -> jcbPackages ))) : ?>
2018-05-03 11:30:53 +00:00
// set packages that are on the page
var packages = {};
jQuery ( document ) . ready ( function ( $ )
{
2023-10-18 07:26:30 +00:00
< ? php if ( isset ( $this -> jcbPackages ) && $this -> jcbPackages && ArrayHelper :: check ( $this -> jcbPackages )) : ?>
2018-05-03 11:30:53 +00:00
// get all jcb packages
jQuery ( " #jcb_package option " ) . each ( function ()
{
2022-06-02 12:05:34 +00:00
var package = jQuery ( this ) . val ();
packages [ package ] = 'jcb' ;
2018-05-03 11:30:53 +00:00
});
2018-05-03 14:04:47 +00:00
< ? php endif ; ?>
2023-10-18 07:26:30 +00:00
< ? php if ( isset ( $this -> vdmPackages ) && $this -> vdmPackages && ArrayHelper :: check ( $this -> vdmPackages )) : ?>
2018-05-03 11:30:53 +00:00
// get all vdm packages
jQuery ( " #vdm_package option " ) . each ( function ()
{
2022-06-02 12:05:34 +00:00
var package = jQuery ( this ) . val ();
packages [ package ] = 'vdm' ;
2018-05-03 11:30:53 +00:00
});
2018-05-03 14:04:47 +00:00
< ? php endif ; ?>
2018-05-03 11:30:53 +00:00
// no start behind the scene getting of package info
autoJCBpackageInfo ();
});
function autoJCBpackageInfo (){
2022-06-02 12:05:34 +00:00
jQuery . each ( packages , function ( package , type ) {
2018-05-03 11:30:53 +00:00
// check if the values are local
2022-06-02 12:05:34 +00:00
var result = jQuery . jStorage . get ( 'JCB-packages-details' + package , null );
if ( ! result && package . length > 0 ) {
autoJCBpackageInfoAgain ( package , type );
2018-05-03 11:30:53 +00:00
}
});
}
2022-06-02 12:05:34 +00:00
function autoJCBpackageInfoAgain ( package , type ){
getJCBpackageInfo_server ( package ) . done ( function ( result ) {
2018-05-03 11:30:53 +00:00
if ( result . owner || result . packages ){
2022-06-02 12:05:34 +00:00
jQuery . jStorage . set ( 'JCB-packages-details' + package , result , { TTL : expire });
2018-05-03 11:30:53 +00:00
}
});
}
2018-05-01 22:17:38 +00:00
function getJCBpackageInfo ( type ){
// show spinner
2018-05-03 11:30:53 +00:00
jQuery ( '#loading' ) . css ( 'display' , 'block' );
2018-05-02 01:38:42 +00:00
jQuery ( '#noticeboard' ) . show ();
jQuery ( '#installer-import' ) . hide ();
2018-05-01 22:17:38 +00:00
// get value
2022-06-02 12:05:34 +00:00
var package = jQuery ( '#' + type + '_package' ) . val ();
if ( package ) {
2018-05-01 22:17:38 +00:00
// check if the values are local
2022-06-02 12:05:34 +00:00
var result = jQuery . jStorage . get ( 'JCB-packages-details' + package , null );
2018-05-01 22:17:38 +00:00
if ( result ) {
2022-06-02 12:05:34 +00:00
showJCBpackageInfo ( result , package , type );
2018-05-01 22:17:38 +00:00
} else {
2022-06-02 12:05:34 +00:00
getJCBpackageInfoAgain ( package , type );
2018-05-01 22:17:38 +00:00
}
} else {
2018-05-02 01:38:42 +00:00
// hide spinner
2018-05-01 22:17:38 +00:00
jQuery ( '#loading' ) . hide ();
2018-05-02 01:38:42 +00:00
jQuery ( '#noticeboard' ) . hide ();
jQuery ( '#installer-import' ) . show ();
2018-05-01 22:17:38 +00:00
jQuery ( '#' + type + '_package_owner_details' ) . html ( ' ' );
jQuery ( '#' + type + '_packages_details' ) . html ( ' ' );
2018-05-02 01:38:42 +00:00
// some display moves
jQuery ( '#' + type + '_packages_installer' ) . removeClass ( 'span6' ) . addClass ( 'span12' );
jQuery ( '#' + type + '_packages_display' ) . removeClass ( 'span6' );
2018-05-01 22:17:38 +00:00
}
}
2022-06-02 12:05:34 +00:00
function getJCBpackageInfoAgain ( package , type ){
getJCBpackageInfo_server ( package ) . done ( function ( result ) {
showJCBpackageInfo ( result , package , type );
2018-05-01 22:17:38 +00:00
});
}
2022-06-02 12:05:34 +00:00
function showJCBpackageInfo ( result , package , type ){
2018-05-01 22:17:38 +00:00
if ( result . owner || result . packages ){
jQuery ( '#' + type + '_packages_details' ) . html ( result . packages );
jQuery ( '#' + type + '_package_owner_details' ) . html ( result . owner );
2022-06-02 12:05:34 +00:00
jQuery . jStorage . set ( 'JCB-packages-details' + package , result , { TTL : expire });
2018-05-02 01:38:42 +00:00
// some display moves
jQuery ( '#' + type + '_packages_installer' ) . removeClass ( 'span12' ) . addClass ( 'span6' );
jQuery ( '#' + type + '_packages_display' ) . addClass ( 'span6' );
2018-05-01 22:17:38 +00:00
} else {
if ( result . error ) {
jQuery ( '#' + type + '_packages_details' ) . html ( result . error );
}
jQuery ( '#' + type + '_package_owner_details' ) . html ( ' ' );
jQuery ( '#' + type + '_noticeboard' ) . show ();
2018-05-02 01:38:42 +00:00
// some display moves
jQuery ( '#' + type + '_packages_installer' ) . removeClass ( 'span6' ) . addClass ( 'span12' );
jQuery ( '#' + type + '_packages_display' ) . removeClass ( 'span6' );
2018-05-01 22:17:38 +00:00
}
// stop spinner
jQuery ( '#loading' ) . hide ();
2018-05-02 01:38:42 +00:00
jQuery ( '#noticeboard' ) . hide ();
jQuery ( '#installer-import' ) . show ();
2018-05-01 22:17:38 +00:00
}
2022-06-02 12:05:34 +00:00
function getJCBpackageInfo_server ( package ){
2018-05-01 22:17:38 +00:00
var getUrl = " index.php?option=com_componentbuilder&task=ajax.getJCBpackageInfo&format=json " ;
2022-06-02 12:05:34 +00:00
if ( token . length > 0 && package . length > 0 ){
var request = token + '=1&package=' + package ;
2018-05-01 22:17:38 +00:00
}
return jQuery . ajax ({
type : 'GET' ,
url : getUrl ,
dataType : 'jsonp' ,
data : request ,
jsonp : 'callback'
});
}
2018-05-03 14:04:47 +00:00
< ? php endif ; ?>
2018-05-01 22:17:38 +00:00
2021-02-19 00:35:54 +00:00
2018-05-01 22:17:38 +00:00
var noticeboard = " https://www.vdm.io/componentbuilder-noticeboard-md " ;
jQuery ( document ) . ready ( function () {
jQuery . get ( noticeboard )
. success ( function ( board ) {
if ( board . length > 5 ) {
2022-06-02 12:05:34 +00:00
jQuery ( " .noticeboard-md " ) . html ( marked . parse ( board ));
2018-05-01 22:17:38 +00:00
getIS ( 1 , board ) . done ( function ( result ) {
if ( result ){
jQuery ( " .vdm-new-notice " ) . show ();
getIS ( 2 , board );
}
});
} else {
jQuery ( " .noticeboard-md " ) . html ( all_is_good );
}
})
. error ( function ( jqXHR , textStatus , errorThrown ) {
jQuery ( " .noticeboard-md " ) . html ( all_is_good );
});
});
// to check is READ/NEW
function getIS ( type , notice ){
2021-02-19 00:35:54 +00:00
if ( type == 1 ){
var getUrl = JRouter ( " index.php?option=com_componentbuilder&task=ajax.isNew&format=json&raw=true " );
2018-05-01 22:17:38 +00:00
} else if ( type == 2 ) {
2021-02-19 00:35:54 +00:00
var getUrl = JRouter ( " index.php?option=com_componentbuilder&task=ajax.isRead&format=json&raw=true " );
2018-05-01 22:17:38 +00:00
}
if ( token . length > 0 && notice . length ){
2021-02-19 00:35:54 +00:00
var request = token + " =1¬ice= " + notice ;
2018-05-01 22:17:38 +00:00
}
return jQuery . ajax ({
type : " POST " ,
url : getUrl ,
2021-02-19 00:35:54 +00:00
dataType : " json " ,
2018-05-01 22:17:38 +00:00
data : request ,
2021-02-19 00:35:54 +00:00
jsonp : false
2018-05-01 22:17:38 +00:00
});
}
2017-03-28 14:57:59 +00:00
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 ();
}
});
2018-05-01 22:17:38 +00:00
2024-03-09 19:47:28 +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-05-01 22:17:38 +00:00
});
< ? php
2024-03-09 19:47:28 +00:00
$app = Factory :: getApplication ();
2018-05-01 22:17:38 +00:00
?>
function JRouter ( link ) {
< ? php
2020-01-03 01:41:55 +00:00
if ( $app -> isClient ( 'site' ))
2018-05-01 22:17:38 +00:00
{
2024-08-01 21:00:32 +00:00
echo 'var url = "' . Uri :: root () . '";' ;
2018-05-01 22:17:38 +00:00
}
else
{
echo 'var url = "";' ;
}
?>
return url + link ;
}
2021-03-05 03:08:47 +00:00
</ script >