User tests: Successful: Unsuccessful:
…ager for com_content component.
In Joomla 1.5 the Category Manager showed the number of published, unpublished and trashed articles per category. Since than the Category Manager has been improved to be more generic and is used in all core components. You can even use it in your own component. However, because it's more generic, it does not show the counter anymore.
This PR adds the number of published, unpublished and trashed articles in the Category Manager for the Articles only.
The Category Manager shows the Categories but does not show number of articles in those categories.
(in back-end: Content > Category Manager)
Install the patch via Patch Tester Component. In Article Manager, unpublish a couple of articles & trash a couple of articles. Go to Category Manager (Content > Category Manager). The Category Manager should show 3 new columns with the numbers of published, unpublished and trashed articles per category.
The Category Manager should not show those columns & numbers for other components. Eg. check the "Category Manager: Contacts" (Components > Contacts > Categories)
Labels |
Added:
?
|
Labels |
Added:
?
|
Labels |
Added:
?
|
Labels |
Added:
?
|
Category | ⇒ | Administration UI/UX |
Status | New | ⇒ | Pending |
Yes, thanks, you are right about that.
Could you please test this PR with the default Isis template?
If there are no errors then I will write and add a fix for the Hathor template override.
@pe7er can you try to fix the Travis errors?
FILE: ...oomla-cms/administrator/components/com_categories/models/categories.php
--------------------------------------------------------------------------------
FOUND 12 ERROR(S) AFFECTING 12 LINE(S)
--------------------------------------------------------------------------------
279 | ERROR | Tabs must be used to indent lines; spaces are not allowed
280 | ERROR | Tabs must be used to indent lines; spaces are not allowed
281 | ERROR | Tabs must be used to indent lines; spaces are not allowed
282 | ERROR | Tabs must be used to indent lines; spaces are not allowed
283 | ERROR | Tabs must be used to indent lines; spaces are not allowed
284 | ERROR | Tabs must be used to indent lines; spaces are not allowed
286 | ERROR | Tabs must be used to indent lines; spaces are not allowed
287 | ERROR | Tabs must be used to indent lines; spaces are not allowed
289 | ERROR | Tabs must be used to indent lines; spaces are not allowed
290 | ERROR | Tabs must be used to indent lines; spaces are not allowed
292 | ERROR | Tabs must be used to indent lines; spaces are not allowed
293 | ERROR | Tabs must be used to indent lines; spaces are not allowed
--------------------------------------------------------------------------------
UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY
--------------------------------------------------------------------------------
and agline the new code into the views? If you would i can do a PR against yours
Oops... Thanks, I'll do that later...
(reminder to myself: reconfigure PHPStorm to use real tabs)
I would prefer them all to be left aligned. BUT whatever you do it should
be consistent with the th and the td
On 10 May 2015 at 13:26, zero-24 notifications@github.com wrote:
@test https://github.com/test @pe7er https://github.com/pe7er can you
also center the values else we get something like this:
[image: center_categors]
https://cloud.githubusercontent.com/assets/2596554/7554255/911c23ae-f720-11e4-8ff9-3b0c27ce342e.PNG—
Reply to this email directly or view it on GitHub
#6916 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
Not sure I understand why
1) You are only doing this for com_content
2) You are only showing 3 of the 4 states
On 10 May 2015 at 13:29, zero-24 notifications@github.com wrote:
Just one bug more on mobile it looks bad as we have the icons but not the
values see:
[image: counts_on_phone]
https://cloud.githubusercontent.com/assets/2596554/7554265/def36416-f720-11e4-8764-cef34439bed3.PNG—
Reply to this email directly or view it on GitHub
#6916 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
Thank you both for all feedback!
1) You are only doing this for com_content
2) You are only showing 3 of the 4 states
The Category Manager component can be used in 3rd party extensions as
well, but there you cannot add these fields.
Really?
On 10 May 2015 14:59, "Peter Martin" notifications@github.com wrote:
Thank you both for all feedback!
1) You are only doing this for com_content
- com_content is the most important component in the CMS.
- It's possible to do it for all core components but you'll need a lot of extra code & checks
- The Category Manager component can be used in 3rd party extensions as well, but there you cannot add these fields.
Someone here at Joomladay France asked me about it. He used this
feature in the past in J1.5 a lot and missed it in 3.x.2) You are only showing 3 of the 4 states
- I did not want to show too much information and IMHO "Archived" is less important than the other 3 states.
- The Menu Manager shows these 3 states too. Menus > Menu Manager.
This comment was created with the J!Tracker Application
https://github.com/joomla/jissues at
issues.joomla.org/joomla-cms/6916
http://issues.joomla.org/tracker/joomla-cms/6916.—
Reply to this email directly or view it on GitHub
#6916 (comment).
I don't like com_content specific checks in com_categories.
It should instead be done in a way which works for other extensions as well.
There is already a category helper which defines the respective table and state field for a component. Maybe that could be used to get the counts?
Also you may want to check the space used for that information. There is a lengthy title for only a number, which in the end cuts down space for the (much more important) title. Maybe just the icon as title would be sufficient? Or some UI guy has a clever idea?
The Category Manager component can be used in 3rd party extensions as
well, but there you cannot add these fields.Really?
Yeah, change
/administrator/index.php?option=com_categories&extension=com_content
to
/administrator/index.php?option=com_categories&extension=com_messages
to see that you can trigger the Messaging component with "Category Manager". You can create categories for your Messages, but as the Message items do not have a catid, the categories will be useless for the messages.
This feature is very nice and can be used in your own custom components!!!
I like this change. About a possible lengthy title: One solution could be, the that holds the title to have two lines so the information Alias span to a new line. Also word-wrap: break-word;
could be handy here.
As mentioned before mobile hidden and placement of the td’s needs some work.
But for the idea!
I'm working on all the feedback and will even implement some extra functionality + better layout very soon...
to see that you can trigger the Messaging component with "Category Manager". You can create categories for your Messages, but as the Message items do not have a catid, the categories will be useless for the messages.
Actually you cant create them as there is no ability ti save the category ;)
I did not want to show too much information and IMHO "Archived" is less important than the other 3 states.
Sorry, why? Just because you don't use this status? ;-)
The Menu Manager shows these 3 states too. Menus > Menu Manager.
Yes, but just because you cannot archive menu items.
I've made some changes in the Category Manager:
now the counted Articles per Category have different colors & are hyperlinked to the Article Manager,
and the right filters are set: Category (+ level) + state.
change line 159 to p
add a class alias before class small
add css to alias margin: 2px 0 -7px;
Alias can be as lengthy as the title and for languages like German with very long words this can be a problem.
This proposal needs review because if it gets accepted we have to adjust all the views in isis
Labels |
Added:
?
|
Labels |
Added:
?
|
Ok, makes sense about "Archive.
I have:
@dgt41 Thanks for your feedback.
I agree about the aliases. However, in your screenshot there are no multiple level sub categories. I've to check how it looks to put the alias on the next line with the sub categories.
@Bakual I agree with you that it's not so nice to have com_content specific checks in com_categories.
If (3rd party) components would be able to add their own count using a helper file that works together with com_categories, then it would be much better...
I'll check out your suggestion some other time soon.
Mhh. sorry Travis... my code failed :-(
I'll correct it soon, but some other time.
I've added titles to the hyperlinks under the counters (and changed the language file),
changed column width to 1% because I did not like the layout on a large screen
and added the Article Count to the Hathor template override.
I hope that some people are willing to test this current version.
Meanwhile I will look into JCategories to see if I can make this functionality more generic so that other components can use this feature too.
The Category Manager + 4 new columns in Hathor Template:
Hi Martin,
I really like this new feature of article counter in the Category Manager. There was indeed no way to have any overview of the # of articles, be it via the Article Manager or the Category Manager.
Convey my regards to the person who suggested this RFC during that chat with you ;-)
Besides this, I have installed the patch and have already quickly tested (I go on with testing later this week).
So here is the result of my partial test.
1. First I went to catagory Manager
It is great !
The click on any counter leads correctly to article manager with the corresponding filters activated
NB : url is http://localhost/_debugging/6916/administrator/index.php?option=com_categories&extension=com_content
Note that, in these three cases, clicking after that on the link "Categories" which is on the left sidebar (cf articles/catagories/featured) leads again to the good layout, with the news columns.
And of course, clicking on the menu Content > Category manager is another way to get back to the new good layout with the three new columns.
This is my very first testing in Joomla, I hope I have been precise enough
Txs for taking the time for this RFC !
I keep you posted as soon as I have done more.
Hi,
Here is a screenshot to illustrate my comment
Thank you for your test report & description how to reproduce it! I was able to reproduce your findings.
At the moment I check for the com_content component via the URL.
After selecting a filter, the com_content is removed from the URL, hence this behavior.
I've to correct that.
btw: it's Mr Martin, or Peter, but I prefer Peter...
I've changed the internal check for com_content from checking via Juri (via URL) to Jinput (checking Requests via URL & Form Input) to solve the issue @woluweb described.
Now the 4 Count Columns will also be displayed after using the filters or order options.
Hum hum, sorry for calling you "Martin" instead of "Pe7er" (I just don't know if I should pronounce it 'pezevener' ;-)
Was a bit tired yesterday evening after the JoomlaDays. But still I wanted to give the feedback asap !
I have tested the very latest version.
I do confirm : the problems I mentionned are totally solved.
I have then tried to be vicious and to find some other weird behaviour, without success
For example :
The only think (I think of) which could yet be tested is the more generic version of Category Manager.
Just tell me how to test on that when it's ready and I will be pleased to do so.
Txs for the good & quick work !
Good to hear that you did not find any other issues.
I'm still looking for a way to make this PR more generic so that other (core & 3rd party) components can use it to show the number of their own component items in the Category Manager.
Thanks for testing & your report Marc!
Hi Peter, I did a quick look :-)
1st question why not grouping over the state so you have this part generic
with that in mind you could provide an array with the mapping stateText to value
then you need the table to join (can be an inner then)
and maybe the join fields (if someone thinks names the catid as category_id is a good idea)
so it is only one join more and you can grap this one over a helper function you have anyway for the menu
in categories you check if function_exists, call the function with the query object and get the query with the join more back
One thing you have to do when group by state is that have to foreach to the results to merge the rows, but that is easy going
Thank you Robert!
I am currently working on an extra helper file that you can include with every Component to extend the query object with the SQL item count.
I've made a generic solution that checks if a component has a helper file called countitems.php
In countitems.php the extra count queries are stored.
This PR only adds the Article Counters to the Categories of com_content.
Tested again everything already mentionned above (except Hathor, too painful for the eyes).
Still works fine within com_content.
Is there any test that should be conducted for other components ?
Great! Thanks for testing.
I'll create separate PRs for the different core components: com_banners, com_contact, com_newsfeeds.
I'm getting a bunch of notices:
Notice: Use of undefined constant count_published - assumed 'count_published' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 66
Notice: Use of undefined constant count_unpublished - assumed 'count_unpublished' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 71
Notice: Use of undefined constant count_archived - assumed 'count_archived' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 76
Notice: Use of undefined constant count_trashed - assumed 'count_trashed' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 81
Notice: Use of undefined constant count_published - assumed 'count_published' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 189
Notice: Use of undefined constant count_unpublished - assumed 'count_unpublished' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 195
Notice: Use of undefined constant count_archived - assumed 'count_archived' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 201
Notice: Use of undefined constant count_trashed - assumed 'count_trashed' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 207
Notice: Use of undefined constant count_published - assumed 'count_published' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 189
Notice: Use of undefined constant count_unpublished - assumed 'count_unpublished' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 195
Notice: Use of undefined constant count_archived - assumed 'count_archived' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 201
Notice: Use of undefined constant count_trashed - assumed 'count_trashed' in /Applications/AMPPS/www/joomla-cms/administrator/components/com_categories/views/categories/tmpl/default.php on line 207
Furthermore the footer td colspan should be updated:
Did you try with a query like
SELECT `catid`, `state`, count(1) FROM `d1y5s_content` GROUP BY `catid`, `state`
That should give you a resultset grouped by category and state with counts for each of them. You don't even need joins for that. But maybe I miss something.
Also I wouldn't create a new helper file for that. And certainly don't extend JHelperContent since we don't use anything from there.
I would still try to use JCategories and add a generic count method to it (or a specific to the helper).
With JCategories::getInstance($extension)
you fetch the JCategories object which already loads the category helper file. The helper file has the table and state field defined in the constructor which is basically all the information we need to fetch the numbers. No need to duplicate that elsewhere.
The query
SELECT `catid`, `state`, count(1) FROM `d1y5s_content` GROUP BY `catid`, `state`
works excellent, @Bakual! It gives all catids + state (or use published if your table uses that) + number of items.
We need to display the numbers in the Categories View. It can be accomplished with some lookup in an array/object for each td field (and if not present, display a 0).
As I need the numbers (including 0) in the records of the categories anyway, I think that my SQL is easier. E.g. if a table (eg com_content) does not have any Archived items, the column with "0" values will be displayed.
However, if your SQL improves the performance (and lookup in the object is faster) then I think we should change that SQL to your suggestion.
Ok, thank you all for all feedback!
I have got rid of the extra helper file and moved the SQL to the existing helper file of the component that uses the Category Manager to list its Categories (Thanks @roland-d for your help!)
I've also created/updated separate PRs for
com_banners #6934
com_contact #6938
com_newsfeeds #6936
However, if your SQL improves the performance (and lookup in the object is faster) then I think we should change that SQL to your suggestion.
I'd say a group by should be faster than four joins. But I would have to test it to really verify.
As I need the numbers (including 0) in the records of the categories anyway, I think that my SQL is easier. E.g. if a table (eg com_content) does not have any Archived items, the column with "0" values will be displayed.
That's a good point. Could be tricky to detect which states the extension uses. Your solution is indeed easier for that.
On I have tested further : indeed, on issue #6934 (count for BANNERS), I noticed that clicking on "zeros" would still show all banners of the category, no matter their "status".
But apparently, this little bug only occurs for com_banners (works fine for the current RFC com_content, and also for com_contact and com_newsfeed)
tested successfully. #jab15
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Milestone |
Added: |
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-06-03 13:50:02 |
Closed_By | ⇒ | Bakual |
Labels |
Removed:
?
|
@pe7er @Bakual
In Hathor, we get the Notices as explained above:
#6916 (comment)
This needs correcting or going back in Hathor to the former display.
Found the culprit, now making a PR
The site of about 85,000 materials and 100 categories. In the transition to the category management page opens a minute. There is possible to disable counting?
@Wertos There is no clean way at the moment to disable the counting but a quick hack would be to change the name countItems in administrator/components/com_content/helpers/content.php to something else. This is a core-hack and not recommended. @pe7er Perhaps we should add a switch for turning it on/off or find out why it takes so long? Are we missing an index?
I am in the process of building a site with 80,000 in over 1000 categories
for testing - but it is taking a while to generate - 2 hours so far and
only half way there
On 14 March 2016 at 11:58, Peter Martin notifications@github.com wrote:
@Wertos https://github.com/Wertos Thanks for reporting this issue.
@roland-d https://github.com/roland-d I'll try to look at this issue at
the end of this week.—
Reply to this email directly or view it on GitHub
#6916 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
@pe7er @Wertos @roland-d please see #9420 and continue the discussion there and not on this closed issue
Doesnt this require an update for the hathor template overrided
On 10 May 2015 at 12:46, Peter Martin notifications@github.com wrote:
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/