Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.2] Indicate if category not published #173

Closed
joomlapl-bot opened this issue Apr 27, 2022 · 0 comments
Closed

[4.2] Indicate if category not published #173

joomlapl-bot opened this issue Apr 27, 2022 · 0 comments

Comments

@joomlapl-bot
Copy link
Collaborator

PR w związku ze zmianą oryginału joomla/joomla-cms#37583 Poniżej zmiany w oryginale:

Click to expand the diff!
diff --git a/administrator/components/com_content/src/Model/ArticlesModel.php b/administrator/components/com_content/src/Model/ArticlesModel.php
index 8c9f46e05874..736ef1e64d81 100644
--- a/administrator/components/com_content/src/Model/ArticlesModel.php
+++ b/administrator/components/com_content/src/Model/ArticlesModel.php
@@ -281,6 +281,7 @@ protected function getListQuery()
 					$db->quoteName('c.title', 'category_title'),
 					$db->quoteName('c.created_user_id', 'category_uid'),
 					$db->quoteName('c.level', 'category_level'),
+					$db->quoteName('c.published', 'category_published'),
 					$db->quoteName('parent.title', 'parent_category_title'),
 					$db->quoteName('parent.id', 'parent_category_id'),
 					$db->quoteName('parent.created_user_id', 'parent_category_uid'),
diff --git a/administrator/components/com_content/tmpl/articles/default.php b/administrator/components/com_content/tmpl/articles/default.php
index 599b0ec92372..b0e353c36719 100644
--- a/administrator/components/com_content/tmpl/articles/default.php
+++ b/administrator/components/com_content/tmpl/articles/default.php
@@ -247,7 +247,8 @@
 									$options = [
 										'task_prefix' => 'articles.',
 										'disabled' => $workflow_state || !$canChange,
-										'id' => 'state-' . $item->id
+										'id' => 'state-' . $item->id,
+										'category_published' => $item->category_published
 									];
 
 									echo (new PublishedButton)->render((int) $item->state, $i, $options, $item->publish_up, $item->publish_down);
@@ -322,6 +323,9 @@
 													echo '</a>';
 												endif;
 											}
+											if ($item->category_published < '1') :
+												echo $item->category_published == '0' ? ' (' . Text::_('JUNPUBLISHED') . ')' : ' (' . Text::_('JTRASHED') . ')';
+											endif;
 											?>
 										</div>
 									</div>
diff --git a/administrator/components/com_content/tmpl/featured/default.php b/administrator/components/com_content/tmpl/featured/default.php
index 5ca431d64fe2..b757ace4a6f8 100644
--- a/administrator/components/com_content/tmpl/featured/default.php
+++ b/administrator/components/com_content/tmpl/featured/default.php
@@ -251,7 +251,8 @@
 									$options = [
 										'task_prefix' => 'articles.',
 										'disabled' => $workflow_state || !$canChange,
-										'id' => 'state-' . $item->id
+										'id' => 'state-' . $item->id,
+										'category_published' => $item->category_published
 									];
 
 									echo (new PublishedButton)->render((int) $item->state, $i, $options, $item->publish_up, $item->publish_down);
@@ -326,6 +327,9 @@
 													echo '</a>';
 												endif;
 											}
+											if ($item->category_published < '1') :
+												echo $item->category_published == '0' ? ' (' . Text::_('JUNPUBLISHED') . ')' : ' (' . Text::_('JTRASHED') . ')';
+											endif;
 											?>
 										</div>
 									</div>
diff --git a/administrator/language/en-GB/lib_joomla.ini b/administrator/language/en-GB/lib_joomla.ini
index a0b9eda76f12..178145886bce 100644
--- a/administrator/language/en-GB/lib_joomla.ini
+++ b/administrator/language/en-GB/lib_joomla.ini
@@ -441,6 +441,8 @@ JLIB_HTML_FEATURED_PENDING_ITEM="Featured, but is Pending."
 JLIB_HTML_FEATURED_STARTED="Start: %s"
 JLIB_HTML_GOTO_PAGE="Go to page %s"
 JLIB_HTML_GOTO_POSITION="Go to %s page"
+JLIB_HTML_ITEM_PUBLISHED_BUT_CATEGORY_TRASHED="Published but the category is trashed."
+JLIB_HTML_ITEM_PUBLISHED_BUT_CATEGORY_UNPUBLISHED="Published but the category is not published."
 JLIB_HTML_MOVE_DOWN="Move Down"
 JLIB_HTML_MOVE_UP="Move Up"
 JLIB_HTML_NO_PARAMETERS_FOR_THIS_ITEM="There are no parameters for this item."
diff --git a/libraries/src/Button/PublishedButton.php b/libraries/src/Button/PublishedButton.php
index 00f0e1b341d8..064e34b0154e 100644
--- a/libraries/src/Button/PublishedButton.php
+++ b/libraries/src/Button/PublishedButton.php
@@ -98,6 +98,23 @@ public function render(?int $value = null, ?int $row = null, array $options = []
 					$options['tip_title'] = Text::_('JLIB_HTML_PUBLISHED_EXPIRED_ITEM');
 					$default['icon'] = 'expired';
 				}
+
+				if (array_key_exists('category_published', $options))
+				{
+					$categoryPublished = $options['category_published'];
+
+					if ($categoryPublished === 0)
+					{
+						$options['tip_title'] = Text::_('JLIB_HTML_ITEM_PUBLISHED_BUT_CATEGORY_UNPUBLISHED');
+						$default['icon'] = 'expired';
+					}
+
+					if ($categoryPublished === -2)
+					{
+						$options['tip_title'] = Text::_('JLIB_HTML_ITEM_PUBLISHED_BUT_CATEGORY_TRASHED');
+						$default['icon'] = 'expired';
+					}
+				}
 			}
 
 			$this->states[$value] = $default;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants