Release of v3.2.3-alpha1
Fix site view form missing classes in J4+. Fix permissions tab in items in J4+. Fix site display controller checkEditId function in J4+. Add class methods to the HtmlView classes in J4+. Fix broken toolbar call in HtmlView in J4+.
This commit is contained in:
parent
36d0eb98ee
commit
fd08d48baf
@ -1,3 +1,11 @@
|
||||
# v3.2.3-alpha1
|
||||
|
||||
- Fix site view form missing classes in J4+
|
||||
- Fix permissions tab in items in J4+
|
||||
- Fix site display controller checkEditId function in J4+
|
||||
- Add class methods to the HtmlView classes in J4+
|
||||
- Fix broken toolbar call in HtmlView in J4+
|
||||
|
||||
# v3.2.2
|
||||
|
||||
- Fix auto build from SQL in Joomla 4 and 5.
|
||||
|
10
README.md
10
README.md
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.3-alpha1) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
||||
|
||||
@ -144,13 +144,13 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 20th July, 2024
|
||||
+ *Version*: 3.2.2
|
||||
+ *Last Build*: 26th July, 2024
|
||||
+ *Version*: 3.2.3-alpha1
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **796047**
|
||||
+ *Line count*: **799073**
|
||||
+ *Field count*: **2104**
|
||||
+ *File count*: **5469**
|
||||
+ *File count*: **5490**
|
||||
+ *Folder count*: **482**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
|
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.3-alpha1) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
||||
|
||||
@ -144,13 +144,13 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 20th July, 2024
|
||||
+ *Version*: 3.2.2
|
||||
+ *Last Build*: 26th July, 2024
|
||||
+ *Version*: 3.2.3-alpha1
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **796047**
|
||||
+ *Line count*: **799073**
|
||||
+ *Field count*: **2104**
|
||||
+ *File count*: **5469**
|
||||
+ *File count*: **5490**
|
||||
+ *Folder count*: **482**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
|
@ -27,6 +27,62 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The items from the model
|
||||
*
|
||||
* @var mixed
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public mixed $items;
|
||||
|
||||
/**
|
||||
* The state object
|
||||
*
|
||||
* @var mixed
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public mixed $state;
|
||||
|
||||
/**
|
||||
* 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 return here base64 url
|
||||
*
|
||||
* @var string
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public string $return_here;
|
||||
|
||||
/**
|
||||
* The user object.
|
||||
*
|
||||
* @var Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $user;
|
||||
|
||||
/**
|
||||
* ###Views### view display method
|
||||
*
|
||||
@ -43,7 +99,7 @@ class HtmlView extends BaseHtmlView
|
||||
$this->state = $this->get('State');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->user ??= Factory::getApplication()->getIdentity();###ADMIN_DIPLAY_METHOD###
|
||||
$this->user ??= $this->getCurrentUser();###ADMIN_DIPLAY_METHOD###
|
||||
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
|
||||
|
@ -27,6 +27,86 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The item from the model
|
||||
*
|
||||
* @var mixed
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public mixed $item;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* ###View### view display method
|
||||
*
|
||||
@ -41,7 +121,7 @@ class HtmlView extends BaseHtmlView
|
||||
$this->params = ComponentHelper::getParams('com_###component###');
|
||||
$this->useCoreUI = true;
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->form ??= $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
|
@ -27,6 +27,38 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
|
||||
*/
|
||||
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 Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $user;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
@ -42,11 +74,11 @@ class HtmlView extends BaseHtmlView
|
||||
// get the application
|
||||
$this->app ??= Factory::getApplication();
|
||||
// get the user object
|
||||
$this->user ??= $this->app->getIdentity();
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###sview###');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
@ -27,6 +27,86 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The item from the model
|
||||
*
|
||||
* @var mixed
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public mixed $item;
|
||||
|
||||
/**
|
||||
* 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 view 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;
|
||||
|
||||
/**
|
||||
* ###View### view display method
|
||||
*
|
||||
@ -41,11 +121,11 @@ class HtmlView extends BaseHtmlView
|
||||
$this->params = ComponentHelper::getParams('com_###component###');
|
||||
$this->useCoreUI = true;
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->form ??= $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->state = $this->get('State');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];
|
||||
// get action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
|
||||
// get input
|
||||
@ -97,6 +177,9 @@ class HtmlView extends BaseHtmlView
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
###ADDTOOLBAR###
|
||||
|
||||
// now initiate the toolbar
|
||||
$this->toolbar ??= Toolbar::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,9 +15,13 @@ defined('_JCB_TEMPLATE') or die;
|
||||
###BOM###
|
||||
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controller;
|
||||
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
@ -31,13 +35,50 @@ use Joomla\CMS\Language\Text;
|
||||
*/
|
||||
class DisplayController extends BaseController
|
||||
{
|
||||
/**
|
||||
* The allowed edit views.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected array $allowed_edit_views = [###SITE_ALLOW_EDIT_VIEWS_ARRAY###
|
||||
];
|
||||
|
||||
/**
|
||||
* The application identity object.
|
||||
*
|
||||
* @var User
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $identity;
|
||||
|
||||
/**
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* Recognized key values include 'name', 'default_task', 'model_path', and
|
||||
* 'view_path' (this list is not meant to be comprehensive).
|
||||
* @param MVCFactoryInterface|null $factory The factory.
|
||||
* @param CMSApplication|null $app The Application for the dispatcher
|
||||
* @param Input|null $input The Input object for the request
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
|
||||
{
|
||||
$app ??= Factory::getApplication();
|
||||
$this->identity ??= $app->getIdentity();
|
||||
|
||||
parent::__construct($config, $factory, $app, $input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached.
|
||||
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link InputFilter::clean()}.
|
||||
* @param boolean $cachable If true, the view output will be cached.
|
||||
* @param boolean|array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link InputFilter::clean()}.
|
||||
*
|
||||
* @return DisplayController This object to support chaining.
|
||||
* @throws \Exception
|
||||
* @since 1.5
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
@ -51,14 +92,13 @@ class DisplayController extends BaseController
|
||||
$cachable = true;
|
||||
|
||||
// ensure that the view is not cashable if edit view or if user is logged in
|
||||
$user = $this->app->getIdentity();
|
||||
if ($user->get('id') || $this->input->getMethod() === 'POST' || $isEdit)
|
||||
if ($this->identity->get('id') || $this->input->getMethod() === 'POST' || $isEdit)
|
||||
{
|
||||
$cachable = false;
|
||||
}
|
||||
|
||||
// Check for edit form.
|
||||
if ($isEdit && !$this->checkEditId('com_###component###.edit.'.$view, $id))
|
||||
if ($isEdit && !$this->checkEditId($view, $id))
|
||||
{
|
||||
// check if item was opened from other than its own list view
|
||||
$ref = $this->input->getCmd('ref', 0);
|
||||
@ -68,12 +108,12 @@ class DisplayController extends BaseController
|
||||
if ($refid > 0 && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref))
|
||||
{
|
||||
// redirect to item of ref
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view=' . (string) $ref . '&layout=edit&id=' . (int) $refid, false));
|
||||
}
|
||||
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref))
|
||||
{
|
||||
// redirect to ref
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref, false));
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view=' . (string) $ref, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -115,18 +155,133 @@ class DisplayController extends BaseController
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function checkEditView($view)
|
||||
/**
|
||||
* Method to check whether an ID is in the edit list.
|
||||
*
|
||||
* @param string $context The view name.
|
||||
* @param integer $id The ID of the record to add to the edit list.
|
||||
*
|
||||
* @return boolean True if the ID is in the edit list.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function checkEditId($context, $id)
|
||||
{
|
||||
if (parent::checkEditId("com_###component###.edit.{$context}", $id))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// check user edit access
|
||||
if ($this->canEditId($context, $id))
|
||||
{
|
||||
$this->holdEditId("com_###component###.edit.{$context}", $id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to check whether an ID is allowed to be edited by the active user.
|
||||
*
|
||||
* @param string $view The view name.
|
||||
* @param integer $id The ID of the record to add to the edit list.
|
||||
*
|
||||
* @return boolean True if the ID is in the edit list.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function canEditId($view, $id): bool
|
||||
{
|
||||
// check that this view is even allowed
|
||||
$allowed = $this->getAllowedEditView($view);
|
||||
if ($allowed === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if this item has custom function set for canEditId
|
||||
if (isset($allowed['function'])
|
||||
&& method_exists($this, $allowed['function'])
|
||||
&& $this->{$allowed['function']}(['id' => $id], 'id'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if this item can be accessed (and has access)
|
||||
$access = true;
|
||||
if (isset($allowed['access']))
|
||||
{
|
||||
$access = ($this->identity->authorise($allowed['access'], "com_###component###.{$view}." . (int) $id)
|
||||
&& $this->identity->authorise($allowed['access'], 'com_###component###'));
|
||||
}
|
||||
|
||||
// check if this item can be edited
|
||||
$edit = false;
|
||||
if ($access && isset($allowed['edit']))
|
||||
{
|
||||
$edit = ($this->identity->authorise($allowed['edit'], "com_###component###.{$view}." . (int) $id)
|
||||
&& $this->identity->authorise($allowed['edit'], 'com_###component###'));
|
||||
}
|
||||
|
||||
// check if this item can be edited by owner
|
||||
if ($access && !$edit && isset($allowed['edit.own']))
|
||||
{
|
||||
$edit = ($this->identity->authorise($allowed['edit.own'], "com_###component###.{$view}." . (int) $id)
|
||||
&& $this->identity->authorise($allowed['edit.own'], 'com_###component###'));
|
||||
}
|
||||
|
||||
return $edit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided view is an edit view.
|
||||
*
|
||||
* This method verifies whether the given view name is recognized as an edit view.
|
||||
* It uses the StringHelper::check() method to validate the input and then checks
|
||||
* against a predefined list of edit views.
|
||||
*
|
||||
* @param string|null $view The name of the view to check.
|
||||
*
|
||||
* @return bool True if the view is an edit view, false otherwise.
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected function checkEditView(?string $view): bool
|
||||
{
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view))
|
||||
{
|
||||
$views = [###SITE_EDIT_VIEW_ARRAY###
|
||||
];
|
||||
// check if this is a edit view
|
||||
if (in_array($view,$views))
|
||||
// check if this is an edit view
|
||||
if (isset($this->allowed_edit_views[$view]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the allowed edit view permission map
|
||||
*
|
||||
* @param string|null $view The name of the view to check.
|
||||
*
|
||||
* @return array|null The permissions map
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function getAllowedEditView(?string $view): ?array
|
||||
{
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view))
|
||||
{
|
||||
// check if this is an edit view
|
||||
if (isset($this->allowed_edit_views[$view]))
|
||||
{
|
||||
return $this->allowed_edit_views[$view];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}###SITE_ALLOW_EDIT_VIEWS_FUNCTIONS###
|
||||
}
|
||||
|
@ -27,6 +27,54 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The items from the model
|
||||
*
|
||||
* @var mixed
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public mixed $items;
|
||||
|
||||
/**
|
||||
* 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 user object.
|
||||
*
|
||||
* @var Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $user;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
@ -82,6 +130,7 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// now initiate the toolbar
|
||||
$this->toolbar = Toolbar::getInstance();
|
||||
}###SITE_GET_MODULE###
|
||||
|
@ -25,7 +25,7 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controll
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SView###Controller extends FormController
|
||||
class ###SView###Controller extends Joomla___907ccae5_57a9_44b9_a8aa_5b905d1cd70f___Power
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
@ -107,14 +107,14 @@ class ###SView###Controller extends FormController
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param BaseDatabaseModel $model The data model object.
|
||||
* @param Joomla___6dce7a1b_cfc3_4c2a_837d_be9cbc902446___Power $model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
|
||||
protected function postSaveHook(Joomla___6dce7a1b_cfc3_4c2a_837d_be9cbc902446___Power $model, $validData = [])
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,38 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The toolbar object
|
||||
*
|
||||
* @var Toolbar
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public Toolbar $toolbar;
|
||||
|
||||
/**
|
||||
* The styles url array
|
||||
*
|
||||
* @var array
|
||||
* @since 3.10.11
|
||||
*/
|
||||
protected array $styles;
|
||||
|
||||
/**
|
||||
* The scripts url array
|
||||
*
|
||||
* @var array
|
||||
* @since 3.10.11
|
||||
*/
|
||||
protected array $scripts;
|
||||
|
||||
/**
|
||||
* The user object.
|
||||
*
|
||||
* @var Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $user;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
@ -41,10 +73,10 @@ class HtmlView extends BaseHtmlView
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->params = $this->app->getParams();
|
||||
$this->menu = $this->app->getMenu()->getActive();
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];
|
||||
// get the user object
|
||||
$this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD###
|
||||
$this->user ??= $this->getCurrentUser();###SITE_DIPLAY_METHOD###
|
||||
}###SITE_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
@ -82,8 +114,9 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// now initiate the toolbar
|
||||
$this->toolbar = Toolbar::getInstance();
|
||||
$this->toolbar ??= Toolbar::getInstance();
|
||||
}###SITE_GET_MODULE###
|
||||
|
||||
/**
|
||||
|
@ -3275,7 +3275,7 @@ COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_STATE_DESCRIPTION="Set the release
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_STATE_HINT="stable"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_STATE_LABEL="Release State"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_TARGET_VERSION_DESCRIPTION="Set the release target version"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_TARGET_VERSION_HINT="3.*"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_TARGET_VERSION_HINT="5\.[012]"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_TARGET_VERSION_LABEL="Update Server Release Target Version"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_URL_DESCRIPTION="Enter Download Link"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_URL_HINT="http://www.example.com/file.zip"
|
||||
|
@ -247,7 +247,7 @@
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_TARGET_VERSION_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
default="3.*"
|
||||
default="5\.[012]"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_UPDATES_UPDATE_TARGET_VERSION_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="string"
|
||||
|
File diff suppressed because one or more lines are too long
1
admin/sql/updates/mysql/3.2.2.sql
Normal file
1
admin/sql/updates/mysql/3.2.2.sql
Normal file
@ -0,0 +1 @@
|
||||
|
@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.10" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>20th July, 2024</creationDate>
|
||||
<creationDate>26th July, 2024</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<version>3.2.2</version>
|
||||
<version>3.2.3-alpha1</version>
|
||||
<description><![CDATA[
|
||||
<h1>Component Builder (v.3.2.2)</h1>
|
||||
<h1>Component Builder (v.3.2.3-alpha1)</h1>
|
||||
<div style="clear: both;"></div>
|
||||
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
|
||||
|
||||
|
@ -160,4 +160,22 @@
|
||||
<maintainerurl>https://dev.vdm.io</maintainerurl>
|
||||
<targetplatform name="joomla" version="3.*"/>
|
||||
</update>
|
||||
<update>
|
||||
<name>Component Builder</name>
|
||||
<description>Builds Complex Joomla Components</description>
|
||||
<element>pkg_component_builder</element>
|
||||
<type>package</type>
|
||||
<client>site</client>
|
||||
<version>3.2.3-alpha1</version>
|
||||
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.3-alpha1.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>alpha</tag>
|
||||
</tags>
|
||||
<maintainer>Llewellyn van der Merwe</maintainer>
|
||||
<maintainerurl>https://dev.vdm.io</maintainerurl>
|
||||
<targetplatform name="joomla" version="3.*"/>
|
||||
</update>
|
||||
</updates>
|
@ -106,7 +106,7 @@ final class AllowEdit implements AllowEditInterface
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode, '', null, true
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($this->category->exists("{$nameListCode}"))
|
||||
|
@ -0,0 +1,243 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Controller;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Category;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\CategoryOtherName;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowEditViewsInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Controller Allow Edit Views Class for Joomla 5
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class AllowEditViews implements AllowEditViewsInterface
|
||||
{
|
||||
/**
|
||||
* The Permission Class.
|
||||
*
|
||||
* @var Permission
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Permission $permission;
|
||||
|
||||
/**
|
||||
* The Dispenser Class.
|
||||
*
|
||||
* @var Dispenser
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Dispenser $dispenser;
|
||||
|
||||
/**
|
||||
* The Category Class.
|
||||
*
|
||||
* @var Category
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Category $category;
|
||||
|
||||
/**
|
||||
* The CategoryOtherName Class.
|
||||
*
|
||||
* @var CategoryOtherName
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected CategoryOtherName $categoryothername;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Permission $permission The Permission Class.
|
||||
* @param Dispenser $dispenser The Dispenser Class.
|
||||
* @param Category $category The Category Class.
|
||||
* @param CategoryOtherName $categoryothername The CategoryOtherName Class.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function __construct(Permission $permission,
|
||||
Dispenser $dispenser, Category $category,
|
||||
CategoryOtherName $categoryothername)
|
||||
{
|
||||
$this->permission = $permission;
|
||||
$this->dispenser = $dispenser;
|
||||
$this->category = $category;
|
||||
$this->categoryothername = $categoryothername;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Array Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The array of Code (string)
|
||||
*/
|
||||
public function getArray(array $views): string
|
||||
{
|
||||
$allow = [];
|
||||
foreach ($views as $nameSingleCode => $nameListCode)
|
||||
{
|
||||
$allow[] = $this->getViewArray($nameSingleCode, $nameListCode);
|
||||
}
|
||||
|
||||
if ($allow === [])
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return PHP_EOL . Indent::_(2) . implode("," . PHP_EOL . Indent::_(2), $allow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Custom Function Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The functions of Code (string)
|
||||
*/
|
||||
public function getFunctions(array $views): string
|
||||
{
|
||||
$allow = [];
|
||||
foreach ($views as $nameSingleCode => $nameListCode)
|
||||
{
|
||||
if (($function = $this->getViewFunction($nameSingleCode, $nameListCode)) !== null)
|
||||
{
|
||||
$allow[] = $function;
|
||||
}
|
||||
}
|
||||
|
||||
if ($allow === [])
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return PHP_EOL . PHP_EOL . implode(PHP_EOL . PHP_EOL, $allow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get View Permissions Array Code
|
||||
*
|
||||
* @param string $nameSingleCode The single code name of the view.
|
||||
* @param string $nameListCode The list code name of the view.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @return string The allow edit method code
|
||||
*/
|
||||
protected function getViewArray(string $nameSingleCode, string $nameListCode): string
|
||||
{
|
||||
$allow = [];
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($customAllow !== '')
|
||||
{
|
||||
$allow[] = Indent::_(3) . "'function' => 'allowEdit_{$nameSingleCode}'";
|
||||
}
|
||||
|
||||
if ($this->category->exists("{$nameListCode}"))
|
||||
{
|
||||
// check if category has another name
|
||||
$otherView = $this->categoryothername->
|
||||
get($nameListCode . '.view', $nameSingleCode);
|
||||
|
||||
// check if the item has permissions.
|
||||
if ($this->permission->globalExist($otherView, 'core.access'))
|
||||
{
|
||||
$access = $this->permission->getGlobal($otherView, 'core.access');
|
||||
$allow[] = Indent::_(3) . "'access' => '{$access}'";
|
||||
}
|
||||
$edit = $this->permission->getAction($otherView, 'core.edit');
|
||||
$allow[] = Indent::_(3) . "'edit' => '{$edit}'";
|
||||
|
||||
$edit_own = $this->permission->getAction($otherView, 'core.edit.own');
|
||||
$allow[] = Indent::_(3) . "'edit.own' => '{$edit_own}'";
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if the item has permissions.
|
||||
if ($this->permission->actionExist($nameSingleCode, 'core.access'))
|
||||
{
|
||||
$access = $this->permission->getAction($nameSingleCode, 'core.access');
|
||||
$allow[] = Indent::_(3) . "'access' => '{$access}'";
|
||||
}
|
||||
$edit = $this->permission->getAction($nameSingleCode, 'core.edit');
|
||||
$allow[] = Indent::_(3) . "'edit' => '{$edit}'";
|
||||
|
||||
$edit_own = $this->permission->getAction($nameSingleCode, 'core.edit.own');
|
||||
$allow[] = Indent::_(3) . "'edit.own' => '{$edit_own}'";
|
||||
}
|
||||
|
||||
return "'{$nameSingleCode}' => [" . PHP_EOL . implode(',' . PHP_EOL, $allow) . PHP_EOL . Indent::_(2) . ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get View Permissions Function Code
|
||||
*
|
||||
* @param string $nameSingleCode The single code name of the view.
|
||||
* @param string $nameListCode The list code name of the view.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @return string|null The allow edit method code
|
||||
*/
|
||||
protected function getViewFunction(string $nameSingleCode, string $nameListCode): ?string
|
||||
{
|
||||
$allow = [];
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($customAllow !== '')
|
||||
{
|
||||
// setup the function
|
||||
$allow[] = Indent::_(1) . '/**';
|
||||
$allow[] = Indent::_(1) . " * Method to check if you can edit an existing {$nameSingleCode} record.";
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @param array $data An array of input data.';
|
||||
$allow[] = Indent::_(1) . ' * @param string $key The name of the key for the primary key.';
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @return boolean';
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @since 5.0.2';
|
||||
$allow[] = Indent::_(1) . ' */';
|
||||
$allow[] = Indent::_(1) . "protected function allowEdit_{$nameSingleCode}(\$data = [], \$key = 'id')";
|
||||
$allow[] = Indent::_(1) . '{';
|
||||
$allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " get user object.";
|
||||
$allow[] = Indent::_(2) . "\$user = \$this->identity;";
|
||||
$allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " get record id.";
|
||||
$allow[] = Indent::_(2)
|
||||
. "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;";
|
||||
// load custom permission script
|
||||
$allow[] = $customAllow;
|
||||
$allow[] = Indent::_(1) . '}';
|
||||
|
||||
return implode(PHP_EOL, $allow);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ final class AllowEdit implements AllowEditInterface
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode, '', null, true
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($this->category->exists("{$nameListCode}"))
|
||||
|
@ -0,0 +1,243 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Controller;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Category;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\CategoryOtherName;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowEditViewsInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Controller Allow Edit Views Class for Joomla 4
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class AllowEditViews implements AllowEditViewsInterface
|
||||
{
|
||||
/**
|
||||
* The Permission Class.
|
||||
*
|
||||
* @var Permission
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Permission $permission;
|
||||
|
||||
/**
|
||||
* The Dispenser Class.
|
||||
*
|
||||
* @var Dispenser
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Dispenser $dispenser;
|
||||
|
||||
/**
|
||||
* The Category Class.
|
||||
*
|
||||
* @var Category
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Category $category;
|
||||
|
||||
/**
|
||||
* The CategoryOtherName Class.
|
||||
*
|
||||
* @var CategoryOtherName
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected CategoryOtherName $categoryothername;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Permission $permission The Permission Class.
|
||||
* @param Dispenser $dispenser The Dispenser Class.
|
||||
* @param Category $category The Category Class.
|
||||
* @param CategoryOtherName $categoryothername The CategoryOtherName Class.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function __construct(Permission $permission,
|
||||
Dispenser $dispenser, Category $category,
|
||||
CategoryOtherName $categoryothername)
|
||||
{
|
||||
$this->permission = $permission;
|
||||
$this->dispenser = $dispenser;
|
||||
$this->category = $category;
|
||||
$this->categoryothername = $categoryothername;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Array Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The array of Code (string)
|
||||
*/
|
||||
public function getArray(array $views): string
|
||||
{
|
||||
$allow = [];
|
||||
foreach ($views as $nameSingleCode => $nameListCode)
|
||||
{
|
||||
$allow[] = $this->getViewArray($nameSingleCode, $nameListCode);
|
||||
}
|
||||
|
||||
if ($allow === [])
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return PHP_EOL . Indent::_(2) . implode("," . PHP_EOL . Indent::_(2), $allow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Custom Function Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The functions of Code (string)
|
||||
*/
|
||||
public function getFunctions(array $views): string
|
||||
{
|
||||
$allow = [];
|
||||
foreach ($views as $nameSingleCode => $nameListCode)
|
||||
{
|
||||
if (($function = $this->getViewFunction($nameSingleCode, $nameListCode)) !== null)
|
||||
{
|
||||
$allow[] = $function;
|
||||
}
|
||||
}
|
||||
|
||||
if ($allow === [])
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return PHP_EOL . PHP_EOL . implode(PHP_EOL . PHP_EOL, $allow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get View Permissions Array Code
|
||||
*
|
||||
* @param string $nameSingleCode The single code name of the view.
|
||||
* @param string $nameListCode The list code name of the view.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @return string The allow edit method code
|
||||
*/
|
||||
protected function getViewArray(string $nameSingleCode, string $nameListCode): string
|
||||
{
|
||||
$allow = [];
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($customAllow !== '')
|
||||
{
|
||||
$allow[] = Indent::_(3) . "'function' => 'allowEdit_{$nameSingleCode}'";
|
||||
}
|
||||
|
||||
if ($this->category->exists("{$nameListCode}"))
|
||||
{
|
||||
// check if category has another name
|
||||
$otherView = $this->categoryothername->
|
||||
get($nameListCode . '.view', $nameSingleCode);
|
||||
|
||||
// check if the item has permissions.
|
||||
if ($this->permission->globalExist($otherView, 'core.access'))
|
||||
{
|
||||
$access = $this->permission->getGlobal($otherView, 'core.access');
|
||||
$allow[] = Indent::_(3) . "'access' => '{$access}'";
|
||||
}
|
||||
$edit = $this->permission->getAction($otherView, 'core.edit');
|
||||
$allow[] = Indent::_(3) . "'edit' => '{$edit}'";
|
||||
|
||||
$edit_own = $this->permission->getAction($otherView, 'core.edit.own');
|
||||
$allow[] = Indent::_(3) . "'edit.own' => '{$edit_own}'";
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if the item has permissions.
|
||||
if ($this->permission->actionExist($nameSingleCode, 'core.access'))
|
||||
{
|
||||
$access = $this->permission->getAction($nameSingleCode, 'core.access');
|
||||
$allow[] = Indent::_(3) . "'access' => '{$access}'";
|
||||
}
|
||||
$edit = $this->permission->getAction($nameSingleCode, 'core.edit');
|
||||
$allow[] = Indent::_(3) . "'edit' => '{$edit}'";
|
||||
|
||||
$edit_own = $this->permission->getAction($nameSingleCode, 'core.edit.own');
|
||||
$allow[] = Indent::_(3) . "'edit.own' => '{$edit_own}'";
|
||||
}
|
||||
|
||||
return "'{$nameSingleCode}' => [" . PHP_EOL . implode(',' . PHP_EOL, $allow) . PHP_EOL . Indent::_(2) . ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get View Permissions Function Code
|
||||
*
|
||||
* @param string $nameSingleCode The single code name of the view.
|
||||
* @param string $nameListCode The list code name of the view.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @return string|null The allow edit method code
|
||||
*/
|
||||
protected function getViewFunction(string $nameSingleCode, string $nameListCode): ?string
|
||||
{
|
||||
$allow = [];
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($customAllow !== '')
|
||||
{
|
||||
// setup the function
|
||||
$allow[] = Indent::_(1) . '/**';
|
||||
$allow[] = Indent::_(1) . " * Method to check if you can edit an existing {$nameSingleCode} record.";
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @param array $data An array of input data.';
|
||||
$allow[] = Indent::_(1) . ' * @param string $key The name of the key for the primary key.';
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @return boolean';
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @since 5.0.2';
|
||||
$allow[] = Indent::_(1) . ' */';
|
||||
$allow[] = Indent::_(1) . "protected function allowEdit_{$nameSingleCode}(\$data = [], \$key = 'id')";
|
||||
$allow[] = Indent::_(1) . '{';
|
||||
$allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " get user object.";
|
||||
$allow[] = Indent::_(2) . "\$user = \$this->identity;";
|
||||
$allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " get record id.";
|
||||
$allow[] = Indent::_(2)
|
||||
. "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;";
|
||||
// load custom permission script
|
||||
$allow[] = $customAllow;
|
||||
$allow[] = Indent::_(1) . '}';
|
||||
|
||||
return implode(PHP_EOL, $allow);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ final class AllowEdit implements AllowEditInterface
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode, '', null, true
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($this->category->exists("{$nameListCode}"))
|
||||
|
@ -0,0 +1,218 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Controller;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Category;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\CategoryOtherName;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowEditViewsInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Controller Allow Edit Views Class for Joomla 3
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class AllowEditViews implements AllowEditViewsInterface
|
||||
{
|
||||
/**
|
||||
* The Permission Class.
|
||||
*
|
||||
* @var Permission
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Permission $permission;
|
||||
|
||||
/**
|
||||
* The Dispenser Class.
|
||||
*
|
||||
* @var Dispenser
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Dispenser $dispenser;
|
||||
|
||||
/**
|
||||
* The Category Class.
|
||||
*
|
||||
* @var Category
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Category $category;
|
||||
|
||||
/**
|
||||
* The CategoryOtherName Class.
|
||||
*
|
||||
* @var CategoryOtherName
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected CategoryOtherName $categoryothername;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Permission $permission The Permission Class.
|
||||
* @param Dispenser $dispenser The Dispenser Class.
|
||||
* @param Category $category The Category Class.
|
||||
* @param CategoryOtherName $categoryothername The CategoryOtherName Class.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function __construct(Permission $permission,
|
||||
Dispenser $dispenser, Category $category,
|
||||
CategoryOtherName $categoryothername)
|
||||
{
|
||||
$this->permission = $permission;
|
||||
$this->dispenser = $dispenser;
|
||||
$this->category = $category;
|
||||
$this->categoryothername = $categoryothername;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Array Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The array of Code (string)
|
||||
*/
|
||||
public function getArray(array $views): string
|
||||
{
|
||||
return ''; // not used for now in Joomla 3
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Custom Function Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The functions of Code (string)
|
||||
*/
|
||||
public function getFunctions(array $views): string
|
||||
{
|
||||
return ''; // not used for now in Joomla 3
|
||||
}
|
||||
|
||||
/**
|
||||
* Get View Permissions Array Code
|
||||
*
|
||||
* @param string $nameSingleCode The single code name of the view.
|
||||
* @param string $nameListCode The list code name of the view.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @return string The allow edit method code
|
||||
*/
|
||||
protected function getViewArray(string $nameSingleCode, string $nameListCode): string
|
||||
{
|
||||
$allow = [];
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($customAllow !== '')
|
||||
{
|
||||
$allow[] = Indent::_(3) . "'function' => 'allowEdit_{$nameSingleCode}'";
|
||||
}
|
||||
|
||||
if ($this->category->exists("{$nameListCode}"))
|
||||
{
|
||||
// check if category has another name
|
||||
$otherView = $this->categoryothername->
|
||||
get($nameListCode . '.view', $nameSingleCode);
|
||||
|
||||
// check if the item has permissions.
|
||||
if ($this->permission->globalExist($otherView, 'core.access'))
|
||||
{
|
||||
$access = $this->permission->getGlobal($otherView, 'core.access');
|
||||
$allow[] = Indent::_(3) . "'access' => '{$access}'";
|
||||
}
|
||||
$edit = $this->permission->getAction($otherView, 'core.edit');
|
||||
$allow[] = Indent::_(3) . "'edit' => '{$edit}'";
|
||||
|
||||
$edit_own = $this->permission->getAction($otherView, 'core.edit.own');
|
||||
$allow[] = Indent::_(3) . "'edit.own' => '{$edit_own}'";
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if the item has permissions.
|
||||
if ($this->permission->actionExist($nameSingleCode, 'core.access'))
|
||||
{
|
||||
$access = $this->permission->getAction($nameSingleCode, 'core.access');
|
||||
$allow[] = Indent::_(3) . "'access' => '{$access}'";
|
||||
}
|
||||
$edit = $this->permission->getAction($nameSingleCode, 'core.edit');
|
||||
$allow[] = Indent::_(3) . "'edit' => '{$edit}'";
|
||||
|
||||
$edit_own = $this->permission->getAction($nameSingleCode, 'core.edit.own');
|
||||
$allow[] = Indent::_(3) . "'edit.own' => '{$edit_own}'";
|
||||
}
|
||||
|
||||
return "'{$nameSingleCode}' => [" . PHP_EOL . implode(',' . PHP_EOL, $allow) . PHP_EOL . Indent::_(2) . ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get View Permissions Function Code
|
||||
*
|
||||
* @param string $nameSingleCode The single code name of the view.
|
||||
* @param string $nameListCode The list code name of the view.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @return string|null The allow edit method code
|
||||
*/
|
||||
protected function getViewFunction(string $nameSingleCode, string $nameListCode): ?string
|
||||
{
|
||||
$allow = [];
|
||||
|
||||
// prepare custom permission script
|
||||
$customAllow = $this->dispenser->get(
|
||||
'php_allowedit', $nameSingleCode
|
||||
);
|
||||
|
||||
if ($customAllow !== '')
|
||||
{
|
||||
// setup the function
|
||||
$allow[] = Indent::_(1) . '/**';
|
||||
$allow[] = Indent::_(1) . " * Method to check if you can edit an existing {$nameSingleCode} record.";
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @param array $data An array of input data.';
|
||||
$allow[] = Indent::_(1) . ' * @param string $key The name of the key for the primary key.';
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @return boolean';
|
||||
$allow[] = Indent::_(1) . ' *';
|
||||
$allow[] = Indent::_(1) . ' * @since 5.0.2';
|
||||
$allow[] = Indent::_(1) . ' */';
|
||||
$allow[] = Indent::_(1) . "protected function allowEdit_{$nameSingleCode}(\$data = [], \$key = 'id')";
|
||||
$allow[] = Indent::_(1) . '{';
|
||||
$allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " get user object.";
|
||||
$allow[] = Indent::_(2) . "\$user = \$this->identity;";
|
||||
$allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " get record id.";
|
||||
$allow[] = Indent::_(2)
|
||||
. "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;";
|
||||
// load custom permission script
|
||||
$allow[] = $customAllow;
|
||||
$allow[] = Indent::_(1) . '}';
|
||||
|
||||
return implode(PHP_EOL, $allow);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -386,8 +386,7 @@ class Infusion extends Interpretation
|
||||
)
|
||||
&& $view['edit_create_site_view'] > 0)
|
||||
{
|
||||
$site_edit_view_array[] = Indent::_(4) . "'"
|
||||
. $nameSingleCode . "'";
|
||||
$site_edit_view_array[$nameSingleCode] = $nameListCode;
|
||||
CFactory::_('Config')->lang_target = 'both';
|
||||
// insure site view does not get removed
|
||||
CFactory::_('Config')->remove_site_edit_folder = false;
|
||||
@ -1501,9 +1500,19 @@ class Infusion extends Interpretation
|
||||
PHP_EOL . implode("," . PHP_EOL, $viewarray)
|
||||
);
|
||||
|
||||
// CUSTOM_ADMIN_EDIT_VIEW_ARRAY
|
||||
// SITE_EDIT_VIEW_ARRAY (Joomla3 only)
|
||||
CFactory::_('Compiler.Builder.Content.One')->set('SITE_EDIT_VIEW_ARRAY',
|
||||
PHP_EOL . implode("," . PHP_EOL, $site_edit_view_array)
|
||||
PHP_EOL . Indent::_(4) . "'" . implode("'," . PHP_EOL . Indent::_(4) . "'", array_keys($site_edit_view_array)) . "'"
|
||||
);
|
||||
|
||||
// SITE_ALLOW_EDIT_VIEWS_ARRAY
|
||||
CFactory::_('Compiler.Builder.Content.One')->set('SITE_ALLOW_EDIT_VIEWS_ARRAY',
|
||||
CFactory::_('Architecture.Controller.AllowEditViews')->getArray($site_edit_view_array)
|
||||
);
|
||||
|
||||
// SITE_ALLOW_EDIT_VIEWS_FUNCTIONS
|
||||
CFactory::_('Compiler.Builder.Content.One')->set('SITE_ALLOW_EDIT_VIEWS_FUNCTIONS',
|
||||
CFactory::_('Architecture.Controller.AllowEditViews')->getFunctions($site_edit_view_array)
|
||||
);
|
||||
|
||||
// MAINMENUS
|
||||
|
@ -13389,18 +13389,33 @@ class Interpretation extends Fields
|
||||
$tabs .= PHP_EOL . Indent::_(2)
|
||||
. '<div class="' . $row_class . '">';
|
||||
$tabs .= PHP_EOL . Indent::_(3) . '<div class="' . $width_class . '12">';
|
||||
$tabs .= PHP_EOL . Indent::_(4) . '<fieldset class="adminform">';
|
||||
$tabs .= PHP_EOL . Indent::_(5) . '<div class="adminformlist">';
|
||||
$tabs .= PHP_EOL . Indent::_(5)
|
||||
. "<?php foreach (\$this->form->getFieldset('accesscontrol') as \$field): ?>";
|
||||
$tabs .= PHP_EOL . Indent::_(6) . "<div>";
|
||||
$tabs .= PHP_EOL . Indent::_(7)
|
||||
. "<?php echo \$field->label; echo \$field->input;?>";
|
||||
$tabs .= PHP_EOL . Indent::_(6) . "</div>";
|
||||
$tabs .= PHP_EOL . Indent::_(6) . '<div class="clearfix"></div>';
|
||||
$tabs .= PHP_EOL . Indent::_(5) . "<?php endforeach; ?>";
|
||||
$tabs .= PHP_EOL . Indent::_(5) . "</div>";
|
||||
$tabs .= PHP_EOL . Indent::_(4) . "</fieldset>";
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$tabs .= PHP_EOL . Indent::_(4) . '<fieldset class="adminform">';
|
||||
$tabs .= PHP_EOL . Indent::_(5) . '<div class="adminformlist">';
|
||||
$tabs .= PHP_EOL . Indent::_(5)
|
||||
. "<?php foreach (\$this->form->getFieldset('accesscontrol') as \$field): ?>";
|
||||
$tabs .= PHP_EOL . Indent::_(6) . "<div>";
|
||||
$tabs .= PHP_EOL . Indent::_(7)
|
||||
. "<?php echo \$field->label; echo \$field->input;?>";
|
||||
$tabs .= PHP_EOL . Indent::_(6) . "</div>";
|
||||
$tabs .= PHP_EOL . Indent::_(6) . '<div class="clearfix"></div>';
|
||||
$tabs .= PHP_EOL . Indent::_(5) . "<?php endforeach; ?>";
|
||||
$tabs .= PHP_EOL . Indent::_(5) . "</div>";
|
||||
$tabs .= PHP_EOL . Indent::_(4) . "</fieldset>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$tabs .= PHP_EOL . Indent::_(4) . '<fieldset id="fieldset-rules" class="options-form">';
|
||||
$tabs .= PHP_EOL . Indent::_(5)
|
||||
. "<legend><?php echo Text:"
|
||||
. ":_('{$tabLangName}'); ?></legend>";
|
||||
$tabs .= PHP_EOL . Indent::_(5) . "<div>";
|
||||
$tabs .= PHP_EOL . Indent::_(6)
|
||||
. "<?php echo \$this->form->getInput('rules'); ?>";
|
||||
$tabs .= PHP_EOL . Indent::_(5) . "</div>";
|
||||
$tabs .= PHP_EOL . Indent::_(4) . "</fieldset>";
|
||||
}
|
||||
$tabs .= PHP_EOL . Indent::_(3) . "</div>";
|
||||
$tabs .= PHP_EOL . Indent::_(2) . "</div>";
|
||||
$tabs .= PHP_EOL . Indent::_(1)
|
||||
|
@ -0,0 +1,42 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller;
|
||||
|
||||
|
||||
/**
|
||||
* Controller Allow Edit Views Interface
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
interface AllowEditViewsInterface
|
||||
{
|
||||
/**
|
||||
* Get Array Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The array of Code (string)
|
||||
*/
|
||||
public function getArray(array $views): string;
|
||||
|
||||
/**
|
||||
* Get Custom Function Code
|
||||
*
|
||||
* @param array $views
|
||||
*
|
||||
* @since 5.0.2
|
||||
* @return string The functions of Code (string)
|
||||
*/
|
||||
public function getFunctions(array $views): string;
|
||||
}
|
||||
|
@ -367,6 +367,7 @@ final class Header implements HeaderInterface
|
||||
$headers[] = 'use Joomla\CMS\Form\FormHelper;';
|
||||
$headers[] = 'use Joomla\CMS\Session\Session;';
|
||||
$headers[] = 'use Joomla\CMS\Uri\Uri;';
|
||||
$headers[] = 'use Joomla\CMS\User\User;';
|
||||
$headers[] = 'use Joomla\CMS\Component\ComponentHelper;';
|
||||
$headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;';
|
||||
$headers[] = 'use Joomla\CMS\Layout\FileLayout;';
|
||||
@ -402,6 +403,7 @@ final class Header implements HeaderInterface
|
||||
$headers[] = 'use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;';
|
||||
$headers[] = 'use Joomla\CMS\Plugin\PluginHelper;';
|
||||
$headers[] = 'use Joomla\CMS\Toolbar\ToolbarHelper;';
|
||||
$headers[] = 'use Joomla\CMS\User\User;';
|
||||
$headers[] = 'use Joomla\CMS\Document\Document;';
|
||||
$headers[] = "use {$this->NamespacePrefix}\\Component\\{$this->ComponentNamespace}\\{$target}\\Helper\\HeaderCheck;";
|
||||
break;
|
||||
|
@ -367,6 +367,7 @@ final class Header implements HeaderInterface
|
||||
$headers[] = 'use Joomla\CMS\Form\FormHelper;';
|
||||
$headers[] = 'use Joomla\CMS\Session\Session;';
|
||||
$headers[] = 'use Joomla\CMS\Uri\Uri;';
|
||||
$headers[] = 'use Joomla\CMS\User\User;';
|
||||
$headers[] = 'use Joomla\CMS\Component\ComponentHelper;';
|
||||
$headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;';
|
||||
$headers[] = 'use Joomla\CMS\Layout\FileLayout;';
|
||||
@ -402,6 +403,7 @@ final class Header implements HeaderInterface
|
||||
$headers[] = 'use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;';
|
||||
$headers[] = 'use Joomla\CMS\Plugin\PluginHelper;';
|
||||
$headers[] = 'use Joomla\CMS\Toolbar\ToolbarHelper;';
|
||||
$headers[] = 'use Joomla\CMS\User\User;';
|
||||
$headers[] = 'use Joomla\CMS\Document\Document;';
|
||||
$headers[] = "use {$this->NamespacePrefix}\\Component\\{$this->ComponentNamespace}\\{$target}\\Helper\\HeaderCheck;";
|
||||
break;
|
||||
|
@ -22,6 +22,10 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\Allo
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Controller\AllowEdit as J5ControllerAllowEdit;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Controller\AllowEdit as J4ControllerAllowEdit;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Controller\AllowEdit as J3ControllerAllowEdit;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowEditViewsInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Controller\AllowEditViews as J5ControllerAllowEditViews;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Controller\AllowEditViews as J4ControllerAllowEditViews;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Controller\AllowEditViews as J3ControllerAllowEditViews;
|
||||
|
||||
|
||||
/**
|
||||
@ -72,6 +76,18 @@ class ArchitectureController implements ServiceProviderInterface
|
||||
|
||||
$container->alias(J3ControllerAllowEdit::class, 'Architecture.Controller.J3.AllowEdit')
|
||||
->share('Architecture.Controller.J3.AllowEdit', [$this, 'getJ3ControllerAllowEdit'], true);
|
||||
|
||||
$container->alias(AllowEditViewsInterface::class, 'Architecture.Controller.AllowEditViews')
|
||||
->share('Architecture.Controller.AllowEditViews', [$this, 'getAllowEditViews'], true);
|
||||
|
||||
$container->alias(J5ControllerAllowEditViews::class, 'Architecture.Controller.J5.AllowEditViews')
|
||||
->share('Architecture.Controller.J5.AllowEditViews', [$this, 'getJ5ControllerAllowEditViews'], true);
|
||||
|
||||
$container->alias(J4ControllerAllowEditViews::class, 'Architecture.Controller.J4.AllowEditViews')
|
||||
->share('Architecture.Controller.J4.AllowEditViews', [$this, 'getJ4ControllerAllowEditViews'], true);
|
||||
|
||||
$container->alias(J3ControllerAllowEditViews::class, 'Architecture.Controller.J3.AllowEditViews')
|
||||
->share('Architecture.Controller.J3.AllowEditViews', [$this, 'getJ3ControllerAllowEditViews'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,6 +232,78 @@ class ArchitectureController implements ServiceProviderInterface
|
||||
$container->get('Compiler.Builder.Category'),
|
||||
$container->get('Compiler.Builder.Category.Other.Name')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The AllowEditViewsInterface Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return AllowEditViewsInterface
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getAllowEditViews(Container $container): AllowEditViewsInterface
|
||||
{
|
||||
if (empty($this->targetVersion))
|
||||
{
|
||||
$this->targetVersion = $container->get('Config')->joomla_version;
|
||||
}
|
||||
|
||||
return $container->get('Architecture.Controller.J' . $this->targetVersion . '.AllowEditViews');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The AllowEditViews Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return J5ControllerAllowEdit
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getJ5ControllerAllowEditViews(Container $container): J5ControllerAllowEditViews
|
||||
{
|
||||
return new J5ControllerAllowEditViews(
|
||||
$container->get('Compiler.Creator.Permission'),
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Compiler.Builder.Category'),
|
||||
$container->get('Compiler.Builder.Category.Other.Name')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The AllowEditViews Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return J4ControllerAllowEditViews
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getJ4ControllerAllowEditViews(Container $container): J4ControllerAllowEditViews
|
||||
{
|
||||
return new J4ControllerAllowEditViews(
|
||||
$container->get('Compiler.Creator.Permission'),
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Compiler.Builder.Category'),
|
||||
$container->get('Compiler.Builder.Category.Other.Name')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The AllowEditViews Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return J3ControllerAllowEditViews
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getJ3ControllerAllowEditViews(Container $container): J3ControllerAllowEditViews
|
||||
{
|
||||
return new J3ControllerAllowEditViews(
|
||||
$container->get('Compiler.Creator.Permission'),
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Compiler.Builder.Category'),
|
||||
$container->get('Compiler.Builder.Category.Other.Name')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9985,7 +9985,7 @@ class Com_ComponentbuilderInstallerScript
|
||||
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
|
||||
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
|
||||
</a>
|
||||
<h3>Upgrade to Version 3.2.2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
|
||||
<h3>Upgrade to Version 3.2.3-alpha1 Was Successful! Let us know if anything is not working as expected.</h3></div>';
|
||||
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
|
@ -115,7 +115,7 @@ class ComponentbuilderController extends BaseController
|
||||
if (StringHelper::check($view))
|
||||
{
|
||||
$views = array(
|
||||
|
||||
''
|
||||
);
|
||||
// check if this is a edit view
|
||||
if (in_array($view,$views))
|
||||
|
Loading…
Reference in New Issue
Block a user