I have an replacement module that fixes nearly all the bugs and usability issues in addnode. I would like to get your feedback on it and discuss the possibility of replacing the current code with the new code. Here is what you can do with the updated module:

1. have multiple add node fields on a cck node
2. previous selections are not lost when new ones are added
3. preview works
4. new nodes are added on a popup window - that does not need reloading of the node edit page
5. You can cancel the parent node create or edit operation - in the current version if you add a "addnode" then the parent also gets saved.
6. it is enabled for thickbox - and has provision for falling back on ordinary popup windows if necessary.

You can try it out an example at: http://www.hyrme.com/d5/node/add/expense and leave me your comments here on any changes or issues you find. I would like to provide this code back up as a patch if lionfish is okay with it.

This work was been sponsored by bsuttis

Comments

sam moore’s picture

Nice improvement. I could make a few usability suggestions, but basically I could use this today - are you still up for this?

panis’s picture

Let me know what your ideas are..

sam moore’s picture

I really like the popup window approach - it's much easier on the overall layout.
• Is the window themable? I'm finding the test one really hard to read. Failing that, maybe it could just be a little more plain vanilla?
• It would be useful to make sure the Preview and Submit buttons show up without scrolling, if possible.
• The button to activate the feature looks like the Add Image button - hard to figure out what it means/does (Add Image suffers from the same problem). Maybe a simpler icon or icon set could work here - "Pick" and "Add new..." on buttons?
• Actually those two buttons could just be there by themselves, with the list picker or the new popup appearing only when the user clicks either "Add" or "Pick" - that way the interface would be cleaner overall.
• Probably the name of the selected or created item should be shown by itself after the user's finished picking/adding.
• The popup window tends to disappear off the page when I scroll the parent page down - some sort of JavaScript bug I think.

But these are just tweaks - it basically seems to work nicely OMM. Thanks for doing this - as I mentioned I could really use this.

Are you thinking of making this available?

panis’s picture

Is the window themable? I'm finding the test one really hard to read. Failing that, maybe it could just be a little more plain vanilla?

- it uses the current theme - the theme on my site is something I am working on - therefore the weird look.

It would be useful to make sure the Preview and Submit buttons show up without scrolling, if possible.
- currently uses the default node edit form layout - not sure how best to enable this - maybe put them up on the menu bar somehow..

The button to activate the feature looks like the Add Image button - hard to figure out what it means/does (Add Image suffers from the same problem). Maybe a simpler icon or icon set could work here - "Pick" and "Add new..." on buttons?

The icon is themable - I ran out of ideas on the icon and borrowed the add image icon.

Actually those two buttons could just be there by themselves, with the list picker or the new popup appearing only when the user clicks either "Add" or "Pick" - that way the interface would be cleaner overall.
- should be doable with a bit of javascript - but because the list picker shows the currently selected nodes it may be a good idea to keep it open.. unless we only display the selected nodes and then the buttons display "add" or "list" of nodes.

Probably the name of the selected or created item should be shown by itself after the user's finished picking/adding.
- You can add multiple items and the listbar should be positioning itself to the most recently created item when you are done.. I will rethink this based on your comments and see how best to change it.

The popup window tends to disappear off the page when I scroll the parent page down - some sort of JavaScript bug I think.

- I use the thickbox module - it has some issues with IE - updating to later jquery and thickbox versions may fix it..

http://www.hyrme.com/files/node_assist-beta.zip.
enable both modules in there..

sam moore’s picture

Super - thanks!
I'll tinker with the theming and if I do anything useful I'll send it back :-)

sam moore’s picture

- You can add multiple items and the listbar should be positioning itself to the most recently created item when you are done.. I will rethink this based on your comments and see how best to change it.

Created items aren't showing up in the list until after reload - I think this is where we're not seeing the same results. I've tried under various Mac browsers and IE on XP. Seems like the list needs to refresh itself somehow (without reloading the page of course).

panis’s picture

does firefox behave the same way too?

sam moore’s picture

Yep - on both MacOS and WinXP.

markDrupal’s picture

I just tried this out, it is great!! Thanks for the work

