Skip to content

Commit e986af5

Browse files
chmstwilsonge
authored andcommitted
[4.0] State to stage (#21544)
* Change "state" to "stage" * article-model * Change "state" to "stage" * Spelling correction controler/controller * Fix typos * Revert renaming of workflowstate * Revert renaming of workflowstate * Fix Language-key and String, rename the e-mail param, revert change of the classname * Fix typos * Some more state-stage changes * Email without hyphen * Language string copied
1 parent 35024a8 commit e986af5

File tree

60 files changed

+1845
-12258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1845
-12258
lines changed

administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-05-15.sql

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ INSERT INTO `#__workflows` (`id`, `asset_id`, `published`, `title`, `description
3939

4040
CREATE TABLE IF NOT EXISTS `#__workflow_associations` (
4141
`item_id` int(10) NOT NULL DEFAULT 0 COMMENT 'Extension table id value',
42-
`state_id` int(10) NOT NULL COMMENT 'Foreign Key to #__workflow_states.id',
42+
`stage_id` int(10) NOT NULL COMMENT 'Foreign Key to #__workflow_stages.id',
4343
`extension` varchar(50) NOT NULL,
44-
PRIMARY KEY (`item_id`, `state_id`, `extension`),
44+
PRIMARY KEY (`item_id`, `stage_id`, `extension`),
4545
KEY `idx_item_id` (`item_id`),
46-
KEY `idx_state_id` (`state_id`),
46+
KEY `idx_stage_id` (`stage_id`),
4747
KEY `idx_extension` (`extension`)
4848
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
4949

5050
--
51-
-- Table structure for table `#__workflow_states`
51+
-- Table structure for table `#__workflow_stages`
5252
--
5353

54-
CREATE TABLE IF NOT EXISTS `#__workflow_states` (
54+
CREATE TABLE IF NOT EXISTS `#__workflow_stages` (
5555
`id` int(10) NOT NULL AUTO_INCREMENT,
5656
`asset_id` int(10) DEFAULT 0,
5757
`ordering` int(11) NOT NULL DEFAULT 0,
@@ -69,10 +69,10 @@ CREATE TABLE IF NOT EXISTS `#__workflow_states` (
6969
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
7070

7171
--
72-
-- Dumping data for table `#__workflow_states`
72+
-- Dumping data for table `#__workflow_stages`
7373
--
7474

75-
INSERT INTO `#__workflow_states` (`id`, `asset_id`, `ordering`, `workflow_id`, `published`, `title`, `description`, `condition`, `default`) VALUES
75+
INSERT INTO `#__workflow_stages` (`id`, `asset_id`, `ordering`, `workflow_id`, `published`, `title`, `description`, `condition`, `default`) VALUES
7676
(1, 0, 1, 1, 1, 'Unpublished', '', '0', 0),
7777
(2, 0, 2, 1, 1, 'Published', '', '1', 1),
7878
(3, 0, 3, 1, 1, 'Trashed', '', '-2', 0),
@@ -90,21 +90,21 @@ CREATE TABLE IF NOT EXISTS `#__workflow_transitions` (
9090
`published` tinyint(1) NOT NULL DEFAULT 0,
9191
`title` varchar(255) NOT NULL,
9292
`description` text NOT NULL,
93-
`from_state_id` int(10) NOT NULL,
94-
`to_state_id` int(10) NOT NULL,
93+
`from_stage_id` int(10) NOT NULL,
94+
`to_stage_id` int(10) NOT NULL,
9595
PRIMARY KEY (`id`),
9696
KEY `title` (`title`(191)),
9797
KEY `asset_id` (`asset_id`),
98-
KEY `from_state_id` (`from_state_id`),
99-
KEY `to_state_id` (`to_state_id`),
98+
KEY `from_stage_id` (`from_stage_id`),
99+
KEY `to_stage_id` (`to_stage_id`),
100100
KEY `workflow_id` (`workflow_id`)
101101
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
102102

103103
--
104104
-- Dumping data for table `#__workflow_transitions`
105105
--
106106

107-
INSERT INTO `#__workflow_transitions` (`id`, `asset_id`, `published`, `ordering`, `workflow_id`, `title`, `description`, `from_state_id`, `to_state_id`) VALUES
107+
INSERT INTO `#__workflow_transitions` (`id`, `asset_id`, `published`, `ordering`, `workflow_id`, `title`, `description`, `from_stage_id`, `to_stage_id`) VALUES
108108
(1, 0, 1, 1, 1, 'Unpublish', '', -1, 1),
109109
(2, 0, 1, 2, 1, 'Publish', '', -1, 2),
110110
(3, 0, 1, 3, 1, 'Trash', '', -1, 3),
@@ -114,11 +114,11 @@ INSERT INTO `#__workflow_transitions` (`id`, `asset_id`, `published`, `ordering`
114114
-- Creating extension entry
115115
--
116116

117-
INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `state`, `namespace`) VALUES
117+
INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `stage`, `namespace`) VALUES
118118
(35, 0, 'com_workflow', 'component', 'com_workflow', '', 1, 1, 0, 0, '', '{}', 0, '0000-00-00 00:00:00', 0, 0, 'Joomla\\Component\\Workflow');
119119

120120
--
121121
-- Creating Associations for existing content
122122
--
123-
INSERT INTO `#__workflow_associations` (`item_id`, `state_id`, `extension`)
124-
SELECT `id`, CASE WHEN `state` = -2 THEN 3 WHEN `state` = 0 THEN 1 WHEN `state` = 2 THEN 4 ELSE 2 END, 'com_content' FROM `#__content`;
123+
INSERT INTO `#__workflow_associations` (`item_id`, `stage_id`, `extension`)
124+
SELECT `id`, CASE WHEN `stage` = -2 THEN 3 WHEN `stage` = 0 THEN 1 WHEN `stage` = 2 THEN 4 ELSE 2 END, 'com_content' FROM `#__content`;

administrator/components/com_content/Helper/ContentHelper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public static function addSubmenu($vName)
6969
$workflowID = $app->getUserStateFromRequest('filter.workflow_id', 'workflow_id', 1, 'int');
7070

7171
\JHtmlSidebar::addEntry(
72-
Text::_('COM_WORKFLOW_STATES'),
73-
'index.php?option=com_workflow&view=states&workflow_id=' . $workflowID . "&extension=com_content",
72+
Text::_('COM_WORKFLOW_STAGES'),
73+
'index.php?option=com_workflow&view=stages&workflow_id=' . $workflowID . "&extension=com_content",
7474
$vName == 'states`'
7575
);
7676

@@ -148,10 +148,10 @@ public static function countItems(&$items)
148148
$query ->select($db->quoteName('condition'))
149149
->select('COUNT(*) AS ' . $db->quoteName('count'))
150150
->from($db->quoteName('#__content', 'c'))
151-
->from($db->quoteName('#__workflow_states', 's'))
151+
->from($db->quoteName('#__workflow_stages', 's'))
152152
->from($db->quoteName('#__workflow_associations', 'a'))
153153
->where($db->quoteName('a.item_id') . ' = ' . $db->quoteName('c.id'))
154-
->where($db->quoteName('s.id') . ' = ' . $db->quoteName('a.state_id'))
154+
->where($db->quoteName('s.id') . ' = ' . $db->quoteName('a.stage_id'))
155155
->where('catid = ' . (int) $item->id)
156156
->where('a.extension = ' . $db->quote('com_content'))
157157
->group($db->quoteName('condition'));
@@ -349,7 +349,7 @@ public static function filterTransitions($transitions, $pk, $workflow_id = 0): a
349349
$transitions,
350350
function ($var) use ($pk, $workflow_id)
351351
{
352-
return in_array($var['from_state_id'], [-1, $pk]) && $var['to_state_id'] != $pk && $workflow_id == $var['workflow_id'];
352+
return in_array($var['from_stage_id'], [-1, $pk]) && $var['to_stage_id'] != $pk && $workflow_id == $var['workflow_id'];
353353
}
354354
)
355355
);

administrator/components/com_content/Model/ArticleModel.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ public function save($data)
821821
$query = $db->getQuery(true);
822822

823823
$query ->select($db->quoteName(['ws.id', 'ws.condition']))
824-
->from($db->quoteName('#__workflow_states', 'ws'))
824+
->from($db->quoteName('#__workflow_stages', 'ws'))
825825
->from($db->quoteName('#__workflow_transitions', 'wt'))
826826
->where($db->quoteName('wt.to_state_id') . ' = ' . $db->quoteName('ws.id'))
827827
->where($db->quoteName('wt.id') . ' = ' . (int) $data['transition'])
@@ -1219,7 +1219,7 @@ protected function getWorkflowByCategory($catId)
12191219
)
12201220
)
12211221
->select($db->quoteName('ws.id', 'state_id'))
1222-
->from($db->quoteName('#__workflow_states', 'ws'))
1222+
->from($db->quoteName('#__workflow_stages', 'ws'))
12231223
->from($db->quoteName('#__workflows', 'w'))
12241224
->where($db->quoteName('ws.workflow_id') . ' = ' . $db->quoteName('w.id'))
12251225
->where($db->quoteName('ws.default') . ' = 1')
@@ -1246,8 +1246,8 @@ protected function getWorkflowByCategory($catId)
12461246
]
12471247
)
12481248
)
1249-
->select($db->quoteName('ws.id', 'state_id'))
1250-
->from($db->quoteName('#__workflow_states', 'ws'))
1249+
->select($db->quoteName('ws.id', 'stage_id'))
1250+
->from($db->quoteName('#__workflow_stages', 'ws'))
12511251
->from($db->quoteName('#__workflows', 'w'))
12521252
->where($db->quoteName('ws.default') . ' = 1')
12531253
->where($db->quoteName('ws.workflow_id') . ' = ' . $db->quoteName('w.id'))
@@ -1284,18 +1284,18 @@ public function runTransition($pk, $transition_id)
12841284

