Skip to content

Commit

Permalink
Merge branch '4.4-dev' into providers/plugins/system
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Apr 3, 2023
2 parents 7f61091 + 6c135dd commit 39a8361
Show file tree
Hide file tree
Showing 123 changed files with 1,610 additions and 945 deletions.
4 changes: 3 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ steps:
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
CYPRESS_VERIFY_TIMEOUT: 100000
commands:
- mv cypress.config.dist.js cypress.config.js
- npx cypress install
Expand Down Expand Up @@ -453,6 +455,6 @@ trigger:

---
kind: signature
hmac: 3457679ef0cd23bde8dd9900016aba663a279aa0c32049c8e37db56676cadd38
hmac: 7abf75de936f722f96087502541c671a0ea093bc7022efe933003353505d30be

...

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE `#__guidedtours` DROP COLUMN `asset_id` /** CAN FAIL **/;

DELETE FROM `#__assets` WHERE `name` LIKE 'com_guidedtours.tour.%';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
UPDATE `#__guidedtour_steps`
SET `target` = 'joomla-field-fancy-select .choices'
WHERE `id` = 5;

UPDATE `#__guidedtour_steps`
SET `target` = 'joomla-field-fancy-select .choices[data-type=select-multiple]'
WHERE `id` IN (26,38,78,90);

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "#__guidedtours" DROP COLUMN "asset_id" /** CAN FAIL **/;

DELETE FROM "#__assets" WHERE "name" LIKE 'com_guidedtours.tour.%';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
UPDATE "#__guidedtour_steps"
SET "target" = 'joomla-field-fancy-select .choices'
WHERE "id" = 5;

UPDATE "#__guidedtour_steps"
SET "target" = 'joomla-field-fancy-select .choices[data-type=select-multiple]'
WHERE "id" IN (26,38,78,90);
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function decodeFields($jsonString)

if (is_object($object)) {
foreach ($object as $name => $value) {
if ($subObject = json_decode($value)) {
if (!is_null($value) && $subObject = json_decode($value)) {
$object->$name = $subObject;
}
}
Expand Down
5 changes: 0 additions & 5 deletions administrator/components/com_guidedtours/access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@
<action name="core.edit.state" title="JACTION_EDITSTATE" />
<action name="core.edit.own" title="JACTION_EDITOWN" />
</section>
<section name="tour">
<action name="core.delete" title="JACTION_DELETE" />
<action name="core.edit" title="JACTION_EDIT" />
<action name="core.edit.state" title="JACTION_EDITSTATE" />
</section>
</access>
19 changes: 0 additions & 19 deletions administrator/components/com_guidedtours/forms/tour.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,4 @@
>
<option value="*">JALL</option>
</field>

<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL">
<field
name="asset_id"
type="hidden"
filter="unset"
/>

<field
name="rules"
type="rules"
label="JFIELD_RULES_LABEL"
translate_label="false"
filter="rules"
validate="rules"
component="com_guidedtours"
section="tour"
/>
</fieldset>
</form>
24 changes: 0 additions & 24 deletions administrator/components/com_guidedtours/src/Model/StepModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ protected function canDelete($record)
return false;
}

if ($record->tour_id) {
return $this->getCurrentUser()->authorise('core.delete', 'com_guidedtours.tour.' . $record->tour_id);
}

return parent::canDelete($record);
}

Expand Down Expand Up @@ -148,26 +144,6 @@ protected function prepareTable($table)
}
}

/**
* Method to test whether a record can have its state changed.
*
* @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 4.3.0
*/
protected function canEditState($record)
{
// Check for existing tour.
if (!empty($record->tour_id)) {
return $this->getCurrentUser()->authorise('core.edit.state', 'com_guidedtours.tour.' . $record->tour_id);
}

return parent::canEditState($record);
}

/**
* Method to get a table object, load it if necessary.
*
Expand Down
41 changes: 1 addition & 40 deletions administrator/components/com_guidedtours/src/Model/TourModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,45 +201,6 @@ protected function loadFormData()
return $data;
}

/**
* 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 for the component.
*
* @since 4.3.0
*/
protected function canDelete($record)
{
if (!empty($record->id)) {
return $this->getCurrentUser()->authorise('core.delete', 'com_guidedtours.tour.' . (int) $record->id);
}

return false;
}

/**
* Method to test whether a record can have its state changed.
*
* @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 4.3.0
*/
protected function canEditState($record)
{
// Check for existing tour.
if (!empty($record->id)) {
return $this->getCurrentUser()->authorise('core.edit.state', 'com_guidedtours.tour.' . (int) $record->id);
}

// Default to component settings if neither tour nor category known.
return parent::canEditState($record);
}

