Skip to content

Commit

Permalink
Merge branch '4.0-dev' into path1
Browse files Browse the repository at this point in the history
  • Loading branch information
amitranjan2 committed Feb 6, 2019
2 parents 9b04afb + 50ed6e9 commit 3bec43e
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 245 deletions.
14 changes: 2 additions & 12 deletions administrator/components/com_content/Model/ArticleModel.php
Expand Up @@ -137,9 +137,6 @@ protected function batchCopy($value, $pks, $contexts)
// Reset hits because we are making a copy
$this->table->hits = 0;

// Unpublish because we are making a copy
$this->table->state = 0;

// New category ID
$this->table->catid = $categoryId;

Expand Down Expand Up @@ -429,12 +426,12 @@ protected function canEditState($record)
protected function prepareTable($table)
{
// Set the publish date to now
if ($table->state == 1 && (int) $table->publish_up == 0)
if ($table->state == Workflow::CONDITION_PUBLISHED && (int) $table->publish_up == 0)
{
$table->publish_up = Factory::getDate()->toSql();
}

if ($table->state == 1 && intval($table->publish_down) == 0)
if ($table->state == Workflow::CONDITION_PUBLISHED && intval($table->publish_down) == 0)
{
$table->publish_down = $this->getDbo()->getNullDate();
}
Expand Down Expand Up @@ -711,12 +708,6 @@ public function getForm($data = array(), $loadData = true)
}
}

// Remove show_associations field if associations is not enabled
if (!$assoc)
{
$form->removeField('show_associations', 'attribs');
}

return $form;
}

Expand Down Expand Up @@ -960,7 +951,6 @@ public function save($data)
}

$data['state'] = (int) $stage->condition;

}

// Automatic handling of alias for empty fields
Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_content/Service/HTML/Icon.php
Expand Up @@ -18,6 +18,7 @@
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Workflow\Workflow;
use Joomla\Component\Mailto\Site\Helper\MailtoHelper;
use Joomla\Registry\Registry;

Expand Down Expand Up @@ -146,7 +147,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false)
}

// Ignore if the state is negative (trashed).
if ($article->state < 0)
if (!in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED]))
{
return;
}
Expand Down Expand Up @@ -175,7 +176,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false)
$contentUrl = \ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language);
$url = $contentUrl . '&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri);

if ($article->state == 0)
if ($article->state == Workflow::CONDITION_UNPUBLISHED)
{
$overlib = Text::_('JUNPUBLISHED');
}
Expand Down
5 changes: 5 additions & 0 deletions administrator/components/com_fields/Table/FieldTable.php
Expand Up @@ -148,6 +148,11 @@ public function check()
$this->created_time = $date->toSql();
}

if (!(int) $this->modified_time)
{
$this->modified_time = $date->toSql();
}

