Skip to content
Closed
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 @@ -53,40 +53,40 @@ class ContentComponent extends MVCComponent implements
*
* @since 4.0.0
*/
const CONDITION_NAMES = [
self::CONDITION_PUBLISHED => 'JPUBLISHED',
self::CONDITION_UNPUBLISHED => 'JUNPUBLISHED',
self::CONDITION_ARCHIVED => 'JARCHIVED',
self::CONDITION_TRASHED => 'JTRASHED',
const STATE_NAMES = [
self::STATE_PUBLISHED => 'JPUBLISHED',
self::STATE_UNPUBLISHED => 'JUNPUBLISHED',
self::STATE_ARCHIVED => 'JARCHIVED',
self::STATE_TRASHED => 'JTRASHED',
];

/**
* The archived condition
*
* @since 4.0.0
*/
const CONDITION_ARCHIVED = 2;
const STATE_ARCHIVED = 2;

/**
* The published condition
*
* @since 4.0.0
*/
const CONDITION_PUBLISHED = 1;
const STATE_PUBLISHED = 1;

/**
* The unpublished condition
*
* @since 4.0.0
*/
const CONDITION_UNPUBLISHED = 0;
const STATE_UNPUBLISHED = 0;

/**
* The trashed condition
*
* @since 4.0.0
*/
const CONDITION_TRASHED = -2;
const STATE_TRASHED = -2;

/**
* Booting the extension. This is the function to set up the environment of the extension like
Expand Down
8 changes: 4 additions & 4 deletions administrator/components/com_content/Model/ArticleModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ protected function batchMove($value, $pks, $contexts)
*/
protected function canDelete($record)
{
if (!empty($record->id) && $record->state == ContentComponent::CONDITION_TRASHED)
if (!empty($record->id) && $record->state == ContentComponent::STATE_TRASHED)
{
return Factory::getUser()->authorise('core.delete', 'com_content.article.' . (int) $record->id);
}
Expand Down Expand Up @@ -318,12 +318,12 @@ protected function canEditState($record)
protected function prepareTable($table)
{
// Set the publish date to now
if ($table->state == ContentComponent::CONDITION_PUBLISHED && (int) $table->publish_up == 0)
if ($table->state == ContentComponent::STATE_PUBLISHED && (int) $table->publish_up == 0)
{
$table->publish_up = Factory::getDate()->toSql();
}

if ($table->state == ContentComponent::CONDITION_PUBLISHED && intval($table->publish_down) == 0)
if ($table->state == ContentComponent::STATE_PUBLISHED && intval($table->publish_down) == 0)
{
$table->publish_down = null;
}
Expand Down Expand Up @@ -787,7 +787,7 @@ public function save($data)
$table['parent_id'] = 1;
$table['extension'] = 'com_content';
$table['language'] = $data['language'];
$table['published'] = ContentComponent::CONDITION_PUBLISHED;
$table['published'] = ContentComponent::STATE_PUBLISHED;

// Create new category and get catid back
$data['catid'] = CategoriesHelper::createCategory($table);
Expand Down
6 changes: 3 additions & 3 deletions administrator/components/com_content/Model/ArticlesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ protected function getListQuery()
$query->whereIn(
$db->quoteName('a.state'),
[
ContentComponent::CONDITION_PUBLISHED,
ContentComponent::CONDITION_UNPUBLISHED
ContentComponent::STATE_PUBLISHED,
ContentComponent::STATE_UNPUBLISHED
]
);
}
Expand Down Expand Up @@ -574,7 +574,7 @@ public function getTransitions()
{
// @TODO: Benjamin fix
// Update the transition text with final state value
//$conditionName = $workflow->getConditionName($transition['stage_condition']);
//$conditionName = $workflow->getStateName($transition['stage_condition']);

//$transitions[$key]['text'] .= ' [' . Text::_($conditionName) . ']';
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_content/Model/FeaturedModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ protected function getListQuery()
$query->whereIn(
$db->quoteName('ws.condition'),
[
ContentComponent::CONDITION_PUBLISHED,
ContentComponent::CONDITION_UNPUBLISHED
ContentComponent::STATE_PUBLISHED,
ContentComponent::STATE_UNPUBLISHED
]
);
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_content/Service/HTML/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false)
}

// Ignore if the state is negative (trashed).
if (!in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED]))
if (!in_array($article->state, [Workflow::STATE_UNPUBLISHED, Workflow::STATE_PUBLISHED]))
{
return;
}
Expand Down Expand Up @@ -176,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 == Workflow::CONDITION_UNPUBLISHED)
if ($article->state == Workflow::STATE_UNPUBLISHED)
{
$overlib = Text::_('JUNPUBLISHED');
}
Expand Down
10 changes: 5 additions & 5 deletions administrator/components/com_content/View/Articles/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,19 @@ public function display($tpl = null)
// {
// switch ($transition['stage_condition'])
// {
// case ContentComponent::CONDITION_PUBLISHED:
// case ContentComponent::STATE_PUBLISHED:
// $transitions['publish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
//
// case ContentComponent::CONDITION_UNPUBLISHED:
// case ContentComponent::STATE_UNPUBLISHED:
// $transitions['unpublish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
//
// case ContentComponent::CONDITION_ARCHIVED:
// case ContentComponent::STATE_ARCHIVED:
// $transitions['archive'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
//
// case ContentComponent::CONDITION_TRASHED:
// case ContentComponent::STATE_TRASHED:
// $transitions['trash'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
// }
Expand Down Expand Up @@ -246,7 +246,7 @@ protected function addToolbar()
}
}

