Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1702,14 +1702,17 @@ public function getFont()
$explodeArray = explode('/', $relPath);
$fileName = end($explodeArray);
$path = $this->getBasePath() . base64_decode($app->getInput()->get('file'));
$isModern = $template->xmldata->inheritable || !empty($template->xmldata->parent);

if (stristr($client->path, 'administrator') === false) {
$folder = '/templates/';
$folder = $isModern ? '/media/templates/site/' : '/templates/';
} else {
$folder = '/administrator/templates/';
$folder = $isModern ? '/media/templates/administrator/' : '/administrator/templates/';
}

$uri = Uri::root(true) . $folder . $template->element;
$uri = $isModern
? (str_replace('/administrator/', '/', Uri::root(true))) . $folder . $template->element
: Uri::root(true) . $folder . $template->element;

if (file_exists(Path::clean($path))) {
$font['address'] = $uri . $relPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null,

// If extension is not set try to get it from input or throw an exception
if (empty($this->extension)) {
$extension = $this->input->getCmd('extension');
$extension = $this->input->getCmd('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null,

// If extension is not set try to get it from input or throw an exception
if (empty($this->extension)) {
$extension = $this->input->getCmd('extension');
$extension = $this->input->getCmd('extension', '');

$parts = explode('.', $extension);

Expand Down Expand Up @@ -154,7 +154,6 @@ protected function allowEdit($data = [], $key = 'id')
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$append = parent::getRedirectToItemAppend($recordId);

$append .= '&workflow_id=' . $this->workflowId . '&extension=' . $this->extension . ($this->section ? '.' . $this->section : '');

return $append;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function __construct(array $config = [], ?MVCFactoryInterface $factory =

// If extension is not set try to get it from input or throw an exception
if (empty($this->extension)) {
$extension = $this->input->getCmd('extension');
$extension = $this->input->getCmd('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null,

// If extension is not set try to get it from input or throw an exception
if (empty($this->extension)) {
$extension = $this->input->getCmd('extension');
$extension = $this->input->getCmd('extension', '');

$parts = explode('.', $extension);

Expand Down Expand Up @@ -156,7 +156,7 @@ protected function allowEdit($data = [], $key = 'id')
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$append = parent::getRedirectToItemAppend($recordId);
$append .= '&workflow_id=' . $this->workflowId . '&extension=' . $this->extension;
$append .= '&workflow_id=' . $this->workflowId . '&extension=' . $this->extension . ($this->section ? '.' . $this->section : '');

return $append;
}
Expand All @@ -171,7 +171,7 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
protected function getRedirectToListAppend()
{
$append = parent::getRedirectToListAppend();
$append .= '&workflow_id=' . $this->workflowId . '&extension=' . $this->extension;
$append .= '&workflow_id=' . $this->workflowId . '&extension=' . $this->extension . ($this->section ? '.' . $this->section : '');

return $append;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null,

// If extension is not set try to get it from input or throw an exception
if (empty($this->extension)) {
$extension = $this->input->getCmd('extension');
$extension = $this->input->getCmd('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null,

// If extension is not set try to get it from input or throw an exception
if (empty($this->extension)) {
$extension = $this->input->getCmd('extension');
$extension = $this->input->getCmd('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null,

// If extension is not set try to get it from input or throw an exception
if (empty($this->extension)) {
$extension = $this->input->getCmd('extension');
$extension = $this->input->getCmd('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class Dispatcher extends ComponentDispatcher
*/
protected function checkAccess()
{
$extension = $this->getApplication()->getInput()->getCmd('extension');

$parts = explode('.', $extension);
$extension = $this->getApplication()->getInput()->getCmd('extension', '');
$parts = explode('.', $extension);

// Check the user has permission to access this component if in the backend
if ($this->app->isClient('administrator') && !$this->app->getIdentity()->authorise('core.manage.workflow', $parts[0])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public function publish(&$pks, $value = 1)
*/
protected function preprocessForm(Form $form, $data, $group = 'content')
{
$extension = Factory::getApplication()->getInput()->get('extension');
$extension = Factory::getApplication()->getInput()->get('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function getWorkflow()
*/
protected function preprocessForm(Form $form, $data, $group = 'content')
{
$extension = Factory::getApplication()->getInput()->get('extension');
$extension = Factory::getApplication()->getInput()->get('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected function loadFormData()
*/
protected function preprocessForm(Form $form, $data, $group = 'content')
{
$extension = Factory::getApplication()->getInput()->get('extension');
$extension = Factory::getApplication()->getInput()->get('extension', '');

$parts = explode('.', $extension);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ public function __construct(DatabaseInterface $db, ?DispatcherInterface $dispatc
parent::__construct('#__workflow_transitions', 'id', $db, $dispatcher);
}

/**
* Overloaded check function
*
* @return boolean True on success
*
* @see Table::check()
* @since __DEPLOY_VERSION__
*/
public function check(): bool
{
$return = parent::check();

if ($return) {
if (empty($this->options)) {
$this->options = '{}';
}
}

return $return;
}

/**
* Method to bind an associative array or object to the Table instance.
* This method only binds properties that are publicly accessible and optionally
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_workflow/tmpl/stage/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>

<?php // Add the translation of the workflow item title when client is administrator ?>
<?php // Add the translation of the stage item title when client is administrator ?>
<?php if ($clientId === 0 && $this->item->id != 0) : ?>
<div class="row title-alias form-vertical mb-3">
<div class="col-12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table">
<table class="table" id="stageList">
<caption class="visually-hidden">
<?php echo Text::_('COM_WORKFLOW_STAGES_TABLE_CAPTION'); ?>,
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
Expand Down
23 changes: 20 additions & 3 deletions administrator/components/com_workflow/tmpl/transition/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,31 @@
$this->useCoreUI = true;

// In case of modal
$isModal = $this->input->get('layout') === 'modal';
$layout = $isModal ? 'modal' : 'edit';
$tmpl = $isModal || $this->input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
$isModal = $this->input->get('layout') === 'modal';
$layout = $isModal ? 'modal' : 'edit';
$tmpl = $isModal || $this->input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
$clientId = $this->state->get('item.client_id', 0);
$lang = $this->getLanguage()->getTag();

?>

<form action="<?php echo Route::_('index.php?option=com_workflow&view=transition&workflow_id=' . $this->workflowID . '&extension=' . $this->input->getCmd('extension') . '&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="workflow-form" aria-label="<?php echo Text::_('COM_WORKFLOW_TRANSITION_FORM_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>" class="form-validate">
<?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
<?php // Add the translation of the transition item title when client is administrator ?>
<?php if ($clientId === 0 && $this->item->id != 0) : ?>
<div class="row title-alias form-vertical mb-3">
<div class="col-12">
<div class="control-group">
<div class="control-label">
<label for="transition_title_translation"><?php echo Text::sprintf('COM_WORKFLOW_TITLE_TRANSLATION', $lang); ?></label>
</div>
<div class="controls">
<input id="transition_title_translation" class="form-control" value="<?php echo Text::_($this->item->title); ?>" readonly="readonly" type="text">
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="main-card">
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'details', 'recall' => true, 'breakpoint' => 768]); ?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table">
<table class="table" id="transitionList">
<caption class="visually-hidden">
<?php echo Text::_('COM_WORKFLOW_TRANSITIONS_TABLE_CAPTION'); ?>,
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table">
<table class="table" id="workflowList">
<caption class="visually-hidden">
<?php echo Text::_('COM_WORKFLOW_WORKFLOWS_TABLE_CAPTION'); ?>,
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
Expand Down
5 changes: 5 additions & 0 deletions api/components/com_users/src/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\ApiController;
use Joomla\CMS\User\UserHelper;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
use Tobscure\JsonApi\Exception\InvalidParameterException;

Expand Down Expand Up @@ -70,6 +71,10 @@ protected function preprocessSaveData(array $data): array
if (!\array_key_exists('password', $body)) {
unset($data['password']);
}

if (!isset($data['groups'])) {
$data['groups'] = UserHelper::getUserGroups($data['id']);
}
}

if ($this->input->getMethod() === 'POST') {
Expand Down
3 changes: 3 additions & 0 deletions tests/System/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ The following commands are available and are served by the file [tests/System/su
- **db_createUser** – Creates a user entry and returns the id
- **db_createUserGroup** – Creates a user group and returns the id
- **db_createUserLevel** – Creates a user access level and returns the id
- **db_createWorkflow** – Creates a workflow and returns the inserted record
- **db_createWorkflowStage** – Creates a workflow stage and returns the inserted record
- **db_createWorkflowTransition** – Creates a workflow transition and returns the inserted record
- **db_enableExtension** – Sets the enabled status for the given extension
- **db_getUserId** – Returns the id of the currently logged in user
- **db_updateExtensionParameter** – Sets the parameter for the given extension
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
describe('Test in backend that the content component', () => {
beforeEach(() => cy.doAdministratorLogin());
afterEach(() => {
cy.task('queryDB', "DELETE FROM #__content_frontpage WHERE content_id IN (SELECT id FROM #__content WHERE title = 'Test article')");
cy.task('queryDB', "DELETE FROM #__workflow_associations WHERE item_id IN (SELECT id FROM #__content WHERE title = 'Test article') AND extension = 'com_content.article'");
cy.task('queryDB', "DELETE FROM #__content WHERE title = 'Test article'");
});
after(() => cy.db_updateExtensionParameter('workflow_enabled', '0', 'com_content'));

it('can enable workflow integration', () => {
cy.visit('/administrator/index.php?option=com_config&view=component&component=com_content');
cy.get('#configTabs div[role="tablist"] button[aria-controls="integration"]').click();
cy.get('#jform_workflow_enabled1').check();
cy.intercept('index.php?option=com_config*').as('config_save');
cy.clickToolbarButton('Save');
cy.wait('@config_save');
cy.checkForSystemMessage('Configuration saved.');
});

it('can run transition (unpublish)', () => {
cy.db_createArticle({ title: 'Test article', state: 1 }).then(() => {
cy.visit('/administrator/index.php?option=com_content&view=articles&filter[search]=Test%20article');
cy.checkAllResults();
cy.get('#toolbar-status-group').click().within(() => {
cy.get('joomla-toolbar-button').contains('Unpublish').click();
});
cy.checkForSystemMessage('New state saved.');
cy.get('#articleList tbody td.article-status span.icon-unpublish').should('exist');
});
});

it('can run transition (publish)', () => {
cy.db_createArticle({ title: 'Test article', state: 0 }).then(() => {
cy.visit('/administrator/index.php?option=com_content&view=articles&filter[search]=Test%20article');
cy.get('#cb0').check();
cy.get('#toolbar-status-group').click().within(() => {
cy.get('joomla-toolbar-button').contains('Publish').click();
});
cy.checkForSystemMessage('New state saved.');
cy.get('#articleList tbody td.article-status span.icon-publish').should('exist');
});
});

it('can run transition (trash)', () => {
cy.db_createArticle({ title: 'Test article', state: 0 }).then(() => {
cy.visit('/administrator/index.php?option=com_content&view=articles&filter[search]=Test%20article&filter[published]=*');
cy.get('#cb0').check();
cy.get('#toolbar-status-group').click().within(() => {
cy.get('joomla-toolbar-button').contains('Trash').click();
});
cy.checkForSystemMessage('New state saved.');
cy.get('#articleList tbody td.article-status span.icon-trash').should('exist');
});
});

it('can run transition (archive)', () => {
cy.db_createArticle({ title: 'Test article', state: 1 }).then(() => {
cy.visit('/administrator/index.php?option=com_content&view=articles&filter[search]=Test%20article&filter[published]=*');
cy.get('#articleList thead th').contains('Stage');
cy.get('#articleList tbody td.article-status span.icon-publish').should('exist');
cy.get('td.article-stage button').click();
cy.get('td.article-stage select').select('Archive');
cy.checkForSystemMessage('New state saved.');
cy.get('#articleList tbody td.article-status span.icon-archive').should('exist');
});
});

it('can run transition (feature)', () => {
cy.db_createArticle({ title: 'Test article', state: 1 }).then(() => {
cy.visit('/administrator/index.php?option=com_content&view=articles&filter[search]=Test%20article');
cy.get('#articleList thead th').contains('Stage');
cy.get('#articleList tbody td span.icon-unfeatured').should('exist');
cy.get('td.article-stage button').click();
cy.get('td.article-stage select').select('Feature');
cy.checkForSystemMessage('New state saved.');
cy.get('#articleList tbody td span.icon-color-featured.icon-star').should('exist');
});
});

it('can run transition (publish & feature)', () => {
cy.db_createArticle({ title: 'Test article', state: 0 }).then(() => {
cy.visit('/administrator/index.php?option=com_content&view=articles&filter[search]=Test%20article');
cy.get('#articleList thead th').contains('Stage');
cy.get('#articleList tbody td.article-status span.icon-unpublish').should('exist');
cy.get('#articleList tbody td span.icon-unfeatured').should('exist');
cy.get('td.article-stage button').click();
cy.get('td.article-stage select').select('Publish & Feature');
cy.checkForSystemMessage('New state saved.');
cy.get('#articleList tbody td.article-status span.icon-publish').should('exist');
cy.get('#articleList tbody td span.icon-color-featured.icon-star').should('exist');
});
});

it('can create new article and run transitions', () => {
cy.visit('/administrator/index.php?option=com_content&view=articles&filter=');
cy.clickToolbarButton('New');
cy.get('#jform_title').type('Test article');
cy.get('#jform_state-lbl').contains('Unpublished');
cy.get('#jform_transition').select('Publish');
cy.clickToolbarButton('Save');

cy.checkForSystemMessage('Article saved.');
cy.get('#jform_state-lbl').contains('Published');
cy.get('#jform_featured-lbl').contains('No');
cy.get('#jform_transition').select('Feature');
cy.clickToolbarButton('Save');

cy.checkForSystemMessage('Article saved.');
cy.get('#jform_state-lbl').contains('Published');
cy.get('#jform_featured-lbl').contains('Yes');
});
});
Loading