A PloneFormGen adapter that will save the data from a form to an actual content type. This way you can still use permissions, workflows, etc on the form data.
This product provides a dynamic content type to store PloneFormGen form data into. It leverages schemaextenders ability to dynamically add extra fields on a content type so that you essentially get a persistent copy of your form.
The product adds a “Save Data to Content Adapter” item to the “Add new..” drop down for the PloneFormGen Form. Once enabled, when a user submits a form, a new content item is created with that data and located in the adapter.
Upon save data adapter creation, user can choose to use any content type that has ‘uwosh.pfg.d2c’ configured as the ‘product’ in the FTI, to store the form submission.
So besides the original FormSaveData2ContentEntry, its clone types can also be used to store form data - whether added to types tool via code, genericsetup profile or by manually copying the FormSaveData2ContentEntry FTI in portal_types tool (and then renaming it appropriately).
The type names can be translated using the product’s domain.
Upgrading to 2.0
You must run the upgrade step in the add/remove product control panel in order for you to successfully upgrade to 2.0 otherwise, your data adapter will not display it’s contents properly.
Don’t forget to enable the adapter after it is added to the form!
It is often very useful to assign a placeful workflow onto a save data content type. Normally, this is rather cumbersome to do; however, d2c now provides a nice widget to make this sort of action automatic (automatically create missing workflow policy).
The new widget will be automatically rendered when CMFPlacefulWorfklow product is installed in your site.
Compatible with versions of PloneFormGen >= 1.2.2 and Plone 3.x -> 4.x.
Version 1.0 derives the new D2C saved data adapter from the BTree folder class. This allows Plone 3.x sites to handle larger numbers of content items inside the D2C objects. There is an upgrade step that allows pre-1.0 D2C objects to get migrated to BTree storage. Version 1.0 also works with Plone 4. However, if you have a Plone 3.x site that uses pre-1.0 D2C and you upgrade to Plone 4 and only then upgrade to 1.0+ D2C, the upgrade step that migrates D2C storage to BTree storage may not work. We recommend that you first upgrade to 1.0+ D2C then upgrade to Plone 4.
D2C Form Images
Since D2C 2.1, there has been the ability for PFG file fields to behave like plone image fields with scales. Just select the ‘Is Image’ checkbox in the PFG file field settings.
Rember to use “image” as id for the image field to use it in views like folder summary.
To access scales for an image, you must construct a url like:
or for original
Upgrade old should-be d2c images
First, make sure you select that the field is an image in the corresponding ploneformgen form.
Then, go to the zmi, portal_setup, upgrades tab, select uwosh.pfg.d2c:default, click to show old and select the image-scales upgrade to run.
In order for this to work, you’ll need to disable the schemaextender cache:
archetypes.schemaextender\archetypes\schemaextender\extender.py line 113 disable CACHE_ENABLED
Finding created d2c object on request
Sometimes you need to know what object you just created was to redirect or perhaps do extra processing. D2C sets values on the request environ so you can get that information:
Content object methods
- getValue(fieldid, default=None)
get the value of a field
- setValue(fieldid, value)
set the value for a field
get connected pfg form
get connected pfg content adapter
2.4.6 ~ 2014-11-12
Fix bug where viewing a data entry led to an ‘Insufficient Privileges’ screen if the user did not have permission to view the container. [davisagli]
2.4.5 ~ 2014-09-18
fix image field support to only work on image file types [vangheem]
2.4.4 ~ 2014-07-23
use plone.app.blob for Image and File Fields
be able to pass in arguments to getValue call [vangheem]
2.4.3 ~ 2013-12-11
handle errors on saving bad image [vangheem]
2.4.2 ~ 2013-09-18
fix js selector for adding a portal type [vangheem]
2.4.1 ~ 2013-09-17
include Products.CMFCore permissions in zcml which will fix potential startup errors [vangheem]
2.4.0 ~ 2013-06-10
fix d2c skin layer not being above PFG layer. Fixes issues with some fields. [vangheem]
2.3.1 ~ 2013-05-29
plone 4.3 import compatibility [calvinhp]
2.3.0b4 ~ 2013-01-24
In FormSaveData2ContentEntry/getForm change the way to check the form: right now is not by portal_type but by interface [lucabel]
2.3.0b3 ~ 2012-12-18
override set of image field to use DELETE_IMAGE instead of DELETE_FILE [vangheem]
2.3.0b2 ~ 2012-11-26
fix rich text field use of default_output_type value[vangheem]
restored finnish translation lost in the beta1 version [keul]
updated italian translation [keul]
2.3.0b1 ~ 2012-10-25
fixed a typo in the main configure.zcml [keul]
refactoring of all the i18n generation and structure, now i18ndude compatible [keul]
restored compatibility with Plone 3.3 [keul]
fixed an issue with the “Add new type” popup if you press “cancel” [keul]
fixed issues when adding new save data types [keul]
removed dependency on archetypes.referencebrowserwidget (not used anywhere) [keul]
generated contents now implements the “tag” method, so can be called from a folder summary view [keul]
fix handling when getting image field fails [vangheem]
2.2.0 ~ 2012-10-23
provide support for pfg.donationform donation field
2.1.6 ~ 2012-10-01
last release didn’t include the actual change
2.1.5 ~ 2012-08-04
fallback to using getSite if current item fails with getToolByName. This will fix using d2c along with versioning.
2.1.4 ~ 2012-07-05
fix with feildsets
remove getSite call
2.1.3 ~ 2012-05-15
fix acquisition error issue on saving an existing entry by always just getting the site object.
2.1.2 ~ 2012-05-03
fix conflicting import [vangheem]
2.1.1 ~ 2012-05-03
fix brown bag release [vangheem]
2.1.0 ~ 2012-05-03
respect avoid security checks for renaming Ids [vangheem]
2.1b3 ~ 2012-04-03
provide setValue method for content types. [vangheem]
2.1b2 ~ 2012-03-28
fix setting of image with scales [vangheem]
2.1b1 ~ 2012-03-27
be able to specify file fields as images fields. [vangheem]
be able to create nice ids from title [vangheem]
2.0b1 ~ 2012-03-20
be able to specify a default value for the getValue method [vangheem]
placeful workflow change widget should be on edit page [vangheem]
Make required on pfg field work on extender field. [vangheem]
add values to request object for created d2c object [vangheem]
2.0a3 ~ 2012-02-09
do not cache form instance because it loses acquisition. [vangheem]
2.0a2 ~ 2012-02-04
Add getNextPreviousParentValue method to fix issue when adding adapter to form. [vangheem]
2.0a1 ~ 2012-02-03
Fixed issue with vocabulary field [vangheem]
Providing ordering support for data adapter folder and enable next/previous navigation. [vangheem]
1.3.2 ~ 2012-01-31
add alias to form findFieldObjectByName method on data entry type. This fixes selection widgets on content objects that were moved out of the adapter directory.
1.3.1 ~ 2012-01-10
safely check portal type when finding related form [vangheem]
1.3.0 ~ 2012-01-10
Add ability to easily assign a placeful workflow onto a data adapter [vangheem]
Correctly use the hidden ‘last_referer’ form field to figure out where the user came to the form from. IFormSaveData2ContentEntryFinalizedEvent subscribers can access the referrer content object simply as event.referrer. [saffe]
set value of adapter on entry object so you can move the object around [vangheem]
fire the object initialized event when data entry object is created [vangheem]
1.2.8 ~ 2011-10-28
Mention the BTree portal_setup upgrade step, in new docs/UPGRADES.txt file [tkimnguyen]
Add ability to easily add new types via edit form. [vangheem]
1.2.7 ~ 2011-07-20
fixed max value validator. [vangheem]
1.2.6 ~ 2011-06-30
Fix use of urlparse for python 2.4
1.2.5 - 2011-06-01
Fix issue where in some cases object could not acquire to parent form. [vangheem]
1.2.4 - 2011-04-29
fix file fields to work with ones that aren’t required. [vangheem]
incorrect default value fo entry type. [vangheem]
1.2.3 - 2011-04-28
File fields are now working. [vangheem]
1.2.2 - 2011-03-03
Improved functionality for product developers: If user arrives to the pfg form via a plone content object, the referring content object is available as ‘referrer’ attribute of the event dispatched upon data entry content creation. [saffe]
Bugfix: anonymous TALES title override did not always work due to insufficient permissions. User is now elevated to “Owner” in the current context, allowing for more useful TALES expressions. [saffe]
1.2.1 - 2011-02-24
New functionality for product developers: uwosh.pfg.d2c now fires a custom event upon a data content entry creation. Subscribe to: uwosh.pfg.d2c.interfaces.IFormSaveData2ContentEntryFinalizedEvent [saffe]
Improved documentation & Sphinx docs [saffe]
1.2 - 2011-02-20
New feature: dynamic data entry title override via a TALES expression configurable in the save data adapter. [saffe] [vangheem]
1.1.1 - 2011-02-11
fix translations [saffe]
1.1 - 2011-02-10
New feature: Any FTI clone of FormSaveData2ContentEntry type can be selected in the save adapter as the data content entry type to use. This makes it possible to apply different workflows, content rules etc. to content saved by different forms. [saffe]
1.0 - 2011-01-06
New saved data adapter derives from large (BTree) folder instead of regular ones to handle better large numbers of contained items. Upgrade step migrates from obsolete normal/slow folder storage to the new BTree storage. [nguyen]
fixed issue where it couldn’t render the title viewlet if a lines field was used for the title field. Convert all value fields to string for the title. [vangheem]
add support for pfg datagridfield [vangheem]
added accessor method getValue for entry type.
index object properly after values are set
allow you to specify which field to use for the title
added autoinclude entry point
only use _finishConstruction method if it’s available since in newer versions of CMFCore, it’s not there.
use id for Title
allow avoiding security checks when creating content.
conditionally include certain fields for backwards compatibility
make backward compatible to at least PloneFormGen 1.2.2 – maybe older.
added permissions for adding content
More fixes for the rating scale field. Should work as expected now.
fixed widgets not working correctly.
memoize the call to get the fields just in case it gets slow
fix the way I checked for FileFields so that anything that subclasses a FileField won’t try to get it’s form value differently anymore.
fix egg distro not including docs folder so the product wouldn’t install
fixed file fields not saving
Nathan Van Gheem, Author T. Kim Nguyen, Lurker Petri Savolainen, Contributor
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.