/**
* Method to get a single record.
*
Expand Down Expand Up @@ -356,7 +317,7 @@ public function duplicate(&$pks)
$db = $this->getDatabase();

// Access checks.
if (!$user->authorise('core.create', 'com_tours')) {
if (!$user->authorise('core.create', 'com_guidedtours')) {
throw new \Exception(Text::_('JERROR_CORE_CREATE_NOT_PERMITTED'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class StepTable extends Table
* @var boolean
* @since 4.3.0
*/
// phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore
protected $_supportNullValue = true;

/**
Expand Down
30 changes: 0 additions & 30 deletions administrator/components/com_guidedtours/src/Table/TourTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class TourTable extends Table
* @var boolean
* @since 4.3.0
*/
// phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore
protected $_supportNullValue = true;

/**
Expand All @@ -40,7 +39,6 @@ class TourTable extends Table
* @var array
* @since 4.3.0
*/
// phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore
protected $_jsonEncode = ['extensions'];

/**
Expand Down Expand Up @@ -99,32 +97,4 @@ public function store($updateNulls = true)

return parent::store($updateNulls);
}

/**
* Returns the asset name of the entry as it appears in the {@see Asset} table.
*
* @return string The asset name.
*
* @since 4.3.0
*/
// phpcs:ignore
protected function _getAssetName(): string
{
$k = $this->_tbl_key;

return 'com_guidedtours.tour.' . (int) $this->$k;
}

