Friday 14 July 2006 1:34:41 pm
Hi
I'm about to create an intranet site based on the standard templates bundled with eZ publish. I want to accomplish this:
- Add a toolbox to the right with buttons to create objects
- Add buttons / links to articles and files to delete/edit them - This should only be able done by users with the rights This is how I tried to accomplish it:
To make the toolbox: - I made an override for the file templates/toolbar/full/node_list.tpl I added another toolbox in the file:
{if $node.can_create} {*I have seen this from many other templates so I guess it does what it says*}
<li><a href="#" onclick="ezpopmenu_submitForm( 'new-article' ); return false;">Add article</a></li>
<form action={"/content/action"|ezurl} method="post" id="new-article">
<input type="hidden" name="NodeID" value="{$node.node_id}" />
<input type="hidden" name="ClassID" value="16" /> {*16 is the class-ID of Article*}
<input type="hidden" name="NewButton" value="" />
</form>
<li><a href="#" onclick="ezpopmenu_submitForm( 'create-folder' ); return false;">Create folder</a></li>
<form action={"/content/action"|ezurl} method="post" id="create-folder">
<input type="hidden" name="NodeID" value="{$node.node_id}" />
<input type="hidden" name="ClassID" value="1" />
<input type="hidden" name="NewButton" value="" />
</form>
<li><a href="#" onclick="ezpopmenu_submitForm( 'del-folder' ); return false;">Delete folder</a></li>
<form method="post" action={"content/action"|ezurl} id="del-folder">
<input type="hidden" name="ContentNodeID" value="{$node.object.main_node_id}" />
<input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
<input type="hidden" name="ActionRemove" value"" />
</form>
{/if}
I don't even know if this is the right way, and the right place to do it but it works on another side I made based on the "Intranet Solution" contribution at ez.no. As you can see, my idea was to make the code to all pages. However I could make an override for each section that should have this "feature" enabled. But this should really be possible from everywhere on the site.
To edit articles and files, this is how I was planned to do it: - make an override for line/article and line/file and add the following:
<a href={concat("content/edit/",$node.object.id)|ezurl}><img src={"edit.png"|ezimage} /></a>
Am I on to something? And why don't the first code works for me? Looks like it doesn't understand onclick=etc etc ..
regards Frode Slettum
|