if (empty($this->created_user_id))
{
$this->created_user_id = $user->get('id');
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_finder/sql/install.mysql.sql
Expand Up @@ -74,8 +74,8 @@ CREATE TABLE IF NOT EXISTS `#__finder_logging` (
`searchterm` VARCHAR(255) NOT NULL DEFAULT '',
`md5sum` VARCHAR(32) NOT NULL DEFAULT '',
`query` BLOB NOT NULL,
`hits` INT(11) NOT NULL DEFAULT '1',
`results` INT(11) NOT NULL DEFAULT '0',
`hits` INT(11) NOT NULL DEFAULT 1,
`results` INT(11) NOT NULL DEFAULT 0,
UNIQUE INDEX `md5sum` (`md5sum`),
INDEX `searchterm` (`searchterm`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci;
Expand Down
10 changes: 7 additions & 3 deletions administrator/components/com_workflow/View/Stages/HtmlView.php
Expand Up @@ -171,10 +171,14 @@ protected function addToolbar()
ToolbarHelper::addNew('stage.add');
}

if ($canDo->get('core.edit.state') && !$isCore)
if ($canDo->get('core.edit.state'))
{
ToolbarHelper::publishList('stages.publish');
ToolbarHelper::unpublishList('stages.unpublish');
if (!$isCore)
{
ToolbarHelper::publishList('stages.publish');
ToolbarHelper::unpublishList('stages.unpublish');
}

ToolbarHelper::makeDefault('stages.setDefault', 'COM_WORKFLOW_TOOLBAR_DEFAULT');
}

Expand Down
8 changes: 4 additions & 4 deletions administrator/components/com_workflow/tmpl/stages/default.php
Expand Up @@ -89,10 +89,10 @@
<?php foreach ($this->stages as $i => $item):
$edit = Route::_('index.php?option=com_workflow&task=stage.edit&id=' . $item->id . '&workflow_id=' . (int) $this->workflowID . '&extension=' . $this->extension);

$canEdit = $user->authorise('core.edit', $this->extension . '.stage.' . $item->id) && !$isCore;
$canEdit = $user->authorise('core.edit', $this->extension . '.stage.' . $item->id);
// @TODO set proper checkin fields
$canCheckin = true || $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canChange = $user->authorise('core.edit.stage', $this->extension . '.stage.' . $item->id) && $canCheckin && !$isCore;
$canChange = $user->authorise('core.edit.stage', $this->extension . '.stage.' . $item->id) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="order text-center hidden-sm-down">
Expand All @@ -118,14 +118,14 @@
</td>
<td class="text-center">
<div class="btn-group">
<?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'stages.', $canChange); ?>
<?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'stages.', $canChange && !$isCore); ?>
</div>
</td>
<td class="text-center">
<?php echo HTMLHelper::_('jgrid.isdefault', $item->default, $i, 'stages.', $canChange); ?>
</td>
<th scope="row">
<?php if ($canEdit) : ?>
<?php if ($canEdit && !$isCore) : ?>
<?php $editIcon = '<span class="fa fa-pencil-square mr-2" aria-hidden="true"></span>'; ?>
<a href="<?php echo $edit; ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape(addslashes(Text::_($item->title))); ?>">
<?php echo $editIcon; ?><?php echo $this->escape(Text::_($item->title)); ?>
Expand Down
10 changes: 5 additions & 5 deletions administrator/components/com_workflow/tmpl/workflows/default.php
Expand Up @@ -102,11 +102,11 @@
$edit = Route::_('index.php?option=com_workflow&task=workflow.edit&id=' . $item->id . '&extension=' . $extension);

$isCore = !empty($item->core);
$canEdit = $user->authorise('core.edit', $extension . '.workflow.' . $item->id) && !$isCore;
$canEdit = $user->authorise('core.edit', $extension . '.workflow.' . $item->id);
// @TODO set proper checkin fields
$canCheckin = true || $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canEditOwn = $user->authorise('core.edit.own', $extension . '.workflow.' . $item->id) && $item->created_by == $userId && !$isCore;
$canChange = $user->authorise('core.edit.state', $extension . '.workflow.' . $item->id) && $canCheckin && !$isCore;
$canEditOwn = $user->authorise('core.edit.own', $extension . '.workflow.' . $item->id) && $item->created_by == $userId;
$canChange = $user->authorise('core.edit.state', $extension . '.workflow.' . $item->id) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>" data-dragable-group="0">
<td class="order text-center hidden-sm-down">
Expand All @@ -133,11 +133,11 @@
</td>
<td class="text-center">
<div class="btn-group">
<?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'workflows.', $canChange); ?>
<?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'workflows.', $canChange && !$isCore); ?>
</div>
</td>
<th scope="row">
<?php if ($canEdit || $canEditOwn) : ?>
<?php if (!$isCore && ($canEdit || $canEditOwn)) : ?>
<?php $editIcon = '<span class="fa fa-pencil-square mr-2" aria-hidden="true"></span>'; ?>
<a href="<?php echo $edit; ?>" title="<?php echo Text::_('JACTION_EDIT', true); ?> <?php echo Text::_($item->title, true); ?>">
<?php echo $editIcon; ?><?php echo $this->escape(Text::_($item->title)); ?>
Expand Down
1 change: 0 additions & 1 deletion administrator/language/en-GB/en-GB.ini
Expand Up @@ -913,7 +913,6 @@ JTOOLBAR_BULK_IMPORT="Bulk Import"
JTOOLBAR_CANCEL="Cancel"
JTOOLBAR_CHANGE_STATUS="Change Status"
JTOOLBAR_CHECKIN="Check-in"
JTOOLBAR_CHANGE_STATUS="Change Status"
JTOOLBAR_CLOSE="Close"
JTOOLBAR_DEFAULT="Default"
JTOOLBAR_DELETE="Delete"
Expand Down
15 changes: 0 additions & 15 deletions build/media_src/system/js/showon.es6.js
Expand Up @@ -2,21 +2,6 @@
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// @todo remove this totally irrelevant piece of code from this file
// Only define the Joomla namespace if not defined.
Joomla = window.Joomla || {};

