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

eZ debug

Timing: Jan 18 2025 22:37:25
Script start
Timing: Jan 18 2025 22:37:25
Module start 'content'
Timing: Jan 18 2025 22:37:26
Module end 'content'
Timing: Jan 18 2025 22:37:26
Script end

Main resources:

Total runtime1.0030 sec
Peak memory usage4,096.0000 KB
Database Queries208

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 587.7109180.8359
Module start 'content' 0.00540.8298 768.5469632.5938
Module end 'content' 0.83520.1677 1,401.1406341.0625
Script end 1.0029  1,742.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.4257210.0002
Check MTime0.00170.1701210.0001
Mysql Total
Database connection0.00040.041710.0004
Mysqli_queries0.911790.89832080.0044
Looping result0.00390.39042060.0000
Template Total0.969196.620.4846
Template load0.00200.196120.0010
Template processing0.967196.422820.4836
Template load and register function0.00010.009510.0001
states
state_id_array0.00160.156310.0016
state_identifier_array0.00220.220020.0011
Override
Cache load0.00170.1658360.0000
Sytem overhead
Fetch class attribute can translate value0.00180.176340.0004
Fetch class attribute name0.00160.159290.0002
XML
Image XML parsing0.00150.145040.0004
class_abstraction
Instantiating content class attribute0.00010.0061110.0000
General
dbfile0.00540.5413350.0002
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs