Changing the placement of an object during publish

Author Message

James Packham

Tuesday 13 January 2004 3:32:37 am

Hi I'm trying to create a customised edit.tpl, where instead of using the default method of searching for a folder node my users can choose a location from a drop down box.

I've looked in edit_placement.tpl at the example, but am struggling to understand it. At the moment I can create the drop down box with the names of the appropiate locations and have a piece of code like this (just the select statement provided here for simpicity) :

<select name="location">

{section name=Folder loop=$FolderList}

<option value="{$Folder:item.node_id}">{$Folder:item.name|wash}</option>

{/section}

</select>

What do I need to change "location" to? Is there any documentation on this? I couldn't find any...

Thanks,

~James~

James Packham

Wednesday 14 January 2004 6:11:42 am

Ok, I got a little further:

<select name="SetPlacementNodeIDArray[]">
<option value="0">Please select a Region</option>
{section name=Folders loop=fetch( 'content', 'list', hash(
'parent_node_id', 53,
'class_filter_type', include,
'class_filter_array', array('folder') ) ) }
<option value="{$:item.node_id}">{$:item.name} node id {$:item.node_id}</option>
{/section}
</select>

lets me set the node ID to one of the subfolders inside the folder where I first create the new object. Unfortunately I get this message:

Location did not validate
* No main node selected, please select one.

I'm not 100% sure what the main node is hmmm Is it the node id for the new object? How do I input it?

At the moment I'm using code borrowed from the how to build an ez publish site tutorial to define it:

<input type="hidden"
name="MainNodeID"
value="{$main_node_id}" />

Is there another way I should be doing this?

Thanks,

~James~

James Packham

Wednesday 14 January 2004 8:00:33 am

It turns out I had to change the input bit to:

<input type="hidden"
name="MainNodeID"
value="{$object.current.temp_main_node.parent_node_id}" />

Because Main node id is the new parent node id.

~James~

James Packham

Thursday 15 January 2004 1:56:29 am

Um ok I thought this was working properly, but it turns out it's not :( The user has to make their selection twice because the first time they do object.current.temp_main_node.parent_node_id doesn't exist! It seems to get added as an object variable after the form is posted. *Doh* On the brightside it works the second time (so long as I don't change my mind about where I want to put the new object!!)

Could anyone help me out? This is the select statement I use to get my new placement node, (it's what I need to set my main_node_id).

<select name="SetPlacementNodeIDArray[]">

<option value="0">Please select a Region</option>
{section name=Folders loop=fetch( 'content', 'list', hash(
'parent_node_id', 53,
'class_filter_type', include,
'class_filter_array', array('folder') ) ) }
<option value="{$:item.node_id}">{$:item.name} node id {$:item.node_id}</option>
{/section}

</select>

I thought the obvious thing to do would be to move my input inside the select statement and change the value to $SetPlacementNodeIDArray[0]. But this doesn't work either (probably because it's an http variable). Maybe somebody who's done this/something similar could give me some pointers?

I'm trying to do it without having to rely on a bit of javascript to update a variable I can use in the input statement, because that sounds a bit unstable (i.e. what if the user has javascript disabled?).

Thanks!

~James~

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

eZ debug

Timing: Jan 19 2025 09:47:05
Script start
Timing: Jan 19 2025 09:47:05
Module start 'layout'
Timing: Jan 19 2025 09:47:05
Module start 'content'
Timing: Jan 19 2025 09:47:05
Module end 'content'
Timing: Jan 19 2025 09:47:05
Script end

Main resources:

Total runtime0.0164 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 589.3828152.6406
Module start 'layout' 0.00640.0029 742.023439.4766
Module start 'content' 0.00930.0048 781.500093.3672
Module end 'content' 0.01410.0023 874.867238.3047
Script end 0.0164  913.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002515.3844140.0002
Check MTime0.00116.9474140.0001
Mysql Total
Database connection0.00095.347410.0009
Mysqli_queries0.002615.573130.0009
Looping result0.00000.090010.0000
Template Total0.001911.410.0019
Template load0.00095.688610.0009
Template processing0.00095.650810.0009
Override
Cache load0.00074.110310.0007
General
dbfile0.00031.874480.0000
String conversion0.00000.062440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs