Not sure if anybody needs it, I was missing that option for a while.
Screnshot and patch are attached.

Comments

Status: Needs review » Needs work

The last submitted patch, nmbr_of_items.patch, failed testing.

juliangb’s picture

Title: number of notes, tasks, tickets and timetrackings per project » Show number of notes, tasks, tickets and timetrackings per project on icon links

Hi @ronline,

I think this could be a useful feature.

A couple of suggestions based on a very quick look at the screenshot and patch:

- Would it be neater to include the number in the existing text?

Notes (5) +
Tasks (17) +
etc...

- What does the code do in terms of access? If as a user, I don't have access to some of the tasks, does it show the total that I can access, or the total in the system?

ronline’s picture

Assigned: Unassigned » ronline
StatusFileSize
new2.86 KB

Great !! Yep include it into release!
I moved the number into the text, patch is attached.
The code is not checking the user access level, it is showing the total number in the system.
We can write down requirements to add setting options for admin/settings/storm.

juliangb’s picture

Status: Needs work » Needs review

Setting to "Needs Review" so that the patch is automatically tested.

Status: Needs review » Needs work

The last submitted patch, nmbr_intext.patch, failed testing.

juliangb’s picture

OK - a couple of points on this - firstly the tests need to pass!

Also, I think that we should check the user access. Otherwise there will be an odd situation when the user sees a number of tasks/tickets, but may not see all of those when clicking the link.

ronline’s picture

Status: Needs work » Needs review
StatusFileSize
new4.56 KB

User with administrative access level see number of all existing tasks, tickets, notes and timetrackings.

Authenticated user doesn't see anything till admin doesn't set permissions in admin/user/permissions as following:
Stormtask module: Storm task: access, Storm task: view if assigned to task
Stormticket module: Storm ticket: access, Storm ticket: view if assigned to ticket
Stromtimetracking module: Storm timetracking: access, Storm timetracking: add, Storm timetracking: view own
Stormnote module: Storm note: access, Storm note: add, Storm note: view own

After that will authenticated user see the number of task and tickets he's assigned to and number of notes and timtrackings he's created.

juliangb’s picture

Status: Needs review » Needs work

I think a better way to check the access will be to pass the SQL queries through stormtask_access_sql() before executing (or a similar function for each storm module).

kfritsche’s picture

Status: Needs work » Needs review
StatusFileSize
new4.56 KB

I like this idea, so I reviewed the patch too and fixed some issues.
Here the changes i made:

  • Fixed code ident
  • Moved count function to storm.module because it is not a theme function, its a helper function
  • Renamed function to _storm_number_of_items to prevent function name collisions
  • Added use of storm*_access_sql()
  • Added theme function for number_counts, so everyone can change it, how they like it. Also added a span there, for better CSS control
  • Added {}-Brackets in the query, so it works with table prefixes
  • Works now for all source modules, not only for projects

New Patch attached.

kfritsche’s picture

StatusFileSize
new5.78 KB

oO
attached old patch from ronline, sorry for that.

ronline’s picture

Status: Needs review » Needs work

I've tested the patch. All works fine till line 238, then is the number of items getting lost in function theme_storm_number_items. The function is not being executed. I've tried anything hard written return, die(), var_dump ....

kfritsche’s picture

Have you cleared your theme cache, after applying this patch?
It add a new theme function, so you must clear your theme cache, otherwise drupal won't find this theme function and nothing happens. You can do this at http://domain.com/admin/settings/performance, there is a cache clear button.
Sometimes I hate Drupal for this behavior, why the hell issn't there a error, when a theme function is called, that doesn't exists!

ronline’s picture

Yep it was in the cache.
Sorry about false alert.

kfritsche’s picture

Status: Needs work » Reviewed & tested by the community

no problem, glad to help.
so i assume it works for you now, too?
setting this to reviewed & tested by community.
I will commit this later this week.

ronline’s picture

Status: Reviewed & tested by the community » Needs review

Yep work nice now.
Will post a report if I spot anything.
Thx for the hand.

kfritsche’s picture

Status: Needs review » Fixed

commited to 2.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.