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

Added Article count (published, unpublished, trashed) to Category Man… #6916

Closed
wants to merge 15 commits into from
Closed

Added Article count (published, unpublished, trashed) to Category Man… #6916

wants to merge 15 commits into from

Conversation

pe7er
Copy link
Contributor

@pe7er pe7er commented May 10, 2015

…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.

Testing instruction

Test before Patch

The Category Manager shows the Categories but does not show number of articles in those categories.
(in back-end: Content > Category Manager)
screen shot 2015-05-10 at 07 06 04

Test after applying Patch

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.
screen shot 2015-05-10 at 07 06 04

Test the Category Manager with other core components

The Category Manager should not show those columns & numbers for other components. Eg. check the "Category Manager: Contacts" (Components > Contacts > Categories)
screen shot 2015-05-10 at 07 06 03

@joomla-cms-bot joomla-cms-bot added the Language Change This is for Translators label May 10, 2015
@brianteeman
Copy link
Contributor

Doesnt this require an update for the hathor template overrided

On 10 May 2015 at 12:46, Peter Martin notifications@github.com wrote:

…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.

[Testing instruction will follow soon...]

You can view, comment on, or merge this pull request online at:

#6916
Commit Summary

  • Added Article count (published, unpublished, trashed) to Category
    Manager for com_content component.

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#6916.

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

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.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@zero-24
Copy link
Member

zero-24 commented May 10, 2015

@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 😄

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

Oops... Thanks, I'll do that later...

(reminder to myself: reconfigure PHPStorm to use real tabs)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@zero-24
Copy link
Member

zero-24 commented May 10, 2015

@test @pe7er can you also center the values else we get something like this:
center_categors

@brianteeman
Copy link
Contributor

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/

@zero-24
Copy link
Member

zero-24 commented May 10, 2015

Just one bug more on mobile it looks bad as we have the icons but not the values see:
counts_on_phone

@brianteeman
Copy link
Contributor

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/

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

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.
  1. You are only showing 3 of the 4 states

@brianteeman
Copy link
Contributor

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.

    1. You are only showing 3 of the 4 states


Reply to this email directly or view it on GitHub
#6916 (comment).

@Bakual
Copy link
Contributor

Bakual commented May 10, 2015

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?

@Bakual
Copy link
Contributor

Bakual commented May 10, 2015

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?

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

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!!!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@dgrammatiko
Copy link
Contributor

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!

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

I'm working on all the feedback and will even implement some extra functionality + better layout very soon...


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@brianteeman
Copy link
Contributor

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 ;)

@ghost
Copy link

ghost commented May 10, 2015

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.

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

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.

New version:
screen shot 2015-05-10 at 12 16 30


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@dgrammatiko
Copy link
Contributor

How about
screen shot 2015-05-10 at 8 24 59

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

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

Ok, makes sense about "Archive.
I have:

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

@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.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

@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.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@pe7er
Copy link
Contributor Author

pe7er commented May 10, 2015

Mhh. sorry Travis... my code failed :-(

I'll correct it soon, but some other time.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@pe7er
Copy link
Contributor Author

pe7er commented May 14, 2015

I've fixed the undefined constant notice + footer td colspan.
Thanks for spotting those @losedk !

@pe7er
Copy link
Contributor Author

pe7er commented May 14, 2015

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.

@pe7er
Copy link
Contributor Author

pe7er commented May 14, 2015

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

@Bakual
Copy link
Contributor

Bakual commented May 14, 2015

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.

@hans2103
Copy link
Contributor

@test succes

Tested both desktop and mobile.
Looks great.
Useful PR for doing housecleaning and detecting empty categories.

@woluweb
Copy link

woluweb commented May 19, 2015

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)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@tecpromotion
Copy link
Contributor

tested successfully. #jab15


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

@zero-24 zero-24 added the RTC This Pull Request is Ready To Commit label May 31, 2015
@Bakual Bakual added this to the Joomla! 3.5.0 milestone Jun 3, 2015
Bakual pushed a commit that referenced this pull request Jun 3, 2015
@Bakual
Copy link
Contributor

Bakual commented Jun 3, 2015

Merged with c57e644 into 3.5-dev.
Solved a small merge conflict on the way.

Thanks!

@Bakual Bakual closed this Jun 3, 2015
@zero-24 zero-24 removed the RTC This Pull Request is Ready To Commit label Oct 14, 2015
@infograf768
Copy link
Member

@pe7er @Bakual
In Hathor, we get the Notices as explained above:
#6916 (comment)

screen shot 2015-11-03 at 07 54 23

This needs correcting or going back in Hathor to the former display.

@infograf768
Copy link
Member

Found the culprit, now making a PR

@infograf768
Copy link
Member

See PR here: #8254

@pe7er pe7er deleted the category-manager-article-count branch November 5, 2015 00:08
@Wertos
Copy link

Wertos commented Mar 12, 2016

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?

@roland-d
Copy link
Contributor

@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?

@wilsonge
Copy link
Contributor

@Wertos @roland-d can you guys please open a new issue for this so I can keep track of it please - nearly missed this tucked away in an old issue. Thanks!

@pe7er
Copy link
Contributor Author

pe7er commented Mar 14, 2016

@Wertos Thanks for reporting this issue.
@roland-d I'll try to look at this issue at the end of this week.

@brianteeman
Copy link
Contributor

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/

@brianteeman
Copy link
Contributor

@pe7er @Wertos @roland-d please see #9420 and continue the discussion there and not on this closed issue


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6916.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Language Change This is for Translators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet