Forums / Developer / Create contentobject through customized form

Create contentobject through customized form

Author Message

Clemens T

Saturday 08 October 2005 8:26:06 am

Hey all!
I want to be able to let users create objects through the normal ezpublish system, but I don't want to show them all the contentattributes, except for the ones that are admin.

like this:

--form

---- name _____
---- city _____
[admin only]
---- priority 1,2,3
---- active 1,0
[/admin only[
---- my telephone number ____

/- form

Thanks, for any comment at all!
Greets,
Clemens

Xavier Dutoit

Sunday 09 October 2005 3:15:17 am

Hi,

What I usualy do in these cases is on the custom edit.tpl, fetch the current_user and based on the groups, section show it parts of the template.

X+

http://www.sydesy.com

Clemens T

Sunday 09 October 2005 5:52:59 am

OK, that sounds good. But now I have one remaining problem, how can I get a link to 'create a new object of this class', without the button and the dropdown?
Greetz,
Clemens

Gabriel Ambuehl

Sunday 09 October 2005 6:25:12 am

Do look at the HTML that is usually used. It's easy to figure out. Just make the selector a hidden form field instead.

Visit http://triligon.org

Clemens T

Sunday 09 October 2005 7:43:55 am

OK, many thanks to both!

Got it.. now what I want to do, is hide some of the attributes, and submit a default value with them.

Because I'm now overriding edit_attribute.tpl.. but not there yet.. how should I build this statement and.. more important.. how can I make sure the 'hidden values' are submitted correctly (to ensure default values upon submit).

Thanks,
Clemens

Xavier Dutoit

Sunday 09 October 2005 9:56:42 am

Hi Clemens,

Have a look at this contrib, might do what you want to prefill the content:
http://ez.no/community/contribs/hacks/object_creator

However, it doesn't solve the validation problem (ie you can change these values easily). If you want to be 100% certain of the values, then create a custom event and put it in the publication workflow.

X+

http://www.sydesy.com

eZ debug

Timing: Jan 20 2025 16:53:11
Script start
Timing: Jan 20 2025 16:53:11
Module start 'content'
Timing: Jan 20 2025 16:53:11
Module end 'content'
Timing: Jan 20 2025 16:53:11
Script end

Main resources:

Total runtime0.1678 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 587.8438180.8125
Module start 'content' 0.00460.0080 768.656398.0547
Module end 'content' 0.01250.1551 866.7109526.6250
Script end 0.1677  1,393.3359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00301.8063200.0002
Check MTime0.00120.7108200.0001
Mysql Total
Database connection0.00050.299910.0005
Mysqli_queries0.121872.59161410.0009
Looping result0.00110.63431390.0000
Template Total0.154892.310.1548
Template load0.00080.471610.0008
Template processing0.154091.791410.1540
Override
Cache load0.00060.341010.0006
Sytem overhead
Fetch class attribute can translate value0.00060.352910.0006
XML
Image XML parsing0.00020.115710.0002
General
dbfile0.01217.1907200.0006
String conversion0.00000.002630.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs