Forums / Setup & design / setting priority on publish

setting priority on publish

Author Message

Marko Žmak

Thursday 28 September 2006 12:16:40 pm

Is there a way to set a node priority in the object edit page (upon publishing)?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Claudia Kosny

Friday 29 September 2006 2:11:46 pm

Hallo Marko

I think I would try to it this way:
Add an integer attribute to each contentclass which will allow your editors to set the priority.
Create an extension that will grab an object by their id and fetch the main node beloging to this objct. Fetch the value of the integer attribute holding your priority and set the priority of the main node to this value using setAttribute.
Create a workflow that will execute this extension right after publishing an object.

The only problem I see with this approach is that the object is already published before you change the node priority whereas it would be nice to it in one step.

(Actually I would not use an additional attribute but insert a custom input field in the edit template and then just hack the content/edit.php to set the node priority to whatever was posted as this is a matter of 15 min work whereas I still have not managed to have a look at workflows and thus tend to avoid them. But doing it without changing kernel files is certainly more flexible and less error prone)

Greetings from Luxembourg

Claudia

Kristof Coomans

Saturday 30 September 2006 6:09:49 am

I think a content/edit extension handler can accomplish this. More info inside: http://pubsvn.ez.no/nextgen/trunk...8/content_edit_extension_handler.txt, settings/content.ini and kernel/classes/ezcontentobjectedithandler.php. And a great blog article by Lukasz: http://serwatka.net/index.php/en/blog/ez_publish_3_8_new_custom_edit_handler

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Claudia Kosny

Saturday 30 September 2006 8:32:52 am

Ah this looks very interesting. Thanks for the tip.

Claudia

Marko Žmak

Friday 06 October 2006 8:38:36 am

Sorry fot the late answer.

Yes Claudia, your aproach could work, but it has one flaw. In your idea the priority is based on object and not on the node. By doing so you couldn't have different prioities for the same object on different locations.

It seems like creating edit handler is the only sollution for now. Maybe I'l implement it when I have some time. But it would be nice to see this feature in standard eZ installation one day.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Claudia Kosny

Friday 06 October 2006 8:51:49 am

Hello Marko

Yes you are right, this does not work for different locations. But wouldn't that be a problem no matter how you do it? After all you edit an object and although the objects knows its node assignments there is no way to know whether the content of your (hypothetical) priority field is meant for one or the other location. Or is that possible?

Of course you could always fetch a list of all the node assignments together with an input field for the new priority for each assignment and then process this data. I hope this is not to complicated as I need to do something similar within the next couple of days...

Greetings from Luxembourg

Claudia

Marko Žmak

Monday 09 October 2006 6:59:21 am

Maybe your idea will work, but it there's still another little problem. You won't be able to change the object's priority after without editing it again.

So your sollution doesn't help since I have to implement both automatic priority assignment upond creating new object, and ability of changing the priority without enetering the edit mode.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth