In issue http://drupal.org/node/4354 we've discussed ways to allow selecting from multiple users to assign issues to. We've talked about a new hook, but using form_alter mightmake more sense.
Here's a rough, completely untested (I don't have a cvs.module install with data) idea of how we'd do this. We introduce a new helper function, cvs_is_project_maintainer(), used to determine if a user is a maintainer of a given project. If so, we form_alter the options of the 'assigned' select on project issues.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | cvs-assignees.patch.1 | 3.54 KB | dww |
| #1 | cvslog-assignees.patch | 2.23 KB | nedjo |
Comments
Comment #1
nedjoAttachment.
Comment #2
dwwunfortunately, this doesn't work at all. ;)
$form['#node']is the *issue* node, not the project node. furthermore, there's no nid yet, since we're in the process of creating the node.$form['#node'], since followups aren't nodescvs access to the project, so we need an additional query in there.
even once you solve these problems, things are still wonky. for example, we always array_merge() the maintainers list, even if one of the maintainers is already assigned the issue. it seems we need to filter out duplicates after that array merge. but you can't just use array_unique() in there since that destroys all the array keys. :(
ugh, this is turning into a huge timesink, and i have no more time. i'll post the current "working" copy i have while i was defeating the numbered points above, but it definitely still needs work. the duplicate values are still unresolved in here. futhermore, my hack solution to #3 is to look directly in $_POST. there might be some crazy way to do this via pre_render() or something, and get the currently selected value out of the form that way, but i don't have time to keep working on this now...
i'd love to get this working, but i don't see that happening before i leave town.
i'm starting to think the hook approach might be more simple, too. this form_alter() stuff is kind of a mess, once you really have to start getting it working. ;) if it was just a hook, project could do a single pass to filter out dups, sort the final list, etc, instead of having everyone trying to do that in their own form_alter()... just a thought.
Comment #3
dwwanother approach: http://drupal.org/node/69556
Comment #4
dwwThis used to work via code in drupalorg.module (added at #253825: Allow project co-maintainers to assign issues to each other). However, something during the d.o upgrade to D6 broke that code. Instead of fixing it there, we should just move it directly into cvs.module so cvs.module will be the one to implement hook_project_issue_assignees().
Comment #5
pasquallesubscribe
Comment #6
dwwFixed, tested, committed (and removed from drupalorg.module) and deployed on d.o.