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.