# Flon is a package for enabling hand picked Five features in Plone # Copyright (C) 2004 Enfold Systems, LLC # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # """ $Id: __init__.py,v 1.2 2004/07/14 22:23:16 dreamcatcher Exp $ """ from cStringIO import StringIO from Globals import package_home from Products.Archetypes.Extensions.utils import install_subskin from Products.CMFCore.utils import getToolByName, minimalpath from Products.Flon.tools.interface import InterfaceTool from Products.Flon.config import SKINS, GLOBALS tool_id = InterfaceTool.id meta_type = InterfaceTool.meta_type def install_tool(self, out): tool = getToolByName(self, tool_id, None) if tool is not None: if tool.meta_type == meta_type: out.write('Interface Tool was already installed.\n') return self.manage_delObjects(ids=[tool_id]) self.manage_addProduct['Flon'].manage_addTool(meta_type) out.write('Interface Tool installed sucessfully.\n') def install_actions(self, out): at = getToolByName(self, 'portal_actions') if 'marker' not in [action.getId() for action in at.listActions()]: at.addAction('marker', 'Change the marker interfaces for this object', 'string:$object_url/edit_marker_form', '', 'Manage portal', 'document_actions') out.write('Added action for marker action icon.\n') else: out.write('Marker action was already installed.\n') ai = getToolByName(self, 'portal_actionicons') if ai.queryActionIcon('plone', 'marker', None) is None: ai.addActionIcon('plone', 'marker', 'marker_icon.gif', 'Marker Interfaces') out.write('Added action icon for marker action.\n') else: out.write('Marker action icon was already installed.\n') def install_index(self, out): ct = getToolByName(self, 'portal_catalog') if 'directly_provided' in ct.indexes(): out.write('directly_provided index already exists.\n') else: pxidx = ct.manage_addProduct['ProxyIndex'] pxidx.manage_addProxyIndex('directly_provided', idx_type='KeywordIndex', value_expr='object/@@directly_provided' ) out.write('Created directly_provided index.\n') if 'provided' in ct.indexes(): out.write('provided index already exists.\n') else: pxidx = ct.manage_addProduct['ProxyIndex'] pxidx.manage_addProxyIndex('provided', idx_type='KeywordIndex', value_expr='object/@@provided' ) out.write('Created provided index.\n') def install_index_metadata(self, out): ct = getToolByName(self, 'portal_catalog') if 'directly_provided' in ct.schema(): out.write('directly_provided catalog metadata already exists.\n') else: ct.addColumn('directly_provided') out.write('Created directly_provided metadata column.\n') if 'provided' in ct.schema(): out.write('provided catalog metadata already exists.\n') else: ct.addColumn('provided') out.write('Created provided metadata column.\n') def install(self, out=None): if out is None: out = StringIO() install_tool(self, out) install_subskin(self, out, GLOBALS) install_actions(self, out) install_index(self, out) install_index_metadata(self, out) return out.getvalue()