Release of v5.1.1-alpha2
Adds the ModalSelect fieldtype to Joomla Component Builder - J5. Adds the Data Import Function to the Demo Component. Adds new country related tables and fields to the Demo Component. Resolves the Database Updating issue in the compiler. #1212,#1209. Adds the Component Commands Plugin to the CLI for Import of spreadsheet data-sets.
This commit is contained in:
536 files changed
+16369
-2067
No files matched your search
@@ -26,6 +26,7 @@ use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\Input\Input;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -46,6 +47,14 @@ class HtmlView extends BaseHtmlView
|
||||
*/
|
||||
public mixed $item;
|
||||
|
||||
/**
|
||||
* The input class
|
||||
*
|
||||
* @var Input
|
||||
* @since 5.2.1
|
||||
*/
|
||||
public Input $input;
|
||||
|
||||
/**
|
||||
* The state object
|
||||
*
|
||||
@@ -118,6 +127,14 @@ class HtmlView extends BaseHtmlView
|
||||
*/
|
||||
public string $referral;
|
||||
|
||||
/**
|
||||
* The modal state
|
||||
*
|
||||
* @var bool
|
||||
* @since 5.2.1
|
||||
*/
|
||||
public bool $isModal;
|
||||
|
||||
/**
|
||||
* Component_plugins view display method
|
||||
*
|
||||
@@ -141,10 +158,10 @@ class HtmlView extends BaseHtmlView
|
||||
// get action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('component_plugins', $this->item);
|
||||
// get input
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
$this->input ??= Factory::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)
|
||||
@@ -165,7 +182,16 @@ class HtmlView extends BaseHtmlView
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->isModal = false;
|
||||
$this->addToolbar();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->isModal = true;
|
||||
$this->addModalToolbar();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
@@ -180,17 +206,17 @@ class HtmlView extends BaseHtmlView
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
Factory::getApplication()->input->set('hidemainmenu', true);
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
$user = $this->getCurrentUser();
|
||||
$userId = $user->id;
|
||||
$isNew = $this->item->id == 0;
|
||||
|
||||
@@ -268,6 +294,71 @@ class HtmlView extends BaseHtmlView
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the modal toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
* @since 5.0.0
|
||||
*/
|
||||
protected function addModalToolbar()
|
||||
{
|
||||
Factory::getApplication()->input->set('hidemainmenu', true);
|
||||
$user = $this->getCurrentUser();
|
||||
$userId = $user->id;
|
||||
$isNew = $this->item->id == 0;
|
||||
|
||||
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT'), 'pencil-2 article-add');
|
||||
// Built the actions for new and existing records.
|
||||
if (StringHelper::check($this->referral))
|
||||
{
|
||||
if ($this->canDo->get('component_plugins.create') && $isNew)
|
||||
{
|
||||
// We can create the record.
|
||||
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
elseif ($this->canDo->get('component_plugins.edit'))
|
||||
{
|
||||
// We can save the record.
|
||||
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($isNew)
|
||||
{
|
||||
// Do not creat but cancel.
|
||||
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
// We can close it.
|
||||
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($isNew)
|
||||
{
|
||||
// For new records, check the create permission.
|
||||
if ($this->canDo->get('component_plugins.create'))
|
||||
{
|
||||
ToolbarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
ToolbarHelper::custom('component_plugins.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
};
|
||||
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->canDo->get('component_plugins.edit'))
|
||||
{
|
||||
// We can save the new record
|
||||
ToolbarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user