has there been any progress on the problem mentioned above where after the new node has been created the parent page needs to be refreshed to see the changes?

panis’s picture

I cannot reproduce the problem on my setup - since this may be most likely a javascript error - if you do experience the bug and are willing to let me take a look at it on your site - I can work on it. I do not need shell or ftp access just simply a drupal login and access to create nodes of that type.

csc4’s picture

Subscribing - fascinating module

brendoncrawford’s picture

Panis: Very good work here. If this does not make it into AddNode, create a new module for it. I would be willing to offer my assistance with developing this as well.

PGiro’s picture

Hi Panis, nice and elegant. Thanks to bsuttis for sponsering it !

I have the exact same requirement except but I would like to handle it a little bit differently. How difficult would it be to get it to work with your module :
- instead of selecting via a multi-select combo, I would like to use an autocomplete field that can handle multiple values (yes, handling the separator is an issue...)
- when a value provided in the autocomplete does not exist, a node gets created with only its title set, transparently to the user

What do you think ?

PGiro’s picture

Oh... and what would it take to get it to work in D6 ?

benansell’s picture

Category: task » support

Demo hard to follow since WatchDog log appears full right now.

Two fundamental questions:

Parent node create form is not updated to reflect the existence of a newly created child node; is there some customization work that I have to do to complete the workflow? Is this documented somewhere?

Is there documentation some where on how to get this to work with Thickbox?

panis’s picture

WatcherFr:
D6 is certainly doable - needs to be ported - CCK handles things a bit differently. Your auto - complete is perhaps addressed better by http://drupal.org/project/nr_autocomplete and for creating nodes on the fly http://drupal.org/project/add_n_reference may work better for you - although this is still at D4 - it should be straightforward to move it to D5.

panis’s picture

ben_a,
a) demo should work now. test with FF - the node create form does get updated to reflect new child node. Not sure why in some IE setups it does not work - I think that the javascript that updates the parent form may not be kicking in correctly in IE.

b) it uses thickbox to display the popup - and the .zip file contains a copy of thickbox javascript files. If you already have thickbox module you may wish to use that thickbox.js file - if you do then you will need to change the code in this module to pickup the thickbox.js file from your thickbox module folder - and only include the thicbox javascript ONCE.The problem I have typically found is that thickbox.js file with the thickbox module may be of a different version and the TB_xxxx() functions may be renamed to tb_xxxx() with slightly different parameters - which you will need to change in this modules javascript files.

benansell’s picture

Yes, thanks; the demo now works.

RE: THICKBOX, if you are referrring to the zip file attached above, I don't see thickbox.js files any where in the file set. And, when I install the module on my site, the pop-up form comes up a regular window, not as a thickbox dialog.

You sure you attached the right zip file, or perhaps just forgot to include thickbox files in zip??

Help getting this to work an getting it themed would be greatly appreciated.

Any docs to direct me to?

Thanks again.

benansell’s picture

To be clear, demo on YOUR site works.

Putting thickbox issues aside for the moment and strictly focusing on functionality .. ....

With my local install of module, you said to test with FF, and not IE; have been using FF 2.0.0.14 whole times. Just tested again using FF, and can confirm that parent node select-widget does not get updated with newly created child node as expected. This is also true on Safari 3.1.1 - does not work there either.

Any thoughts on how to debug/trouble-shoot.

Modules is not the right solution unless we can iron out these issues.

As always, any help/guidance is appreciated.

panis’s picture

ben - does the demo work as you want it to on my site with your combination of browsers? If it does - try with the latest refresh of the code from my working site..

The download the file from http://www.hyrme.com/files/node_assist-beta.zip

MedicSean37’s picture

Hey panis, this is a really good improvement. Thanks. I have one suggestion. It would be nice if there was an option not to show a list of possible nodes to reference. That would clean up the UI when you want the user to always create a new node to reference. Anyways, thanks!

AD-DA’s picture

Hi Panis,

I have also issues with the latest version. It seems that the thickbox.js do not load. It is not referenced in the page.
I would also prefer an option to choose between a simple dropdow to select the reference and the combo select box.

icecreamyou’s picture

Subscribing.

darrenmothersele’s picture

subscribing, because i'm trying to do something similar.

