Skip to content

Commit

Permalink
Merge branch '5.1-dev' into dialog-for-shortcut-plg
Browse files Browse the repository at this point in the history
  • Loading branch information
LadySolveig committed Dec 16, 2023
2 parents 7ff0791 + 4c6623e commit 4657798
Show file tree
Hide file tree
Showing 159 changed files with 2,267 additions and 2,445 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ steps:
- ./libraries/vendor/bin/phan

- name: npm
image: node:18-bullseye-slim
image: node:20-bullseye-slim
depends_on: [ phpcs ]
volumes:
- name: npm-cache
Expand Down Expand Up @@ -382,6 +382,6 @@ trigger:

---
kind: signature
hmac: 3cea0dbbf3e13e88b16369bbbbd85531791831bbc8f083fdae4928b3122fbf7c
hmac: 5814cadc441b90eec51da0aa32cd29ff1014c4d759841cc70063b5e9245d2b08

...
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Actionlogs\Administrator\Field;

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
use Joomla\Database\ParameterType;

/**
* Field to load a list of all users that have logged actions
*
* @since __DEPLOY_VERSION__
*/
class UserlogtypeField extends ListField
{
/**
* The form field type.
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $type = 'UserLogType';

/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since __DEPLOY_VERSION__
*/
public function getOptions()
{
$db = $this->getDatabase();
$user = Factory::getApplication()->getIdentity();
$query = $db->getQuery(true)
->select($db->quoteName('extensions'))
->from($db->quoteName('#__action_logs_users'))
->where($db->quoteName('user_id') . ' = :userid')
->bind(':userid', $user->id, ParameterType::INTEGER);

$extensions = $db->setQuery($query)->loadColumn();
$userExt = [];
$params = ComponentHelper::getParams('com_actionlogs');
$globalExt = $params->get('loggable_extensions', []);

if (!empty($extensions)) {
$userExt = substr($extensions[0], 2);
$userExt = substr($userExt, 0, -2);
$userExt = explode('","', $userExt);
}

$common = array_merge($globalExt, array_intersect($globalExt, $userExt));
$options = [];

foreach ($common as $extension) {
ActionlogsHelper::loadTranslationFiles($extension);
$extensionName = Text::_($extension);
$options[ApplicationHelper::stringURLSafe($extensionName) . '_' . $extension] = HTMLHelper::_('select.option', $extension, $extensionName);
}

ksort($options);

return array_merge(parent::getOptions(), array_values($options));
}
}
14 changes: 14 additions & 0 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,16 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/media/system/css/sortablelist.css',
'/media/system/css/sortablelist.min.css',
'/media/system/css/sortablelist.min.css.gz',
// From 5.0.0 to 5.1.0-alpha1
'/administrator/components/com_banners/tmpl/banners/default_batch_footer.php',
'/administrator/components/com_contact/tmpl/contacts/default_batch_footer.php',
'/administrator/components/com_fields/tmpl/fields/default_batch_footer.php',
'/administrator/components/com_fields/tmpl/groups/default_batch_footer.php',
'/administrator/components/com_menus/tmpl/items/default_batch_footer.php',
'/administrator/components/com_modules/tmpl/modules/default_batch_footer.php',
'/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_footer.php',
'/administrator/components/com_tags/tmpl/tags/default_batch_footer.php',
'/administrator/components/com_users/tmpl/users/default_batch_footer.php',
];

$folders = [
Expand Down Expand Up @@ -2488,6 +2498,10 @@ public function updateAssets($installer)
// List all components added since 4.0
$newComponents = [
// Components to be added here
'com_guidedtours',
'com_mails',
'com_scheduler',
'com_workflow',
];

foreach ($newComponents as $component) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ protected function addToolbar(): void
&& $user->authorise('core.edit.state', 'com_banners')
) {
$childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->popupType('inline')
->textHeader(Text::_('COM_BANNERS_BATCH_OPTIONS'))
->url('#joomla-dialog-batch')
->modalWidth('800px')
->modalHeight('fit-content')
->listCheck(true);
}
}
Expand Down
10 changes: 1 addition & 9 deletions administrator/components/com_banners/tmpl/banners/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,7 @@
&& $user->authorise('core.edit', 'com_banners')
&& $user->authorise('core.edit.state', 'com_banners')
) : ?>
<?php echo HTMLHelper::_(
'bootstrap.renderModal',
'collapseModal',
[
'title' => Text::_('COM_BANNERS_BATCH_OPTIONS'),
'footer' => $this->loadTemplate('batch_footer')
],
$this->loadTemplate('batch_body')
); ?>
<template id="joomla-dialog-batch"><?php echo $this->loadTemplate('batch_body'); ?></template>
<?php endif; ?>
<?php endif; ?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;

/** @var \Joomla\Component\Banners\Administrator\View\Banners\HtmlView $this */

$published = (int) $this->state->get('filter.published');
?>


<div class="p-3">
<div class="row">
<?php if (Multilanguage::isEnabled()) : ?>
Expand All @@ -45,3 +45,8 @@
<?php endif; ?>
</div>
</div>
<div class="btn-toolbar p-3">
<joomla-toolbar-button task="banner.batch" class="ms-auto">
<button type="button" class="btn btn-success"><?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?></button>
</joomla-toolbar-button>
</div>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

extract($displayData);

/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
* @var string $valueTitle
* @var array $canDo
* @var string[] $urls
* @var string[] $modalTitles
* @var string $language
*/

// Do nothing when propagate is disabled
if (empty($canDo['propagate'])) {
return;
}

// Scripts for backward compatibility
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('field.modal-fields');
$wa->addInlineScript(
'window.jSelectCategory_' . $id . ' = function (id, title, object) {
window.processModalSelect("Category", "' . $id . '", id, title, "", object);
}',
['name' => 'inline.select_category_' . $id],
['type' => 'module']
);
Text::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');

// Language propagate callback name
// Strip off language tag at the end
$tagLength = strlen($language);
$callbackFunctionStem = substr("jSelectCategory_" . $id, 0, -$tagLength);

?>

<button type="button" class="btn btn-primary" <?php echo $value ? '' : 'hidden'; ?>
title="<?php echo $this->escape(Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP')); ?>"
data-show-when-value="1"
onclick="Joomla.propagateAssociation('<?php echo $id; ?>', '<?php echo $callbackFunctionStem; ?>')">
<span class="icon-sync" aria-hidden="true"></span> <?php echo Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON'); ?>
</button>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Versioning\VersionableControllerTrait;
use Joomla\Input\Input;
use Joomla\Registry\Registry;
Expand Down Expand Up @@ -152,6 +153,15 @@ public function cancel($key = null)
$newKey = $this->option . '.edit.category.' . substr($this->extension, 4) . '.data';
$this->app->setUserState($newKey, null);

// When editing in modal then redirect to modalreturn layout
if ($result && $this->input->get('layout') === 'modal') {
$id = $this->input->get('id');
$return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id)
. '&layout=modalreturn&from-task=cancel';

$this->setRedirect(Route::_($return, false));
}

return $result;
}

Expand Down Expand Up @@ -243,5 +253,14 @@ protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
$registry = new Registry($item->metadata);
$item->metadata = (string) $registry;
}

// When editing in modal then redirect to modalreturn layout
if ($this->input->get('layout') === 'modal' && $this->task === 'save') {
$id = $item->id;
$return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id)
. '&layout=modalreturn&from-task=save';

$this->setRedirect(Route::_($return, false));
}
}
}

0 comments on commit 4657798

Please sign in to comment.