if ($this->state->get('filter.condition') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete'))
if ($this->state->get('filter.condition') == ContentComponent::STATE_TRASHED && $canDo->get('core.delete'))
{
$toolbar->delete('articles.delete')
->text('JTOOLBAR_EMPTY_TRASH')
Expand Down
10 changes: 5 additions & 5 deletions administrator/components/com_content/View/Featured/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ public function display($tpl = null)
// {
// switch ($transition['stage_condition'])
// {
// case ContentComponent::CONDITION_PUBLISHED:
// case ContentComponent::STATE_PUBLISHED:
// $transitions['publish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
//
// case ContentComponent::CONDITION_UNPUBLISHED:
// case ContentComponent::STATE_UNPUBLISHED:
// $transitions['unpublish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
//
// case ContentComponent::CONDITION_ARCHIVED:
// case ContentComponent::STATE_ARCHIVED:
// $transitions['archive'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
//
// case ContentComponent::CONDITION_TRASHED:
// case ContentComponent::STATE_TRASHED:
// $transitions['trash'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition;
// break;
// }
Expand Down Expand Up @@ -209,7 +209,7 @@ protected function addToolbar()
}
}

if ($this->state->get('filter.condition') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete'))
if ($this->state->get('filter.condition') == ContentComponent::STATE_TRASHED && $canDo->get('core.delete'))
{
$toolbar->delete('articles.delete')
->text('JTOOLBAR_EMPTY_TRASH')
Expand Down
16 changes: 8 additions & 8 deletions administrator/components/com_content/tmpl/articles/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@

// foreach ($transitions as $transition) :
// switch ($transition['stage_condition']) :
// case ContentComponent::CONDITION_PUBLISHED:
// case ContentComponent::STATE_PUBLISHED:
// ++$publish;
// break;
// case ContentComponent::CONDITION_UNPUBLISHED:
// case ContentComponent::STATE_UNPUBLISHED:
// ++$unpublish;
// break;
// case ContentComponent::CONDITION_ARCHIVED:
// case ContentComponent::STATE_ARCHIVED:
// ++$archive;
// break;
// case ContentComponent::CONDITION_TRASHED:
// case ContentComponent::STATE_TRASHED:
// ++$trash;
// break;
// endswitch;
Expand Down Expand Up @@ -247,10 +247,10 @@
->removeState(1)
->removeState(2)
->removeState(-2)
->addState(ContentComponent::CONDITION_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED'])
->addState(ContentComponent::CONDITION_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED'])
->addState(ContentComponent::CONDITION_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED'])
->addState(ContentComponent::CONDITION_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED'])
->addState(ContentComponent::STATE_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED'])
->addState(ContentComponent::STATE_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED'])
->addState(ContentComponent::STATE_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED'])
->addState(ContentComponent::STATE_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED'])
->setLayout('joomla.button.transition-button')
->render($item->state, $i, $options, $item->publish_up, $item->publish_down);
?>
Expand Down
16 changes: 8 additions & 8 deletions administrator/components/com_content/tmpl/featured/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@

// foreach ($transitions as $transition) :
// switch ($transition['stage_condition']) :
// case ContentComponent::CONDITION_PUBLISHED:
// case ContentComponent::STATE_PUBLISHED:
// ++$publish;
// break;
// case ContentComponent::CONDITION_UNPUBLISHED:
// case ContentComponent::STATE_UNPUBLISHED:
// ++$unpublish;
// break;
// case ContentComponent::CONDITION_ARCHIVED:
// case ContentComponent::STATE_ARCHIVED:
// ++$archive;
// break;
// case ContentComponent::CONDITION_TRASHED:
// case ContentComponent::STATE_TRASHED:
// ++$trash;
// break;
// endswitch;
Expand Down Expand Up @@ -230,10 +230,10 @@
->removeState(1)
->removeState(2)
->removeState(-2)
->addState(ContentComponent::CONDITION_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED'])
->addState(ContentComponent::CONDITION_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED'])
->addState(ContentComponent::CONDITION_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED'])
->addState(ContentComponent::CONDITION_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED'])
->addState(ContentComponent::STATE_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED'])
->addState(ContentComponent::STATE_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED'])
->addState(ContentComponent::STATE_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED'])
->addState(ContentComponent::STATE_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED'])
->setLayout('joomla.button.transition-button')
->render($item->state, $i, $options, $item->publish_up, $item->publish_down);
?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ public function getListQuery()
);

$select[] = $db->quoteName('f_stage.title', 'from_stage');
$select[] = $db->quoteName('f_stage.condition', 'from_condition');
$select[] = $db->quoteName('t_stage.title', 'to_stage');
$select[] = $db->quoteName('t_stage.condition', 'to_condition');
$joinTo = $db->quoteName('#__workflow_stages', 't_stage') .
' ON ' . $db->quoteName('t_stage.id') . ' = ' . $db->quoteName('t.to_stage_id');

Expand All @@ -166,7 +164,7 @@ public function getListQuery()

$status = $this->getState('filter.published');

// Filter by condition
// Filter by state
if (is_numeric($status))
{
$query->where($db->quoteName('t.published') . ' = ' . (int) $status);
Expand Down
8 changes: 4 additions & 4 deletions administrator/components/com_workflow/Model/WorkflowModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,23 @@ public function save($data)
$stages = [
[
'title' => 'JUNPUBLISHED',
'condition' => Workflow::CONDITION_UNPUBLISHED,
'condition' => Workflow::STATE_UNPUBLISHED,
'default' => 1,
'transition' => 'Unpublish'
],
[
'title' => 'JPUBLISHED',
'condition' => Workflow::CONDITION_PUBLISHED,
'condition' => Workflow::STATE_PUBLISHED,
'transition' => 'Publish'
],
[
'title' => 'JTRASHED',
'condition' => Workflow::CONDITION_TRASHED,
'condition' => Workflow::STATE_TRASHED,
'transition' => 'Trash'
],
[
'title' => 'JARCHIVED',
'condition' => Workflow::CONDITION_ARCHIVED,
'condition' => Workflow::STATE_ARCHIVED,
'transition' => 'Archive'
]
];
Expand Down
12 changes: 0 additions & 12 deletions administrator/components/com_workflow/View/Stages/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,6 @@ public function display($tpl = null)
WorkflowHelper::addSubmenu('stages');

$this->sidebar = \JHtmlSidebar::render();

if (!empty($this->stages))
{
$extension = Factory::getApplication()->input->getCmd('extension');
$workflow = new Workflow(['extension' => $extension]);

foreach ($this->stages as $i => $item)
{
$item->condition = $workflow->getConditionName($item->condition);
}
}

$this->addToolbar();

return parent::display($tpl);
Expand Down
20 changes: 1 addition & 19 deletions administrator/components/com_workflow/tmpl/stages/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,9 @@
<th scope="col" style="width:1%" class="text-center d-none d-md-table-cell">
<?php echo Text::_('COM_WORKFLOW_DEFAULT'); ?>
</th>
<th scope="col" style="width:10%" class="d-none d-md-table-cell">
<th scope="col" class="d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_WORKFLOW_NAME', 's.title', $listDirn, $listOrder); ?>
</th>
<th scope="col" style="width:10%" class="d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_WORKFLOW_CONDITION', 's.condition', $listDirn, $listOrder); ?>
</th>
<th scope="col" style="width:1%" class="d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_WORKFLOW_ID', 's.id', $listDirn, $listOrder); ?>
</th>
Expand Down Expand Up @@ -135,21 +132,6 @@
<div class="small"><?php echo $this->escape(Text::_($item->description)); ?></div>
<?php endif; ?>
</th>
<td class="nowrap">
<?php
if ($item->condition == 'JARCHIVED'):
$icon = 'icon-archive';
elseif ($item->condition == 'JTRASHED'):
$icon = 'icon-trash';
elseif ($item->condition == 'JPUBLISHED'):
$icon = 'icon-publish';
elseif ($item->condition == 'JUNPUBLISHED'):
$icon = 'icon-unpublish';
endif;
?>
<span class="<?php echo $icon; ?>" aria-hidden="true"></span>
<?php echo Text::_($item->condition); ?>
</td>
<td class="d-none d-md-table-cell">
<?php echo (int) $item->id; ?>
</td>
Expand Down
Loading