Thanks for providing a demo. I'm working on a slightly different use-case, but has required a new node reference widget. I've adapted the basic node reference autocomplete widget, so that if the node being referenced doesn't exists (the user types something unknown), then a new node is created.

I currently pull sample content in from Wikipedia to create the new node...

http://darrenmothersele.com/content/node-reference-autocomplete-with-aut...

Next I'm planning on adding a validation step for disambiguating several possible options for what should be referenced, and I'd like to have three options - one of which matches the use case above...

1- variations on the node title already exist - present drop down of possible options
2- create new node and automatically populate with either wikipedia or freebase content (use hooks_ to make extensible)
3- create a new node - node creation form appears in place on page

icecreamyou’s picture

Wow darrenmUK, that's nearly exactly what I need and it's a very similar use-case as well. You might be interested in checking out BMusic... I'm going to make sure to follow your progress. :D

EgorfromMurmansk’s picture

panis, Unfortunately, your patch does not work on your site and on my site.

damienmckenna’s picture

Very cool update, I really like it.

I'm seriously considering using this for a new project but due to the volume of content involved would like to re-do the two-pane select system to optionally use an autocomplete field on the left. Also, there appears to be a problem where it doesn't upload attachments, but I'm not 100% yet where the exact problem is.

Until this code gets its own project, or replaces what is currently available, I've started to track my changes at github:
https://github.com/damienmckenna/drupal_addnode

Thanks for all the hard work, panis.

Damien

icecreamyou’s picture

Damien, that looks like a solution I would be interested in as well. I really think this is where this project needs to go next.

vacilando’s picture

+1, subscribing!

damienmckenna’s picture

Panis,

Now that you have ownership of the module what I suggest doing is:

  • Upload your code as 1.9beta (or 2.x-dev)
  • Refactor the code to be one module, as you'd mentioned previously.
  • Get it stable.
  • Release it as D5-2.0.
  • Use that as a starting point to work on D6-1.0.

Damien

panis’s picture

refactored into a single module
http://www.hyrme.com/files/addnode-beta.zip
and checked into HEAD.

Need to figure out how to best manage the thickbox files - any ideas..

icecreamyou’s picture

Um... take them out and use Thickbox as a dependency?

socialnicheguru’s picture

can I use lightbox2 on this? I am trying to standardize on one or the other. I am using lighbox2 for galleries.

michael_kirk’s picture

Panis, what is the addnode_order table used for? Could it be accomplished with the delta field in the node reference table?

panis’s picture

nodeorder table stores the order of the nodes attached - you can rearrange them anyway you wish.
The delta field in the node reference table only seems to work as a running counter so was unable to reliably use it to store node order.

michael_kirk’s picture

panis: I've been able to order node references using the multiselect widget using just delta in 5.x. I wonder whats different.

ndwilliams3’s picture

The Thickbox is displaying in the bottom left of the screen and moves down as you scroll?

Also the add content within the Thickbox is displayed in duplicate?

Anyone else having similar results? Any solutions?

ndwilliams3’s picture

Solved my own issue! There is a conflict with the Thickbox module's CSS file. The thickbox.css file from the Thickbox module loads after the addnode thickbox.css and overrides the styles.

Shai’s picture

This looks great. Any movement on this for Drupal 6?

I'm also noting that the head version is not listed as a dev release. The only release on the project page is 5--1-2.

Shai

socialnicheguru’s picture

can I restrict what can be added by either taxonomy or role or author?
Chris

Johannes De Boeck’s picture

Panis: Any chance you could integrate this with the MULTISELECT module http://drupal.org/project/multiselect ?

kind regards
Johannes

cyberskier’s picture

Subscribing. Looks like a great module Would love to see this in Drupal 6.

tommyill’s picture

Would also love to see Drupal 6 version, this adds great usability.

t4him’s picture

Title: Proposal to revamp addnode - demo available. » This zip file has a dependancy on node_assist, it is not in the zip file

The required node assist files are not in this zip file. What I have seen so far is that ALL of the files are not in any one .zip file. Do you have a current copy? including the proper image files . . . . either add-image.jpg or newdocument.gif.