Skip to content

Commit

Permalink
Merge remote-tracking branch 'Joomla/4.4-dev' into 5.0/upmerge-2023-1…
Browse files Browse the repository at this point in the history
…1-17
  • Loading branch information
bembelimen committed Nov 18, 2023
2 parents 153193e + 0b61376 commit 3ea2ede
Show file tree
Hide file tree
Showing 24 changed files with 181 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected function addToolbar()

$childBar = $dropdown->getChildToolbar();

if (\count($this->transitions)) {
if ($canDo->get('core.execute.transition') && \count($this->transitions)) {
$childBar->separatorButton('transition-headline')
->text('COM_CONTENT_RUN_TRANSITIONS')
->buttonClass('text-center py-2 h3');
Expand Down
48 changes: 28 additions & 20 deletions administrator/components/com_content/tmpl/articles/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,39 @@
endif; ?>>
<?php foreach ($this->items as $i => $item) :
$item->max_ordering = 0;
$canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId;
$canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin;
$canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid);
$canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId;
$canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id);
$canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId;
$canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId;
$canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin;
$canExecuteTransition = $user->authorise('core.execute.transition', 'com_content.article.' . $item->id);
$canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid);
$canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId;
$canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id);
$canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId;

$transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id);
// Transition button options
$options = [
'title' => Text::_($item->stage_title),
'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)),
'id' => 'workflow-' . $item->id,
'task' => 'articles.runTransition',
'disabled' => !$canExecuteTransition,
];

$transition_ids = ArrayHelper::getColumn($transitions, 'value');
$transition_ids = ArrayHelper::toInteger($transition_ids);
if ($canExecuteTransition) {
$transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id);

$transition_ids = ArrayHelper::getColumn($transitions, 'value');
$transition_ids = ArrayHelper::toInteger($transition_ids);

$dataTransitionsAttribute = 'data-transitions="' . implode(',', $transition_ids) . '"';

$options = array_merge($options, ['transitions' => $transitions]);
}

?>
<tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->catid; ?>"
data-transitions="<?php echo implode(',', $transition_ids); ?>"
<?php echo $dataTransitionsAttribute ?? '' ?>
>
<td class="text-center">
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
Expand All @@ -192,14 +208,6 @@
<?php if ($workflow_enabled) : ?>
<td class="article-stage text-center">
<?php
$options = [
'transitions' => $transitions,
'title' => Text::_($item->stage_title),
'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)),
'id' => 'workflow-' . $item->id,
'task' => 'articles.runTransition'
];

echo (new TransitionButton($options))
->render(0, $i);
?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function update()
$redirect_url = $app->getUserState('com_installer.redirect_url');

// Don't redirect to an external URL.
if (!Uri::isInternal($redirect_url)) {
if ($redirect_url && !Uri::isInternal($redirect_url)) {
$redirect_url = '';
}

Expand Down
2 changes: 1 addition & 1 deletion build/build-modules-js/compilecss.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports.stylesheets = async (options, path) => {
} else {
// eslint-disable-next-line no-console
console.error(`Unknown path ${path}`);
process.exit(1);
process.exitCode = 1;
}
} else {
folders = [
Expand Down
2 changes: 1 addition & 1 deletion build/build-modules-js/compilejs.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports.scripts = async (options, path) => {
} else {
// eslint-disable-next-line no-console
console.error(`Unknown path ${path}`);
process.exit(1);
process.exitCode = 1;
}
} else {
folders = [
Expand Down
4 changes: 2 additions & 2 deletions build/build-modules-js/error-pages.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports.createErrorPages = async (options) => {
await Promise.all(iniFilesProcess).catch((err) => {
// eslint-disable-next-line no-console
console.error(err);
process.exit(-1);
process.exitCode = -1;
});

const processPage = async (name) => {
Expand Down Expand Up @@ -161,6 +161,6 @@ module.exports.createErrorPages = async (options) => {
return Promise.all(processPages).catch((err) => {
// eslint-disable-next-line no-console
console.error(err);
process.exit(-1);
process.exitCode = -1;
});
};
2 changes: 1 addition & 1 deletion build/build-modules-js/init/cleanup-media.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ module.exports.cleanVendors = async () => {
} else {
// eslint-disable-next-line no-console
console.error('You need to run `npm install` AFTER the command `composer install`!!!. The debug plugin HASN\'T installed all its front end assets');
process.exit(1);
process.exitCode = 1;
}
};
4 changes: 2 additions & 2 deletions build/build-modules-js/javascript/build-bootstrap-js.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module.exports.bootstrapJs = async () => {
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
process.exit(1);
process.exitCode = 1;
}

(await readdir(outputFolder)).forEach((file) => {
Expand All @@ -106,6 +106,6 @@ module.exports.bootstrapJs = async () => {
return Promise.all(tasks).catch((er) => {
// eslint-disable-next-line no-console
console.log(er);
process.exit(1);
process.exitCode = 1;
});
};
2 changes: 1 addition & 1 deletion build/build-modules-js/stylesheets/handle-scss.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports.handleScssFile = async (file) => {
} catch (error) {
// eslint-disable-next-line no-console
console.error(error.formatted);
process.exit(1);
process.exitCode = 1;
}

let contents = LightningCSS.transform({
Expand Down
2 changes: 1 addition & 1 deletion build/build-modules-js/stylesheets/scss-transform.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports.compile = async (file) => {
} catch (error) {
// eslint-disable-next-line no-console
console.error(error.formatted);
process.exit(1);
process.exitCode = 1;
}

// Auto prefixing
Expand Down
6 changes: 1 addition & 5 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const settings = require('./build-modules-js/settings.json');

const handleError = (err, terminateCode) => {
console.error(err); // eslint-disable-line no-console
process.exit(terminateCode);
process.exitCode = terminateCode;
};

if (semver.gte(semver.minVersion(options.engines.node), semver.clean(process.version))) {
Expand Down Expand Up @@ -100,9 +100,6 @@ if (cliOptions.copyAssets) {
.then(() => localisePackages(options))
.then(() => patchPackages(options))
.then(() => minifyVendor())
.then(() => {
process.exit(0);
})
.catch((error) => handleError(error, 1));
}

Expand Down Expand Up @@ -183,6 +180,5 @@ if (cliOptions.prepare) {
.then(() => bootstrapJs())
.then(() => compileCodemirror())
.then(() => bench.stop('Build'))
.then(() => { process.exit(0); })
.catch((err) => handleError(err, -1));
}
1 change: 1 addition & 0 deletions build/development.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NODE_ENV=DEVELOPMENT
2 changes: 1 addition & 1 deletion build/media_source/system/joomla.asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
],
"uri": "system/multiselect.min.js",
"attributes": {
"defer": true
"type": "module"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem
if (this.isDisconnected) {
// Re init previous instance
this.choicesInstance.init();
this.choicesInstance.setChoiceByValue(this.disconnectValues);
this.isDisconnected = false;
}
return;
Expand Down Expand Up @@ -275,6 +276,8 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem
disconnectedCallback() {
// Destroy Choices instance, to unbind event listeners
if (this.choicesInstance) {
// Keep selected values, because choices will reset them on re-init
this.disconnectValues = this.choicesInstance.getValue(true);
this.choicesInstance.destroy();
this.isDisconnected = true;
}
Expand Down
Loading

0 comments on commit 3ea2ede

Please sign in to comment.