Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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 @@ -162,7 +162,7 @@
$hasTransitions = count($transitions) > 0;

$default = [
JHtml::_('select.option', '', $this->escape($item->stage_title)),
JHtml::_('select.option', '', Text::_($this->escape($item->stage_title))),
JHtml::_('select.option', '-1', '--------', ['disable' => true])
];

Expand Down Expand Up @@ -220,7 +220,7 @@
<span class="icon-<?php echo $icon; ?>"></span>
<?php endif; ?>
</div>
<div class="mr-auto"><?php echo $this->escape($item->stage_title); ?></div>
<div class="mr-auto"><?php echo Text::_($this->escape($item->stage_title)); ?></div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think correct would be do escape() after translation, not before 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, thx

<?php if ($hasTransitions) : ?>
<div class="d-none">
<?php
Expand Down
2 changes: 2 additions & 0 deletions administrator/components/com_workflow/forms/transition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
required="true"
sql_select="id as value, title as from_stage_id"
sql_from="#__workflow_stages"
translate="true"
>
<option value="-1">JALL</option>
</field>
Expand All @@ -35,6 +36,7 @@
required="true"
sql_select="id as value, title as to_stage_id"
sql_from="#__workflow_stages"
translate="true"
/>
<field
name="description"
Expand Down
10 changes: 6 additions & 4 deletions administrator/components/com_workflow/tmpl/stages/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Factory;
Expand All @@ -23,6 +23,8 @@
$user = Factory::getUser();
$userId = $user->id;

$lang = Factory::getLanguage();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You aren't using this property


$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrderingUrl = '';
Expand Down Expand Up @@ -119,11 +121,11 @@
<th scope="row">
<?php if ($canEdit) : ?>
<?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($item->title)); ?>">
<?php echo $editIcon; ?><?php echo $item->title; ?>
<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)); ?>
</a>
<?php else: ?>
<?php echo $item->title; ?>
<?php echo $this->escape(Text::_($item->title)); ?>
<?php endif; ?>
</th>
<td class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
Expand All @@ -20,7 +21,9 @@

HTMLHelper::_('behavior.tooltip');

$user = Factory::getUser();
$user = Factory::getUser();

$lang = Factory::getLanguage();

$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
Expand Down Expand Up @@ -125,11 +128,11 @@
<?php if ($item->from_stage_id < 0) : ?>
<?php echo Text::_('JALL'); ?>
<?php else : ?>
<?php echo $item->from_stage; ?>
<?php echo Text::_($this->escape($item->from_stage)); ?>
<?php endif; ?>
</td>
<td class="text-center">
<?php echo $this->escape($item->to_stage); ?>
<?php echo Text::_($this->escape($item->to_stage)); ?>
</td>
<td class="text-right">
<?php echo $item->id; ?>
Expand Down
8 changes: 4 additions & 4 deletions installation/sql/mysql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2010,10 +2010,10 @@ CREATE TABLE IF NOT EXISTS `#__workflow_stages` (
--

INSERT INTO `#__workflow_stages` (`id`, `asset_id`, `ordering`, `workflow_id`, `published`, `title`, `description`, `condition`, `default`) VALUES
(1, 57, 1, 1, 1, 'Unpublished', '', '0', 0),
(2, 58, 2, 1, 1, 'Published', '', '1', 1),
(3, 59, 3, 1, 1, 'Trashed', '', '-2', 0),
(4, 60, 4, 1, 1, 'Archived', '', '1', 0);
(1, 57, 1, 1, 1, 'JUNPUBLISHED', '', '0', 0),
(2, 58, 2, 1, 1, 'JPUBLISHED', '', '1', 1),
(3, 59, 3, 1, 1, 'JTRASHED', '', '-2', 0),
(4, 60, 4, 1, 1, 'JARCHIVED', '', '1', 0);

--
-- Table structure for table `#__workflow_transitions`
Expand Down
9 changes: 6 additions & 3 deletions libraries/src/Form/Field/TransitionField.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Workflow\Workflow;
use Joomla\CMS\Form\Field\ListField;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to import this as it's in the same namespace

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\Utilities\ArrayHelper;

FormHelper::loadFieldClass('list');
Expand Down Expand Up @@ -62,7 +65,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
* @return array An array of HTMLHelper options.
*
* @since __DEPLOY_VERSION__
*/
Expand Down Expand Up @@ -128,13 +131,13 @@ function ($item) use ($user, $extension)

$workflowName = $db->setQuery($query)->loadResult();

$default = [\JHtml::_('select.option', '', $workflowName)];
$default = [HTMLHelper::_('select.option', '', Text::_($workflowName))];

$options = array_merge(parent::getOptions(), $items);

if (count($options))
{
$default[] = \JHtml::_('select.option', '-1', '--------', ['disable' => true]);
$default[] = HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]);
}

// Merge with defaults
Expand Down
4 changes: 3 additions & 1 deletion libraries/src/Form/Field/WorkflowStageField.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\GroupedlistField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

/**
* Workflow Stages field.
Expand Down Expand Up @@ -124,7 +126,7 @@ protected function getGroups()
$workflowStages[$workflowStageKey] = array();
}

$workflowStages[$workflowStageKey][] = HTMLHelper::_('select.option', $stage->workflow_stage_id, $stage->workflow_stage_title);
$workflowStates[$workflowStateKey][] = HTMLHelper::_('select.option', $state->workflow_stage_id, Text::_($state->workflow_stage_title));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$state or $stage?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be $stage

Copy link
Contributor Author

@bembelimen bembelimen Aug 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}

// Merge any additional options in the XML definition.
Expand Down