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

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

eZ debug

Timing: Jan 18 2025 15:17:35
Script start
Timing: Jan 18 2025 15:17:35
Module start 'content'
Timing: Jan 18 2025 15:17:37
Module end 'content'
Timing: Jan 18 2025 15:17:37
Script end

Main resources:

Total runtime1.2793 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 588.9922180.8125
Module start 'content' 0.00821.0941 769.8047538.6875
Module end 'content' 1.10230.1769 1,308.4922332.7422
Script end 1.2792  1,641.2344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3258210.0002
Check MTime0.00150.1152210.0001
Mysql Total
Database connection0.00070.057610.0007
Mysqli_queries1.204394.14441940.0062
Looping result0.00230.18151920.0000
Template Total1.245197.320.6225
Template load0.00230.179920.0012
Template processing1.242797.146020.6214
Template load and register function0.00010.010510.0001
states
state_id_array0.00100.079710.0010
state_identifier_array0.00180.141520.0009
Override
Cache load0.00160.1287210.0001
Sytem overhead
Fetch class attribute can translate value0.00100.079030.0003
Fetch class attribute name0.00120.095340.0003
XML
Image XML parsing0.00080.064830.0003
class_abstraction
Instantiating content class attribute0.00000.000640.0000
General
dbfile0.00400.3126270.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs