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.

eZ debug

Timing: Jan 31 2025 01:30:29
Script start
Timing: Jan 31 2025 01:30:29
Module start 'layout'
Timing: Jan 31 2025 01:30:29
Module start 'content'
Timing: Jan 31 2025 01:30:29
Module end 'content'
Timing: Jan 31 2025 01:30:29
Script end

Main resources:

Total runtime0.0268 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.2813151.2266
Module start 'layout' 0.00610.0053 739.5078220.7188
Module start 'content' 0.01140.0139 960.2266997.9609
Module end 'content' 0.02530.0015 1,958.187533.9922
Script end 0.0268  1,992.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002910.8694140.0002
Check MTime0.00114.0264140.0001
Mysql Total
Database connection0.00072.720510.0007
Mysqli_queries0.003914.469730.0013
Looping result0.00000.089910.0000
Template Total0.00103.610.0010
Template load0.00082.850410.0008
Template processing0.00020.764210.0002
Override
Cache load0.00051.906510.0005
General
dbfile0.00031.230480.0000
String conversion0.00000.040940.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