12851285
if (!$runTransaction)
12861286
{
1287-
$this->setError(Text::_('COM_CONTENT_ERROR_UPDATE_STATE'));
1287+
$this->setError(Text::_('COM_CONTENT_ERROR_UPDATE_STAGE'));
12881288

12891289
return false;
12901290
}
12911291

12921292
// B/C state change trigger for UCM
12931293
$context = $this->option . '.' . $this->name;
12941294

1295-
// Include the plugins for the change of state event.
1295+
// Include the plugins for the change of stage event.
12961296
\JPluginHelper::importPlugin($this->events_map['change_state']);
12971297

1298-
// Trigger the change state event.
1298+
// Trigger the change stage event.
12991299
\JFactory::getApplication()->triggerEvent($this->event_change_state, [$context, [$pk], $transition_id]);
13001300

13011301
return true;

administrator/components/com_content/Model/ArticlesModel.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ protected function getListQuery()
224224
->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
225225

226226
// Join over the associations.
227-
$query ->select($query->quoteName('wa.state_id', 'state_id'))
227+
$query ->select($query->quoteName('wa.stage_id', 'stage_id'))
228228
->innerJoin($query->quoteName('#__workflow_associations', 'wa'))
229229
->where($query->quoteName('wa.item_id') . ' = ' . $query->quoteName('a.id'));
230230

