forked from joomla/Component-Builder
Linked the new plugin area to Joomla components. gh-436
This commit is contained in:
parent
fcd5846c5a
commit
a5ae94b93a
12
README.md
12
README.md
@ -12,7 +12,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 safe you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.32) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.33) 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)
|
||||
|
||||
@ -147,13 +147,13 @@ TODO
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 17th July, 2019
|
||||
+ *Version*: 2.9.32
|
||||
+ *Version*: 2.9.33
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **232852**
|
||||
+ *Field count*: **1222**
|
||||
+ *File count*: **1497**
|
||||
+ *Folder count*: **229**
|
||||
+ *Line count*: **236366**
|
||||
+ *Field count*: **1235**
|
||||
+ *File count*: **1527**
|
||||
+ *Folder count*: **233**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -12,7 +12,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 safe you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.32) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.33) 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)
|
||||
|
||||
@ -147,13 +147,13 @@ TODO
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 17th July, 2019
|
||||
+ *Version*: 2.9.32
|
||||
+ *Version*: 2.9.33
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **232852**
|
||||
+ *Field count*: **1222**
|
||||
+ *File count*: **1497**
|
||||
+ *Folder count*: **229**
|
||||
+ *Line count*: **236366**
|
||||
+ *Field count*: **1235**
|
||||
+ *File count*: **1527**
|
||||
+ *Folder count*: **233**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -191,6 +191,16 @@
|
||||
<action name="component_placeholders.edit.own" title="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_OWN" description="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_OWN_DESC" />
|
||||
<action name="component_placeholders.edit.state" title="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE" description="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE_DESC" />
|
||||
<action name="component_placeholders.version" title="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC" />
|
||||
<action name="component_plugins.access" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC" />
|
||||
<action name="component_plugins.batch" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC" />
|
||||
<action name="component_plugins.create" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC" />
|
||||
<action name="component_plugins.delete" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE_DESC" />
|
||||
<action name="component_plugins.edit" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_DESC" />
|
||||
<action name="component_plugins.edit.created_by" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY_DESC" />
|
||||
<action name="component_plugins.edit.created" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE_DESC" />
|
||||
<action name="component_plugins.edit.own" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC" />
|
||||
<action name="component_plugins.edit.state" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC" />
|
||||
<action name="component_plugins.version" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC" />
|
||||
<action name="component_site_views.access" title="COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS_DESC" />
|
||||
<action name="component_site_views.batch" title="COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE" description="COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE_DESC" />
|
||||
<action name="component_site_views.create" title="COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_CREATE" description="COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_CREATE_DESC" />
|
||||
@ -831,6 +841,17 @@
|
||||
<action name="component_placeholders.access" title="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_ACCESS" description="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_ACCESS_DESC" />
|
||||
<action name="component_placeholders.version" title="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="component_plugins">
|
||||
<action name="component_plugins.edit" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_DESC" />
|
||||
<action name="component_plugins.edit.own" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC" />
|
||||
<action name="component_plugins.edit.state" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC" />
|
||||
<action name="component_plugins.edit.created_by" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY_DESC" />
|
||||
<action name="component_plugins.edit.created" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE_DESC" />
|
||||
<action name="component_plugins.create" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC" />
|
||||
<action name="component_plugins.delete" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE_DESC" />
|
||||
<action name="component_plugins.access" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC" />
|
||||
<action name="component_plugins.version" title="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION" description="COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="snippet_type">
|
||||
<action name="snippet_type.edit" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_DESC" />
|
||||
<action name="snippet_type.edit.own" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_OWN" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_OWN_DESC" />
|
||||
|
13
admin/assets/css/component_plugins.css
Normal file
13
admin/assets/css/component_plugins.css
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
13
admin/assets/css/components_plugins.css
Normal file
13
admin/assets/css/components_plugins.css
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
@ -125,6 +125,7 @@ class ComponentbuilderController extends JControllerLegacy
|
||||
'component_dashboard' => 'components_dashboard',
|
||||
'component_files_folders' => 'components_files_folders',
|
||||
'component_placeholders' => 'components_placeholders',
|
||||
'component_plugins' => 'components_plugins',
|
||||
'snippet_type' => 'snippet_types',
|
||||
'library_config' => 'libraries_config',
|
||||
'library_files_folders_urls' => 'libraries_files_folders_urls',
|
||||
|
321
admin/controllers/component_plugins.php
Normal file
321
admin/controllers/component_plugins.php
Normal file
@ -0,0 +1,321 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Component_plugins Controller
|
||||
*/
|
||||
class ComponentbuilderControllerComponent_plugins extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Components_plugins'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Get user object.
|
||||
$user = JFactory::getUser();
|
||||
// Access check.
|
||||
$access = $user->authorise('component_plugins.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return $user->authorise('component_plugins.create', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
// get record id.
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
|
||||
|
||||
// Access check.
|
||||
$access = ($user->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $recordId) && $user->authorise('component_plugins.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('component_plugins.edit', 'com_componentbuilder.component_plugins.' . (int) $recordId);
|
||||
if (!$permission)
|
||||
{
|
||||
if ($user->authorise('component_plugins.edit.own', 'com_componentbuilder.component_plugins.' . $recordId))
|
||||
{
|
||||
// Now test the owner is the user.
|
||||
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||
if (empty($ownerId))
|
||||
{
|
||||
// Need to do a lookup from the model.
|
||||
$record = $this->getModel()->getItem($recordId);
|
||||
|
||||
if (empty($record))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$ownerId = $record->created_by;
|
||||
}
|
||||
|
||||
// If the owner matches 'me' then allow.
|
||||
if ($ownerId == $user->id)
|
||||
{
|
||||
if ($user->authorise('component_plugins.edit.own', 'com_componentbuilder'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return $user->authorise('component_plugins.edit', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Component_plugins', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_plugins' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
43
admin/controllers/components_plugins.php
Normal file
43
admin/controllers/components_plugins.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Components_plugins Controller
|
||||
*/
|
||||
class ComponentbuilderControllerComponents_plugins extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_PLUGINS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Component_plugins', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
}
|
@ -2065,6 +2065,46 @@ COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNFEATURED="%s Components P
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNFEATURED_1="%s Component Placeholders unfeatured."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNPUBLISHED="%s Components Placeholders unpublished."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNPUBLISHED_1="%s Component Placeholders unpublished."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS="Components Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS="Components Plugins Access"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC="Allows the users in this group to access access components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_OPTIONS="Batch process the selected Components Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_TIP="All changes will be applied to all selected Components Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE="Components Plugins Batch Use"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE="Components Plugins Create"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC="Allows the users in this group to create create components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE="Components Plugins Delete"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE_DESC="Allows the users in this group to delete delete components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT="Components Plugins Edit"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY="Components Plugins Edit Created By"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE="Components Plugins Edit Created Date"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_DESC="Allows the users in this group to edit the component plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN="Components Plugins Edit Own"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC="Allows the users in this group to edit edit own components plugins created by them"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE="Components Plugins Edit State"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION="Components Plugins Edit Version"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_ARCHIVED="%s Components Plugins archived."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_ARCHIVED_1="%s Component Plugins archived."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_CHECKED_IN_0="No Component Plugins successfully checked in."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_CHECKED_IN_1="%d Component Plugins successfully checked in."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_CHECKED_IN_MORE="%d Components Plugins successfully checked in."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_DELETED="%s Components Plugins deleted."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_DELETED_1="%s Component Plugins deleted."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_FEATURED="%s Components Plugins featured."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_FEATURED_1="%s Component Plugins featured."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_PUBLISHED="%s Components Plugins published."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_PUBLISHED_1="%s Component Plugins published."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_TRASHED="%s Components Plugins trashed."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_TRASHED_1="%s Component Plugins trashed."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNFEATURED="%s Components Plugins unfeatured."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNFEATURED_1="%s Component Plugins unfeatured."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNPUBLISHED="%s Components Plugins unpublished."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNPUBLISHED_1="%s Component Plugins unpublished."
|
||||
COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS="Components Site Views"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS="Components Site Views Access"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to access access components site views"
|
||||
@ -2987,6 +3027,37 @@ COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VALUE_LABEL="Set String Value"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VALUE_MESSAGE="Error! Please add some set target value here."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VERSION_DESC="A count of the number of times this Component Placeholders has been revised."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VERSION_LABEL="Revision"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS="Component Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS="Addjoomla Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_DESCRIPTION="Setup the Joomla plugins for this component."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_LABEL="Joomla Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_DESC="The user that created this Component Plugins."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_LABEL="Created By"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_DESC="The date this Component Plugins was created."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_LABEL="Created Date"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT="Editing the Component Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS="Another Component Plugins has the same alias."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ID="Id"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT="Joomla Component"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_LABEL="Component"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_BY_DESC="The last user that modified this Component Plugins."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_BY_LABEL="Modified By"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_DATE_DESC="The date this Component Plugins was modified."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_DATE_LABEL="Modified Date"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW="A New Component Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NOTE_ON_JOOMLA_PLUGINS_DESCRIPTION="Do not add the same Joomla plugins twice it will not work."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NOTE_ON_JOOMLA_PLUGINS_LABEL="Setting Joomla Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ORDERING_LABEL="Ordering"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PERMISSION="Permissions"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGIN="Plugin"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGINS="Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGIN_LABEL="Plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PUBLISHING="Publishing"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Component Plugins to customise the alias."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_STATUS="Status"
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_DESC="A count of the number of times this Component Plugins has been revised."
|
||||
COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_LABEL="Revision"
|
||||
COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS="Component Site Views"
|
||||
COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ACCESS_DESCRIPTION="Select if this view<br />should use access."
|
||||
COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ACCESS_LABEL="Add Access"
|
||||
@ -7860,6 +7931,7 @@ COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD="The component dashboard"
|
||||
COM_COMPONENTBUILDER_THE_COMPONENT_FILES_FOLDERS="The component files & folders"
|
||||
COM_COMPONENTBUILDER_THE_COMPONENT_MYSQL_TWEAKS="The component mysql tweaks"
|
||||
COM_COMPONENTBUILDER_THE_COMPONENT_PLACEHOLDERS="The component placeholders"
|
||||
COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS="The component plugins"
|
||||
COM_COMPONENTBUILDER_THE_COMPONENT_SITE_VIEWS="The component site views"
|
||||
COM_COMPONENTBUILDER_THE_COMPONENT_UPDATES="The component updates"
|
||||
COM_COMPONENTBUILDER_THE_COMPONENT_WITH_ALL_LINKED_ADMIN_VIEWS_FIELDS_LINKED_TO_ADMIN_VIEWS_CUSTOM_ADMIN_VIEWS_SITE_VIEWS_TEMPLATES_AND_LAYOUTS_WERE_CLONED_SUCCESSFUL="The Component with all linked admin views, fields linked to admin views, custom admin views, site views, templates and layouts were cloned successful!"
|
||||
|
@ -351,6 +351,26 @@ COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE="Components Placeholders
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component placeholders"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION="Components Placeholders Edit Version"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components placeholders"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS="Components Plugins Access"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC="Allows the users in this group to access access components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE="Components Plugins Batch Use"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE="Components Plugins Create"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC="Allows the users in this group to create create components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE="Components Plugins Delete"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE_DESC="Allows the users in this group to delete delete components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT="Components Plugins Edit"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY="Components Plugins Edit Created By"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE="Components Plugins Edit Created Date"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_DESC="Allows the users in this group to edit the component plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN="Components Plugins Edit Own"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC="Allows the users in this group to edit edit own components plugins created by them"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE="Components Plugins Edit State"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION="Components Plugins Edit Version"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components plugins"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS="Components Site Views Access"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to access access components site views"
|
||||
COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE="Components Site Views Batch Use"
|
||||
|
1
admin/layouts/component_plugins/index.html
Normal file
1
admin/layouts/component_plugins/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
44
admin/layouts/component_plugins/plugins_above.php
Normal file
44
admin/layouts/component_plugins/plugins_above.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'joomla_component'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
45
admin/layouts/component_plugins/plugins_fullwidth.php
Normal file
45
admin/layouts/component_plugins/plugins_fullwidth.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'note_on_joomla_plugins',
|
||||
'addjoomla_plugins'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-vertical">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
45
admin/layouts/component_plugins/publishing.php
Normal file
45
admin/layouts/component_plugins/publishing.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'created',
|
||||
'created_by',
|
||||
'modified',
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
47
admin/layouts/component_plugins/publlshing.php
Normal file
47
admin/layouts/component_plugins/publlshing.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'published',
|
||||
'ordering',
|
||||
'access',
|
||||
'version',
|
||||
'hits',
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
@ -146,7 +146,12 @@ else
|
||||
'view' => 'component_dashboard',
|
||||
'views' => 'components_dashboard',
|
||||
'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD'),
|
||||
'icon' => 'dashboard')
|
||||
'icon' => 'dashboard'),
|
||||
array(
|
||||
'view' => 'component_plugins',
|
||||
'views' => 'components_plugins',
|
||||
'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS'),
|
||||
'icon' => 'power-cord')
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
881
admin/models/component_plugins.php
Normal file
881
admin/models/component_plugins.php
Normal file
@ -0,0 +1,881 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
/**
|
||||
* Componentbuilder Component_plugins Model
|
||||
*/
|
||||
class ComponentbuilderModelComponent_plugins extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $tabLayoutFields = array(
|
||||
'plugins' => array(
|
||||
'fullwidth' => array(
|
||||
'note_on_joomla_plugins',
|
||||
'addjoomla_plugins'
|
||||
),
|
||||
'above' => array(
|
||||
'joomla_component'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_componentbuilder.component_plugins';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'component_plugins', $prefix = 'ComponentbuilderTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->addjoomla_plugins))
|
||||
{
|
||||
// Convert the addjoomla_plugins field to an array.
|
||||
$addjoomla_plugins = new Registry;
|
||||
$addjoomla_plugins->loadString($item->addjoomla_plugins);
|
||||
$item->addjoomla_plugins = $addjoomla_plugins->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_componentbuilder.component_plugins');
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_componentbuilder.component_plugins', 'component_plugins', $options);
|
||||
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
|
||||
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
|
||||
if ($jinput->get('a_id'))
|
||||
{
|
||||
$id = $jinput->get('a_id', 0, 'INT');
|
||||
}
|
||||
// The back end uses id so we use that the rest of the time and set it to 0 by default.
|
||||
else
|
||||
{
|
||||
$id = $jinput->get('id', 0, 'INT');
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Check for existing item.
|
||||
// Modify the form based on Edit State access controls.
|
||||
if ($id != 0 && (!$user->authorise('component_plugins.edit.state', 'com_componentbuilder.component_plugins.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('component_plugins.edit.state', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||
$form->setFieldAttribute('published', 'disabled', 'true');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
||||
$form->setFieldAttribute('published', 'filter', 'unset');
|
||||
}
|
||||
// If this is a new item insure the greated by is set.
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set the created_by to this user
|
||||
$form->setValue('created_by', null, $user->id);
|
||||
}
|
||||
// Modify the form based on Edit Creaded By access controls.
|
||||
if ($id != 0 && (!$user->authorise('component_plugins.edit.created_by', 'com_componentbuilder.component_plugins.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('component_plugins.edit.created_by', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('created_by', 'disabled', 'true');
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('created_by', 'readonly', 'true');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('created_by', 'filter', 'unset');
|
||||
}
|
||||
// Modify the form based on Edit Creaded Date access controls.
|
||||
if ($id != 0 && (!$user->authorise('component_plugins.edit.created', 'com_componentbuilder.component_plugins.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('component_plugins.edit.created', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('created', 'disabled', 'true');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('created', 'filter', 'unset');
|
||||
}
|
||||
// Only load these values if no id is found
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set redirected view name
|
||||
$redirectedView = $jinput->get('ref', null, 'STRING');
|
||||
// Set field name (or fall back to view name)
|
||||
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
|
||||
// Set redirected view id
|
||||
$redirectedId = $jinput->get('refid', 0, 'INT');
|
||||
// Set field id (or fall back to redirected view id)
|
||||
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
|
||||
if (0 != $redirectedValue && $redirectedField)
|
||||
{
|
||||
// Now set the local-redirected field default value
|
||||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_componentbuilder/models/forms/component_plugins.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
if (!empty($record->id))
|
||||
{
|
||||
if ($record->published != -2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('component_plugins.delete', 'com_componentbuilder.component_plugins.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('component_plugins.edit.state', 'com_componentbuilder.component_plugins.' . (int) $recordId);
|
||||
if (!$permission && !is_null($permission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return $user->authorise('component_plugins.edit.state', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
$user = JFactory::getUser();
|
||||
|
||||
return $user->authorise('component_plugins.edit', 'com_componentbuilder.component_plugins.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_plugins.edit', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__componentbuilder_component_plugins'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_plugins.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the unique fields of this table.
|
||||
*
|
||||
* @return mixed An array of field names, boolean false if none is set.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function getUniqeFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
JArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('component_plugins');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch copy items to a new category or current.
|
||||
*
|
||||
* @param integer $values The new values.
|
||||
* @param array $pks An array of row IDs.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return mixed An array of new IDs on success, boolean false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchCopy($values, $pks, $contexts)
|
||||
{
|
||||
if (empty($this->batchSet))
|
||||
{
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('component_plugins');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('component_plugins.create') && !$this->canDo->get('component_plugins.batch'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get list of uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
// remove move_copy from array
|
||||
unset($values['move_copy']);
|
||||
|
||||
// make sure published is set
|
||||
if (!isset($values['published']))
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
elseif (isset($values['published']) && !$this->canDo->get('component_plugins.edit.state'))
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
|
||||
$newIds = array();
|
||||
// Parent exists so let's proceed
|
||||
while (!empty($pks))
|
||||
{
|
||||
// Pop the first ID off the stack
|
||||
$pk = array_shift($pks);
|
||||
|
||||
$this->table->reset();
|
||||
|
||||
// only allow copy if user may edit this item.
|
||||
if (!$this->user->authorise('component_plugins.edit', $contexts[$pk]))
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check that the row actually exists
|
||||
if (!$this->table->load($pk))
|
||||
{
|
||||
if ($error = $this->table->getError())
|
||||
{
|
||||
// Fatal error
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Only for strings
|
||||
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
|
||||
{
|
||||
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component);
|
||||
}
|
||||
|
||||
// insert all set values
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
foreach ($values as $key => $value)
|
||||
{
|
||||
if (strlen($value) > 0 && isset($this->table->$key))
|
||||
{
|
||||
$this->table->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update all uniqe fields
|
||||
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
||||
{
|
||||
foreach ($uniqeFields as $uniqeField)
|
||||
{
|
||||
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the ID because we are making a copy
|
||||
$this->table->id = 0;
|
||||
|
||||
// TODO: Deal with ordering?
|
||||
// $this->table->ordering = 1;
|
||||
|
||||
// Check the row.
|
||||
if (!$this->table->check())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->type))
|
||||
{
|
||||
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$this->table->store())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the new item ID
|
||||
$newId = $this->table->get('id');
|
||||
|
||||
// Add the new ID to the array
|
||||
$newIds[$pk] = $newId;
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return $newIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch move items to a new category
|
||||
*
|
||||
* @param integer $value The new category ID.
|
||||
* @param array $pks An array of row IDs.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchMove($values, $pks, $contexts)
|
||||
{
|
||||
if (empty($this->batchSet))
|
||||
{
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('component_plugins');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('component_plugins.edit') && !$this->canDo->get('component_plugins.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure published only updates if user has the permission.
|
||||
if (isset($values['published']) && !$this->canDo->get('component_plugins.edit.state'))
|
||||
{
|
||||
unset($values['published']);
|
||||
}
|
||||
// remove move_copy from array
|
||||
unset($values['move_copy']);
|
||||
|
||||
// Parent exists so we proceed
|
||||
foreach ($pks as $pk)
|
||||
{
|
||||
if (!$this->user->authorise('component_plugins.edit', $contexts[$pk]))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that the row actually exists
|
||||
if (!$this->table->load($pk))
|
||||
{
|
||||
if ($error = $this->table->getError())
|
||||
{
|
||||
// Fatal error
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// insert all set values.
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
foreach ($values as $key => $value)
|
||||
{
|
||||
// Do special action for access.
|
||||
if ('access' === $key && strlen($value) > 0)
|
||||
{
|
||||
$this->table->$key = $value;
|
||||
}
|
||||
elseif (strlen($value) > 0 && isset($this->table->$key))
|
||||
{
|
||||
$this->table->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check the row.
|
||||
if (!$this->table->check())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->type))
|
||||
{
|
||||
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$this->table->store())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the addjoomla_plugins items to data.
|
||||
if (isset($data['addjoomla_plugins']) && is_array($data['addjoomla_plugins']))
|
||||
{
|
||||
$addjoomla_plugins = new JRegistry;
|
||||
$addjoomla_plugins->loadArray($data['addjoomla_plugins']);
|
||||
$data['addjoomla_plugins'] = (string) $addjoomla_plugins;
|
||||
}
|
||||
elseif (!isset($data['addjoomla_plugins']))
|
||||
{
|
||||
// Set the empty addjoomla_plugins to data
|
||||
$data['addjoomla_plugins'] = '';
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
||||
{
|
||||
foreach ($uniqeFields as $uniqeField)
|
||||
{
|
||||
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a uniqe value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUniqe($field,$value)
|
||||
{
|
||||
|
||||
// set field value uniqe
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = JString::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
*/
|
||||
protected function _generateNewTitle($title)
|
||||
{
|
||||
|
||||
// Alter the title
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array('title' => $title)))
|
||||
{
|
||||
$title = JString::increment($title);
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
@ -177,6 +177,9 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
'component_placeholders.create' => 'component_placeholders.create',
|
||||
'components_placeholders.access' => 'component_placeholders.access',
|
||||
'component_placeholders.access' => 'component_placeholders.access',
|
||||
'component_plugins.create' => 'component_plugins.create',
|
||||
'components_plugins.access' => 'component_plugins.access',
|
||||
'component_plugins.access' => 'component_plugins.access',
|
||||
'snippet_type.create' => 'snippet_type.create',
|
||||
'snippet_types.access' => 'snippet_type.access',
|
||||
'snippet_type.access' => 'snippet_type.access',
|
||||
|
237
admin/models/components_plugins.php
Normal file
237
admin/models/components_plugins.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Components_plugins Model
|
||||
*/
|
||||
class ComponentbuilderModelComponents_plugins extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// check in items
|
||||
$this->checkInNow();
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// set values to display correctly.
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = (JFactory::getUser()->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $item->id) && JFactory::getUser()->authorise('component_plugins.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_item table
|
||||
$query->from($db->quoteName('#__componentbuilder_component_plugins', 'a'));
|
||||
|
||||
// From the componentbuilder_joomla_component table.
|
||||
$query->select($db->quoteName('g.system_name','joomla_component_system_name'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_component', 'g') . ' ON (' . $db->quoteName('a.joomla_component') . ' = ' . $db->quoteName('g.id') . ')');
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.published = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
if ($orderCol != '')
|
||||
{
|
||||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.id');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to checkin all items left checked out longer then a set time.
|
||||
*
|
||||
* @return a bool
|
||||
*
|
||||
*/
|
||||
protected function checkInNow()
|
||||
{
|
||||
// Get set check in time
|
||||
$time = JComponentHelper::getParams('com_componentbuilder')->get('check_in');
|
||||
|
||||
if ($time)
|
||||
{
|
||||
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// reset query
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__componentbuilder_component_plugins'));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date
|
||||
$date = JFactory::getDate()->modify($time)->toSql();
|
||||
// reset query
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Fields to update.
|
||||
$fields = array(
|
||||
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
|
||||
$db->quoteName('checked_out') . '=0'
|
||||
);
|
||||
|
||||
// Conditions for which records should be updated.
|
||||
$conditions = array(
|
||||
$db->quoteName('checked_out') . '!=0',
|
||||
$db->quoteName('checked_out_time') . '<\''.$date.'\''
|
||||
);
|
||||
|
||||
// Check table
|
||||
$query->update($db->quoteName('#__componentbuilder_component_plugins'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
74
admin/models/fields/joomlaplugins.php
Normal file
74
admin/models/fields/joomlaplugins.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Joomlaplugins Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldJoomlaplugins extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The joomlaplugins field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'joomlaplugins';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Get the databse object.
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.name','b.name','c.name'),array('id','plugin_name','class_extends_name','joomla_plugin_group_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_plugin', 'a'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_class_extends', 'b') . ' ON (' . $db->quoteName('a.class_extends') . ' = ' . $db->quoteName('b.id') . ')');
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin_group', 'c') . ' ON (' . $db->quoteName('a.joomla_plugin_group') . ' = ' . $db->quoteName('c.id') . ')');
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.name ASC');
|
||||
// Implement View Level Access (if set in table)
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$columns = $db->getTableColumns('#__componentbuilder_joomla_plugin');
|
||||
if(isset($columns['access']))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
}
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select a plugin');
|
||||
foreach($items as $item)
|
||||
{
|
||||
// set a full class name
|
||||
$select = 'class Plg' . ucfirst($item->joomla_plugin_group_name) . $item->plugin_name . ' extends ' . $item->class_extends_name;
|
||||
$options[] = JHtml::_('select.option', $item->id, $select);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
11
admin/models/forms/component_plugins.js
Normal file
11
admin/models/forms/component_plugins.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
150
admin/models/forms/component_plugins.xml
Normal file
150
admin/models/forms/component_plugins.xml
Normal file
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_componentbuilder/models/rules"
|
||||
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
|
||||
>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields. -->
|
||||
<!-- Id Field. Type: Text (joomla) -->
|
||||
<field
|
||||
name="id"
|
||||
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
|
||||
readonly="true"
|
||||
/>
|
||||
<!-- Date Created Field. Type: Calendar (joomla) -->
|
||||
<field
|
||||
name="created"
|
||||
type="calendar"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_DESC"
|
||||
size="22"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
filter="user_utc"
|
||||
/>
|
||||
<!-- User Created Field. Type: User (joomla) -->
|
||||
<field
|
||||
name="created_by"
|
||||
type="user"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_DESC"
|
||||
/>
|
||||
<!-- Published Field. Type: List (joomla) -->
|
||||
<field name="published" type="list" label="JSTATUS"
|
||||
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
|
||||
filter="intval" size="1" default="1" >
|
||||
<option value="1">
|
||||
JPUBLISHED</option>
|
||||
<option value="0">
|
||||
JUNPUBLISHED</option>
|
||||
<option value="2">
|
||||
JARCHIVED</option>
|
||||
<option value="-2">
|
||||
JTRASHED</option>
|
||||
</field>
|
||||
<!-- Date Modified Field. Type: Calendar (joomla) -->
|
||||
<field name="modified" type="calendar" class="readonly"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_DATE_DESC"
|
||||
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
|
||||
<!-- User Modified Field. Type: User (joomla) -->
|
||||
<field name="modified_by" type="user"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_BY_DESC"
|
||||
class="readonly"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
type="number"
|
||||
class="inputbox validate-ordering"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ORDERING_LABEL"
|
||||
description=""
|
||||
default="0"
|
||||
size="6"
|
||||
required="false"
|
||||
/>
|
||||
<!-- Version Field. Type: Text (joomla) -->
|
||||
<field
|
||||
name="version"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_DESC"
|
||||
size="6"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Joomla_component Field. Type: Joomlacomponents. (custom) -->
|
||||
<field
|
||||
type="joomlacomponents"
|
||||
name="joomla_component"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_LABEL"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_DESCRIPTION"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default=""
|
||||
required="true"
|
||||
readonly="true"
|
||||
button="false"
|
||||
/>
|
||||
<!-- Addjoomla_plugins Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
name="addjoomla_plugins"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_DESCRIPTION"
|
||||
default=""
|
||||
icon="list"
|
||||
min="1">
|
||||
<form hidden="true" name="list_addjoomla_plugins_modal" repeat="true">
|
||||
<!-- Plugin Field. Type: Joomlaplugins. (custom) -->
|
||||
<field
|
||||
type="joomlaplugins"
|
||||
name="plugin"
|
||||
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGIN_LABEL"
|
||||
class="list_class span12"
|
||||
multiple="false"
|
||||
default="0"
|
||||
button="false"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Note_on_joomla_plugins Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_on_joomla_plugins" label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NOTE_ON_JOOMLA_PLUGINS_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NOTE_ON_JOOMLA_PLUGINS_DESCRIPTION" heading="h4" class="alert alert-info note_on_joomla_plugins" />
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
<field
|
||||
name="asset_id"
|
||||
type="hidden"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Rules Field. Type: Rules (joomla) -->
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="Permissions in relation to this component_plugins"
|
||||
translate_label="false"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
class="inputbox"
|
||||
component="com_componentbuilder"
|
||||
section="component_plugins"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
@ -1448,6 +1448,32 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_placeholders` (
|
||||
KEY `idx_joomla_component` (`joomla_component`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_plugins` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
`addjoomla_plugins` TEXT NOT NULL,
|
||||
`joomla_component` INT(11) NOT NULL DEFAULT 0,
|
||||
`params` text NOT NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`version` INT(10) unsigned NOT NULL DEFAULT 1,
|
||||
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`access` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_access` (`access`),
|
||||
KEY `idx_checkout` (`checked_out`),
|
||||
KEY `idx_createdby` (`created_by`),
|
||||
KEY `idx_modifiedby` (`modified_by`),
|
||||
KEY `idx_state` (`published`),
|
||||
KEY `idx_joomla_component` (`joomla_component`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet_type` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
|
@ -33,6 +33,7 @@ DROP TABLE IF EXISTS `#__componentbuilder_component_config`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_component_dashboard`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_component_files_folders`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_component_placeholders`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_component_plugins`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_snippet_type`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_library_config`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_library_files_folders_urls`;
|
||||
|
25
admin/sql/updates/mysql/2.9.32.sql
Normal file
25
admin/sql/updates/mysql/2.9.32.sql
Normal file
@ -0,0 +1,25 @@
|
||||
CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_plugins` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
`addjoomla_plugins` TEXT NOT NULL,
|
||||
`joomla_component` INT(11) NOT NULL DEFAULT 0,
|
||||
`params` text NOT NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`version` INT(10) unsigned NOT NULL DEFAULT 1,
|
||||
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`access` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_access` (`access`),
|
||||
KEY `idx_checkout` (`checked_out`),
|
||||
KEY `idx_createdby` (`created_by`),
|
||||
KEY `idx_modifiedby` (`modified_by`),
|
||||
KEY `idx_state` (`published`),
|
||||
KEY `idx_joomla_component` (`joomla_component`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
321
admin/tables/component_plugins.php
Normal file
321
admin/tables/component_plugins.php
Normal file
@ -0,0 +1,321 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
/**
|
||||
* Components_plugins Table class
|
||||
*/
|
||||
class ComponentbuilderTableComponent_plugins extends JTable
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__componentbuilder_component_plugins', 'id', $db);
|
||||
|
||||
// Adding History Options
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_plugins'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Component_plugins table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New component_plugins. A component_plugins created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('component_plugins', 'ComponentbuilderTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('component_plugins', 'componentbuilderTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = JString::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_componentbuilder.component_plugins.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset alread set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_componentbuilder.component_plugins.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_componentbuilder');
|
||||
|
||||
return $asset->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This view does not actually have an alias
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function generateAlias()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
25
admin/views/component_plugins/submitbutton.js
Normal file
25
admin/views/component_plugins/submitbutton.js
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == ''){
|
||||
return false;
|
||||
} else {
|
||||
var action = task.split('.');
|
||||
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
|
||||
Joomla.submitform(task, document.getElementById("adminForm"));
|
||||
return true;
|
||||
} else {
|
||||
alert(Joomla.JText._('component_plugins, some values are not acceptable.','Some values are unacceptable'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
122
admin/views/component_plugins/tmpl/edit.php
Normal file
122
admin/views/component_plugins/tmpl/edit.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// waiting spinner
|
||||
var outerDiv = jQuery('body');
|
||||
jQuery('<div id="loading"></div>')
|
||||
.css("background", "rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat")
|
||||
.css("top", outerDiv.position().top - jQuery(window).scrollTop())
|
||||
.css("left", outerDiv.position().left - jQuery(window).scrollLeft())
|
||||
.css("width", outerDiv.width())
|
||||
.css("height", outerDiv.height())
|
||||
.css("position", "fixed")
|
||||
.css("opacity", "0.80")
|
||||
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
|
||||
.css("filter", "alpha(opacity = 80)")
|
||||
.css("display", "none")
|
||||
.appendTo(outerDiv);
|
||||
jQuery('#loading').show();
|
||||
// when page is ready remove and show
|
||||
jQuery(window).load(function() {
|
||||
jQuery('#componentbuilder_loader').fadeIn('fast');
|
||||
jQuery('#loading').hide();
|
||||
});
|
||||
</script>
|
||||
<div id="componentbuilder_loader" style="display: none;">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php echo JLayoutHelper::render('component_plugins.plugins_above', $this); ?>
|
||||
<div class="form-horizontal">
|
||||
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'component_pluginsTab', array('active' => 'plugins')); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'component_pluginsTab', 'plugins', JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGINS', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
</div>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span12">
|
||||
<?php echo JLayoutHelper::render('component_plugins.plugins_fullwidth', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
|
||||
<?php $this->tab_name = 'component_pluginsTab'; ?>
|
||||
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
|
||||
|
||||
<?php if ($this->canDo->get('component_plugins.delete') || $this->canDo->get('component_plugins.edit.created_by') || $this->canDo->get('component_plugins.edit.state') || $this->canDo->get('component_plugins.edit.created')) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'component_pluginsTab', 'publishing', JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PUBLISHING', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('component_plugins.publishing', $this); ?>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('component_plugins.publlshing', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->canDo->get('core.admin')) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'component_pluginsTab', 'permissions', JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PERMISSION', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span12">
|
||||
<fieldset class="adminform">
|
||||
<div class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('accesscontrol') as $field): ?>
|
||||
<div>
|
||||
<?php echo $field->label; echo $field->input;?>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||||
|
||||
<div>
|
||||
<input type="hidden" name="task" value="component_plugins.edit" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
jQuery(document).on('subform-row-add', function(event, row){
|
||||
var group_key = jQuery(row).context.dataset.group;
|
||||
jQuery(row).find('#jform_addadmin_views__' + group_key + '__submenu').prop('checked', true);
|
||||
jQuery(row).find('#jform_addadmin_views__' + group_key + '__checkin').prop('checked', true);
|
||||
jQuery(row).find('#jform_addadmin_views__' + group_key + '__history').prop('checked', true);
|
||||
jQuery(row).find('#jform_addadmin_views__' + group_key + '__access').prop('checked', true);
|
||||
jQuery(row).find('#jform_addadmin_views__' + group_key + '__port').prop('checked', true);
|
||||
})
|
||||
});
|
||||
</script>
|
1
admin/views/component_plugins/tmpl/index.html
Normal file
1
admin/views/component_plugins/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
195
admin/views/component_plugins/view.html.php
Normal file
195
admin/views/component_plugins/view.html.php
Normal file
@ -0,0 +1,195 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Component_plugins View class
|
||||
*/
|
||||
class ComponentbuilderViewComponent_plugins extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* display method of View
|
||||
* @return void
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = JComponentHelper::getParams('com_componentbuilder');
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('component_plugins', $this->item);
|
||||
// get input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->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;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JFactory::getApplication()->input->set('hidemainmenu', true);
|
||||
$user = JFactory::getUser();
|
||||
$userId = $user->id;
|
||||
$isNew = $this->item->id == 0;
|
||||
|
||||
JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT'), 'pencil-2 article-add');
|
||||
// Built the actions for new and existing records.
|
||||
if (ComponentbuilderHelper::checkString($this->referral))
|
||||
{
|
||||
if ($this->canDo->get('component_plugins.create') && $isNew)
|
||||
{
|
||||
// We can create the record.
|
||||
JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
elseif ($this->canDo->get('component_plugins.edit'))
|
||||
{
|
||||
// We can save the record.
|
||||
JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($isNew)
|
||||
{
|
||||
// Do not creat but cancel.
|
||||
JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
// We can close it.
|
||||
JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($isNew)
|
||||
{
|
||||
// For new records, check the create permission.
|
||||
if ($this->canDo->get('component_plugins.create'))
|
||||
{
|
||||
JToolBarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY');
|
||||
JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
JToolBarHelper::custom('component_plugins.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
};
|
||||
JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->canDo->get('component_plugins.edit'))
|
||||
{
|
||||
// We can save the new record
|
||||
JToolBarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY');
|
||||
JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
|
||||
// We can save this record, but check the create permission to see
|
||||
// if we can return to make a new one.
|
||||
if ($this->canDo->get('component_plugins.create'))
|
||||
{
|
||||
JToolBarHelper::custom('component_plugins.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
}
|
||||
}
|
||||
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_plugins.version'));
|
||||
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_plugins.edit') && $canVersion)
|
||||
{
|
||||
JToolbarHelper::versions('com_componentbuilder.component_plugins', $this->item->id);
|
||||
}
|
||||
if ($this->canDo->get('component_plugins.create'))
|
||||
{
|
||||
JToolBarHelper::custom('component_plugins.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
JToolbarHelper::divider();
|
||||
// set help url for this view if found
|
||||
$help_url = ComponentbuilderHelper::getHelpUrl('component_plugins');
|
||||
if (ComponentbuilderHelper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 30)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
$isNew = ($this->item->id < 1);
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/component_plugins.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
$this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/component_plugins/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
JText::script('view not acceptable. Error');
|
||||
}
|
||||
}
|
1
admin/views/components_plugins/index.html
Normal file
1
admin/views/components_plugins/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
85
admin/views/components_plugins/tmpl/default.php
Normal file
85
admin/views/components_plugins/tmpl/default.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// load tooltip behavior
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_plugins.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'component_pluginsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.orderTable = function()
|
||||
{
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != '<?php echo $this->listOrder; ?>')
|
||||
{
|
||||
dirn = 'asc';
|
||||
}
|
||||
else
|
||||
{
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, '');
|
||||
}
|
||||
</script>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=components_plugins'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if(!empty( $this->sidebar)): ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php if (empty($this->items)): ?>
|
||||
<?php echo $this->loadTemplate('toolbar');?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php echo $this->loadTemplate('toolbar');?>
|
||||
<table class="table table-striped" id="component_pluginsList">
|
||||
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||
</table>
|
||||
<?php //Load the batch processing form. ?>
|
||||
<?php if ($this->canCreate && $this->canEdit) : ?>
|
||||
<?php echo JHtml::_(
|
||||
'bootstrap.renderModal',
|
||||
'collapseModal',
|
||||
array(
|
||||
'title' => JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_OPTIONS'),
|
||||
'footer' => $this->loadTemplate('batch_footer')
|
||||
),
|
||||
$this->loadTemplate('batch_body')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="filter_order" value="" />
|
||||
<input type="hidden" name="filter_order_Dir" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
18
admin/views/components_plugins/tmpl/default_batch_body.php
Normal file
18
admin/views/components_plugins/tmpl/default_batch_body.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
|
||||
<p><?php echo JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_TIP'); ?></p>
|
||||
<?php echo $this->batchDisplay; ?>
|
23
admin/views/components_plugins/tmpl/default_batch_footer.php
Normal file
23
admin/views/components_plugins/tmpl/default_batch_footer.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<!-- clear the batch values if cancel -->
|
||||
<button class="btn" type="button" onclick="" data-dismiss="modal">
|
||||
<?php echo JText::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<!-- post the batch values if process -->
|
||||
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('component_plugins.batch');">
|
||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
</button>
|
94
admin/views/components_plugins/tmpl/default_body.php
Normal file
94
admin/views/components_plugins/tmpl/default_body.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$edit = "index.php?option=com_componentbuilder&view=components_plugins&task=component_plugins.edit";
|
||||
|
||||
?>
|
||||
<?php foreach ($this->items as $i => $item): ?>
|
||||
<?php
|
||||
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
|
||||
$userChkOut = JFactory::getUser($item->checked_out);
|
||||
$canDo = ComponentbuilderHelper::getActions('component_plugins',$item,'components_plugins');
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="order nowrap center hidden-phone">
|
||||
<?php if ($canDo->get('component_plugins.edit.state')): ?>
|
||||
<?php
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive';
|
||||
}
|
||||
else
|
||||
{
|
||||
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
<span class="sortable-handler<?php echo $iconClass; ?>">
|
||||
<i class="icon-menu"></i>
|
||||
</span>
|
||||
<?php if ($this->saveOrder) : ?>
|
||||
<input type="text" style="display:none" name="order[]" size="5"
|
||||
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
⋮
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap center">
|
||||
<?php if ($canDo->get('component_plugins.edit')): ?>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php if ($canCheckin) : ?>
|
||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||
<?php else: ?>
|
||||
□
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
□
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap">
|
||||
<div class="name">
|
||||
<?php if ($canDo->get('component_plugins.edit')): ?>
|
||||
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->joomla_component_system_name); ?></a>
|
||||
<?php if ($item->checked_out): ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'components_plugins.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->joomla_component_system_name); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php if ($canDo->get('component_plugins.edit.state')) : ?>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php if ($canCheckin) : ?>
|
||||
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'components_plugins.', true, 'cb'); ?>
|
||||
<?php else: ?>
|
||||
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'components_plugins.', false, 'cb'); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'components_plugins.', true, 'cb'); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'components_plugins.', false, 'cb'); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap center hidden-phone">
|
||||
<?php echo $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
18
admin/views/components_plugins/tmpl/default_foot.php
Normal file
18
admin/views/components_plugins/tmpl/default_foot.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="5"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||
</tr>
|
47
admin/views/components_plugins/tmpl/default_head.php
Normal file
47
admin/views/components_plugins/tmpl/default_head.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<?php if ($this->canEdit&& $this->canState): ?>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
|
||||
</th>
|
||||
<th width="20" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th width="20" class="nowrap center hidden-phone">
|
||||
▾
|
||||
</th>
|
||||
<th width="20" class="nowrap center">
|
||||
■
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th class="nowrap" >
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_LABEL'); ?>
|
||||
</th>
|
||||
<?php if ($this->canState): ?>
|
||||
<th width="10" class="nowrap center" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_STATUS', 'published', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th width="10" class="nowrap center" >
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_STATUS'); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th width="5" class="nowrap center hidden-phone" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ID', 'id', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
45
admin/views/components_plugins/tmpl/default_toolbar.php
Normal file
45
admin/views/components_plugins/tmpl/default_toolbar.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Components_plugins'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
1
admin/views/components_plugins/tmpl/index.html
Normal file
1
admin/views/components_plugins/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
226
admin/views/components_plugins/view.html.php
Normal file
226
admin/views/components_plugins/view.html.php
Normal file
@ -0,0 +1,226 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Componentbuilder View class for the Components_plugins
|
||||
*/
|
||||
class ComponentbuilderViewComponents_plugins extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* Components_plugins view display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// Include helper submenu
|
||||
ComponentbuilderHelper::addSubmenu('components_plugins');
|
||||
}
|
||||
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->user = JFactory::getUser();
|
||||
$this->listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$this->listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$this->saveOrder = $this->listOrder == 'ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('component_plugins');
|
||||
$this->canEdit = $this->canDo->get('component_plugins.edit');
|
||||
$this->canState = $this->canDo->get('component_plugins.edit.state');
|
||||
$this->canCreate = $this->canDo->get('component_plugins.create');
|
||||
$this->canDelete = $this->canDo->get('component_plugins.delete');
|
||||
$this->canBatch = $this->canDo->get('core.batch');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
// load the batch html
|
||||
if ($this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
$this->batchDisplay = JHtmlBatch_::render();
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS'), 'joomla');
|
||||
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=components_plugins');
|
||||
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
JToolBarHelper::addNew('component_plugins.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (ComponentbuilderHelper::checkArray($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
JToolBarHelper::editList('component_plugins.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JToolBarHelper::publishList('components_plugins.publish');
|
||||
JToolBarHelper::unpublishList('components_plugins.unpublish');
|
||||
JToolBarHelper::archiveList('components_plugins.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::checkin('components_plugins.checkin');
|
||||
}
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
// set the batch button name
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
JToolbarHelper::deleteList('', 'components_plugins.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
JToolbarHelper::trash('components_plugins.trash');
|
||||
}
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ComponentbuilderHelper::getHelpUrl('components_plugins');
|
||||
if (ComponentbuilderHelper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_published',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
|
||||
);
|
||||
// only load if batch allowed
|
||||
if ($this->canBatch)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'),
|
||||
'batch[published]',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_ACCESS'),
|
||||
'filter_access',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
|
||||
);
|
||||
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'),
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/components_plugins.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 50)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array Array containing the field name to sort by as the key and display text as value
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
return array(
|
||||
'a.sorting' => JText::_('JGRID_HEADING_ORDERING'),
|
||||
'a.published' => JText::_('JSTATUS'),
|
||||
'a.id' => JText::_('JGRID_HEADING_ID')
|
||||
);
|
||||
}
|
||||
}
|
@ -135,7 +135,12 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
|
||||
'view' => 'component_dashboard',
|
||||
'views' => 'components_dashboard',
|
||||
'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD'),
|
||||
'icon' => 'dashboard')
|
||||
'icon' => 'dashboard'),
|
||||
array(
|
||||
'view' => 'component_plugins',
|
||||
'views' => 'components_plugins',
|
||||
'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS'),
|
||||
'icon' => 'power-cord')
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@ -7,9 +7,9 @@
|
||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||
<copyright>Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<version>2.9.32</version>
|
||||
<version>2.9.33</version>
|
||||
<description><![CDATA[
|
||||
<h1>Component Builder (v.2.9.32)</h1>
|
||||
<h1>Component Builder (v.2.9.33)</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.
|
||||
|
||||
|
@ -721,7 +721,7 @@
|
||||
<version>2.9.31</version>
|
||||
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.32/JCB_v2.9.32.zip</downloadurl>
|
||||
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.33/JCB_v2.9.33.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>stable</tag>
|
||||
@ -738,7 +738,24 @@
|
||||
<version>2.9.32</version>
|
||||
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.32/JCB_v2.9.32.zip</downloadurl>
|
||||
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.33/JCB_v2.9.33.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>stable</tag>
|
||||
</tags>
|
||||
<maintainer>Llewellyn van der Merwe</maintainer>
|
||||
<maintainerurl>http://www.joomlacomponentbuilder.com</maintainerurl>
|
||||
<targetplatform name="joomla" version="3.*"/>
|
||||
</update>
|
||||
<update>
|
||||
<name>Component Builder</name>
|
||||
<description>Builds Complex Joomla Components</description>
|
||||
<element>com_componentbuilder</element>
|
||||
<type>component</type>
|
||||
<version>2.9.33</version>
|
||||
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.33/JCB_v2.9.33.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>stable</tag>
|
||||
|
129
script.php
129
script.php
@ -3224,6 +3224,92 @@ class com_componentbuilderInstallerScript
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Select id from content type table
|
||||
$query->select($db->quoteName('type_id'));
|
||||
$query->from($db->quoteName('#__content_types'));
|
||||
// Where Component_plugins alias is found
|
||||
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.component_plugins') );
|
||||
$db->setQuery($query);
|
||||
// Execute query to see if alias is found
|
||||
$db->execute();
|
||||
$component_plugins_found = $db->getNumRows();
|
||||
// Now check if there were any rows
|
||||
if ($component_plugins_found)
|
||||
{
|
||||
// Since there are load the needed component_plugins type ids
|
||||
$component_plugins_ids = $db->loadColumn();
|
||||
// Remove Component_plugins from the content type table
|
||||
$component_plugins_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.component_plugins') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__content_types'));
|
||||
$query->where($component_plugins_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Component_plugins items
|
||||
$component_plugins_done = $db->execute();
|
||||
if ($component_plugins_done)
|
||||
{
|
||||
// If succesfully remove Component_plugins add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the <b>#__content_type</b> table'));
|
||||
}
|
||||
|
||||
// Remove Component_plugins items from the contentitem tag map table
|
||||
$component_plugins_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.component_plugins') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
||||
$query->where($component_plugins_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Component_plugins items
|
||||
$component_plugins_done = $db->execute();
|
||||
if ($component_plugins_done)
|
||||
{
|
||||
// If succesfully remove Component_plugins add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
||||
}
|
||||
|
||||
// Remove Component_plugins items from the ucm content table
|
||||
$component_plugins_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.component_plugins') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__ucm_content'));
|
||||
$query->where($component_plugins_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Component_plugins items
|
||||
$component_plugins_done = $db->execute();
|
||||
if ($component_plugins_done)
|
||||
{
|
||||
// If succesfully remove Component_plugins add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the <b>#__ucm_content</b> table'));
|
||||
}
|
||||
|
||||
// Make sure that all the Component_plugins items are cleared from DB
|
||||
foreach ($component_plugins_ids as $component_plugins_id)
|
||||
{
|
||||
// Remove Component_plugins items from the ucm base table
|
||||
$component_plugins_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $component_plugins_id);
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__ucm_base'));
|
||||
$query->where($component_plugins_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Component_plugins items
|
||||
$db->execute();
|
||||
|
||||
// Remove Component_plugins items from the ucm history table
|
||||
$component_plugins_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $component_plugins_id);
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__ucm_history'));
|
||||
$query->where($component_plugins_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Component_plugins items
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Select id from content type table
|
||||
@ -4549,6 +4635,18 @@ class com_componentbuilderInstallerScript
|
||||
// Set the object into the content types table.
|
||||
$component_placeholders_Inserted = $db->insertObject('#__content_types', $component_placeholders);
|
||||
|
||||
// Create the component_plugins content type object.
|
||||
$component_plugins = new stdClass();
|
||||
$component_plugins->type_title = 'Componentbuilder Component_plugins';
|
||||
$component_plugins->type_alias = 'com_componentbuilder.component_plugins';
|
||||
$component_plugins->table = '{"special": {"dbtable": "#__componentbuilder_component_plugins","key": "id","type": "Component_plugins","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
|
||||
$component_plugins->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_component","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_component":"joomla_component"}}';
|
||||
$component_plugins->router = 'ComponentbuilderHelperRoute::getComponent_pluginsRoute';
|
||||
$component_plugins->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/component_plugins.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_component"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_component","targetTable": "#__componentbuilder_joomla_component","targetColumn": "id","displayColumn": "system_name"}]}';
|
||||
|
||||
// Set the object into the content types table.
|
||||
$component_plugins_Inserted = $db->insertObject('#__content_types', $component_plugins);
|
||||
|
||||
// Create the snippet_type content type object.
|
||||
$snippet_type = new stdClass();
|
||||
$snippet_type->type_title = 'Componentbuilder Snippet_type';
|
||||
@ -5708,6 +5806,35 @@ class com_componentbuilderInstallerScript
|
||||
$component_placeholders_Inserted = $db->insertObject('#__content_types', $component_placeholders);
|
||||
}
|
||||
|
||||
// Create the component_plugins content type object.
|
||||
$component_plugins = new stdClass();
|
||||
$component_plugins->type_title = 'Componentbuilder Component_plugins';
|
||||
$component_plugins->type_alias = 'com_componentbuilder.component_plugins';
|
||||
$component_plugins->table = '{"special": {"dbtable": "#__componentbuilder_component_plugins","key": "id","type": "Component_plugins","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
|
||||
$component_plugins->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_component","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_component":"joomla_component"}}';
|
||||
$component_plugins->router = 'ComponentbuilderHelperRoute::getComponent_pluginsRoute';
|
||||
$component_plugins->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/component_plugins.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_component"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_component","targetTable": "#__componentbuilder_joomla_component","targetColumn": "id","displayColumn": "system_name"}]}';
|
||||
|
||||
// Check if component_plugins type is already in content_type DB.
|
||||
$component_plugins_id = null;
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('type_id')));
|
||||
$query->from($db->quoteName('#__content_types'));
|
||||
$query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($component_plugins->type_alias));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
// Set the object into the content types table.
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$component_plugins->type_id = $db->loadResult();
|
||||
$component_plugins_Updated = $db->updateObject('#__content_types', $component_plugins, 'type_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$component_plugins_Inserted = $db->insertObject('#__content_types', $component_plugins);
|
||||
}
|
||||
|
||||
// Create the snippet_type content type object.
|
||||
$snippet_type = new stdClass();
|
||||
$snippet_type->type_title = 'Componentbuilder Snippet_type';
|
||||
@ -6061,7 +6188,7 @@ class com_componentbuilderInstallerScript
|
||||
echo '<a target="_blank" href="http://www.joomlacomponentbuilder.com" title="Component Builder">
|
||||
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
|
||||
</a>
|
||||
<h3>Upgrade to Version 2.9.32 Was Successful! Let us know if anything is not working as expected.</h3>';
|
||||
<h3>Upgrade to Version 2.9.33 Was Successful! Let us know if anything is not working as expected.</h3>';
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user