se7enxweb / powercontent
Power Content Provides for Publishing any type of content dynamically without needing to first visit content/edit view to input content durring creation (POST) Actions. Great for advanced developers!
Fund package maintenance!
se7enxweb
Patreon
www.paypal.me/7xweb
account.venmo.com/u/se7enxweb
cash.app/$7xweb
se7enx.com
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 2
Type:ezpublish-legacy-extension
Requires
- php: >=5.0.0
- se7enxweb/ezpublish-legacy-installer: *
This package is auto-updated.
Last update: 2025-02-01 12:52:52 UTC
README
Copyright
Copyright (C) 2006-2007 SCK-CEN
Written by Kristof Coomans ( kristof[dot]coomans[at]telenet[dot]be )
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Features
The Power content module allows one-click publishing or pre-filling of attributes, similar to the Object Creator extension (http://ez.no/community/contribs/hacks/object_creator). However, it uses content/edit for the final processing.
This module has one big advantage: it can deal with any type of attribute, even new custom ones.
Installation instructions
-
Enable the extension (in site.ini.append or by using the admin interface)
-
Add a policy for this module to the desired roles.
How to use in your template ?
The main idea is to add new attributes that are going to contain the values you want instead of the default ones on ez publish. This module associate these new fields with standard fields that exist when editing with the default edit template. Therefore, you have to understand how ez names these fields so you can add the values you want.
A typical naming scheme for the input fields of an attribute is:
ContentObjectAttribute_[some attribute specific name]_[contentobjectattribute id]
For instance the name for the fields of an articles are (do a view source of the page when you're editing an article):
- title: ContentObjectAttribute_ezstring_data_text_1105
- into: ContentObjectAttribute_data_text_1108 (1105 and 1108 are contentobjectattribute identifier numbers that are going to be different on your installation.)
You will have to to change these names to:
powercontent_[contentclassattribute identifier]ContentObjectAttribute[some attribute specific name]_pcattributeid
For the article, it would be: -title: powercontent_title_ContentObjectAttribute_ezstring_data_text_pcattributeid -intro: powercontent_intro_ContentObjectAttribute_data_text_pcattributeid
When the Power Content module processes this kind of post variables, it will take their content and put them into the proper fields as if the user would have inputed it (it will inject fake post variables where the string "pcattributeid" will be replaced by the expected contentobjectattribute id).
On the top of the parameters you want to "prefill", you have to provide a few additionnal ones:
- NodeID: The nodeid of the parent object you want to create (as an option, you can put "UserNode", that will put create it under the usernode of the currently logged in user)
- ClassIdentifier: The class identifier of the object you want to create (you can provide either the class identifier or the class id, no need for both)
- CreateButton: a submit button You have more optional parameters, see the examples for details
- RedirectToMainNodeAfterPublish : if set, it will redirect to the full view of the newly created node
- RedirectURIAfterPublish : the url to display after the publication of the node.
Examples code
- Example code for the "article" content class. This will prefill the title and intro of the article:
- Example code for the "File" content class:
<div>
<label>File:</label>
<input class="box" name="powercontent_file_ContentObjectAttribute_data_binaryfilename_pcattributeid" type="file" />
</div>
<div>
<label>Title:</label>
<input type="text" name="powercontent_name_ContentObjectAttribute_ezstring_data_text_pcattributeid" value="" />
</div>
<div>
<input class="button" type="submit" name="CreateButton" value="Create" />
</div>