change priority automatically

Author Message

Marko Žmak

Wednesday 18 October 2006 11:33:44 pm

I have a question about changing the priority of nodes in eZ admin interface. When have two nodes with priority 1 and 2, and I change the priority of the second node then I get two nodes both with priority 1.

Is there a way to change this behaviour so that when I change the priority of second node to 1, the first node gets priority 2 and the second node priority 1?

Is there maybe an extension for this, or something else?

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

Hubert Farnsworth

Claudia Kosny

Thursday 19 October 2006 3:48:26 am

Hi Marko

Depending on how the priority change should propagate this might be easiest to solve using Javascript.
If you want to reorder all priorities it is really simple: Fetch all the input boxes, order them by their value and insert the position on the ordering as new value . Just take care that the input box that triggers the function takes precedence in the ordering. Trigger this script onblur or onchange of the textboxes. I can send you a script which does that for selectboxes if you are interested, but it is really easy.

This simple approach will cause problems if you have some special priorities that should not change (E.g I use a priorities of 1000 for nodes that should not be displayed when fetching all children). In this case you might need something more fancy.

I haven't looked into whether there are any extensions or native EZ functions that do this.

Greetings from Luxembourg

Claudia

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.