[drupal-devel] How do I... node submit, resubmit, folksonomy
Alright. I'm working on a spec to take my homebrew NHPR.org CMS and turn it into a Drupal site. It'll be one of the more complicated Drupal sites I've ever worked on. I've got two related questions: * who was working on that folksonomy module? where is it? * can I, via a module, put up a page AFTER the node submit screen? NHPR.org has about 5000+ taxonomy terms. And as much as I hate the flipping name, consider this a "folksonomy" that has been built over 4 years. To minimize the duplication and similarity of names ("horse", "horses", and "horseriding"), I wrote some custom PHP code that: * checks all terms entered by a reporter AFTER the submit. * suggests terms that have a percentile of 75% match. * put up a checkbox list of "these terms may be better". * reporter optionally chooses new terms based on suggestions. * reporter resubmits the node, with the new terms. Since the taxonomy is 5000+ terms, I can't depend on Drupal's selectbox. So, the game plan was to write up some sort of module (or flexinode field type) that was a simple textbox that accepted terms. These terms would be checked/associated/created with their existing vocabulary programmatically (via some sort of module backend or custom flexinode code). My understanding, based on IRC snippets over the weeks, is that this is similar to someone's folksonomy module they were working on. On top of the above, I need to "interrupt" the normal node submission process. After a reporter has filled out their node and clicked "Submit", I need to show a page of "suggested terms", along with a form of checkboxes. Modifying/submitting the checkboxes would resubmit the node. Is there a hook to do this? What options do I have? Any code I write (most importantly, the "suggest new terms" formulas) will be submitted back to Drupal, naturally. -- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
I am maintainer of folksonomy.module. Its is a slow work in progress.
Mmkay. I'm probably a month or so away from working on my particular implementation per NHPR's needs. We should hook up on IRC sometime to discuss our particular needs - maybe we can nail everything into one. -- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
Morbus Iff wrote:
* who was working on that folksonomy module? where is it?
I think Moshe is working on this(?)
* can I, via a module, put up a page AFTER the node submit screen?
Look at the hook_nodeapi. You could implement the 'validate' nodeapi hook if you wanted the action to take place prior to the node being saved, or the 'insert' nodeapi hook could have a drupal_goto("node/$nid/edit"); in it (though this may be problematic in other ways). -Mark
On Wed, 2 Mar 2005, Morbus Iff wrote:
* who was working on that folksonomy module? where is it? * can I, via a module, put up a page AFTER the node submit screen?
I am not completely sure, but there was a recent patch by Moshe that might enable you to do this. You'd need to add a hidden destination field to your form. Alternatively use the validate part of nodeapi as Moshe suggested.
NHPR.org has about 5000+ taxonomy terms. And as much as I hate the
Yay for taxonomy!
flipping name, consider this a "folksonomy" that has been built over 4 years. To minimize the duplication and similarity of names ("horse", "horses", and "horseriding"), I wrote some custom PHP code that:
* checks all terms entered by a reporter AFTER the submit. * suggests terms that have a percentile of 75% match. * put up a checkbox list of "these terms may be better". * reporter optionally chooses new terms based on suggestions. * reporter resubmits the node, with the new terms.
Cool, such an approach might make folksonomy actually usable. Did you think about using taxonomy synonyms for this?
Since the taxonomy is 5000+ terms, I can't depend on Drupal's selectbox. So, the game plan was to write up some sort of module (or flexinode field type) that was a simple textbox that accepted terms. These terms would be checked/associated/created with their existing vocabulary programmatically (via some sort of module backend or custom flexinode code).
My understanding, based on IRC snippets over the weeks, is that this is similar to someone's folksonomy module they were working on.
On top of the above, I need to "interrupt" the normal node submission process. After a reporter has filled out their node and clicked "Submit", I need to show a page of "suggested terms", along with a form of checkboxes. Modifying/submitting the checkboxes would resubmit the node.
'Validate' seems like the least painfll way to do this.
Is there a hook to do this? What options do I have? Any code I write (most importantly, the "suggest new terms" formulas) will be submitted back to Drupal, naturally.
I am in the process of setting up an image related site that would need some usable tagging system. I can barely wait. :) Cheers, Gerhard
Yay for taxonomy!
Of course, they call 'em "keywords", because I'm not sure anyone there would really "grasp" the idea of a taxonomy or controlled vocab, and a "category" is too broad a term for their expectations. For an example of how they use keywords (and this is all stuff I'd have to duplicate within Drupal somehow. whee! <g>), see the following URL. This is a complete story. No mention of keywords whatsoever: http://www.nhpr.org/view_content/8317/ The keywords, however, are being used to to generate the "Related stories" and "Related shows" boxes. And, in the lower right of that box, you can see "see more": http://www.nhpr.org/view_content_more/8317/ which then breaks down each individual keyword, with XML feeds, and the last ten or so stories published for each one. For this particular story, they've chosen some relatively sane keywords, but believe me, there's some wacky one-use-only stuff in there too.
* checks all terms entered by a reporter AFTER the submit. * suggests terms that have a percentile of 75% match. * put up a checkbox list of "these terms may be better". * reporter optionally chooses new terms based on suggestions. * reporter resubmits the node, with the new terms.
Cool, such an approach might make folksonomy actually usable. Did you think about using taxonomy synonyms for this?
That's a great idea! If a reporter enters "horseriding", and then chooses "horses" on the validate screen, the module code could automatically add "horseriding" as a synonym to "horses", and then (visually) autocorrect future "horseriding" entries to "horses". Nice. I like. -- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
* checks all terms entered by a reporter AFTER the submit. * suggests terms that have a percentile of 75% match. * put up a checkbox list of "these terms may be better". * reporter optionally chooses new terms based on suggestions. * reporter resubmits the node, with the new terms.
Cool, such an approach might make folksonomy actually usable. Did you
As an example of the current interface in the homebrew CMS, see: http://www.disobey.com/d/2005/similar_keywords.jpg Remember, this is an entirely optional step, and happens AFTER the user has already submitted their node with unchecked tags. If the user doesn't take any of these suggestions (as this particular user didn't - see the better suggestion for "death penalty"), then the node is still published. This PHP code uses similar_text() and metaphone(), which killes has pointed out is English only. I'm not sure what'd we do to make it i18n. He also mentioned that the percentage printout was probably unfriendly for normal usability, and I'm fine with removing it (I think I probably left it in in the first place just to check out the formula). I'm not sure how long lisppaste lasts, but you can see the homebrew function that calculates the similarity here: http://paste.lisp.org/display/6226 Thoughts on UI? Thoughts on i18n? -- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
participants (4)
-
Gerhard Killesreiter -
Mark -
Morbus Iff -
Moshe Weitzman