Release of v5.1.1-alpha5
Refactor initialization flow to accommodate future scalability and integration with all designated areas. Refactor the Creator Builders class. Refactor the FieldString and FieldXML classes.
This commit is contained in:
336 files changed
+22861
-20675
No files matched your search
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('admin_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('admin_view.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('admin_view.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,21 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('admin_views.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('admin_view.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('admin_views.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('admin_view.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('admin_views.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('admin_view.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('admin_views.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_views');
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('custom_admin_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('custom_admin_view.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('custom_admin_view.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('custom_admin_views.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('custom_admin_view.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('custom_admin_view.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('custom_admin_views.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('custom_admin_views.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_admin_view.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_admin_views.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_admin_view.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_admin_views.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('custom_code.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_code.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_code.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_code.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_code.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('custom_code.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('custom_code.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('custom_code.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_code.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_code.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_code.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('custom_codes.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('custom_code.run_expansion', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('custom_code.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Run Expansion button.
|
||||
ToolbarHelper::custom('custom_codes.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('custom_codes.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_code.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_codes.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_code.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_codes.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('dynamic_get.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('dynamic_get.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('dynamic_get.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('dynamic_get.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('dynamic_get.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('dynamic_get.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('dynamic_get.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,21 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('dynamic_gets.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('dynamic_get.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('dynamic_gets.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('dynamic_get.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('dynamic_gets.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('dynamic_get.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('dynamic_gets.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('dynamic_gets');
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('field.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('field.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('field.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('field.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('field.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('field.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('field.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('field.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('field.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('field.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('field.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,21 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('fields.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('field.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('fields.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('field.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('fields.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('field.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fields.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('fields');
|
||||
|
||||
@@ -292,7 +292,7 @@ class HtmlView extends BaseHtmlView
|
||||
if ($this->canDo->get('fieldtype.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'joomla custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('fieldtype.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
@@ -375,7 +375,7 @@ class HtmlView extends BaseHtmlView
|
||||
if ($this->canDo->get('fieldtype.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'joomla custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('fieldtype.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ class HtmlView extends BaseHtmlView
|
||||
if ($this->user->authorise('fieldtype.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fieldtypes.pushPowers', 'joomla custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
ToolbarHelper::custom('fieldtypes.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
@@ -1,397 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\View\Get_snippets;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\HeaderCheck;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\Filesystem\File;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Html View class for the Get_snippets
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The styles url array
|
||||
*
|
||||
* @var array
|
||||
* @since 5.0.0
|
||||
*/
|
||||
protected array $styles;
|
||||
|
||||
/**
|
||||
* The scripts url array
|
||||
*
|
||||
* @var array
|
||||
* @since 5.0.0
|
||||
*/
|
||||
protected array $scripts;
|
||||
|
||||
/**
|
||||
* The actions object
|
||||
*
|
||||
* @var object
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public object $canDo;
|
||||
|
||||
/**
|
||||
* The user object.
|
||||
*
|
||||
* @var User
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null): void
|
||||
{
|
||||
// get component params
|
||||
$this->params = ComponentHelper::getParams('com_componentbuilder');
|
||||
// get the application
|
||||
$this->app ??= Factory::getApplication();
|
||||
// get the user object
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('get_snippets');
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];
|
||||
// Initialise variables.
|
||||
$this->items = $this->get('Items');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// add the tool bar
|
||||
$this->addToolBar();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode(PHP_EOL, $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
|
||||
// Only load jQuery if needed. (default is true)
|
||||
if ($this->params->get('add_jquery_framework', 1) == 1)
|
||||
{
|
||||
Html::_('jquery.framework');
|
||||
}
|
||||
// Load the header checker class.
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new HeaderCheck();
|
||||
|
||||
// Add View JavaScript File
|
||||
Html::_('script', "administrator/components/com_componentbuilder/assets/js/get_snippets.js", ['version' => 'auto']);
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
// Set script size.
|
||||
$size = $this->params->get('uikit_min');
|
||||
// Set css style.
|
||||
$style = $this->params->get('uikit_style');
|
||||
|
||||
// The uikit css.
|
||||
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
|
||||
}
|
||||
// The uikit js.
|
||||
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
|
||||
}
|
||||
|
||||
// Load the script to find all uikit components needed.
|
||||
if ($uikit != 2)
|
||||
{
|
||||
// Set the default uikit components in this view.
|
||||
$uikitComp = [];
|
||||
$uikitComp[] = 'data-uk-grid';
|
||||
}
|
||||
|
||||
// Load the needed uikit components in this view.
|
||||
if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp))
|
||||
{
|
||||
// loading...
|
||||
foreach ($uikitComp as $class)
|
||||
{
|
||||
foreach (ComponentbuilderHelper::$uk_components[$class] as $name)
|
||||
{
|
||||
// check if the CSS file exists.
|
||||
if (@file_exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css'))
|
||||
{
|
||||
// load the css.
|
||||
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']);
|
||||
}
|
||||
// check if the JavaScript file exists.
|
||||
if (@file_exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js'))
|
||||
{
|
||||
// load the js.
|
||||
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// load the local snippets
|
||||
if (ArrayHelper::check($this->items))
|
||||
{
|
||||
$local_snippets = array();
|
||||
foreach ($this->items as $item)
|
||||
{
|
||||
$path = StringHelper::safe($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false). '.json';
|
||||
$local_snippets[$path] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the JavaScript for JStore
|
||||
Html::_('script', 'media/com_componentbuilder/js/jquery.json.min.js', ['version' => 'auto']);
|
||||
Html::_('script', 'media/com_componentbuilder/js/jstorage.min.js', ['version' => 'auto']);
|
||||
Html::_('script', 'media/com_componentbuilder/js/strtotime.js', ['version' => 'auto']);
|
||||
// check if we should use browser storage
|
||||
$setBrowserStorage = $this->params->get('set_browser_storage', null);
|
||||
if ($setBrowserStorage)
|
||||
{
|
||||
// check what (Time To Live) show we use
|
||||
$storageTimeToLive = $this->params->get('storage_time_to_live', 'global');
|
||||
if ('global' == $storageTimeToLive)
|
||||
{
|
||||
// use the global session time
|
||||
$session = Factory::getSession();
|
||||
// must have itin milliseconds
|
||||
$expire = ($session->getExpire()*60)* 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the Componentbuilder Global setting
|
||||
if (0 != $storageTimeToLive)
|
||||
{
|
||||
// this will convert the time into milliseconds
|
||||
$storageTimeToLive = $storageTimeToLive * 1000;
|
||||
}
|
||||
$expire = $storageTimeToLive;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// set to use no storage
|
||||
$expire = 30000; // only 30 seconds
|
||||
}
|
||||
// Set the Time To Live To JavaScript
|
||||
$this->getDocument()->addScriptDeclaration("var expire = ". (int) $expire.";");
|
||||
// set snippet path
|
||||
$this->getDocument()->addScriptDeclaration("var snippetPath = '". ComponentbuilderHelper::$snippetPath ."';");
|
||||
$this->getDocument()->addScriptDeclaration("var snippetsPath = '". ComponentbuilderHelper::$snippetsPath ."';");
|
||||
// token
|
||||
$this->getDocument()->addScriptDeclaration("var token = '". Session::getFormToken() ."';");
|
||||
// add some global items buckets for bulk updating
|
||||
$this->getDocument()->addScriptDeclaration("var bulkItems = {};");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.new = [];");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.diverged = [];");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.ahead = [];");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.behind = [];");
|
||||
// set an error message if needed
|
||||
$this->getDocument()->addScriptDeclaration("var returnError = '<div class=\"uk-alert uk-alert-warning\"><h1>".Text::_('COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED')."!</h1><p>".Text::_('COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER').".</p></div>';");
|
||||
// need to add some language strings
|
||||
Text::script('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPETS');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_SNIPPET_OF_COMMUNITY_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_GET_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_LOCAL_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY');
|
||||
Text::script('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_USAGE');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_USAGE_OF_COMMUNITY_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_DESCRIPTION');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_BLAME');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_WHO_CONTRIBUTED_TO_THIS_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_SNIPPET_REFERENCE_URL');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPETS_COULD_NOT_BE_UPDATEDSAVED');
|
||||
Text::script('COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_THE_CONTRIBUTOR_DETAILS');
|
||||
Text::script('COM_COMPONENTBUILDER_JCB_COMMUNITY');
|
||||
Text::script('COM_COMPONENTBUILDER_COMPANY_NAME');
|
||||
Text::script('COM_COMPONENTBUILDER_AUTHOR_NAME');
|
||||
Text::script('COM_COMPONENTBUILDER_AUTHOR_EMAIL');
|
||||
Text::script('COM_COMPONENTBUILDER_AUTHOR_WEBSITE');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_DIVERGED_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_AHEAD_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES');
|
||||
Text::script('COM_COMPONENTBUILDER_OPEN_LIBRARY_SNIPPETS');
|
||||
// add some lang verfy messages
|
||||
$this->getDocument()->addScriptDeclaration("
|
||||
// set the snippet from gitHub
|
||||
function getConfirmUpdate(status) {
|
||||
switch(status) {
|
||||
case 'new':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_ADD_THIS_NEW_JCB_COMMUNITY_SNIPPET_TO_YOUR_LOCAL_SNIPPETS')."';
|
||||
break;
|
||||
case 'behind':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_UPDATE_YOUR_LOCAL_SNIPPET_WITH_THIS_NEWER_JCB_COMMUNITY_SNIPPET')."';
|
||||
break;
|
||||
case 'ahead':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_UPDATE_YOUR_LOCAL_SNIPPET_WITH_THIS_OLDER_JCB_COMMUNITY_SNIPPET')."';
|
||||
break;
|
||||
case 'diverged':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_REPLACE_YOUR_LOCAL_SNIPPET_WITH_THIS_JCB_COMMUNITY_SNIPPET')."';
|
||||
break;
|
||||
default:
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_CONTINUE')."';
|
||||
break;
|
||||
}
|
||||
}
|
||||
");
|
||||
// load the local snippets
|
||||
if (ArrayHelper::check($this->items))
|
||||
{
|
||||
// Set the local snippets array
|
||||
$this->getDocument()->addScriptDeclaration("var local_snippets = ". json_encode($local_snippets).";");
|
||||
}
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
// hide the main menu
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
// add title to the page
|
||||
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_GET_SNIPPETS'),'search');
|
||||
// add cpanel button
|
||||
ToolbarHelper::custom('get_snippets.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
|
||||
if ($this->canDo->get('get_snippets.custom_admin_views'))
|
||||
{
|
||||
// add Custom Admin Views button.
|
||||
ToolbarHelper::custom('get_snippets.openCustomAdminViews', 'screen custom-button-opencustomadminviews', '', 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.site_views'))
|
||||
{
|
||||
// add Site Views button.
|
||||
ToolbarHelper::custom('get_snippets.openSiteViews', 'palette custom-button-opensiteviews', '', 'COM_COMPONENTBUILDER_SITE_VIEWS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.templates'))
|
||||
{
|
||||
// add Templates button.
|
||||
ToolbarHelper::custom('get_snippets.openTemplates', 'brush custom-button-opentemplates', '', 'COM_COMPONENTBUILDER_TEMPLATES', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.layouts'))
|
||||
{
|
||||
// add Layouts button.
|
||||
ToolbarHelper::custom('get_snippets.openLayouts', 'brush custom-button-openlayouts', '', 'COM_COMPONENTBUILDER_LAYOUTS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.snippets'))
|
||||
{
|
||||
// add Snippets button.
|
||||
ToolbarHelper::custom('get_snippets.openSnippets', 'pin custom-button-opensnippets', '', 'COM_COMPONENTBUILDER_SNIPPETS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.libraries'))
|
||||
{
|
||||
// add Libraries button.
|
||||
ToolbarHelper::custom('get_snippets.openLibraries', 'puzzle custom-button-openlibraries', '', 'COM_COMPONENTBUILDER_LIBRARIES', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('get_snippets');
|
||||
if (StringHelper::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\View\Initialization_selection;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\HeaderCheck;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Html View class for the Initialization_selection
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null): void
|
||||
{
|
||||
// get component params
|
||||
$this->params = ComponentHelper::getParams('com_componentbuilder');
|
||||
// get the application
|
||||
$this->app ??= Factory::getApplication();
|
||||
// get the user object
|
||||
$this->user ??= Factory::getApplication()->getIdentity();
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('initialization_selection');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
// Initialise variables.
|
||||
$this->item = $this->get('Item');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// add the tool bar
|
||||
$this->addToolBar();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode(PHP_EOL, $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
|
||||
// Only load jQuery if needed. (default is true)
|
||||
if ($this->params->get('add_jquery_framework', 1) == 1)
|
||||
{
|
||||
Html::_('jquery.framework');
|
||||
}
|
||||
// Load the header checker class.
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new HeaderCheck();
|
||||
|
||||
// always load these files.
|
||||
Html::_('stylesheet', "media/com_componentbuilder/uikit-v3/css/uikit.min.css", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/uikit-v3/js/uikit.min.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/uikit-v3/js/uikit-icons.min.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/uikit-v3/js/Uploader.min.js", ['version' => 'auto']);
|
||||
|
||||
// always load these files.
|
||||
Html::_('stylesheet', "media/com_componentbuilder/datatable-bootstrap5/css/datatables.min.css", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/datatable-bootstrap5/js/pdfmake.min.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/datatable-bootstrap5/js/vfs_fonts.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/datatable-bootstrap5/js/datatables.min.js", ['version' => 'auto']);
|
||||
|
||||
// Add View JavaScript File
|
||||
Html::_('script', "administrator/components/com_componentbuilder/assets/js/initialization_selection.js", ['version' => 'auto']);
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
// Set script size.
|
||||
$size = $this->params->get('uikit_min');
|
||||
// Set css style.
|
||||
$style = $this->params->get('uikit_style');
|
||||
|
||||
// The uikit css.
|
||||
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
|
||||
}
|
||||
// The uikit js.
|
||||
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
|
||||
}
|
||||
// set some language strings for the JS class: [InitializationManager]
|
||||
Text::script("COM_COMPONENTBUILDER_MISSING_REPOSITORY_OR_AREA_DATA");
|
||||
Text::script("COM_COMPONENTBUILDER_FAILED_TO_RETRIEVE_REPOSITORY_INDEX");
|
||||
Text::script("COM_COMPONENTBUILDER_NETWORK_OR_SERVER_ERROR_OCCURRED_WHILE_FETCHING_INDEX");
|
||||
Text::script("COM_COMPONENTBUILDER_NO_ITEMS_SELECTED");
|
||||
Text::script("COM_COMPONENTBUILDER_FAILED_TO_INITIALIZE_SELECTED_POWERS");
|
||||
Text::script("COM_COMPONENTBUILDER_ERROR_OCCURRED_WHILE_INITIALIZING_POWERS");
|
||||
Text::script('COM_COMPONENTBUILDER_THESE_ITEMS_WERE_ALREADY_PRESENT_LOCALLY_AND_WERE_NOT_INITIALIZED');
|
||||
Text::script('COM_COMPONENTBUILDER_THESE_ITEMS_COULD_NOT_BE_FOUND_IN_THE_REMOTE_REPOSITORY_AND_WERE_NOT_INITIALIZED');
|
||||
Text::script('COM_COMPONENTBUILDER_THESE_ITEMS_WERE_SUCCESSFULLY_INITIALIZED');
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
// hide the main menu
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
// set the title
|
||||
if (isset($this->item->name) && $this->item->name)
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
// Check for empty title and add view name if param is set
|
||||
if (empty($title))
|
||||
{
|
||||
$title = Text::_('COM_COMPONENTBUILDER_INITIALIZATION_SELECTION');
|
||||
}
|
||||
// add title to the page
|
||||
ToolbarHelper::title($title,'puzzle');
|
||||
// add cpanel button
|
||||
ToolbarHelper::custom('initialization_selection.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('initialization_selection');
|
||||
if (StringHelper::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('joomla_component.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_component.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('joomla_component.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('joomla_component.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('joomla_component.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('joomla_component.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_component.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('joomla_component.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('joomla_component.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +223,21 @@ class HtmlView extends BaseHtmlView
|
||||
// add Clear tmp button.
|
||||
ToolbarHelper::custom('joomla_components.clearTmp', 'purge custom-button-cleartmp', '', 'COM_COMPONENTBUILDER_CLEAR_TMP', false);
|
||||
}
|
||||
if ($this->user->authorise('joomla_component.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('joomla_components.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('joomla_component.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_components.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('joomla_component.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('joomla_components.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_components');
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('layout.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('layout.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('layout.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('layout.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('layout.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('layout.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('layout.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('layout.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('layout.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('layout.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('layout.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('layout.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('layout.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('layouts.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('layout.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('layout.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('layouts.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('layouts.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('layout.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('layouts.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('layout.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('layouts.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
@@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('libraries.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('library.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('library.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('libraries.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('libraries.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('library.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('libraries.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('library.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('libraries.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('library.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('library.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('library.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('library.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('library.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('library.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('library.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('library.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('library.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('library.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('library.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('library.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('library.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('site_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('site_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('site_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('site_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('site_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('site_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('site_view.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('site_view.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('site_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('site_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('site_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('site_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('site_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('site_views.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('site_view.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('site_view.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('site_views.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('site_views.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('site_view.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('site_views.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('site_view.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('site_views.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('snippet.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('snippet.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('snippet.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('snippet.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('snippet.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('snippet.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('snippet.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('snippet.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('snippet.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('snippet.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,11 +208,6 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::checkin('snippets.checkin');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('snippet.share_snippets', 'com_componentbuilder'))
|
||||
{
|
||||
// add Share Snippets button.
|
||||
ToolbarHelper::custom('snippets.shareSnippets', 'share custom-button-sharesnippets', '', 'COM_COMPONENTBUILDER_SHARE_SNIPPETS', 'true');
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
@@ -223,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('snippets.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('snippet.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('snippet.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('snippets.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('snippets.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('snippet.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('snippets.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('snippet.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('snippets.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
@@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('template.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('template.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('template.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('template.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('template.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('template.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('template.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('template.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('template.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('template.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('template.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('templates.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('template.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('template.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('templates.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('templates.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('template.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('templates.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('template.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('templates.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
||||
Reference in new issue
Block a user