Skip to content

Commit

Permalink
Merge branch '4.3-dev' into 4.4-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Apr 3, 2023
2 parents 229e27d + 83079a6 commit 6c135dd
Show file tree
Hide file tree
Showing 27 changed files with 172 additions and 250 deletions.

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);
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 @@ -94,14 +94,12 @@ 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::_($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 @@ -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
4 changes: 2 additions & 2 deletions administrator/language/en-GB/com_guidedtours.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COM_GUIDEDTOURS_FIELD_VALUE_INTERACTIVESTEP_TYPE_TEXT_FIELD="Text Field"
COM_GUIDEDTOURS_FIELD_VALUE_STEP_TYPE_INTERACTIVE="Interactive"
COM_GUIDEDTOURS_FIELD_VALUE_STEP_TYPE_NEXT="Next"
COM_GUIDEDTOURS_FIELD_VALUE_STEP_TYPE_REDIRECT="Redirect"
COM_GUIDEDTOURS_FILTER_SEARCH_DESC="Search in id, title and description. Prefix with ID: to search for tour ID or DESCRIPTION: to search only description text."
COM_GUIDEDTOURS_FILTER_SEARCH_DESC="Search in title. Prefix with ID: to search for a tour ID or DESCRIPTION: to search in description."
COM_GUIDEDTOURS_FILTER_SEARCH_LABEL="Search"
COM_GUIDEDTOURS_GUIDEDTOURS_TABLE_CAPTION="List of Tours"
COM_GUIDEDTOURS_MANAGER_STEP_EDIT="Guided Tours: Edit Step"
Expand All @@ -45,7 +45,7 @@ COM_GUIDEDTOURS_ORDER_TYPE_DESC="Type descending"
COM_GUIDEDTOURS_STATUS="Status"
COM_GUIDEDTOURS_STEP_DESCRIPTION_TRANSLATION="Description (%s)"
COM_GUIDEDTOURS_STEP_EDIT_STEP="Edit Step"
COM_GUIDEDTOURS_STEP_FILTER_SEARCH_DESC="Search in id, title and description. Prefix with ID: to search for step ID or DESCRIPTION: to search only description text."
COM_GUIDEDTOURS_STEP_FILTER_SEARCH_DESC="Search in title. Prefix with ID: to search for a step ID or DESCRIPTION: to search in description."
COM_GUIDEDTOURS_STEP_FILTER_SEARCH_LABEL="Search"
COM_GUIDEDTOURS_STEP_ID="ID"
COM_GUIDEDTOURS_STEP_NEW_STEP="New Step"
Expand Down
Loading

0 comments on commit 6c135dd

Please sign in to comment.