Release of v4.0.0-beta2
Add view list and single name fix. Add component code name fix. Add reset list of powers.
This commit is contained in:
@@ -19,6 +19,7 @@ use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -145,7 +146,7 @@ class PowersController extends AdminController
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// check if there is any selections
|
||||
if ($pks == [])
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
@@ -156,21 +157,39 @@ class PowersController extends AdminController
|
||||
return false;
|
||||
}
|
||||
|
||||
$status = 'error';
|
||||
$success = false;
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
if($user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_THIS_RESET_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
|
||||
$message .= '<p>'.Text::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
|
||||
$guids = GetHelper::vars('power', $pks, 'id', 'guid');
|
||||
|
||||
if (PowerFactory::_('Superpower')->reset($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_POWERS_HAS_FAILED') . '</p>';
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
return true;
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return false;
|
||||
return $success;
|
||||
}
|
||||
}
|
@@ -65,12 +65,17 @@ class PluginsclassmethodsField extends ListField
|
||||
}
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
$options = [];
|
||||
if ($items)
|
||||
{
|
||||
$options[] = Html::_('select.option', '', 'Select a method');
|
||||
foreach($items as $item)
|
||||
{
|
||||
if (!isset($item->visibility))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// we are using this code in more then one field JCB custom_code
|
||||
if ('method' === 'method')
|
||||
{
|
||||
@@ -80,6 +85,7 @@ class PluginsclassmethodsField extends ListField
|
||||
{
|
||||
$select = $item->visibility . ' $' . $item->method_name;
|
||||
}
|
||||
|
||||
$options[] = Html::_('select.option', $item->id, $select);
|
||||
}
|
||||
}
|
||||
|
@@ -65,12 +65,17 @@ class PluginsclasspropertiesField extends ListField
|
||||
}
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
$options = [];
|
||||
if ($items)
|
||||
{
|
||||
$options[] = Html::_('select.option', '', 'Select a property');
|
||||
foreach($items as $item)
|
||||
{
|
||||
if (!isset($item->visibility))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// we are using this code in more then one field JCB custom_code
|
||||
if ('method' === 'property')
|
||||
{
|
||||
@@ -80,6 +85,7 @@ class PluginsclasspropertiesField extends ListField
|
||||
{
|
||||
$select = $item->visibility . ' $' . $item->property_name;
|
||||
}
|
||||
|
||||
$options[] = Html::_('select.option', $item->id, $select);
|
||||
}
|
||||
}
|
||||
|
@@ -65,12 +65,17 @@ class PowersclassmethodsField extends ListField
|
||||
}
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
$options = [];
|
||||
if ($items)
|
||||
{
|
||||
$options[] = Html::_('select.option', '', 'Select a method');
|
||||
foreach($items as $item)
|
||||
{
|
||||
if (!isset($item->visibility))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// we are using this code in more then one field JCB custom_code
|
||||
if ('method' === 'method')
|
||||
{
|
||||
@@ -80,6 +85,7 @@ class PowersclassmethodsField extends ListField
|
||||
{
|
||||
$select = $item->visibility . ' $' . $item->method_name;
|
||||
}
|
||||
|
||||
$options[] = Html::_('select.option', $item->id, $select);
|
||||
}
|
||||
}
|
||||
|
@@ -65,12 +65,17 @@ class PowersclasspropertiesField extends ListField
|
||||
}
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
$options = [];
|
||||
if ($items)
|
||||
{
|
||||
$options[] = Html::_('select.option', '', 'Select a property');
|
||||
foreach($items as $item)
|
||||
{
|
||||
if (!isset($item->visibility))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// we are using this code in more then one field JCB custom_code
|
||||
if ('method' === 'property')
|
||||
{
|
||||
@@ -80,6 +85,7 @@ class PowersclasspropertiesField extends ListField
|
||||
{
|
||||
$select = $item->visibility . ' $' . $item->property_name;
|
||||
}
|
||||
|
||||
$options[] = Html::_('select.option', $item->id, $select);
|
||||
}
|
||||
}
|
||||
|
@@ -1529,6 +1529,12 @@ class Admin_viewModel extends AdminModel
|
||||
{
|
||||
$data['system_name'] = $data['name_single'];
|
||||
}
|
||||
|
||||
// validate that the list and single view name are not the same
|
||||
if ($data['name_single'] === $data['name_list'])
|
||||
{
|
||||
$data['name_list'] .= '_s';
|
||||
}
|
||||
|
||||
// Set the GUID if empty or not valid
|
||||
if (empty($data['guid']) && $data['id'] > 0)
|
||||
|
@@ -34,6 +34,7 @@ use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
use VDM\Joomla\FOF\Encrypt\AES;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\String\ComponentCodeNameHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Componentbuilder\Extrusion\Helper\Extrusion;
|
||||
|
||||
@@ -1460,6 +1461,9 @@ class Joomla_componentModel extends AdminModel
|
||||
{
|
||||
$data['system_name'] = $data['name'];
|
||||
}
|
||||
|
||||
// make sure that the component code name is safe.
|
||||
$data['name_code'] = ComponentCodeNameHelper::safe($data['name_code']);
|
||||
|
||||
// Set the GUID if empty or not valid
|
||||
if (empty($data['guid']) && $data['id'] > 0)
|
||||
|
Reference in New Issue
Block a user