def setupComment(site): # Set up form controller actions for the widgets to work registerAttachmentsFormControllerActions(site, contentType = 'PloneboardComment', template = 'base_edit') registerImagesFormControllerActions(site, contentType = 'PloneboardComment', template = 'base_edit') # Register form controller actions for LinguaPlone translate_item registerAttachmentsFormControllerActions(site, contentType = 'PloneboardComment', template = 'translate_item') registerImagesFormControllerActions(site, contentType = 'PloneboardComment', template = 'translate_item') site.plone_log('setupComment', 'Updated Widget Attachment Management')
def setupComment(site): # Set up form controller actions for the widgets to work registerAttachmentsFormControllerActions(site, contentType = 'PloneboardComment', template = 'base_edit') registerImagesFormControllerActions(site, contentType = 'PloneboardComment', template = 'base_edit') # Register form controller actions for LinguaPlone translate_item registerAttachmentsFormControllerActions(site, contentType = 'PloneboardComment', template = 'translate_item') registerImagesFormControllerActions(site, contentType = 'PloneboardComment', template = 'translate_item') site.plone_log('setupComment', 'Updated Widget Attachment Management')
def installAttachmentSupport(context): """ install attachment handlers """ site = context.getSite() # Set up form controller actions for the widgets to work registerAttachmentsFormControllerActions( site, contentType='CaseStudy', template='base_edit') # Register form controller actions for LinguaPlone translate_item registerAttachmentsFormControllerActions( site, contentType='CaseStudy', template='translate_item')
def setupRhaptosForums(context): if context.readDataFile('rhaptosforums.txt') is None: return portal = context.getSite() portal_quickinstaller = getToolByName(portal, 'portal_quickinstaller') portal_types = getToolByName(portal, 'portal_types') portal_setup = getToolByName(portal, 'portal_setup') import_context = portal_setup.getImportContextID() portal_setup.setImportContext( 'profile-Products.SimpleAttachment:SimpleAttachment') portal_setup.runAllImportSteps() import_context = portal_setup.getImportContextID() registerAttachmentsFormControllerActions(portal) registerImagesFormControllerActions(portal) portal_quickinstaller.installProduct('Ploneboard') # remove Ploneboard from globally allowed content types fti = portal_types.getTypeInfo('Ploneboard') fti.global_allow = False
def setupRichDocument(context): if context.readDataFile('richdocument_various.txt') is None: return portal = context.getSite() qi = getToolByName(portal, 'portal_quickinstaller') if not (qi.isProductInstalled('Products.SimpleAttachment') or qi.isProductInstalled('SimpleAttachment') or qi.isProductInstalled('Attachment support')): qi.installProduct('Products.SimpleAttachment') # Set up form controller actions for the widgets to work registerAttachmentsFormControllerActions(portal, contentType = 'RichDocument', template = 'atct_edit') registerImagesFormControllerActions(portal, contentType = 'RichDocument', template = 'atct_edit') # Register form controller actions for LinguaPlone translate_item registerAttachmentsFormControllerActions(portal, contentType = 'RichDocument', template = 'translate_item') registerImagesFormControllerActions(portal, contentType = 'RichDocument', template = 'translate_item') # Make RichDocumnt objects linkable in kupu kupuTool = getToolByName(portal, 'kupu_library_tool', None) tinyTool = getToolByName(portal, 'portal_tinymce', None) if kupuTool: linkable = list(kupuTool.getPortalTypesForResourceType('linkable')) if 'RichDocument' not in linkable: linkable.append('RichDocument') # kupu_library_tool has an idiotic interface, basically written purely to # work with its configuration page. :-( kupuTool.updateResourceTypes(({'resource_type' : 'linkable', 'old_type' : 'linkable', 'portal_types' : linkable},)) if tinyTool: linkable = tinyTool.linkable.split('\n') linkable.append('RichDocument') tinyTool.linkable = '\n'.join(set(linkable))
def install(self, reinstall=False): """ External Method to install minaraad """ print >> out, "Installation log of %s:" % config.PROJECTNAME from Products.minaraad.config import PRODUCT_DEPENDENCIES from Products.minaraad.config import PACKAGE_DEPENDENCIES portal = getToolByName(self, 'portal_url').getPortalObject() portal_quickinstaller = portal.portal_quickinstaller for product in PRODUCT_DEPENDENCIES + PACKAGE_DEPENDENCIES: if not portal_quickinstaller.isProductInstalled(product): portal_quickinstaller.installProduct(product) transaction.savepoint() portal_setup = getToolByName(self, 'portal_setup') portal_setup.runAllImportStepsFromProfile( 'profile-Products.minaraad:default') # Fix encoded element. In the tests it somehow works fine without # this on Mac, but not on Linux. Problem is that in both cases it # gets encoded as iso-8859-1, but Plone wants utf-8 everywhere. mina_props = portal.portal_properties.minaraad_properties themes = mina_props.getProperty('themes') new_themes = [] for theme in themes: # This is especially for "23/Milieuhygiëne en klimaat" try: theme.decode('utf-8') except UnicodeDecodeError: # Bad one, fix it. theme = theme.decode('iso-8859-1').encode('utf-8') new_themes.append(theme) mina_props._updateProperty('themes', tuple(new_themes)) # Set up form controller actions for the widgets to work registerAttachmentsFormControllerActions(self) set_recaptcha_keys(self) print >> out, "Added actions for the attachment controls to the " print >> out, "base_edit form controller." # Add extra indexes. Has been done in production a long time ago, # perhaps by hand, but now some new automated tests are failing # when we do not add the getItemstartdate index here. catalog = getToolByName(self, 'portal_catalog') indexes = catalog.indexes() # Specify the indexes you want, with ('index_name', 'index_type') wanted = (('getItemstartdate', 'DateIndex'), ('getCategory', 'FieldIndex'), ('getDate', 'DateIndex'), ('getStart_time', 'DateIndex'), ('published', 'FieldIndex'), ) indexables = [] for name, meta_type in wanted: if name not in indexes: catalog.addIndex(name, meta_type) indexables.append(name) print >> out, "Added %s for field %s." % (meta_type, name) if len(indexables) > 0: print >> out, "Indexing new indexes %s." % ', '.join(indexables) catalog.manage_reindexIndex(ids=indexables) return out.getvalue()