/**
* Method to return the title to use for the asset table.
*
* @return string The string to use as the title in the asset table.
*
* @since 4.3.0
*/
// phpcs:ignore
protected function _getAssetTitle()
{
return $this->title;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function addToolbar()

$canDo = ContentHelper::getActions('com_guidedtours');

ToolbarHelper::title(Text::_('COM_GUIDEDTOURS') . ' - ' . ($isNew ? Text::_('COM_GUIDEDTOURS_MANAGER_STEP_NEW') : Text::_('COM_GUIDEDTOURS_MANAGER_STEP_EDIT')), 'map-signs');
ToolbarHelper::title(Text::_($isNew ? 'COM_GUIDEDTOURS_MANAGER_STEP_NEW' : 'COM_GUIDEDTOURS_MANAGER_STEP_EDIT'), 'map-signs');

$toolbarButtons = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@ protected function addToolbar()
{
Factory::getApplication()->input->set('hidemainmenu', true);

$user = Factory::getUser();
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = empty($this->item->id);

$canDo = ContentHelper::getActions('com_guidedtours');

$toolbar = Toolbar::getInstance();

ToolbarHelper::title(Text::_('COM_GUIDEDTOURS') . ' - ' . ($isNew ? Text::_('COM_GUIDEDTOURS_MANAGER_TOUR_NEW') : Text::_('COM_GUIDEDTOURS_MANAGER_TOUR_EDIT')), 'map-signs');
ToolbarHelper::title(Text::_($isNew ? 'COM_GUIDEDTOURS_MANAGER_TOUR_NEW' : 'COM_GUIDEDTOURS_MANAGER_TOUR_EDIT'), 'map-signs');

$toolbarButtons = [];

Expand Down
20 changes: 12 additions & 8 deletions administrator/components/com_guidedtours/tmpl/steps/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,27 @@
$wa->useScript('table.columns')
->useScript('multiselect');

$app = Factory::getApplication();
$user = $app->getIdentity();
$user = Factory::getApplication()->getIdentity();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'a.ordering';
$section = null;
$mode = false;
$tour_id = $this->state->get('filter.tour_id');
$tourId = $this->state->get('filter.tour_id');

$canEdit = $user->authorise('core.edit', 'com_guidedtours');
$canEditOwnTour = $user->authorise('core.edit.own', 'com_guidedtours');
$canEditStateTour = $user->authorise('core.edit.state', 'com_guidedtours');
$hasCheckinPermission = $user->authorise('core.manage', 'com_checkin');

if ($saveOrder && !empty($this->items)) {
$saveOrderingUrl = 'index.php?option=com_guidedtours&task=steps.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
HTMLHelper::_('draggablelist.draggable');
}
?>

<form action="<?php echo Route::_('index.php?option=com_guidedtours&view=steps&tour_id=' . $tour_id); ?>"
<form action="<?php echo Route::_('index.php?option=com_guidedtours&view=steps&tour_id=' . $tourId); ?>"
method="post" name="adminForm" id="adminForm">
<div id="j-main-container" class="j-main-container">
<?php
Expand Down Expand Up @@ -136,9 +140,9 @@
class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true" <?php
endif; ?>>
<?php foreach ($this->items as $i => $item) :
$canEdit = $user->authorise('core.edit', 'com_guidedtours' . '.step.' . $item->id);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canChange = $user->authorise('core.edit.state', 'com_guidedtours' . '.step.' . $item->id) && $canCheckin;
$canEditOwn = $canEditOwnTour && $item->created_by == $userId;
$canCheckin = $hasCheckinPermission || $item->checked_out == $userId || is_null($item->checked_out);
$canChange = $canEditStateTour && $canCheckin;
?>

<!-- Row begins -->
Expand Down Expand Up @@ -186,7 +190,7 @@ class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="
<?php if ($item->checked_out) : ?>
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'steps.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
<?php if ($canEdit || $canEditOwn) : ?>
<a href="<?php echo Route::_('index.php?option=com_guidedtours&task=step.edit&id=' . $item->id); ?> " title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
<?php echo $this->escape($item->title); ?>
</a>
Expand Down
9 changes: 0 additions & 9 deletions administrator/components/com_guidedtours/tmpl/tour/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,6 @@
</div>
<?php echo HTMLHelper::_('uitab.endTab'); ?>

<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'permissions', Text::_('JCONFIG_PERMISSIONS_LABEL')); ?>
<div class="row">
<fieldset id="fieldset-rules" class="options-form">
<legend><?php echo Text::_('JCONFIG_PERMISSIONS_LABEL'); ?></legend>
<?php echo $this->form->getInput('rules'); ?>
</fieldset>
</div>
<?php echo HTMLHelper::_('uitab.endTab'); ?>

<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
</div>

Expand Down
13 changes: 9 additions & 4 deletions administrator/components/com_guidedtours/tmpl/tours/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
$section = null;
$mode = false;

$canEdit = $user->authorise('core.edit', 'com_guidedtours');
$canEditOwnTour = $user->authorise('core.edit.own', 'com_guidedtours');
$canEditStateTour = $user->authorise('core.edit.state', 'com_guidedtours');
$hasCheckinPermission = $user->authorise('core.manage', 'com_checkin');

if ($saveOrder && !empty($this->items)) {
$saveOrderingUrl =
'index.php?option=com_guidedtours&task=tours.saveOrderAjax&tmpl=component&'
Expand Down Expand Up @@ -148,9 +153,9 @@
class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true" <?php
endif; ?>>
<?php foreach ($this->items as $i => $item) :
$canEdit = $user->authorise('core.edit', 'com_guidedtours' . '.tour.' . $item->id);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canChange = $user->authorise('core.edit.state', 'com_guidedtours' . '.tour.' . $item->id) && $canCheckin;
$canEditOwn = $canEditOwnTour && $item->created_by == $userId;
$canCheckin = $hasCheckinPermission || $item->checked_out == $userId || is_null($item->checked_out);
$canChange = $canEditStateTour && $canCheckin;
?>

<!-- Row begins -->
Expand Down Expand Up @@ -197,7 +202,7 @@ class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="
<?php if ($item->checked_out) : ?>
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'tours.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
<?php if ($canEdit || $canEditOwn) : ?>
<a href="<?php echo Route::_('index.php?option=com_guidedtours&task=tour.edit&id=' . $item->id); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
<?php echo $this->escape($item->title); ?>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Joomla\Component\Privacy\Administrator\Export\Domain;
use Joomla\Component\Privacy\Administrator\Export\Field;
use Joomla\Component\Privacy\Administrator\Export\Item;
use Joomla\Database\DatabaseAwareTrait;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
Expand All @@ -28,11 +29,14 @@
*/
abstract class PrivacyPlugin extends CMSPlugin
{
use DatabaseAwareTrait;

/**
* Database object
*
* @var \Joomla\Database\DatabaseDriver
* @since 3.9.0
* @deprecated __DEPLOY_VERSION__ will be removed in 6.0 use $this->getDatabase() instead
*/
protected $db;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
defined('_JEXEC') or die;

/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = \Joomla\CMS\Factory\Factory::getApplication()->getDocument()->getWebAssetManager();
$wa = \Joomla\CMS\Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('core');

$title = $displayData['title'];
Expand Down

0 comments on commit 39a8361

Please sign in to comment.