plone

Making TinyMCE image pick dialog point to a default folder on Plone

∥☆過路亽.° 提交于 2019-12-01 04:43:02
Plone 4.1. What would be the easiest way to make TinyMCE image picker dialog point to a site default folder (/image-bank) instead of current folder? This + folder display as album would provide a rudimentary image bank support for Plone easily. I'd hope to achieve this feature for All Plone out of the box content types (ATContentTypes) My custom AT content types MY custom Dexterity content types Portlet editor WYSIWYG (is it zope.formlib?) If it's difficult to edit Python code all over the places, it's accetable just to a Javascript snippet patching TinyMCE settings on the client side. Mikko:

Making TinyMCE image pick dialog point to a default folder on Plone

若如初见. 提交于 2019-12-01 02:54:22
问题 Plone 4.1. What would be the easiest way to make TinyMCE image picker dialog point to a site default folder (/image-bank) instead of current folder? This + folder display as album would provide a rudimentary image bank support for Plone easily. I'd hope to achieve this feature for All Plone out of the box content types (ATContentTypes) My custom AT content types MY custom Dexterity content types Portlet editor WYSIWYG (is it zope.formlib?) If it's difficult to edit Python code all over the

Provide a default value on a field also on edit form

China☆狼群 提交于 2019-12-01 01:09:32
So I have a form (just getting the example from plone.directives.form ): from plone.directives import form from zope import schema class IMySchema(form.Schema): title = schema.TextLine(title=u"Title") @form.default_value(field=IMySchema['title']) def default_title(data): return data.context.suggested_title Which works fine only for add forms. So the question is: how can I make this same method be also used on an edit form? I do not generate the edit form by myself if that's relevant to the matter. Edit: I forgot something that it's quite relevant: the value entered in the field is stored

Generate PDF from Plone content types

。_饼干妹妹 提交于 2019-12-01 00:15:00
I need to create PDFs from content types (made with dexerity if that matters) so that the user creates a new document and after filling the form a PDF is generated and ready to be downloaded. So basically after creating/modifying the document a PDF should be created and stored in ZODB (actually I'm using blobs) so that I could link the view with a "Download as PDF". I've seen PDFNode but it doesn't seem to be what I'm looking for. There's also Produce & Publish but it's a webservice(?) and the company I'm going to develop this for doesn't want (for privacy) to send data outside their

Plone: reacting to object removal

六眼飞鱼酱① 提交于 2019-11-30 22:58:37
I'm wanting to redirect to a container's parent after deleting an item within it. To this end, I've tried subscribing to zope.lifecycleevent's IObjectRemovedEvent : @grok.subscribe(ISite, IObjectRemovedEvent) def redirect_to_trial_on_delete(obj, event): request = getattr(obj, 'REQUEST', None) if request: trial_url = obj.aq_parent.aq_parent.absolute_url() request.response.redirect(trial_url) Deletion is triggered by clicking on container/id/delete_confirmation however this fires more events than I was expecting. My subscribed function is called twice: once when I click on the link, then again

Provide a default value on a field also on edit form

↘锁芯ラ 提交于 2019-11-30 21:03:22
问题 So I have a form (just getting the example from plone.directives.form): from plone.directives import form from zope import schema class IMySchema(form.Schema): title = schema.TextLine(title=u"Title") @form.default_value(field=IMySchema['title']) def default_title(data): return data.context.suggested_title Which works fine only for add forms. So the question is: how can I make this same method be also used on an edit form? I do not generate the edit form by myself if that's relevant to the

Generate PDF from Plone content types

戏子无情 提交于 2019-11-30 18:54:39
问题 I need to create PDFs from content types (made with dexerity if that matters) so that the user creates a new document and after filling the form a PDF is generated and ready to be downloaded. So basically after creating/modifying the document a PDF should be created and stored in ZODB (actually I'm using blobs) so that I could link the view with a "Download as PDF". I've seen PDFNode but it doesn't seem to be what I'm looking for. There's also Produce & Publish but it's a webservice(?) and

Plone: reacting to object removal

做~自己de王妃 提交于 2019-11-30 17:23:33
问题 I'm wanting to redirect to a container's parent after deleting an item within it. To this end, I've tried subscribing to zope.lifecycleevent's IObjectRemovedEvent : @grok.subscribe(ISite, IObjectRemovedEvent) def redirect_to_trial_on_delete(obj, event): request = getattr(obj, 'REQUEST', None) if request: trial_url = obj.aq_parent.aq_parent.absolute_url() request.response.redirect(trial_url) Deletion is triggered by clicking on container/id/delete_confirmation however this fires more events

How to retract content after expiration date

橙三吉。 提交于 2019-11-30 09:37:40
问题 one of our customers is using in their site third party content that must be unavailable after one month because of license restrictions. in this specific case expiring content will not help because the content is still available on the site and is viewable by anyone who already has its address. we make a quick research and found an old tutorial by our friend Mikko Ohtamaa (who else?) about Time based workflow transitions and I'm currently checking if dependencies work on latest versions of

how to get derived class name from base class

≯℡__Kan透↙ 提交于 2019-11-30 08:08:08
I have a base class Person and derived classes Manager and Employee . Now, what I would like to know is the object created is Manager or the Employee . The person is given as belows: from Project.CMFCore.utils import getToolByName schema = getattr(Person, 'schema', Schema(())).copy() + Schema((TextField('FirstName', required = True, widget = StringWidget(label='First Name', i18n_domain='project')), TextField('Last Name', required = True, widget = StringWidget(label='Last Name', i18n_domain='i5', label_msgid='label_pub_city')) class Manager(BaseContent): def get_name(self): catalog =