Package: collective.immediatecreate
Folderish types are designed to be able to contain content.
When you usecollective.folderishtypes(or any custom folderish types) in Plone and you simply add a folderish item on edit (like an image in TinyMCE), then  after adding you will see that all the assets you upload through the editor will be stored as siblings of the item you just created.
This is due to the fact that the new item does not “exist” yet - it is just an add-form - that is, before it has been saved once.This addon creates the object immediately, so items can be stored inside.FeaturesID/ ShortnameA valid (and intermediate) ID will be generated after “add <Type>…” has been clicked, so the item can be persisted.
However, the ID changes when the user saves the content for the first time so the Plone’s default behavior is retained.
This feature might not be wanted by some users and is configureable (todo).VerificationAdditionally the drop-in-feature covers the usecase when an added type has mandatory fields or custom verification.
All verification tasks are performed as usual when the user saves an item.Cancel becomes DeleteWhen the user interacts with the item after it has been automatically created the “cancel” button is turned into a “delete” button.
If the cancel button is clicked, the item will be discarded.CleanupIn order to get rid of initially created but never saved nor deleted items,
a cleanup script is provided.InstallationInstallcollective.immediatecreateby adding it to your buildout:[buildout]# ...eggs=collective.immediatecreateand then runningbin/buildoutRestart Plone and installImmediate Createin control panel under addons.ActivationAfter installation nothing changed.
The feature must be activated for a content-type first.
To make a type available for immediate create, two changes need to be done:Add the behaviorcollective.immediatecreateto the type in the control panel underDexterity Content TypesModify the Factory Type Information using the ZMI underportal_types.
Change the value ofAdd view URL (Expression)to++addimmediate++TYPENAME.Configuration using GenericSetupIn a policy profile in filesystem the a Type Information underprofiles/default/types/TYPENAME.xmlcan be edited to make a type aware of immediate create:<?xml version="1.0"?><objecti18n:domain="plone"meta_type="Dexterity FTI"name="MyFolderishType"xmlns:i18n="http://xml.zope.org/namespaces/i18n"><!-- ... SNIP ... --><propertyname="add_view_expr">string:${folder_url}/++addimmediate++MyFolderishType</property><!-- ... SNIP ... --><!-- Enabled behaviors --><propertyname="behaviors"purge="False"><elementvalue="collective.immediatecreate"/></property><!-- ... SNIP ... --></object>CleanupA cleanup script can be called as Manager user.
It removes all stalled creations older than two hours.
It is named@@immediatecreate-cleanup-leftovers.
You may want to use a cron service of your choice to call it recurring.Source CodeThe sources are in a GIT DVCS with its main branches atgithub.
There you can report issue too.We’d be happy to see many forks and pull-requests to make this addon even better.This package uses theblack coding stylewith 79 chars line length.SupportMaintainers areJens Klein,Gogo Bernhard,Markus Hilbertand the BlueDynamics Alliance developer team.
We appreciate any contribution and if a release is needed to be done on pypi, please just contact one of us.
We also offer commercial support if any training, coaching, integration or adaptions are needed.If you are having issues, please let us know.LicenseThe project is licensed under the GPLv2.ContributorsJens W. Klein,jk@kleinundpartner.atGogo Bernhard,g.bernhard@akbild.ac.atMarkus Hilbert,markus.hilbert@iham.atChangelog2.0.1 (2023-07-20)Fix cancel button on form validation if immediate create for has a validation error.
[jensens]2.0.0 (2023-06-14)Towards Plone 6, Python 3 (only).
[jensens]1.0a3 (2018-11-07)added ImmediateAddedEvent.[iham]fixed code-styles. [jensens]1.0a2 (2018-09-12)fixed locking [iham]robot test added [llisa123]1.0a1 (2018-06-23)Initial release.
[jensens]