This is a big task for this module, and I guess its a must as project module forms no longer display or function under the current HEAD release. Is anyone planning on working on this? I'll try and help out where I can, but some of the forms look rather complex!

Note that introducing the Form API changes will effects some active patches, notably http://drupal.org/node/32737 and http://drupal.org/node/25362

I've assigned this to the Projects component, although it applies to: project.module, issue.inc, release.inc, project.inc and comment.inc.

Comments

moggy’s picture

I've been practicing on simpler modules. Haven't touched project yet.

It's a bit of a bastard of a change. I hope it makes someone's life easier :s

pfaocle’s picture

Same here, its seems OK although I have had problems with checkboxes. Will take a look over some of the project module files now - it is a required change, isn't it?

moggy’s picture

it is a required change, isn't it

looks like it. there doesn't seem to be any legacy support for it, infact it looks like there isn't going to be any legacy support period.

so, you're going to do this then leafish?

pfaocle’s picture

Well, I've had a look, and its a darn sight more complex than some of the simple modules I've had a go at updating so far, and I'm still having some trouble with those!

Keep an eye out for patches, tho. I may submit some if I'm feeling brave.

pfaocle’s picture

StatusFileSize
new4.35 KB

First brick wall: checkboxes. Can anyone spot why the form checkbox in the attached patch doesn't work? Its either (a) defaulting to the result of variable_get('project_browse_releases', 1), ie 1, or (b) its not saving to the db properly.

I've checked through core modules, and this seems to be the correct syntax for checkboxes...

The next hurdle: form groups and collapsible groups. Anyone know how this is done with new Form API?

Cheers!

pfaocle’s picture

StatusFileSize
new4.62 KB

Ah, not to worry: have sussed form groups, or fieldsets. Revised patch attached for project.module only. Unfortunately, still have the problem with the checkbox.

(ps I've not made the form groups on this settings page collapsible, but its easy to do so. Replace:

$form['project_releases'] = array('#type' => 'fieldset', '#title' => t('Project Releases'));

with:

$form['project_releases'] = array('#type' => 'fieldset', '#title' => t('Project Releases'), '#collapsible' => TRUE, '#collapsed' => FALSE);

dreed47’s picture

I'm having the same problem with checkboxes that you describe. I've got 2 on my form and they are coded identical. The first one saves correctly and the second one does not.

pfaocle’s picture

StatusFileSize
new5.54 KB

Another patch, this time for issue.inc's form hook. This is pretty much a straight-forward search & replace, except I've replaced the old CSS div classes ('standard', 'admin' and 'options' I think) that were used to separate sections of this form with form fieldsets. As a result, the CSS definitions for project module will need changing. The new forms have individual IDs, so that shouldn't be a problem.

One downside of this patch - the two page submission when creating issues no longer works. I'm unsure whether this was due to my changes or a bug present previously. As I said, these replacements are pretty simple. I've also resurrected an old issue on the usability of this 2-stage submission, with JS auto-complete as a possible solution. For now though, if anyone can test this patch and spot why this is not working, that will do us for now.

Apologies for the sporadic nature of these patches, I have limited time to work on this, and it is a whopping task, Please help out by testing my patches, and amending them as we go. Perhaps we'll get one big patch out of the other end.

moggy’s picture

project_settings_page_formapi_r2.patch didn't apply cleanly.

patching file project.module
Hunk #3 FAILED at 248.
Hunk #4 FAILED at 496.
2 out of 4 hunks FAILED -- saving rejects to file project.module.rej

pfaocle’s picture

StatusFileSize
new14.92 KB

Was this because of this? Here's both those patches re-made against the new bunch of UNIX files. Can you test?

pfaocle’s picture

StatusFileSize
new21.5 KB

Another one with some minor changes. Signing off for the night, and I may not be around till next week. If someone wants to test this patch and keep hammering this?

Issues:

  • components field in project.inc isn't working correctly - not storing array variable in database?
  • two-stage 'wizard' issue create form doesn't work properly: the full form is not output (and so fields can't be set) once a project has been selected
  • checkbox on project settings page not saving to db (could be bug elsewhere?)
  • still loads more to do, including the use of some non-hook forms (using drupal_get_form(), now I think) eg issue queries in issue.inc, release editing/management in release.inc

Hopefully the first three are just a result of my blurry eyes, and can be spotted by another pair.

pfaocle’s picture

Status: Active » Fixed

Marking this fixed... see:

* http://drupal.org/cvs?commit=20979
* http://drupal.org/cvs?commit=20986
* other commits listed at http://drupal.org/project/cvs/3281

Kudos and thank yous to hunmonk, webchick and all others involved! Cheers!

webchick’s picture

Status: Fixed » Active

Thanks, Paul! Your code was a great help too! And I can't take too much credit, hunmonk did most of the hard work. :)

I'm changing this back to active though, as there are still a couple remaining bugs:

* When submitting a file attachment with an issue, the attachment is always renamed to "issues" (or issues_0, or issues_1, etc.)
* When submitting a file attachment with a follow-up to an issue, nothing is saved

If you or anyone else happens to have any insight as to why either of these are happening, it would be much appreciated! :)

webchick’s picture

> * When submitting a file attachment with a follow-up to an issue, nothing is saved

By "nothing" I should clarify that I mean nothing about the file itself is not saved -- it doesn't get passed to the $FILES array. But all other things appear to save fine.

webchick’s picture

It now looks as if those two issues have been fixed! (thanks, hunmonk!!)

I am going to test one more time from a fresh HEAD install tomorrow after a good night's sleep and then I think we can mark this sucker "fixed" for good! :)

pfaocle’s picture

One more for you, I think:

* Go to the issues summary for a project
* Click 'submit' to add a new issue to the current project (.../node/add/project_issue/project_name)
* The current project project_name is not selected in the checkbox
* We then have to reselect the project, submit or preview, and get the warnings for missing required fields, and add in the rest of the fields for the new issue.

I'd guess this is a bug - the current project should already be selected (taken from the URL path), and the entire form for a new issue should be displayed immediately. I think the culprit is line ~312 of issue.inc:

$pid = $node->pid ? $node->pid : $_POST['edit']['pid'];

hunmonk’s picture

Status: Active » Fixed

ok, committed a fix for that last bug. marking as fixed and crossing my fingers... :)

Anonymous’s picture

Status: Fixed » Closed (fixed)