Add edit and delete button in the view of sub-items

Author Message

Albe Terra

Tuesday 05 August 2008 5:50:10 am

Hi!
I have a content class that displays its children in the standard view.

I need, when a user is logged in, to display for each children the “Edit” and “Remove” button, as the one of the Web Toolbar.

How can I do this? I need to create manually the form with the two buttons or there is a better way? How it is possible to display buttons only when the user is logged in?

Thank you very much!
Albe

Felix Laate

Tuesday 05 August 2008 5:55:48 am

Hi,

in the line view of the children include this:

 {if $node.object.can_edit}
                <form method="post" action={"content/action/"|ezurl}>
                    <input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
                    <input class="button forum-account-edit" type="submit" name="EditButton" value="{'Edit'|i18n('design/ezwebin/full/forum_topic')}" />
                    <input type="hidden" name="ContentObjectLanguageCode" value="{ezini( 'RegionalSettings', 'Locale', 'site.ini')}" />
                </form>
            {/if}
            {if $node.object.can_remove}
                <form method="post" action={"content/action/"|ezurl}>
                    <input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
                    <input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
                    <input class="button" type="submit" name="ActionRemove" value="{'Remove'|i18n( 'design/ezwebin/full/forum_topic' )}" title="{'Remove this item.'|i18n( 'design/ezwebin/full/forum_topic' )}" />
                </form>
            {/if}

hope this helps!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Albe Terra

Tuesday 05 August 2008 6:18:45 am

That's great!
It works perfectly!

Thanks a lot...you make me save hours of work! :)

By, Albe

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