chx and I were discussing in IRC about http://drupal.org/node/144590#comment-652867
One of his ideas was to remove the multipage form entirely, since it adds all kinds of complication.

Basically:
- register our own simple page with a trivial project selector form at node/add/project-issue
- register a node_add() callback at node/add/project-issue/[arg]
- make project_issue_form() a single page form that assumes it knows the project

I've got this mostly working, but I haven't started ripping out all the multi-page form badness yet. Just wanted to post an issue to let the everyone know i'm working on it and it'll be coming soon.

Death to complicated FAPI in project*! ;)

Comments

webchick’s picture

+1 :)

dww’s picture

Status: Active » Needs work
StatusFileSize
new20.9 KB

This patch looks way bigger than it really is: project_issue_form() now requires 1 less nested if(), so everything in that function is indented 2 spaces fewer. Aside from that, all this is doing is:

- Adding the new menu callbacks in project_issue_menu()
- Defining the new page (to set the right title) and form for the project picker (aka "page 1")
- Makes the node form require a valid project in the URL.
- Rip out all the crazy pre_render junk, button swapping, page manipulation, required field toggling, etc.

Seems to be working great, for both new issues and followups, with one exception: now, the JS when you modify a project which updates your choices for component/version is working on initial issue submit and editing issues, but not on comments. ;) So, we've got http://drupal.org/node/197281 in reverse with this patch... However, I think it's both desirable and possible to fix this without the full-blown $node namespace stuff, so I'm posting this now for initial review, testing, and in case anyone wants to track down the specific JS problem. Look in #197281 for more about that.

dww’s picture

Status: Needs work » Needs review

Tee hee, whoops. There's no bug after all, I just wasn't seeing it since I forgot that all the auto-generated projects in the d.o test profile have the same components (something else we should fix). Now that I modified a project with a different list, I see this is all working nicely. Please review/test. ;)

dww’s picture

Bah, the other problem was http://drupal.org/node/199180 ;)

dww’s picture

StatusFileSize
new20.9 KB

hunmonk complained about the bogus drupal_set_message(blah, 'warning'). That's only in this patch b/c of the indentation change, but sure, we can fix that here, too.

dww’s picture

StatusFileSize
new20.98 KB

Oh, and we shouldn't hard-code "Submit Issue", either. We should see what the current title of that content type is and use that.

dww’s picture

StatusFileSize
new21.21 KB

Fixes from hunmonk:
- Removed the ", try again" part of a warning message. ;)
- Consolidated the validation so that non-existing and non-project are both lumped into "invalid project".

Fixes of my own:
- Fixed all the menu problems, so that "Issue" still shows up in the navigation menu
- Fixed the breadcrumbs on "page 2" so it still shows "Create content" as our parent.

The only remaining snag is that once you're on "page 2", the menu no longer thinks "Issue" is the active menu item (since we're really on a different menu item now). I'm not sure what, if anything, we can do about this, nor that I care. Just thought I should mention it.

hunmonk’s picture

Status: Needs review » Reviewed & tested by the community

code looks good. ran some basic tests on creating issues and followups, and everything works fine. IMO, we're not really on the create issue page anymore, so i don't think the non-active item is really a problem.

let's get this puppy in -- it removes one of the ugliest sections of project code we have!

dww’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Yay. I was strongly tempted to backport, but it's not really a bug, just cleaning the code and making it easier to port to D6, so 5.x-2.* is fine.

beginner’s picture

Category: task » bug
Status: Fixed » Active

I just upgraded my test environment.

When I go to node/add/issue, firefox 1.5 stops processing:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

Then, drupal message prints a long list of Invalid project selected.

dww’s picture

Status: Active » Postponed (maintainer needs more info)

reset your menu and try again. e.g., save your admin modules page, or reset your menu via devel.module, etc.

beginner’s picture

Status: Postponed (maintainer needs more info) » Active

I just did (save the module page), and the problem in the same.
I tried with Konqueror and have the same problem:

An error occurred while loading http://127.0.0.1/project_issue/?q=node/add/project-issue:
Found a cyclic link in http://127.0.0.1/project_issue/?q=node/add/project-issue.

I use PHP4, in case it matters.

beginner’s picture

Same problem if I turn off javascript.

I also noticed that just after the upgrade, the breadcrumbs when viewing an issue are wrong. They show home > create content instead of home > projects > project name > issues .
I see that the patch modifies the breadcrumbs so I wonder if it's related.

beginner’s picture

I only experience the problem with user 1

hunmonk’s picture

Status: Active » Postponed (maintainer needs more info)

I also noticed that just after the upgrade, the breadcrumbs when viewing an issue are wrong. They show home > create content instead of home > projects > project name > issues

this change is intended, and not a bug.

have you tried with a fresh install? i've been using user 1, and have not experienced any problems like this.

dww’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new873 bytes

Ok, the breadcrumbs are clearly wrong. I forgot that project_issue_form() is called for comment followups, not just new issues. Attached patch solves it.

As for the other stuff, I'm not seeing any problems.

beginner’s picture

Status: Needs review » Reviewed & tested by the community

The breadcrumbs patch is good.

The other problem is gone. I updated project* and everything works, now. I am surprised because my previous checkout of project_issue was only a few days old.

I apologize for wasting your time.

dww’s picture

Category: bug » task
Status: Reviewed & tested by the community » Fixed

Glad everything's cool. Committed to HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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