Adds new JCB package engine. Fix issue with loading the Component Builder Wiki. Adds advanced version update notice to the Component Builder Dashboard. Completely refactors the class that builds the Component Dashboard. #1134. Adds Initialize, Reset, and Push functionality to the Repository entities. Completely refactors the SQL teaks and SQL dump classes. Changes J4 fields to allow NULL. Fix a bug in Dynamic Get JavaScript that causes table columns to not load.
264 lines
5.7 KiB
PHP
264 lines
5.7 KiB
PHP
<?php
|
|
/**
|
|
* @package Joomla.Component.Builder
|
|
*
|
|
* @created 4th September 2022
|
|
* @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
|
|
*/
|
|
|
|
// No direct access to this JCB template file (EVER)
|
|
defined('_JCB_TEMPLATE') or die;
|
|
?>
|
|
###BOM###
|
|
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###View###;
|
|
|
|
###ADMIN_VIEW_HTML_HEADER###
|
|
|
|
// No direct access to this file
|
|
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
|
|
|
/**
|
|
* ###View### Html View class
|
|
*
|
|
* @since 1.6
|
|
*/
|
|
#[\AllowDynamicProperties]
|
|
class HtmlView extends BaseHtmlView
|
|
{
|
|
/**
|
|
* The item from the model
|
|
*
|
|
* @var mixed
|
|
* @since 3.10.11
|
|
*/
|
|
public mixed $item;
|
|
|
|
/**
|
|
* The input class
|
|
*
|
|
* @var Joomla___59106b64_dd51_4280_be0a_1b9b9ebb7161___Power
|
|
* @since 5.2.1
|
|
*/
|
|
public Joomla___59106b64_dd51_4280_be0a_1b9b9ebb7161___Power $input;
|
|
|
|
/**
|
|
* The state object
|
|
*
|
|
* @var mixed
|
|
* @since 3.10.11
|
|
*/
|
|
public mixed $state;
|
|
|
|
/**
|
|
* The form from the model
|
|
*
|
|
* @var mixed
|
|
* @since 3.10.11
|
|
*/
|
|
public mixed $form;
|
|
|
|
/**
|
|
* The toolbar object
|
|
*
|
|
* @var Toolbar
|
|
* @since 3.10.11
|
|
*/
|
|
public Toolbar $toolbar;
|
|
|
|
/**
|
|
* 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 origin referral view name
|
|
*
|
|
* @var string
|
|
* @since 3.10.11
|
|
*/
|
|
public string $ref;
|
|
|
|
/**
|
|
* The origin referral item id
|
|
*
|
|
* @var int
|
|
* @since 3.10.11
|
|
*/
|
|
public int $refid;
|
|
|
|
/**
|
|
* The referral url suffix values
|
|
*
|
|
* @var string
|
|
* @since 3.10.11
|
|
*/
|
|
public string $referral;
|
|
|
|
/**
|
|
* The modal state
|
|
*
|
|
* @var bool
|
|
* @since 5.2.1
|
|
*/
|
|
public bool $isModal;
|
|
|
|
/**
|
|
* ###View### view display method
|
|
*
|
|
* @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
|
|
{
|
|
// set params
|
|
$this->params = Joomla___aeb8e463_291f_4445_9ac4_34b637c12dbd___Power::getParams('com_###component###');
|
|
$this->useCoreUI = true;
|
|
// Assign the variables
|
|
$this->form ??= $this->get('Form');
|
|
$this->item = $this->get('Item');
|
|
$this->styles = $this->get('Styles');
|
|
$this->scripts = $this->get('Scripts');
|
|
$this->state = $this->get('State');
|
|
// get action permissions
|
|
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
|
|
// get input
|
|
$this->input ??= Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input;
|
|
$this->ref = $this->input->get('ref', 0, 'word');
|
|
$this->refid = $this->input->get('refid', 0, 'int');
|
|
$return = $this->input->get('return', null, 'base64');
|
|
// set the referral string
|
|
$this->referral = '';
|
|
if ($this->refid && $this->ref)
|
|
{
|
|
// return to the item that referred to this item
|
|
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
|
|
}
|
|
elseif($this->ref)
|
|
{
|
|
// return to the list view that referred to this item
|
|
$this->referral = '&ref=' . (string) $this->ref;
|
|
}
|
|
// check return value
|
|
if (!is_null($return))
|
|
{
|
|
// add the return value
|
|
$this->referral .= '&return=' . (string) $return;
|
|
}###LINKEDVIEWITEMS###
|
|
|
|
// Set the toolbar
|
|
if ($this->getLayout() !== 'modal')
|
|
{
|
|
$this->isModal = false;
|
|
$this->addToolbar();
|
|
}
|
|
else
|
|
{
|
|
$this->isModal = true;
|
|
$this->addModalToolbar();
|
|
}
|
|
|
|
// Check for errors.
|
|
if (count($errors = $this->get('Errors')))
|
|
{
|
|
throw new \Exception(implode("\n", $errors), 500);
|
|
}
|
|
|
|
// Set the html view document stuff
|
|
$this->_prepareDocument();
|
|
|
|
// Display the template
|
|
parent::display($tpl);
|
|
}
|
|
|
|
/**
|
|
* Add the page title and toolbar.
|
|
*
|
|
* @return void
|
|
* @throws \Exception
|
|
* @since 1.6
|
|
*/
|
|
protected function addToolbar(): void
|
|
{
|
|
###ADDTOOLBAR###
|
|
}
|
|
|
|
/**
|
|
* Add the modal toolbar.
|
|
*
|
|
* @return void
|
|
* @throws \Exception
|
|
* @since 5.0.0
|
|
*/
|
|
protected function addModalToolbar()
|
|
{
|
|
###ADDMODALTOOLBAR###
|
|
}
|
|
|
|
/**
|
|
* 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 = true, int $length = 30)
|
|
{
|
|
if (!is_string($var))
|
|
{
|
|
return $var;
|
|
}
|
|
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
|
}
|
|
|
|
/**
|
|
* Prepare some document related stuff.
|
|
*
|
|
* @return void
|
|
* @since 1.6
|
|
*/
|
|
protected function _prepareDocument(): void
|
|
{###JQUERY###
|
|
$isNew = ($this->item->id < 1);
|
|
$this->getDocument()->setTitle(Joomla___ba6326ef_cb79_4348_80f4_ab086082e3c5___Power::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT'));
|
|
// add styles
|
|
foreach ($this->styles as $style)
|
|
{
|
|
Joomla___34690c75_1090_47eb_8c06_7228dc7eedd6___Power::_('stylesheet', $style, ['version' => 'auto']);
|
|
}###AJAXTOKE######LINKEDVIEWTABLESCRIPTS###
|
|
// add scripts
|
|
foreach ($this->scripts as $script)
|
|
{
|
|
Joomla___34690c75_1090_47eb_8c06_7228dc7eedd6___Power::_('script', $script, ['version' => 'auto']);
|
|
}###DOCUMENT_CUSTOM_PHP###
|
|
}
|
|
}
|