Author
|
Message
|
David Wirth
|
Friday 04 December 2009 7:11:07 pm
I am new to ez so please have mercy on me. I want to create a classified-ad app in which anonymous users fill out a form with ad details, submit it, one of our staffers reviews submissions, and then if the ad is OK it's added to the list of publicly viewable ads. Normally I would build a standalone php app to do this but we now have ez and it seems to me like it is perfectly suited to host this sort of app -- it already has form validation, automated database interfaces, workflow, yada yada. I can see how one could accomplish this with a custom handler (feeding the post data into eZContentFunctions::createAndPublishObject() is how I'm thinking I'd do it) but I'm thinking there must be something much simpler already built into ez that will do this but I have not yet found it. Content/action appears to have functions that will create the object but I don't see that it will populate the object's class attributes. Content/edit has the opposite problem. It seems like there ought to be a simpler way to create and publish objects without creating a custom handler or having to use a clunky sequence of two handlers. Using information collection seems like a likely candidate but I am not seeing how to put information collection objects into the site node tree so I can apply workflow to them. Is there a simple way to do this or am I barking up the wrong tree? (Bonus question: Is there a reason I should not create this sort of app in ez?) If someone can help me with this, I promise to be less clueless the next time I post a question here.
|
David Wirth
|
Friday 04 December 2009 7:29:20 pm
I probably should have also noted that my org just started using ez for most of our web presence. In my first post it kind of sounds like I'm considering using ez for this one simple app but that's not the deal. I know installing ez for this minor project would be like hunting squirrels with tactical nukes. I probably should have made more clear in that metaphor that it's me that would be wielding the tactical nukes, not the squirrels. If the squirrels had tactical nukes I probably would not try to hunt for them. I should probably just stop typing.
|
Sylvain Gogel
|
Saturday 05 December 2009 12:16:07 am
I guess ez can fully address your feature requests: 1. Set permissions to allow anonymous user to create your classified ads content class 2. Create a folder that will content ads to review 3. Play with sections to allow anonymous to see the folder but not childer adds (this way they cannot see other's ads) 4. In the folder tpl expose a link to content/create (not sure of the right view name, but you can have a look at ezwt ezwebtoolbar that allow front office content management) 5. Your Poweruser can review and move nodes to a fully public folder I guess there is another way to do it than playing with sections and node assignements with a validation workflows or object states Cheers
--
http://www.ecedi.fr
Agence Web, Créa/Conseils, Accessibilité
eZPublish, Drupal, Zend, Symfony
|
Bertrand Dunogier
|
Saturday 05 December 2009 4:22:32 am
Sylvain's approach is good. The view you're looking for is "content/action", with a POST var named "NewButton", along with the expected paramerters. You can find more details on ezpedia: http://ezpedia.org/snippet/template_logic_to_add_edit_button_into_your_custom_user_siteaccess_design
Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier
|
David Wirth
|
Saturday 05 December 2009 6:18:02 pm
Sylvain's approach is basically what I had in mind, and I know I can trigger the creation of a node by having a button with the name "NewButton" in my form that has content/action as the handler. My issue is that, as far as I can tell, the 'New' mode in action.php only creates an empty object and you have to use content/edit and the new node/object id to fill in (edit) the class attribute values. It seems to work that way for adding content in the admin interface, the front-end interface, forum replies, and so on -- you click one button that creates the object and takes you to a page where you edit its values and click another button to save it. I want to create the node and fill in its class attributes at the same time with one click of a submit button. Am I just mistaken about what the 'New' mode can do -- i.e. if the post data includes the proper class attribute identifiers will action.php automagically fill in those parts of the new object? I have not fully parsed how it all works and I'm kind of new to PHP anyway so I wouldn't be surprised to learn that I'm missing something. If it just doesn't do what I want it to do, I guess I'll create an extension (once I figure out how to do that) and share it back.
|
Bertrand Dunogier
|
Sunday 06 December 2009 2:17:29 am
I was indeed a bit quick when reading about your issue. a New action on content/action indeed creates a new draft with empty, default values. This is how editing works from the backoffice, as well as from the frontoffice, when using ezwebin for instance. You could use a content edit handler. You can read more about this on Lukasz Blog: http://serwatka.net/blog/do_you_need_action. Another approach would be the powercontent extension by Kristof Coomans: http://projects.ez.no/powercontent.
Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier
|
David Wirth
|
Sunday 06 December 2009 8:17:51 am
It looks like an extension is the way to go then. Thanks!
|
Bertrand Dunogier
|
Sunday 06 December 2009 12:49:04 pm
"
It looks like an extension is the way to go then. Thanks!
"
Quite a common conclusion ;) To be honest, the CMS is in my opinion 50% of eZ Publish's features. Trying to use it without considering extensions as soon as a complex feature is required is usually a bad idea. If you consider data import, for instance, trying to build a generic import extension is utopic. Such a developement would always cover a small percentage of common needs. An import framework, on the other hand, that abstracts most common import operations, is a better way to go, and it is what the data_import extension achieves. Yes, this was completely out of topic :-)
Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier
|