Changeset 1224
- Timestamp:
- 09/03/08 13:29:21
- Files:
-
- qPingTool/branches/plone-3.1/Extensions (deleted)
- qPingTool/branches/plone-3.1/PingInfo.py (modified) (2 diffs)
- qPingTool/branches/plone-3.1/PingTool.py (modified) (6 diffs)
- qPingTool/branches/plone-3.1/__init__.py (modified) (2 diffs)
- qPingTool/branches/plone-3.1/adapter.py (modified) (3 diffs)
- qPingTool/branches/plone-3.1/config.py (modified) (2 diffs)
- qPingTool/branches/plone-3.1/configure.zcml (added)
- qPingTool/branches/plone-3.1/profiles (added)
- qPingTool/branches/plone-3.1/profiles.zcml (added)
- qPingTool/branches/plone-3.1/profiles/default (added)
- qPingTool/branches/plone-3.1/profiles/default/actionicons.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/actions.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/archetype_tool.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/controlpanel.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/factorytool.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/import_steps.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/metadata.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/properties.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/propertiestool.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/qPingTool_various.txt (added)
- qPingTool/branches/plone-3.1/profiles/default/skins.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/toolset.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/types (added)
- qPingTool/branches/plone-3.1/profiles/default/types.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/types/PingInfo.xml (added)
- qPingTool/branches/plone-3.1/profiles/default/types/PingTool.xml (added)
- qPingTool/branches/plone-3.1/refresh.txt (deleted)
- qPingTool/branches/plone-3.1/setuphandlers.py (added)
- qPingTool/branches/plone-3.1/skins.zcml (added)
- qPingTool/branches/plone-3.1/version.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPingTool/branches/plone-3.1/PingInfo.py
r697 r1224 1 from Globals import DTMLFile 2 from AccessControl import ClassSecurityInfo 1 3 from Products.Archetypes.public import * 2 4 from Products.Archetypes.BaseContent import BaseContentMixin 3 from Products.CMFCore.ActionInformation import ActionInformation 4 from Products.CMFCore.Expression import Expression, createExprContext 5 from Products.CMFCore.permissions import ModifyPortalContent 5 6 from Products.CMFCore.utils import getToolByName 6 from Acquisition import aq_inner, aq_parent7 7 from Products.CMFDefault.utils import _dtmldir 8 8 from config import * 9 from AccessControl import ClassSecurityInfo10 from Globals import InitializeClass, DTMLFile11 9 12 10 schema = BaseContentMixin.schema + Schema(( … … 55 53 return self.contributors 56 54 57 try: 58 from Products.CMFCore import permissions 59 security.declareProtected(permissions.ModifyPortalContent, 'manage_metadata' ) 60 except: 61 from Products.CMFCore.CMFCorePermissions import ModifyPortalContent 62 security.declareProtected(ModifyPortalContent, 'manage_metadata' ) 63 55 security.declareProtected(ModifyPortalContent, 'manage_metadata' ) 64 56 manage_metadata = DTMLFile('zmi_metadata', _dtmldir) 65 57 66 58 67 registerType(PingInfo )59 registerType(PingInfo, PROJECTNAME) qPingTool/branches/plone-3.1/PingTool.py
r697 r1224 1 1 #from Globals import InitializeClass 2 2 import os 3 from Acquisition import aq_base 4 5 from zope.interface import implements 6 from AccessControl import ClassSecurityInfo 7 8 from Products.Archetypes.public import * 9 10 from Products.CMFPlone.interfaces.OrderedContainer import IOrderedContainer 11 from Products.CMFPlone.PloneFolder import PloneFolder 12 13 from Products.PageTemplates.PageTemplateFile import PageTemplateFile 14 15 from Products.CMFCore.permissions import ManagePortal 16 from Products.CMFCore.utils import getToolByName 3 17 from Products.CMFCore.ActionProviderBase import ActionProviderBase 4 from Products.CMFPlone.PloneFolder import PloneFolder 5 from config import TOOL_ID, PROJECTNAME 6 from Products.Archetypes.public import * 18 7 19 from Products.ATContentTypes.content.folder import ATFolder 8 from Products.ATContentTypes.content.base import updateActions, updateAliases 9 from Products.CMFPlone.interfaces.OrderedContainer import IOrderedContainer 10 from Products.CMFCore.ActionInformation import ActionInformation 11 from Products.CMFCore.Expression import Expression 12 from Products.CMFCore.CMFCorePermissions import ManageProperties 13 from Acquisition import aq_base 14 from Products.CMFCore.utils import _getViewFor 15 from Products.PageTemplates.PageTemplateFile import PageTemplateFile 20 16 21 from Products.XMLRPCMethod.XMLRPCMethod import RPCThread, XMLRPCMethod 17 from Products.CMFCore.utils import getToolByName 22 18 23 from util import getCanonicalURL 19 24 from zLOG import LOG 25 from config import TOOL_ID, PROJECTNAME 20 26 21 27 _marker = [] … … 33 39 """This tool serve for operation with ActionInfo objects 34 40 """ 41 security = ClassSecurityInfo() 35 42 36 #schema = BaseSchema 37 filter_content_types = 1 38 allowed_content_types = ('PingInfo',) 39 global_allowed = 0 43 archetype_name = portal_type = 'PingTool' 40 44 41 meta_type = archetype_name = portal_type = 'PingTool'42 43 ########44 content_icon = 'tool.gif'45 immediate_view = 'view'46 default_view = 'view'47 48 ########49 45 __implements__ = (IOrderedContainer,) 50 _actions = ( ActionInformation(51 id='ping'52 , title='Ping setup'53 , action=Expression(54 text='string:${folder_url}/ping_setup')55 , condition=Expression(56 text='python: folder is object and portal.portal_syndication.isSyndicationAllowed(object)')57 , permissions=(ManageProperties,)58 , category='folder'59 , visible=160 ),61 )62 63 actions = updateActions(ATFolder,64 ({'id' : 'view' \65 ,'name' : 'View' \66 ,'action' : 'string:folder_contents' \67 ,'permissions': ('Manage portal',) \68 ,'category' :'object' \69 },70 )71 )72 73 aliases = updateAliases(ATFolder,74 {'(Default)' : 'folder_listing' \75 ,'view' : 'folder_contents' \76 },77 )78 46 79 47 manage_options = ( … … 81 49 ) + ATFolder.manage_options 82 50 51 security.declareProtected(ManagePortal, 'manage_overview') 83 52 manage_overview = PageTemplateFile(os.path.join('www','overview'), globals()) 84 53 manage_overview.__name__ = 'manage_overview' 85 54 manage_overview._need__name__ = 0 86 55 56 def om_icons(self): 57 """ Checking on ZMI for canonical_url setting.""" 58 icons = ({'path':'misc_/qPingTool/tool.gif' \ 59 ,'alt':self.meta_type \ 60 ,'title':self.meta_type \ 61 },) 62 if not getCanonicalURL(self): 63 icons = icons + ({'path':'misc_/PageTemplates/exclamation.gif' \ 64 ,'alt':'Error' \ 65 ,'title':'PingTool needs setting canonical_url' \ 66 },) 67 return icons 68 69 security.declareProtected(ManagePortal, 'pingFeedReader') 87 70 def pingFeedReader(self,context): 88 71 """ ping """ … … 129 112 return status, message 130 113 131 114 security.declareProtected(ManagePortal, 'setupPing') 132 115 def setupPing(self,context, 133 116 enable_ping=0, … … 149 132 return status, message 150 133 134 security.declareProtected(ManagePortal, 'getPingProperties') 151 135 def getPingProperties(self, context): 152 136 """ """ … … 159 143 return pingPropeties 160 144 161 def om_icons(self): 162 """ Checking on ZMI for canonical_url setting.""" 163 icons = ({'path':'misc_/qPingTool/tool.gif' \ 164 ,'alt':self.meta_type \ 165 ,'title':self.meta_type \ 166 },) 167 if not getCanonicalURL(self): 168 icons = icons + ({'path':'misc_/PageTemplates/exclamation.gif' \ 169 ,'alt':'Error' \ 170 ,'title':'PingTool needs setting canonical_url' \ 171 },) 172 return icons 173 174 registerType(PingTool) 145 registerType(PingTool, PROJECTNAME) qPingTool/branches/plone-3.1/__init__.py
r697 r1224 1 from Globals import package_home2 1 from Products.Archetypes.public import process_types, listTypes 3 2 from Products.CMFCore import utils 4 from Products.CMFCore.DirectoryView import registerDirectory5 import os, os.path6 3 import PingInfo, PingTool 7 4 from config import * 8 5 9 try:10 from adapter import registerAdapter11 registerAdapter()12 except:13 from Products.CMFCore.utils import getToolByName14 from Products.CMFPlone.URLTool import URLTool15 def getCanonicalURL(self):16 portal = getToolByName(self, 'portal_url').getPortalObject()17 return portal.getProperty('canonical_url', None)18 #URLTool.security.declarePublic('getCanonicalURL')19 URLTool.getCanonicalURL = getCanonicalURL20 21 22 registerDirectory(SKINS_DIR, GLOBALS)23 6 tools = ( PingTool.PingTool, ) 24 7 … … 27 10 allow_module('Products.qPingTool.util') 28 11 29 utils.ToolInit("PingTool", tools=tools, product_name=PROJECTNAME,icon=TOOL_ICON,12 utils.ToolInit("PingTool", tools=tools, icon=TOOL_ICON, 30 13 ).initialize(context) 31 14 qPingTool/branches/plone-3.1/adapter.py
r697 r1224 1 1 from zope.interface import Interface, implements #, Attribute 2 from zope.component import adapts 3 4 from Products.CMFPlone.interfaces import IPloneBaseTool 2 5 from Products.CMFCore.utils import getToolByName 3 6 … … 21 24 """ CanonicalURL adapter 22 25 """ 26 adapts(IPloneBaseTool) 23 27 implements(ICanonicalURL) 24 28 … … 58 62 # Register adapter 59 63 60 def registerAdapter():61 from Products.CMFPlone.interfaces import IPloneBaseTool62 from zope.component import provideAdapter63 provideAdapter(CanonicalURL, adapts=[IPloneBaseTool,], provides=ICanonicalURL )64 #def registerAdapter(): 65 # from Products.CMFPlone.interfaces import IPloneBaseTool 66 # from zope.component import provideAdapter 67 # provideAdapter(CanonicalURL, adapts=[IPloneBaseTool,], provides=ICanonicalURL ) qPingTool/branches/plone-3.1/config.py
r697 r1224 1 from Products.CMFCore import CMFCorePermissions2 1 from Products.Archetypes.utils import DisplayList 2 from Products.CMFCore.permissions import ManagePortal 3 3 4 SKINS_DIR = 'skins'5 4 GLOBALS = globals() 6 5 PROJECTNAME = 'qPingTool' 7 6 8 ADD_PERMISSION = CMFCorePermissions.ManagePortal7 ADD_PERMISSION = ManagePortal 9 8 10 9 TOOL_ID = 'portal_pingtool' … … 12 11 TOOL_ICON = 'skins/qpingtool/tool.gif' 13 12 14 RSS_LIST = DisplayList(((' Blog','Blog'),('RSS','RSS1'),('RSS2','RSS2')))13 RSS_LIST = DisplayList((('Weblog','Weblog'),('RSS','RSS1'),('RSS2','RSS2'))) 15 14 16 15 CONFIGURATION_CONFIGLET = 'pingtool_config' qPingTool/branches/plone-3.1/version.txt
r699 r1224 1 0.3.1 1 1.0.0