/**
* Sets the HTML of the container-collapse element
*/
Joomla.setcollapse = (url, name, height) => {
if (!document.getElementById(`collapse-${name}`)) {
document.getElementById('container-collapse').innerHTML = `<div class="collapse fade" id="collapse-${name}"><iframe class="iframe" src="${url}" height="${height}" width="100%"></iframe></div>`;
}
};
// end of @todo

((document) => {
'use strict';

Expand Down
7 changes: 4 additions & 3 deletions components/com_content/tmpl/featured/default_item.php
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Workflow\Workflow;

// Create a shortcut for params.
$params = &$this->item->params;
Expand All @@ -31,7 +32,7 @@
<?php endif; ?>

<div class="item-content">
<?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
<?php if ($this->item->state == Workflow::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
|| ((strtotime($this->item->publish_down) < strtotime(Factory::getDate())) && $this->item->publish_down != Factory::getDbo()->getNullDate())) : ?>
<div class="system-unpublished">
<?php endif; ?>
Expand All @@ -48,7 +49,7 @@
</h2>
<?php endif; ?>

<?php if ($this->item->state == 0) : ?>
<?php if ($this->item->state == Workflow::CONDITION_UNPUBLISHED) : ?>
<span class="badge badge-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if (strtotime($this->item->publish_up) > strtotime(Factory::getDate())) : ?>
Expand Down Expand Up @@ -103,7 +104,7 @@

<?php endif; ?>

<?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
<?php if ($this->item->state == Workflow::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
|| ((strtotime($this->item->publish_down) < strtotime(Factory::getDate())) && $this->item->publish_down != $this->db->getNullDate() )) : ?>
</div>
<?php endif; ?>
Expand Down
34 changes: 17 additions & 17 deletions installation/sql/mysql/joomla.sql
Expand Up @@ -699,19 +699,19 @@ CREATE TABLE IF NOT EXISTS `#__fields` (
`type` varchar(255) NOT NULL DEFAULT 'text',
`note` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
`state` tinyint(1) NOT NULL DEFAULT '0',
`required` tinyint(1) NOT NULL DEFAULT '0',
`checked_out` int(11) NOT NULL DEFAULT '0',
`state` tinyint(1) NOT NULL DEFAULT 0,
`required` tinyint(1) NOT NULL DEFAULT 0,
`checked_out` int(11) NOT NULL DEFAULT 0,
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ordering` int(11) NOT NULL DEFAULT '0',
`ordering` int(11) NOT NULL DEFAULT 0,
`params` text NOT NULL,
`fieldparams` text NOT NULL,
`language` char(7) NOT NULL DEFAULT '',
`created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_user_id` int(10) unsigned NOT NULL DEFAULT '0',
`created_user_id` int(10) unsigned NOT NULL DEFAULT 0,
`modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` int(10) unsigned NOT NULL DEFAULT '0',
`access` int(11) NOT NULL DEFAULT '1',
`modified_by` int(10) unsigned NOT NULL DEFAULT 0,
`access` int(11) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_state` (`state`),
Expand Down Expand Up @@ -746,17 +746,17 @@ CREATE TABLE IF NOT EXISTS `#__fields_groups` (
`title` varchar(255) NOT NULL DEFAULT '',
`note` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
`state` tinyint(1) NOT NULL DEFAULT '0',
`checked_out` int(11) NOT NULL DEFAULT '0',
`state` tinyint(1) NOT NULL DEFAULT 0,
`checked_out` int(11) NOT NULL DEFAULT 0,
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ordering` int(11) NOT NULL DEFAULT '0',
`ordering` int(11) NOT NULL DEFAULT 0,
`params` text NOT NULL,
`language` char(7) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_by` int(10) unsigned NOT NULL DEFAULT '0',
`created_by` int(10) unsigned NOT NULL DEFAULT 0,
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` int(10) unsigned NOT NULL DEFAULT '0',
`access` int(11) NOT NULL DEFAULT '1',
`modified_by` int(10) unsigned NOT NULL DEFAULT 0,
`access` int(11) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_state` (`state`),
Expand Down Expand Up @@ -864,8 +864,8 @@ CREATE TABLE IF NOT EXISTS `#__finder_logging` (
`searchterm` VARCHAR(255) NOT NULL DEFAULT '',
`md5sum` VARCHAR(32) NOT NULL DEFAULT '',
`query` BLOB NOT NULL,
`hits` INT(11) NOT NULL DEFAULT '1',
`results` INT(11) NOT NULL DEFAULT '0',
`hits` INT(11) NOT NULL DEFAULT 1,
`results` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY `md5sum` (`md5sum`),
INDEX `searchterm` (`searchterm`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci;
Expand Down Expand Up @@ -1234,7 +1234,7 @@ CREATE TABLE IF NOT EXISTS `#__menu_types` (
`menutype` varchar(24) NOT NULL,
`title` varchar(48) NOT NULL,
`description` varchar(255) NOT NULL DEFAULT '',
`client_id` int(11) NOT NULL DEFAULT '0',
`client_id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_menutype` (`menutype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
Expand Down Expand Up @@ -1440,7 +1440,7 @@ CREATE TABLE IF NOT EXISTS `#__postinstall_messages` (
`description_key` varchar(255) NOT NULL DEFAULT '' COMMENT 'Lang key for description',
`action_key` varchar(255) NOT NULL DEFAULT '',
`language_extension` varchar(255) NOT NULL DEFAULT 'com_postinstall' COMMENT 'Extension holding lang keys',
`language_client_id` tinyint(3) NOT NULL DEFAULT '1',
`language_client_id` tinyint(3) NOT NULL DEFAULT 1,
`type` varchar(10) NOT NULL DEFAULT 'link' COMMENT 'Message type - message, link, action',
`action_file` varchar(255) DEFAULT '' COMMENT 'RAD URI to the PHP file containing action method',
`action` varchar(255) DEFAULT '' COMMENT 'Action method name or URL',
Expand Down
12 changes: 6 additions & 6 deletions installation/sql/postgresql/joomla.sql
Expand Up @@ -754,17 +754,17 @@ CREATE TABLE IF NOT EXISTS "#__fields_groups" (
"title" varchar(255) DEFAULT '' NOT NULL,
"note" varchar(255) DEFAULT '' NOT NULL,
"description" text NOT NULL,
"state" smallint DEFAULT '0' NOT NULL,
"checked_out" integer DEFAULT '0' NOT NULL,
"state" smallint DEFAULT 0 NOT NULL,
"checked_out" integer DEFAULT 0 NOT NULL,
"checked_out_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"ordering" integer DEFAULT '0' NOT NULL,
"ordering" integer DEFAULT 0 NOT NULL,
"params" text DEFAULT '' NOT NULL,
"language" varchar(7) DEFAULT '' NOT NULL,
"created" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"created_by" bigint DEFAULT '0' NOT NULL,
"created_by" bigint DEFAULT 0 NOT NULL,
"modified" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"modified_by" bigint DEFAULT '0' NOT NULL,
"access" bigint DEFAULT '1' NOT NULL,
"modified_by" bigint DEFAULT 0 NOT NULL,
"access" bigint DEFAULT 1 NOT NULL,
PRIMARY KEY ("id")
);
CREATE INDEX "#__fields_groups_idx_checked_out" ON "#__fields_groups" ("checked_out");
Expand Down
26 changes: 0 additions & 26 deletions layouts/joomla/toolbar/slider.php

This file was deleted.

1 change: 0 additions & 1 deletion libraries/classmap.php
Expand Up @@ -157,7 +157,6 @@
JLoader::registerAlias('JToolbarButtonLink', '\\Joomla\\CMS\\Toolbar\\Button\\LinkButton', '5.0');
JLoader::registerAlias('JToolbarButtonPopup', '\\Joomla\\CMS\\Toolbar\\Button\\PopupButton', '5.0');
JLoader::registerAlias('JToolbarButtonSeparator', '\\Joomla\\CMS\\Toolbar\\Button\\SeparatorButton', '5.0');
JLoader::registerAlias('JToolbarButtonSlider', '\\Joomla\\CMS\\Toolbar\\Button\\SliderButton', '5.0');
JLoader::registerAlias('JToolbarButtonStandard', '\\Joomla\\CMS\\Toolbar\\Button\\StandardButton', '5.0');
JLoader::registerAlias('JToolbarHelper', '\\Joomla\\CMS\\Toolbar\\ToolbarHelper', '5.0');
JLoader::registerAlias('JButton', '\\Joomla\\CMS\\Toolbar\\ToolbarButton', '5.0');
Expand Down

0 comments on commit 3bec43e

Please sign in to comment.