Closed (fixed)
Project:
Project issue tracking
Version:
5.x-2.x-dev
Component:
Comments
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 Dec 2007 at 01:09 UTC
Updated:
3 Feb 2008 at 00:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
dwwBetter title -- these attributes aren't just for comments.
Comment #2
aclight commentedThis patch combines the two functions into one and calls it project_issue_field_labels()
Comment #3
dwwThanks.
Argh, I didn't notice at first it was 2 separate sets of attributes. That's too bad. :( Makes it seem like this isn't such a clear win of a patch, after all... At least it's all in 1 place now, so that's a little better for defensive programming. Also, perhaps we could do something like this to share more of the code:
Oh, crap, except I guess that'd alter the order in which the meta data changes show up in the various places. Ugh. :( So, I guess we'd have to do funkier array operations to get this right without changing the order, or, learn to love the new order. ;) Honestly, I don't think the order is that important, anyway.
But, I'm torn about this issue. Part of me thinks that, as ugly as the original code is, perhaps it's just not worth fixing it. @hunmonk: any opinions?
Comment #4
hunmonk commentedhow about this approach? small reorganization, but should still be fine.
Comment #5
dwwYeah, that seems ok, that's pretty much the fancy array manipulation I had in mind.
However, now that I look at it, it's not clear why this function is in comment.inc. I guess it's all going to get re-organized in the D6 port anyway, but it'd still be nice if we're going to be changing this anyway, to put it somewhere more appropriate. How about issue.inc or perhaps just project_issue.module itself?
And, is 'table' really the best name for an 'operation' we're passing to this function? Sorry to nit pick. ;) But, the issue is about cleaning up a mess, I'd rather we were tidy about it when we do...
Thanks all,
-Derek
Comment #6
aclight commentedI think hunmonk's patch needs an extra '=' here:
I don't really think that it matters much where we put this, you could make an argument probably for any of those places.
As for debating whether 'table' is the best, maybe not, but I can't think of a better alternative off the top of my head.
It's silly to keep rerolling this for minor changes like that, however, so we should decide with a name and location for the function first.
It might be helpful to actually have this function return a more detailed array such as:
The reason I suggest this is that with the other comment changes patch, I'm building in a new hook that allows other modules (such as the upcoming comment_taxonomy module) to add to the changes array. It might be a little easier if we just dumped everything in the changes array at first and then sorted the array by weight (though I'm not sure how easy PHP makes it to sort by an element in a nested array like this).
Just an idea.
Comment #7
dwwUgh, sorry for the delay replying. My current thoughts:
- this new function should be in issue.inc
- the '$op' argument should be renamed '$context'
- the 2 supported values should be 'email' and 'web'
I don't fully understand the nested array thing. You just want to to able to sort by the weight field when we add other attributes which need their own labels, right? I guess that's a good idea. Someday we could even expose an admin UI to tweak these weights instead of having them all hard-coded. Sorting on a nested attribute like this is pretty easy in PHP, you just need to use uasort() and define your own sorting function that knows how to find the nested field you want to sort on. I just added code like this to update.module in core:
http://api.drupal.org/api/function/update_requirements/6
http://api.drupal.org/api/function/_update_project_status_sort/6
http://php.net/uasort
However, if we do that, the call sites are going to get more complicated here, too. And, if the only reason is to allow flexible ordering, I'm not sure it's really worth the trouble. ;) So, I think we could live without, at least in here. If, in the diff/hook patch, we need to reconsider, we can do it there.
Thanks,
-Derek
Comment #8
hunmonk commentedimplemented dww's suggestions from above, and skipped the whole array thing for now. we can incorporate that later if there's a perceived need.
Comment #9
dwwRerolled for 2 problems:
A) You forget the "return $labels;" at the end of the function. ;)
B) Code style:
} else {Tested the web context, seems to be fine. Didn't test email yet. Probably RTBC.
Comment #10
aclight commentedI tested this with both emails and the tables on the issues themselves and all seems to be fine.
Comment #11
dwwYay, committed to HEAD, then. Thanks everyone.
Comment #12
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.