@@ -237,14 +237,14 @@ protected function getListQuery()
237237
'ws.workflow_id'
238238
],
239239
[
240-
'state_title',
241-
'state_condition',
240+
'stage_title',
241+
'stage_condition',
242242
'workflow_id'
243243
]
244244
)
245245
)
246-
->innerJoin($query->quoteName('#__workflow_states', 'ws'))
247-
->where($query->quoteName('ws.id') . ' = ' . $query->quoteName('wa.state_id'));
246+
->innerJoin($query->quoteName('#__workflow_stages', 'ws'))
247+
->where($query->quoteName('ws.id') . ' = ' . $query->quoteName('wa.stage_id'));
248248

249249
// Join on voting table
250250
$associationsGroupBy = array(
@@ -275,7 +275,7 @@ protected function getListQuery()
275275
'ws.title',
276276
'ws.workflow_id',
277277
'ws.condition',
278-
'wa.state_id'
278+
'wa.stage_id'
279279
);
280280

281281
if (PluginHelper::isEnabled('content', 'vote'))
@@ -323,7 +323,7 @@ protected function getListQuery()
323323

324324
if (is_numeric($workflowState))
325325
{
326-
$query->where('wa.state_id = ' . (int) $workflowState);
326+
$query->where('wa.stage_id = ' . (int) $workflowState);
327327
}
328328

329329
$condition = (string) $this->getState('filter.condition');
@@ -484,7 +484,7 @@ public function getTransitions()
484484

485485
$items = $this->getItems();
486486

487-
$ids = ArrayHelper::getColumn($items, 'state_id');
487+
$ids = ArrayHelper::getColumn($items, 'stage_id');
488488
$ids = ArrayHelper::toInteger($ids);
489489
$ids = array_unique(array_filter($ids));
490490

@@ -504,8 +504,8 @@ public function getTransitions()
504504
array(
505505
't.id',
506506
't.title',
507-
't.from_state_id',
508-
't.to_state_id',
507+
't.from_stage_id',
508+
't.to_stage_id',
509509
's.id',
510510
's.title',
511511
's.condition',
@@ -514,19 +514,19 @@ public function getTransitions()
514514
array(
515515
'value',
516516
'text',
517-
'from_state_id',
518-
'to_state_id',
519-
'state_id',
520-
'state_title',
521-
'state_condition',
517+
'from_stage_id',
518+
'to_stage_id',
519+
'stage_id',
520+
'stage_title',
521+
'stage_condition',
522522
'workflow_id'
523523
)
524524
);
525525

526526
$query->select($select)
527527
->from($db->quoteName('#__workflow_transitions', 't'))
528-
->leftJoin($db->quoteName('#__workflow_states', 's') . ' ON ' . $db->quoteName('t.from_state_id') . ' IN(' . implode(',', $ids) . ')')
529-
->where($db->quoteName('t.to_state_id') . ' = ' . $db->quoteName('s.id'))
528+
->leftJoin($db->quoteName('#__workflow_stages', 's') . ' ON ' . $db->quoteName('t.from_stage_id') . ' IN(' . implode(',', $ids) . ')')
529+
->where($db->quoteName('t.to_stage_id') . ' = ' . $db->quoteName('s.id'))
530530
->where($db->quoteName('t.published') . ' = 1')
531531
->where($db->quoteName('s.published') . ' = 1')
532532
->order($db->quoteName('t.ordering'));
@@ -544,7 +544,7 @@ public function getTransitions()
544544
else
545545
{
546546
// Update the transition text with final state value
547-
$conditionName = $workflow->getConditionName($transition['state_condition']);
547+
$conditionName = $workflow->getConditionName($transition['stage_condition']);
548548

549549
$transitions[$key]['text'] .= ' [' . \JText::_($conditionName) . ']';
550550
}

administrator/components/com_content/Model/FeaturedModel.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected function getListQuery()
114114
->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
115115

116116
// Join over the states.
117-
$query->select('wa.state_id AS state_id')
117+
$query->select('wa.stage_id AS stage_id')
118118
->join('LEFT', '#__workflow_associations AS wa ON wa.item_id = a.id');
119119

120120
// Join over the states.
@@ -126,14 +126,14 @@ protected function getListQuery()
126126
'ws.workflow_id'
127127
],
128128
[
129-
'state_title',
130-
'state_condition',
129+
'stage_title',
130+
'stage_condition',
131131
'workflow_id'
132132
]
133133
)
134134
)
135-
->innerJoin($query->quoteName('#__workflow_states', 'ws'))
136-
->where($query->quoteName('ws.id') . ' = ' . $query->quoteName('wa.state_id'));
135+
->innerJoin($query->quoteName('#__workflow_stages', 'ws'))
136+
->where($query->quoteName('ws.id') . ' = ' . $query->quoteName('wa.stage_id'));
137137

138138
// Join on voting table
139139
if (PluginHelper::isEnabled('content', 'vote'))
@@ -161,7 +161,7 @@ protected function getListQuery()
161161

162162
if (is_numeric($workflowState))
163163
{
164-
$query->where('wa.state_id = ' . (int) $workflowState);
164+
$query->where('wa.stage_id = ' . (int) $workflowState);
165165
}
166166

167167
$condition = (string) $this->getState('filter.condition');

administrator/components/com_content/tmpl/articles/default.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@
157157
$canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId;
158158
$canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin;
159159

160-
$transitions = ContentHelper::filterTransitions($this->transitions, $item->state_id, $item->workflow_id);
160+
$transitions = ContentHelper::filterTransitions($this->transitions, $item->stage_id, $item->workflow_id);
161161

162162
$hasTransitions = count($transitions) > 0;
163163

164164
$default = [
165-
JHtml::_('select.option', '', $this->escape($item->state_title)),
165+
JHtml::_('select.option', '', $this->escape($item->stage_title)),
166166
JHtml::_('select.option', '-1', '--------', ['disable' => true])
167167
];
168168

@@ -200,7 +200,7 @@
200200

201201
$icon = 'publish';
202202

203-
switch ($item->state_condition) :
203+
switch ($item->stage_condition) :
204204

205205
case Workflow::TRASHED:
206206
$icon = 'trash';
@@ -220,7 +220,7 @@
220220
<span class="icon-<?php echo $icon; ?>"></span>
221221
<?php endif; ?>
222222
</div>
223-
<div class="mr-auto"><?php echo $this->escape($item->state_title); ?></div>
223+
<div class="mr-auto"><?php echo $this->escape($item->stage_title); ?></div>
224224
<?php if ($hasTransitions) : ?>
225225
<div class="d-none">
226226
<?php

administrator/components/com_content/tmpl/articles/default_batch_body.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<div class="controls">
4747
<?php
4848
$displayData = ['extension' => 'com_content'];
49-
echo JLayoutHelper::render('joomla.html.batch.workflowstate', $displayData); ?>
49+
echo JLayoutHelper::render('joomla.html.batch.workflowstage', $displayData); ?>
5050
</div>
5151
</div>
5252
<?php endif; ?>

administrator/components/com_content/tmpl/articles/default_batch_footer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
document.getElementById('batch-language-id').value = '';
2020
document.getElementById('batch-user-id').value = '';
2121
document.getElementById('batch-tag-id').value = '';
22-
document.getElementById('batch-workflowstate-id').value = '';
22+
document.getElementById('batch-workflowstage-id').value = '';
2323
});
2424
");
2525

administrator/components/com_content/tmpl/featured/default.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@
138138
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
139139
$canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin;
140140

141-
$transitions = ContentHelper::filterTransitions($this->transitions, $item->state_id, $item->workflow_id);
141+
$transitions = ContentHelper::filterTransitions($this->transitions, $item->stage_id, $item->workflow_id);
142142

143143
$hasTransitions = count($transitions) > 0;
144144

145145
$default = [
146-
JHtml::_('select.option', '', $this->escape($item->state_title)),
146+
JHtml::_('select.option', '', $this->escape($item->stage_title)),
147147
JHtml::_('select.option', '-1', '--------', ['disable' => true])
148148
];
149149

@@ -182,7 +182,7 @@
182182

183183
$icon = 'publish';
184184

185-
switch ($item->state_condition) :
185+
switch ($item->stage_condition) :
186186

187187
case Workflow::TRASHED:
188188
$icon = 'trash';
@@ -202,7 +202,7 @@
202202
<span class="icon-<?php echo $icon; ?>"></span>
203203
<?php endif; ?>
204204
</div>
205-
<div class="mr-auto"><?php echo $this->escape($item->state_title); ?></div>
205+
<div class="mr-auto"><?php echo $this->escape($item->stage_title); ?></div>
206206
<?php if ($hasTransitions) : ?>
207207
<div class="d-none">
208208
<?php

0 commit comments

Comments
 (0)