Allow project maintainers to assign issues to each other
nedjo - June 4, 2006 - 23:38
| Project: | CVS integration |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | nedjo |
| Status: | patch (code needs work) |
Description
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.

#1
Attachment.
#2
unfortunately, 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.
#3
another approach: http://drupal.org/node/69556