def install(portal): out = StringIO() # copy the News Item for our blog entry portal_types = getToolByName(portal, 'portal_types') if BLOG_ENTRY_NAME not in portal_types.objectIds(): cb_copy_data = portal_types.manage_copyObjects(['News Item']) paste_data = portal_types.manage_pasteObjects(cb_copy_data) temp_id = paste_data[0]['new_id'] portal_types.manage_renameObject(temp_id, BLOG_ENTRY_NAME) getattr(portal_types, BLOG_ENTRY_NAME).title = BLOG_ENTRY_NAME getattr(portal_types, BLOG_ENTRY_NAME).i18n_domain = 'cynin' out.write("Duplicated 'News Item' FTI info as '%s'" % BLOG_ENTRY_NAME) # tweak Blog Entry FTI settings blog = getattr(portal_types, BLOG_ENTRY_NAME) blog.default_view = 'blogentry_view' blog.immediate_view = 'blogentry_view' view = 'blogentry_view' if view not in blog.view_methods: blog._updateProperty('view_methods', blog.view_methods + (view,)) blog.allow_discussion = True out.write("Tweaked %s FTU settings" % BLOG_ENTRY_NAME) # make Blog Entry use portal factory, so we don't have any blog entry skeletons factory = getToolByName(portal, 'portal_factory') types = factory.getFactoryTypes().keys() if 'Blog Entry' not in types: types.append('Blog Entry') factory.manage_setPortalFactoryTypes(listOfTypeIds=types) print >> out, "Added Blog Entry to portal factory" # install our skins install_subskin(portal, out, GLOBALS) skins_tool = getToolByName(portal, "portal_skins") if HAS_PLONE30: bad_skin = "scrawl" else: bad_skin = "scrawl_30" # Iterate over all existing skins and remove the one we don't want skins = skins_tool.getSkinSelections() for skin in skins: path = skins_tool.getSkinPath(skin) path = map(string.strip, string.split(path,',')) if bad_skin in path: path.remove(bad_skin) path = string.join(path, ', ') # addSkinSelection will replace existing skins as well. skins_tool.addSkinSelection(skin, path) # make blog view available to Smart Folders view = 'blog_view' topic = portal_types.Topic if view not in topic.view_methods: topic._updateProperty('view_methods', topic.view_methods + (view,)) print >> out, "Made %s available for topics.\n" % view return out.getvalue()
def install(self): """Install Plone Slimbox: Install skin layer, javascript and stylesheet """ out = StringIO() print >> out, "Installing %s" % PROJECTNAME # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Register stylesheet csstool = getToolByName(self, 'portal_css') csstool.registerStylesheet(id='slimbox.css', media='screen') print >> out, "Registered stylesheet" # Register javascript jstool = getToolByName(self, 'portal_javascripts') jstool.registerScript(id='mootools.v1.11.js') jstool.registerScript(id='slimbox.js') print >> out, "Registered javascript" print >> out, "Installation completed." return out.getvalue()
def install(self): """ Quick install script This script is executed when user chooses quickinstall in Zope Management Interface or Plone Management Page @param portal Plone portal where are installing to """ portal = self # Create buffer which logs messages during installation out = StringIO() # Register Archetypes types in the portal installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) # Register layout files in the portal install_subskin(self, out, GLOBALS) # Register CSS definitions used by our product registerStylesheets(self, out, STYLESHEETS) ic = InstallationContext(self, GLOBALS) ic.requiresInstalledProduct("DataGridField") getInstallationRunner(self).install(ic, auto_reorder=1) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self, reinstall=False): out = StringIO() addPloneboardTool(self, out) addCatalogIndices(self, out) installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) registerNavigationTreeSettings(self, out) registerTypesWithPortalFactory(self, out) setupPloneboardWorkflow(self, out) addPortalProperties(self, out) addConfiglets(self, out) addMemberProperties(self, out) # Not sure when is best to make this call, but it works here ;-). automigrate(self, out) removeOldCatalog(self, out) migrateTransforms(self, out) addTransforms(self, out) setupRootPermissions(self, out) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() # Install types type_info = listTypes(PROJECTNAME) installTypes(self, out, type_info, PROJECTNAME) # Install tools add_tool = self.manage_addProduct[PROJECTNAME].manage_addTool if not self.objectIds(spec=FSSTool.meta_type): add_tool(FSSTool.meta_type) # Install skin install_subskin(self, out, GLOBALS) # Install configlet cp_tool = getToolByName(self, 'portal_controlpanel') try: cp_tool.registerConfiglet(**fss_prefs_configlet) except: pass # Install modifier install_modifier(self, out) out.write('Installation completed.\n') return out.getvalue()
def install(self): """ Executed from the quickinstaller """ out = StringIO() install_subskin(self, out, GLOBALS) return out.getvalue()
def install(self): """Install Plone Slimbox: Install skin layer, javascript and stylesheet """ out = StringIO() print >> out, "Installing %s" % PROJECTNAME # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Register stylesheet csstool = getToolByName(self, 'portal_css') csstool.registerStylesheet(id='slimbox2.css', media='screen') print >> out, "Registered stylesheet" # Register javascript jstool = getToolByName(self, 'portal_javascripts') version = getToolByName(self, 'portal_migration').getFileSystemVersion() if version < "3.1": jstool.registerScript(id='jquery.min.js') jstool.registerScript(id='slimbox2.js') print >> out, "Registered javascript" print >> out, "Installation completed." return out.getvalue()
def install(self): """Install Plone Slimbox: Install skin layer, javascript and stylesheet """ out = StringIO() print >> out, "Installing %s" % PROJECTNAME # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Register stylesheet csstool = getToolByName(self, 'portal_css') csstool.registerStylesheet(id='slimbox.css', media='screen') print >> out, "Registered stylesheet" # Register javascript jstool = getToolByName(self, 'portal_javascripts') jstool.registerScript(id='mootools.v1.11.js') jstool.registerScript(id='slimbox.js') print >> out, "Registered javascript" print >> out, "Installation completed." return out.getvalue()
def install(self): """Install CMFNotification.""" out = StringIO() install_subskin(self, out, GLOBALS) ## Add tool portal = getToolByName(self, 'portal_url').getPortalObject() if getToolByName(portal, ID, None) is None: t = NotificationTool() portal._setObject(ID, t) ## Add configlet panel = getToolByName(self, 'portal_controlpanel') if panel is not None: existing = panel.enumConfiglets(group='Products') existing = [c['id'] for c in existing] for configlet in CONFIGLETS: if configlet['id'] not in existing: panel.registerConfiglet(**configlet) ## Add portlet to the right slots. right_slots = list(portal.getProperty('right_slots')) if 'here/portlet_notification/macros/portlet' not in right_slots: right_slots.insert(0, 'here/portlet_notification/macros/portlet') portal.manage_changeProperties(right_slots=right_slots) ## Set default roles for subscribe permission portal.manage_permission(SUBSCRIBE_PERMISSION, DEFAULT_ROLES) print >> out, "Successfully installed %s." % PROJECT_NAME return out.getvalue()
def install(self): out = StringIO() self._addRole("Procurement") self._addRole("Finance") for account in config.accounts.keys(): self.acl_users.userFolderAddGroup(utils.getGroupFromAccount(account), ()) installTypes(self, out, atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) install_subskin(self, out, config.GLOBALS) wf_tool = getToolByName(self, "portal_workflow") wf_tool.setChainForPortalTypes( [t['portal_type'] for t in atapi.listTypes(config.PROJECTNAME)], "alphaflow_fake") alf = getToolByName(self, 'workflow_manager') id = "procurement" if id in alf.processes.objectIds(): IProcessWriteContainer(alf.processes).remove(id) wf_dir = os.path.abspath( os.path.join( os.path.split(config.GLOBALS['__file__'])[0], "workflows")) importer = zope.component.getUtility(IWorkflowImporter, name='xml') version = importer(file(os.path.join(wf_dir, "simple.alf"))) process = IProcessWriteContainer(alf.processes).add(id, Process(id)) process.editable(version) process.update()
def install(self): """ Executed from the quickinstaller """ out = StringIO() install_subskin(self, out, GLOBALS) return out.getvalue()
def install(self, reinstall=False): out = StringIO() out.write( 'CMFContentPanels installation tool\n') portal = getToolByName(self, 'portal_url').getPortalObject() setup_tool = getToolByName(portal, 'portal_setup') if PLONE_VERSION >= 3: setup_tool.runAllImportStepsFromProfile( "profile-Products.CMFContentPanels:default", purge_old=False) else: factory_tool = getToolByName(self,'portal_factory') factory_types=[ "ContentPanels", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) if not hasattr(portal, 'portal_contentpanels'): portal._setObject( 'portal_contentpanels', ContentPanelsTool() ) out.write('Added ConentPanels Tool\n') p_cp=getToolByName(self, 'portal_contentpanels') p_cp.manage_installAllViewlets() install_RSSCache(portal, out) install_default_page(portal, out) addViewMethods(portal, out) return out.getvalue()
def install(self, reinstall=False): out = StringIO() utils.installDependencies(self, out) installTypes(self, out, listTypes(config.PROJECT_NAME), config.PROJECT_NAME, refresh_references=0) install_subskin(self, out, config.GLOBALS) utils.setupWorkflows(self, out) utils.setupCacheTool(self, out) utils.setupSquidTool(self, out) utils.setupPortalFactory(self, out) utils.setupFolderViews(self, out) utils.setupSiteProperties(self, out) utils.setupConfiglet(self, out) # clean up old cache policy and migrate changed schemas if reinstall: policy_utils.updateOldCachePolicy(self, out) utils.updateSchemas(self, out) # add new cache policies policy_utils.addCachePolicies(self, out) out.write("Successfully installed %s." % config.PROJECT_NAME) return out.getvalue()
def install(self, reinstall=False): out = StringIO() portal_quickinstaller = getToolByName(self, 'portal_quickinstaller') portal_setup = getToolByName(self, 'portal_setup') install_subskin(self, out, GLOBALS) # The skins need to be sorted differently depending on whether Azax # is available or not. sort_skins(self) if not hasattr(self, TOOL_ID): from Products.CompositePack.tool import manage_addCompositeTool manage_addCompositeTool(self) for extension_id in EXTENSION_PROFILES: portal_setup.runAllImportStepsFromProfile( 'profile-%s' % extension_id, purge_old=False) product_name = extension_id.split(':')[0] portal_quickinstaller.notifyInstalled(product_name) transaction.savepoint() install_tool(self, out) install_customisation(self, out) install_fixuids(self, out) install_kupu_resource(self, out) out.write("Successfully installed %s.\n" % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) #register the folderish items in portal_properties/site_properties site_props = getToolByName(self, 'portal_properties').site_properties use_folder_tabs = site_props.getProperty('use_folder_tabs', None) if not 'FaqFolder' in use_folder_tabs: site_props._updateProperty('use_folder_tabs', tuple(use_folder_tabs) + ('FaqFolder',)) print >> out, "Added FaqFolder to portal_properties/site_properties/use_folder_tabs" use_folder_contents = site_props.getProperty('use_folder_contents', None) if not 'FaqFolder' in use_folder_tabs: site_props._updateProperty('use_folder_contents', tuple(use_folder_tabs) + ('FaqFolder',)) print >> out, "Added FaqFolder to portal_properties/site_properties/use_folder_contents" print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() # Add actionInfo icon to portal_actionicons. Delete old version before adding, if exist one. actionicons_tool = getToolByName(self, 'portal_actionicons') if actionicons_tool.queryActionInfo('plone', 'rss2syndication'): actionicons_tool.removeActionIcon('plone','rss2syndication') actionicons_tool.addActionIcon(category='plone', action_id='rss2syndication', icon_expr='rss2_icon.png', title='RSS2 Syndication') # Add actionInfo action to portal_actions. Delete old versions before adding, if exist one. action_tool = getToolByName(self, 'portal_actions') actions_id = [a.id for a in action_tool._actions] selections = [actions_id.index(a) for a in actions_id if a in ('rss2syndication','setup_rss2')] action_tool.deleteActions(selections=selections) action_tool.addAction(id='rss2syndication', name='RSS2 Syndication', action='string:$object_url/RSS2', condition='python: folder==object and portal.portal_syndication.isSyndicationAllowed(object)', permission=('View',), category='document_actions') action_tool.addAction(id='setup_rss2', name='RSS2 Setup', action='string:$object_url/setup_rss2', condition='python:portal.portal_syndication.isSyndicationAllowed(object)', permission=('Manage properties',), category='folder') install_subskin(self,out,GLOBALS) print >> out, "\nSuccessfully installed qRSS2Syndication." return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) if PRE_PLONE3: # Migrate FTI, to make sure we get the necessary infrastructure for the # 'display' menu to work. migrated = migrateFTIs(self, product=PROJECTNAME) print >>out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated) # install slots slotpath='here/portlet_simpleportlet/macros/' # Enable portal_factory factory = getToolByName(self, 'portal_factory') types = factory.getFactoryTypes().keys() if 'Portlet' not in types: types.append('Portlet') factory.manage_setPortalFactoryTypes(listOfTypeIds = types) if 'TopicPortlet' not in types: types.append('TopicPortlet') factory.manage_setPortalFactoryTypes(listOfTypeIds = types) if 'RSSPortlet' not in types: types.append('RSSPortlet') factory.manage_setPortalFactoryTypes(listOfTypeIds = types) #create the tool instance portal = getToolByName(self, 'portal_url').getPortalObject() if not hasattr(self, 'portlet_manager'): addTool = portal.manage_addProduct['SimplePortlet'].manage_addTool addTool(type='SimplePortlet tool') at=getToolByName(self, 'portal_actions') if 'portlets' not in [action.id for action in at.listActions()]: at.addAction('portlets', 'Portlets', 'string: ${folder_url}/portlet_setup', 'python: portal.plone_utils.isDefaultPage(object) or object is folder', 'SimplePortlet: Manage Portlet Layout','object') try: if not slotpath + 'portlet_left' in portal.left_slots: portal.left_slots = list(portal.left_slots) + [slotpath+'portlet_left', ] if not slotpath + 'portlet_right' in portal.right_slots: portal.right_slots = list(portal.right_slots) + [slotpath+'portlet_right', ] except: pass # collect existing non-standard plone portlets additionalPortlets = extractExistingPortlets(self) # try to add them to the portlet_tool for p in additionalPortlets.keys(): self.portlet_manager.registerPortlet(p, additionalPortlets[p]) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): """ Install ARFilePreview """ out = StringIO() pt = self.portal_types pt['File'].default_view = "file_preview" pt['File'].immediate_view = "file_preview" pt['File'].view_methods += ("file_preview", "file_asdoc") install_subskin(self, out, GLOBALS) portal_quickinstaller = getToolByName(self, 'portal_quickinstaller') portal_setup = getToolByName(self, 'portal_setup') for product in PRODUCT_DEPENDENCIES: is_installed = portal_quickinstaller.isProductInstalled(product) if reinstall and is_installed: portal_quickinstaller.reinstallProducts([product]) transaction.savepoint() elif not is_installed: portal_quickinstaller.installProduct(product) transaction.savepoint() for extension_id in EXTENSION_PROFILES: portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False) product_name = extension_id.split(':')[0] portal_quickinstaller.notifyInstalled(product_name) transaction.savepoint() print "installed ARFilePreview" return "%s \nRan all install steps for." % out.getvalue()
def install(self): """Install QuillsEnabled. """ out = StringIO() portal = getToolByName(self,'portal_url').getPortalObject() portal_setup = getToolByName(self, 'portal_setup') quickinstaller = portal.portal_quickinstaller for dependency in config.DEPENDENCIES: print >> out, u"Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) transaction.savepoint() # Register CSS #registerStylesheets(self, out) for extension_id in EXTENSION_PROFILES: portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False) transaction.savepoint() install_subskin(self, out, config.GLOBALS) addNewDiscussionReplyFormAction(portal, out) # Keep some of our types out of the navtree #updateNavtreeProperties(self, out) # Allow Weblogs to be used as the front page of a site # FIXME: When this is enabled there is no way to add an Entry to the blog #updateDefaultPageTypes(self) #permissions.setupPortalSecurity(self, out) #automigrate(self, out) #updateSchemas(self, out) print >> out, u"Successfully installed %s." % config.PROJECTNAME return out.getvalue()
def install(self, reinstall=False): out = StringIO() portal_quickinstaller = getToolByName(self, 'portal_quickinstaller') portal_setup = getToolByName(self, 'portal_setup') install_subskin(self, out, GLOBALS) # The skins need to be sorted differently depending on whether Azax # is available or not. sort_skins(self) if not hasattr(self, TOOL_ID): from Products.CompositePack.tool import manage_addCompositeTool manage_addCompositeTool(self) for extension_id in EXTENSION_PROFILES: portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False) product_name = extension_id.split(':')[0] portal_quickinstaller.notifyInstalled(product_name) transaction.savepoint() install_tool(self, out) install_customisation(self, out) install_fixuids(self, out) install_kupu_resource(self, out) out.write("Successfully installed %s.\n" % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() install_dependencies(self, out) # ######################################## """ACV OJO 20101027 To fix error when installing product through the test machinery. """ someTypes = listTypes(PROJECTNAME) for aType in someTypes: aKlass = aType.get('klass', None) if not (aKlass == None): aFTIMetaType = getattr(aKlass, '_at_fti_meta_type', None) if not (aFTIMetaType == 'Factory-based Type Information with dynamic views'): aKlass._at_fti_meta_type = 'Factory-based Type Information with dynamic views' """ACV OJO 20101027 To fix error when installing product through the test machinery. """ # ######################################## installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_tools(self, out) print >> out, utils.installConfiglets(self, CONFIGLETS) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out=StringIO() controlpanel_tool = getToolByName(self, 'portal_controlpanel') controlpanel_tool.unregisterConfiglet(CONFIGURATION_CONFIGLET) controlpanel_tool.registerConfiglet(id=CONFIGURATION_CONFIGLET, name='qPloneSkinDump Configuration', category='Products', action='string:${portal_url}/qploneskindump_config', appId=PROJECTNAME, permission=ManagePortal, imageUrl='skins_icon.gif') # generation configlet controlpanel_tool.unregisterConfiglet(GENERATION_CONFIGLET) controlpanel_tool.registerConfiglet(id=GENERATION_CONFIGLET, name='qPloneSkinDump Main Template Generation', category='Products', action='string:${portal_url}/qploneskindump_generate', condition="python:modules['Products.qPloneSkinDump.generatingTemplate'].available(here)", appId=PROJECTNAME, permission=ManagePortal, imageUrl='skins_icon.gif') install_subskin(self, out, GLOBALS) out.write('Installation qPloneSkinDump successfully completed.\n') return out.getvalue()
def install(self): """ Installs the product. """ out = StringIO() # install depending products installDependencies(self, out) # install types installTypes(self, out, listTypes(PRODUCT_NAME), PRODUCT_NAME) # install subskins install_subskin(self, out, GLOBALS) # install workflows setupWorkflow(self, out) # install tools # register tool to Plone's preferences panel # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types=[ ECRB_NAME, ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) print >> out, "Successfully installed %s." % PRODUCT_NAME return out.getvalue()
def install(self): out = StringIO() # Install types type_info = listTypes(PROJECTNAME) installTypes(self, out, type_info, PROJECTNAME) # Install tools add_tool = self.manage_addProduct[PROJECTNAME].manage_addTool if not self.objectIds(spec=FSSTool.meta_type): add_tool(FSSTool.meta_type) # Install skin install_subskin(self, out, GLOBALS) # Install configlet cp_tool = getToolByName(self, 'portal_controlpanel') try: cp_tool.registerConfiglet(**fss_prefs_configlet) except: pass # Install modifier install_modifier(self, out) out.write('Installation completed.\n') return out.getvalue()
def install(self): out = StringIO() qi = getToolByName(self, 'portal_quickinstaller') installable = [ prod['id'] for prod in qi.listInstallableProducts() ] installed = [ prod['id'] for prod in qi.listInstalledProducts() ] for product in (DEPENDENCIES): if product not in installable + installed: raise RuntimeError('%s not available' % product) if product in installable: qi.installProduct(product) print >>out, 'Install %s' % product installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_cmfcpviews(self, out) site_properties = getToolByName(self, 'portal_properties').site_properties if site_properties.hasProperty('typesUseViewActionInListings'): types = list(site_properties.getProperty('typesUseViewActionInListings')) types.append('FlashMovie') site_properties.manage_changeProperties(typesUseViewActionInListings=types) print >> out, "Added FlashMovie in typesUseViewActionInListings\n" print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() configureTypes(self, out) install_subskin(self, out, GLOBALS) print >>out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() configureTypes(self, out) install_subskin(self, out, GLOBALS) print("Successfully installed %s." % PROJECTNAME, file=out) return out.getvalue()
def install(self): """Install COREBlog2: Install content types, skin layer, install the stylesheet, set up global properties, enable the portal factory and set up form controller actions for the widget actions """ out = StringIO() # Install tool id = COREBlog2Tool.id if not hasattr(aq_base(self), id): addTool = self.manage_addProduct['COREBlog2'].manage_addTool addTool(COREBlog2Tool.meta_type) print >>out, 'Installing COREBlog2 Tool' print >> out, "Installing COREBlog2" # Install types classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Installed types" # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Migrate FTI, to make sure we get the necessary infrastructure for the # 'display' menu to work. try: migrated = migrateFTIs(self, product=PROJECTNAME) print >>out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated) except: print >>out, "DynamicViewFTI might not works well. You use Plone 3.0 alpha ?" # Enable portal_factory factory = getToolByName(self, 'portal_factory') types = factory.getFactoryTypes().keys() for add_type in ['COREBlog2','COREBlogEntry','COREBlogCategory']: if add_type not in types: types.append(add_type) factory.manage_setPortalFactoryTypes(listOfTypeIds = types) print >> out, "Added COREBlog2 to portal_factory" #propsTool = getToolByName(self, 'portal_properties') #siteProperties = getattr(propsTool, 'site_properties') #navtreeProperties = getattr(propsTool, 'navtree_properties') # install enabled index for topic atcttool = getToolByName(self, 'portal_atct') atcttool.addIndex('getTags', 'Tag', 'Tag(Category)', True, ('ATListCriterion', )) return out.getvalue()
def install(self): out = StringIO() if INSTALL_DEMO_TYPES: installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) setupProperties(self, out) configureFormController(self, out) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() if INSTALL_DEMO_TYPES: installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) setupProperties(self, out) configureFormController(self, out) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() # Install types classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Installed types" # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Set up the workflow for the widget types setupFileAttachmentWorkflow(self) setupImageAttachmentWorkflow(self) print >> out, "Set up FileAttachment and ImageAttachment workflows." # Make the widget types use the /view action when linked to setupFileAttachmentView(self) setupImageAttachmentView(self) print >> out, "Set up FileAttachment and ImageAttachment to use /view." propsTool = getToolByName(self, 'portal_properties') siteProperties = getattr(propsTool, 'site_properties') navtreeProperties = getattr(propsTool, 'navtree_properties') # Add the FileAttachment and ImageAttachment types to types_not_searched # (this is configurable via the Search settings control panel) typesNotSearched = list(siteProperties.getProperty('types_not_searched')) if 'FileAttachment' not in typesNotSearched: typesNotSearched.append('FileAttachment') if 'ImageAttachment' not in typesNotSearched: typesNotSearched.append('ImageAttachment') siteProperties.manage_changeProperties(types_not_searched = typesNotSearched) print >> out, "Added FileAttachment and ImageAttachment to types_not_searched" # Add FileAttachment and ImageAttachment to kupu's linkable and media types kupuTool = getToolByName(self, 'kupu_library_tool') linkable = list(kupuTool.getPortalTypesForResourceType('linkable')) mediaobject = list(kupuTool.getPortalTypesForResourceType('mediaobject')) if 'FileAttachment' not in linkable: linkable.append('FileAttachment') if 'ImageAttachment' not in linkable: linkable.append('ImageAttachment') if 'ImageAttachment' not in mediaobject: mediaobject.append('ImageAttachment') # 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}, {'resource_type' : 'mediaobject', 'old_type' : 'mediaobject', 'portal_types' : mediaobject},)) print >> out, "Added FileAttachment and ImageAttachment to kupu's linkable and mediaobject types" return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PKG_NAME), PKG_NAME) install_subskin(self, out, GLOBALS) setupActions(self) print >> out, "Successfully installed %s." % PKG_NAME return out.getvalue()
def install(self): out = StringIO() classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) print >> out, 'Successfully installed %s' % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() if INSTALL_SAMPLE_TYPES: installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() ## don't install the demao type as it's broken in Zope 2.10/CMF 2.0 ## anyways ## installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) setupProperties(self, out) configureFormController(self, out) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() install_subskin(self, out, GLOBALS) add_properties(self, out) add_configlet(self, out) add_tool(self, out) out.write("Successfully installed %s.\n\n" % PROJECTNAME) return out.getvalue()
def old_install(self): out = StringIO() install_dependencies(self, out) installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_tools(self, out) print >> out, utils.installConfiglets(self, CONFIGLETS) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out=StringIO(); installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_tool(self, out) install_configlet(self, out) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): """Install COREBlog2: Install content types, skin layer, install the stylesheet, set up global properties, enable the portal factory and set up form controller actions for the widget actions """ out = StringIO() # Install tool id = COREBlog2Tool.id if not hasattr(aq_base(self), id): addTool = self.manage_addProduct['COREBlog2'].manage_addTool addTool(COREBlog2Tool.meta_type) print >> out, 'Installing COREBlog2 Tool' print >> out, "Installing COREBlog2" # Install types classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Installed types" # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Migrate FTI, to make sure we get the necessary infrastructure for the # 'display' menu to work. try: migrated = migrateFTIs(self, product=PROJECTNAME) print >> out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated) except: print >> out, "DynamicViewFTI might not works well. You use Plone 3.0 alpha ?" # Enable portal_factory factory = getToolByName(self, 'portal_factory') types = factory.getFactoryTypes().keys() for add_type in ['COREBlog2', 'COREBlogEntry', 'COREBlogCategory']: if add_type not in types: types.append(add_type) factory.manage_setPortalFactoryTypes(listOfTypeIds=types) print >> out, "Added COREBlog2 to portal_factory" #propsTool = getToolByName(self, 'portal_properties') #siteProperties = getattr(propsTool, 'site_properties') #navtreeProperties = getattr(propsTool, 'navtree_properties') # install enabled index for topic atcttool = getToolByName(self, 'portal_atct') atcttool.addIndex('getTags', 'Tag', 'Tag(Category)', True, ('ATListCriterion', )) return out.getvalue()
def install(self): out = StringIO() install_subskin(self, out, GLOBALS) js = ( {'id': 'intellidatetime.js'}, ) registerJavascripts(self, out, js) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() install_subskin(self, out, GLOBALS) print >> out, "skin installed" if not hasattr(self, 'portal_ratings'): m = self.manage_addProduct['ATRatings'] manage_addTool(m, 'Ratings Tool') print >> out, 'tool installed' setupCatalog(self, out) return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) # currentIds = self.objectIds() # for i in currentIds: # if i == "MapServer": # self.manage_delObjects(["MapServer"]) # # #self.invokeFactory(id="MapServer", type_name="MapServer") # self._setObject("MapServer",MapServerFacade("MapServer")) return out.getvalue()
def install(self): out = StringIO() portal = getToolByName(self, 'portal_url').getPortalObject() classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) setup_tool = getToolByName(self, 'portal_setup') setup_tool.setImportContext('profile-FinanceFields:default') result = setup_tool.runImportStep('propertiestool') out.write('Steps run: %s \n' % ', '.join(result['steps'])) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() print >> out, 'Installing skin ...' install_subskin(self, out, config.GLOBALS) print >> out, 'Installing types ...' installTypes(self, out, listTypes(config.PROJECTNAME), config.PROJECTNAME) print >> out, "Setting catalog types ..." configure_catalogs(self, out) install_roles(self, out, ['Assignee', 'ProcessUser']) print >> out, 'Importing faked workflow' install_dcworkflow(self, out) print >> out, "Installing 'workflow_manager' ..." install_manager(self, out) print >> out, "Setting initial permissions ..." configure_permissions(self, out) print >> out, "Registering Instance object ..." install_instanceobject(self, out) print >> out, "Registering work items" install_workitems(self, out) print >> out, "Configuring portal catalog index / event channel" install_portal_catalog(self, out) print >> out, "Adding portlet ..." portlet = "here/portlet_worklist/macros/portlet" if portlet not in self.right_slots: self.right_slots = tuple(self.right_slots) + (portlet, ) print >> out, 'Upgrading instances ...' upgrade_instances(self, out) if config.PATCH_PLONE_TYPES: print >> out, "Installing process definitions ..." install_process_definitions(self, out, config.GLOBALS) print >> out, "Successfully installed AlphaFlow" return out.getvalue()
def DEPRECATED_install(self): out = StringIO() # Install types typeInfo = listTypes(PROJECTNAME) installTypes(self, out, typeInfo, PROJECTNAME) # Install tools add_tool = self.manage_addProduct[PROJECTNAME].manage_addTool if not self.objectIds(spec=BookingTool.meta_type): add_tool(BookingTool.meta_type) # Install skin install_subskin(self, out, GLOBALS) # Install permissions self.manage_permission(BookingPermissions.AddBooking, ('Member', 'Owner', 'Manager'), 1) # Add portal types to use portal factory pftool = getToolByName(self, 'portal_factory') pftool.manage_setPortalFactoryTypes(listOfTypeIds=('Booking', 'BookableObject')) # Install workflows #addWorkflow(self, out) # Add action icons addActionIcon(self, category='plone', action_id='book', icon_expr='booking.gif', title="Book an object", priority=0) # Hide Booking from the navtree ntp = getToolByName(self, 'portal_properties').navtree_properties bl = list(ntp.getProperty('metaTypesNotToList', ())) if 'Booking' not in bl: bl.append('Booking') ntp._p_changed = 1 ntp.metaTypesNotToList = bl out.write('Installation completed.\n') return out.getvalue()
def install(self): """install LandingPage product: install content types, skin layer, stylesheet set up global properties, enable the portal factory and set up form controller actions for the widget actions. uses StringIO() to return a success message. """ out = StringIO() print >> out, "Installing %s..." % PROJECTNAME # install types, enable portal_factory configureTypes(self, out) # install skin install_subskin(self, out, GLOBALS) print >> out, "installed skin." propsTool = getToolByName(self, 'portal_properties') siteProperties = getattr(propsTool, 'site_properties') # Add the TextBlock type to types_not_searched # (this is configurable via the Search settings control panel) typesNotSearched = list(siteProperties.getProperty('types_not_searched')) if 'TextBlock' not in typesNotSearched: typesNotSearched.append('TextBlock') siteProperties.manage_changeProperties(types_not_searched = typesNotSearched) print >> out, "Added TextBlock to types_not_searched" # Add LandingPage to kupu's linkable type kupuTool = getToolByName(self, 'kupu_library_tool') linkable = list(kupuTool.getPortalTypesForResourceType('linkable')) if 'LandingPage' not in linkable: linkable.append('LandingPage') # 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},)) print >> out, "Added LandingPage to kupu's linkable type" print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() # Add actionInfo icon to portal_actionicons. Delete old version before adding, if exist one. actionicons_tool = getToolByName(self, 'portal_actionicons') if actionicons_tool.queryActionInfo('plone', 'rss2syndication'): actionicons_tool.removeActionIcon('plone', 'rss2syndication') actionicons_tool.addActionIcon(category='plone', action_id='rss2syndication', icon_expr='rss2_icon.png', title='RSS2 Syndication') # Add actionInfo action to portal_actions. Delete old versions before adding, if exist one. action_tool = getToolByName(self, 'portal_actions') actions_id = [a.id for a in action_tool._actions] selections = [ actions_id.index(a) for a in actions_id if a in ('rss2syndication', 'setup_rss2') ] action_tool.deleteActions(selections=selections) action_tool.addAction( id='rss2syndication', name='RSS2 Syndication', action='string:$object_url/RSS2', condition= 'python: folder==object and portal.portal_syndication.isSyndicationAllowed(object)', permission=('View', ), category='document_actions') action_tool.addAction( id='setup_rss2', name='RSS2 Setup', action='string:$object_url/setup_rss2', condition= 'python:portal.portal_syndication.isSyndicationAllowed(object)', permission=('Manage properties', ), category='folder') install_subskin(self, out, GLOBALS) print >> out, "\nSuccessfully installed qRSS2Syndication." return out.getvalue()
def install(self, reinstall=False): """ External Method to install BungeniHelpCenter """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME portal = getToolByName(self, 'portal_url').getPortalObject() # If the config contains a list of dependencies, try to install them from Products.BungeniHelpCenter.config import DEPENDENCIES quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) import transaction transaction.savepoint(optimistic=True) types = getToolByName(self, 'portal_types') tutorial_folder = types['HelpCenterTutorialFolder'] tutorial_folder.allowed_content_types = ('BungeniHelpCenterTutorial', ) tutorial_folder = types['HelpCenterReferenceManualFolder'] tutorial_folder.allowed_content_types = ( 'BungeniHelpCenterReferenceManual', ) tutorial_folder.allowed_content_types = ('BungeniHelpCenterGlossary', ) reference_section = types['HelpCenterReferenceManualSection'] reference_section.allowed_content_types = ('BungeniHelpCenterReferenceManualPage', 'Image',\ 'BungeniHelpCenterReferenceManualSection') classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # autoinstall tools portal = getToolByName(self, 'portal_url').getPortalObject() setup_tool = getToolByName(portal, 'portal_setup') setup_tool.runAllImportStepsFromProfile( 'profile-Products.BungeniHelpCenter:default') print >> out, 'Installed' return out.getvalue()
def install(self, reinstall=False): """ External Method to install <dtml-var "package.getProductModuleName()"> """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.<dtml-var "package.getProductModuleName()">.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self,'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS)
def install(self, reinstall=False): """ External Method to install UWOshCommitteeOnCommittees """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.UWOshCommitteeOnCommittees.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "Committee", "CommitteeMember", "College", "Division", "Department", "Constituency", "Person", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) from Products.UWOshCommitteeOnCommittees.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.UWOshCommitteeOnCommittees.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def install(self, reinstall=False): """ External Method to install Bungeni """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.Bungeni.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) import transaction transaction.savepoint(optimistic=True) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # autoinstall tools portal = getToolByName(self, 'portal_url').getPortalObject() for t in ['BungeniMembershipTool', 'RotaTool']: try: portal.manage_addProduct[PROJECTNAME].manage_addTool(t) except BadRequest: # if an instance with the same name already exists this error will # be swallowed. Zope raises in an unelegant manner a 'Bad Request' error pass except: e = sys.exc_info() if e[0] != 'Bad Request': raise # hide tools in the search form portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: siteProperties = getattr(portalProperties, 'site_properties', None) if siteProperties is not None and siteProperties.hasProperty( 'types_not_searched'): for tool in ['BungeniMembershipTool', 'RotaTool']: current = list( siteProperties.getProperty('types_not_searched')) if tool not in current: current.append(tool) siteProperties.manage_changeProperties( **{'types_not_searched': current}) # remove workflow for tools portal_workflow = getToolByName(self, 'portal_workflow') for tool in ['BungeniMembershipTool', 'RotaTool']: portal_workflow.setChainForPortalTypes([tool], '') # uncatalog tools for toolname in ['portal_bungenimembershiptool', 'portal_rotatool']: try: portal[toolname].unindexObject() except: pass # hide tools in the navigation portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: navtreeProperties = getattr(portalProperties, 'navtree_properties', None) if navtreeProperties is not None and navtreeProperties.hasProperty( 'idsNotToList'): for toolname in [ 'portal_bungenimembershiptool', 'portal_rotatool' ]: current = list(navtreeProperties.getProperty('idsNotToList')) if toolname not in current: current.append(toolname) navtreeProperties.manage_changeProperties( **{'idsNotToList': current}) # register tools as configlets portal_controlpanel = getToolByName(self, 'portal_controlpanel') portal_controlpanel.unregisterConfiglet('RotaTool') portal_controlpanel.registerConfiglet( 'RotaTool', #id of your Tool 'RotaTool', # Title of your Product 'string:${portal_url}/portal_rotatool/view', 'python:True', # a condition 'Manage portal', # access permission 'Products', # section to which the configlet should be added: (Plone, Products (default) or Member) 1, # visibility 'RotaToolID', 'site_icon.gif', # icon in control_panel 'Defaults for rota generation', None, ) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # Adds our types to MemberDataContainer.allowed_content_types types_tool = getToolByName(self, 'portal_types') act = types_tool.MemberDataContainer.allowed_content_types types_tool.MemberDataContainer.manage_changeProperties( allowed_content_types=act + ( 'MemberOfPublic', 'MemberOfParliament', 'Staff', )) # registers with membrane tool ... membrane_tool = getToolByName(self, 'membrane_tool') membrane_tool.registerMembraneType('MemberOfPublic') # print >> out, SetupMember(self, member_type='MemberOfPublic', register=False).finish() membrane_tool.registerMembraneType('MemberOfParliament') # print >> out, SetupMember(self, member_type='MemberOfParliament', register=False).finish() membrane_tool.registerMembraneType('Staff') # print >> out, SetupMember(self, member_type='Staff', register=False).finish() #bind classes to workflows wft = getToolByName(self, 'portal_workflow') wft.setChainForPortalTypes(['Staff'], "MemberAutoWorkflow") wft.setChainForPortalTypes(['Motion'], "ParliamentaryEventWorkflow") wft.setChainForPortalTypes(['Question'], "ParliamentaryEventWorkflow") wft.setChainForPortalTypes(['LegislationFolder'], "BungeniWorkflow") wft.setChainForPortalTypes(['BillPage'], "SubWorkflow") wft.setChainForPortalTypes(['DebateRecordPage'], "SubWorkflow") wft.setChainForPortalTypes(['DebateRecordSection'], "SubWorkflow") # configuration for Relations relations_tool = getToolByName(self, 'relations_library') xmlpath = os.path.join(package_home(GLOBALS), 'relations.xml') f = open(xmlpath) xml = f.read() f.close() relations_tool.importXML(xml) # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "MemberOfPublic", "MemberOfParliament", "BungeniMembershipTool", "Staff", "LongDocument", "LongDocumentSection", "LongDocumentPage", "HelpFolder", "MinistryFolder", "Motion", "Question", "Response", "OrderOfBusiness", "AgendaItem", "Sitting", "Session", "CommitteeFolder", "LegislationFolder", "Bill", "BillPage", "BillSection", "Amendment", "DebateRecord", "DebateRecordPage", "DebateRecordFolder", "DebateRecordSection", "TakeTranscription", "Minutes", "Take", "RotaFolder", "RotaItem", "RotaTool", "Committee", "PoliticalGroup", "Reporters", "Parliament", "Office", "BungeniTeamSpace", "DebateRecordOffice", "BungeniTeam", "Region", "Constituency", "Regions", "Province", "OfficeWS", "OfficeFolder", "ParliamentWS", "CommitteeWS", "Ministry", "Portfolio", "Government", "Minister", "AssistantMinister", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) from Products.Bungeni.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.Bungeni.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' setup_tool = getToolByName(portal, 'portal_setup') setup_tool.setImportContext('profile-Bungeni:default') setup_tool.runAllImportSteps() setup_tool.setImportContext('profile-CMFPlone:plone') print >> out, "Ran all GS import steps." return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECT_NAME), PROJECT_NAME) install_subskin(self, out, GLOBALS) out.write("Successfully installed %s." % PROJECT_NAME) return out.getvalue()
def install(self, reinstall=False): """ External Method to install Marginalia """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.Marginalia.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) import transaction transaction.savepoint(optimistic=True) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # autoinstall tools portal = getToolByName(self, 'portal_url').getPortalObject() for t in ['Annotations']: try: portal.manage_addProduct[PROJECTNAME].manage_addTool(t) except BadRequest: # if an instance with the same name already exists this error will # be swallowed. Zope raises in an unelegant manner a 'Bad Request' error pass except: e = sys.exc_info() if e[0] != 'Bad Request': raise # Adding a new catalog index catalog = getToolByName(portal, "portal_catalog") if 'getAccess' not in catalog.indexes(): catalog.addIndex('getAccess', 'FieldIndex') catalog.addIndex('getEditType', 'FieldIndex') # hide tools in the search form portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: siteProperties = getattr(portalProperties, 'site_properties', None) if siteProperties is not None and siteProperties.hasProperty( 'types_not_searched'): for tool in ['Annotations']: current = list( siteProperties.getProperty('types_not_searched')) if tool not in current: current.append(tool) siteProperties.manage_changeProperties( **{'types_not_searched': current}) # remove workflow for tools portal_workflow = getToolByName(self, 'portal_workflow') portal_workflow.setChainForPortalTypes(['Annotations'], '') portal_workflow.setChainForPortalTypes(['Annotation'], 'annotation_workflow') # uncatalog tools for toolname in ['portal_annotations']: try: portal[toolname].unindexObject() except: pass # hide tools in the navigation portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: navtreeProperties = getattr(portalProperties, 'navtree_properties', None) if navtreeProperties is not None and navtreeProperties.hasProperty( 'idsNotToList'): for toolname in ['portal_annotations']: current = list(navtreeProperties.getProperty('idsNotToList')) if toolname not in current: current.append(toolname) navtreeProperties.manage_changeProperties( **{'idsNotToList': current}) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "Annotation", "AnnotatableDocument", "Annotations", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) portal.portal_annotations.manage_permission("Add portal content", ["Member", "Anonymous"], 1) from Products.Marginalia.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.Marginalia.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def DEPRECATED_install(self): out = StringIO() sys.modules['Products.PlonePopoll.PlonePopoll'] = sys.modules['Products.PlonePopoll.content.PlonePopoll'] # install types typeInfo = listTypes(PROJECTNAME) installTypes(self, out, typeInfo, PROJECTNAME) # install skin install_subskin(self, out, GLOBALS) # Install portlet setupCustomSlots(self, out) # Add portal types to use portal factory portal_factory = getToolByName(self, 'portal_factory') if portal_factory is not None: factoryTypes = list(portal_factory.getFactoryTypes().keys()) factoryTypes.append('PlonePopoll') portal_factory.manage_setPortalFactoryTypes(listOfTypeIds = factoryTypes) else: out.write('Couldn\'t get Portal Factory, so couldn\'t add PlonePopoll type to it\n') # Install tool setupTools(self, out) install_configlet(self, out) provider = getToolByName(self, 'portal_selenium', None) if provider: # Functional Tests action = {'id':PROJECTNAME.lower(), 'name':PROJECTNAME, 'action':'string:here/get_%s_ftests'%PROJECTNAME.lower(), 'condition': '', 'permission': 'View', 'category':'ftests', 'visible': 1} provider.addAction(**action) typesTool = getToolByName(self, 'portal_types') # Set the human readable title explicitly t = getattr(typesTool, 'PlonePopoll', None) if t: t.title = 'Poll' # Hide Polls from the navtree ntp = getToolByName(self, 'portal_properties').navtree_properties bl = list(ntp.getProperty('metaTypesNotToList', ())) if 'PlonePopoll' not in bl: bl.append('PlonePopoll') ntp._p_changed = 1 ntp.metaTypesNotToList = bl migratePopollConfiguration(self, out) #raise "Installation OK" out.write('Installation completed.\n') return out.getvalue()
def install(self, reinstall=False): """ External Method to install BungeniSkinTZ """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.BungeniSkinTZ.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) portal = getToolByName(self, 'portal_url').getPortalObject() for slot in ['here/theme_portlet/macros/portlet']: if slot not in portal.left_slots: portal.left_slots = list(portal.left_slots) + [slot] for slot in ['here/sections_portlet/macros/portlet']: if slot not in portal.right_slots: portal.right_slots = list(portal.right_slots) + [slot] # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' from Products.BungeniSkinTZ.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.BungeniSkinTZ.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def install(self, reinstall=False): """ External Method to install gvSIGi18n """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.gvSIGi18n.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "TRAColeccionInformes", "TRAModulo", "TRAColeccionCadenas", "TRAProgreso", "TRAInforme", "TRAParametrosControlProgreso", "TRAContenidoXML", "TRAColeccionImportaciones", "TRACadena", "TRAColeccionSolicitudesCadenas", "TRAConfiguracionSolicitudesCadenas", "TRAConfiguracionPaginaTraducciones", "TRASimbolosOrdenados", "TRACatalogo", "TRAColeccionIdiomas", "TRAConfiguracionInvalidacionInformes", "TRAConfiguracionVarios", "TRAContenidoIntercambio", "TRAConfiguracionImportacion", "TRAConfiguracionExportacion", "TRAImportacion", "TRAIdioma", "TRAColeccionModulos", "TRATraduccion", "TRAColeccionContribuciones", "TRAColeccionProgresos", "TRAConfiguracionPermisos", "TRAContribuciones", "TRAConfiguracionPerfilEjecucion", "TRASolicitudCadena", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) from Products.gvSIGi18n.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.gvSIGi18n.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()