Conjunto de mudanças 6528 no repositório publico
- Timestamp:
- 18/06/2012 19:46:42 (9 anos atrás)
- Localização:
- Ombudsman/trunk/Extensions
- Arquivos:
-
- 5 editados
Legenda:
- Não Modificado
- Adicionado
- Removido
-
Ombudsman/trunk/Extensions/Install.py
r6423 r6528 1 # -*- coding: utf-8 -*- 2 # 1 3 # File: Install.py 2 4 # 3 # Copyright (c) 20 06 by Rafahela Garcia Bazzanella4 # Generator: ArchGenXML Version 1.5. 0 svn/devel5 # Copyright (c) 2012 by Interlegis 6 # Generator: ArchGenXML Version 1.5.3 dev/svn 5 7 # http://plone.org/products/archgenxml 6 8 # … … 23 25 # 24 26 25 __author__ = """Rafahela Bazzanella <rafabazzanella@yahoo.com.br>, Jean Rodrigo Ferri26 <jean rodrigoferri@yahoo.com.br>"""27 __author__ = """Rafahela Garcia Bazzanella <rafahela@gmail.com>, Jean Rodrigo Ferri 28 <jeanferri@gmail.com>""" 27 29 __docformat__ = 'plaintext' 28 30 … … 45 47 from Products.Ombudsman.config import product_globals as GLOBALS 46 48 47 def install(self ):49 def install(self, reinstall=False): 48 50 """ External Method to install Ombudsman """ 49 51 out = StringIO() … … 70 72 install_subskin(self, out, GLOBALS) 71 73 72 # autoinstall tools74 # autoinstall tools 73 75 portal = getToolByName(self,'portal_url').getPortalObject() 74 76 for t in ['OmbudsmanTool']: … … 83 85 if e[0] != 'Bad Request': 84 86 raise 85 #hide tools in the navigation 87 88 # hide tools in the search form 89 portalProperties = getToolByName(self, 'portal_properties', None) 90 if portalProperties is not None: 91 siteProperties = getattr(portalProperties, 'site_properties', None) 92 if siteProperties is not None and siteProperties.hasProperty('types_not_searched'): 93 for tool in ['OmbudsmanTool']: 94 current = list(siteProperties.getProperty('types_not_searched')) 95 if tool not in current: 96 current.append(tool) 97 siteProperties.manage_changeProperties(**{'types_not_searched' : current}) 98 99 # remove workflow for tools 100 portal_workflow = getToolByName(self, 'portal_workflow') 101 for tool in ['OmbudsmanTool']: 102 portal_workflow.setChainForPortalTypes([tool], '') 103 104 # uncatalog tools 105 for toolname in ['portal_ombudsman']: 106 try: 107 portal[toolname].unindexObject() 108 except: 109 pass 110 111 # hide tools in the navigation 86 112 portalProperties = getToolByName(self, 'portal_properties', None) 87 113 if portalProperties is not None: 88 114 navtreeProperties = getattr(portalProperties, 'navtree_properties', None) 89 if navtreeProperties: 90 navtreeProperties.idsNotToList = list(navtreeProperties.idsNotToList) + \ 91 [toolname for toolname in ['portal_ombudsman'] \ 92 if toolname not in navtreeProperties.idsNotToList] 115 if navtreeProperties is not None and navtreeProperties.hasProperty('idsNotToList'): 116 for toolname in ['portal_ombudsman']: 117 current = list(navtreeProperties.getProperty('idsNotToList')) 118 if toolname not in current: 119 current.append(toolname) 120 navtreeProperties.manage_changeProperties(**{'idsNotToList' : current}) 121 93 122 # register tools as configlets 94 123 portal_controlpanel = getToolByName(self,'portal_controlpanel') … … 96 125 portal_controlpanel.registerConfiglet( 97 126 'OmbudsmanTool', #id of your Tool 98 'Ombudsman Tool', # Title of your Troduct99 'string:${portal_url}/portal_ombudsman/ /',100 ' ''python:True''', # a condition101 'Manage Portal', # access permission127 'Ombudsman Tool', # Title of your Product 128 'string:${portal_url}/portal_ombudsman/view', 129 'python:True', # a condition 130 'Manage portal', # access permission 102 131 'Products', # section to which the configlet should be added: (Plone, Products (default) or Member) 103 132 1, # visibility … … 130 159 wft.setChainForPortalTypes( ['OmbudsmanResponse'], '') 131 160 161 # update workflow for created tools if they have been designated a workflow 162 for toolname in ['portal_ombudsman']: 163 try: 164 portal[toolname].notifyWorkflowCreated() 165 except: 166 pass 167 132 168 # enable portal_factory for given types 133 169 factory_tool = getToolByName(self,'portal_factory') 134 170 factory_types=[ 171 "OmbudsmanTool", 135 172 "Ombudsman", 136 173 "OmbudsmanClaim", … … 151 188 'enabled': True} 152 189 defaults.update(stylesheet) 153 portal_css. manage_addStylesheet(**defaults)190 portal_css.registerStylesheet(**defaults) 154 191 except: 155 192 # No portal_css registry … … 180 217 if install: 181 218 print >>out,'Custom Install:' 182 res = install(self) 219 try: 220 res = install(self, reinstall) 221 except TypeError: 222 res = install(self) 183 223 if res: 184 224 print >>out,res … … 189 229 return out.getvalue() 190 230 191 def uninstall(self ):231 def uninstall(self, reinstall=False): 192 232 out = StringIO() 233 234 235 # unhide tools in the search form 236 portalProperties = getToolByName(self, 'portal_properties', None) 237 if portalProperties is not None: 238 siteProperties = getattr(portalProperties, 'site_properties', None) 239 if siteProperties is not None and siteProperties.hasProperty('types_not_searched'): 240 for tool in ['OmbudsmanTool']: 241 current = list(siteProperties.getProperty('types_not_searched')) 242 if tool in current: 243 current.remove(tool) 244 siteProperties.manage_changeProperties(**{'types_not_searched' : current}) 245 193 246 194 247 # unhide tools … … 196 249 if portalProperties is not None: 197 250 navtreeProperties = getattr(portalProperties, 'navtree_properties', None) 198 if navtreeProperties :199 navtreeProperties.idsNotToList = list(navtreeProperties.idsNotToList)200 for toolname in [toolname for toolname in ['portal_ombudsman'] \201 if toolname not in navtreeProperties.idsNotToList]:202 if toolname in navtreeProperties.idsNotToList:203 navtreeProperties. idsNotToList.remove(toolname)251 if navtreeProperties is not None and navtreeProperties.hasProperty('idsNotToList'): 252 for toolname in ['portal_ombudsman']: 253 current = list(navtreeProperties.getProperty('idsNotToList')) 254 if toolname in current: 255 current.remove(toolname) 256 navtreeProperties.manage_changeProperties(**{'idsNotToList' : current}) 204 257 205 258 … … 234 287 if uninstall: 235 288 print >>out,'Custom Uninstall:' 236 res = uninstall(self) 289 try: 290 res = uninstall(self, reinstall) 291 except TypeError: 292 res = uninstall(self) 237 293 if res: 238 294 print >>out,res … … 243 299 244 300 return out.getvalue() 301 302 def beforeUninstall(self, reinstall, product, cascade): 303 """ try to call a custom beforeUninstall method in 'AppInstall.py' 304 method 'beforeUninstall' 305 """ 306 out = StringIO() 307 try: 308 beforeuninstall = ExternalMethod('temp', 'temp', 309 PROJECTNAME+'.AppInstall', 'beforeUninstall') 310 except: 311 beforeuninstall = [] 312 313 if beforeuninstall: 314 print >>out, 'Custom beforeUninstall:' 315 res = beforeuninstall(self, reinstall=reinstall 316 , product=product 317 , cascade=cascade) 318 if res: 319 print >>out, res 320 else: 321 print >>out, 'no output' 322 else: 323 print >>out, 'no custom beforeUninstall' 324 return (out,cascade) 325 326 def afterInstall(self, reinstall, product): 327 """ try to call a custom afterInstall method in 'AppInstall.py' method 328 'afterInstall' 329 """ 330 out = StringIO() 331 try: 332 afterinstall = ExternalMethod('temp', 'temp', 333 PROJECTNAME+'.AppInstall', 'afterInstall') 334 except: 335 afterinstall = None 336 337 if afterinstall: 338 print >>out, 'Custom afterInstall:' 339 res = afterinstall(self, product=None 340 , reinstall=None) 341 if res: 342 print >>out, res 343 else: 344 print >>out, 'no output' 345 else: 346 print >>out, 'no custom afterInstall' 347 return out -
Ombudsman/trunk/Extensions/InstallWorkflows.py
r6423 r6528 1 # -*- coding: utf-8 -*- 2 # 1 3 # File: Ombudsman.py 2 4 # 3 # Copyright (c) 20 06 by Rafahela Garcia Bazzanella4 # Generator: ArchGenXML Version 1.5. 0 svn/devel5 # Copyright (c) 2012 by Interlegis 6 # Generator: ArchGenXML Version 1.5.3 dev/svn 5 7 # http://plone.org/products/archgenxml 6 8 # … … 23 25 # 24 26 25 __author__ = """Rafahela Bazzanella <rafabazzanella@yahoo.com.br>, Jean Rodrigo Ferri26 <jean rodrigoferri@yahoo.com.br>"""27 __author__ = """Rafahela Garcia Bazzanella <rafahela@gmail.com>, Jean Rodrigo Ferri 28 <jeanferri@gmail.com>""" 27 29 __docformat__ = 'plaintext' 28 30 … … 41 43 42 44 ourProductWorkflow = ExternalMethod('temp', 'temp', 43 productname+'.'+'ombudsman_workflow',44 'createombudsman_workflow')45 productname+'.'+'ombudsman_workflow', 46 'createombudsman_workflow') 45 47 workflow = ourProductWorkflow(self, 'ombudsman_workflow') 46 workflowTool._setObject('ombudsman_workflow', workflow) 48 if workflow.getId() in workflowTool.listWorkflows(): 49 print >> out, '%s already in workflows.' % workflow.getId() 50 else: 51 try: 52 # plone 2.x 53 workflowTool._setObject('ombudsman_workflow', workflow) 54 except: 55 # works in Plone 3.0, but isnt perfect! use ArchGenXML 2.0 for a 56 # better result! 57 workflowTool._setOb('ombudsman_workflow', workflow) 58 print >> out, '%s added in workflows.' % workflow.getId() 47 59 workflowTool.setChainForPortalTypes(['Ombudsman'], workflow.getId()) 48 60 49 61 ourProductWorkflow = ExternalMethod('temp', 'temp', 50 productname+'.'+'ombudsman_claim_workflow',51 'createombudsman_claim_workflow')62 productname+'.'+'ombudsman_claim_workflow', 63 'createombudsman_claim_workflow') 52 64 workflow = ourProductWorkflow(self, 'ombudsman_claim_workflow') 53 workflowTool._setObject('ombudsman_claim_workflow', workflow) 65 if workflow.getId() in workflowTool.listWorkflows(): 66 print >> out, '%s already in workflows.' % workflow.getId() 67 else: 68 try: 69 # plone 2.x 70 workflowTool._setObject('ombudsman_claim_workflow', workflow) 71 except: 72 # works in Plone 3.0, but isnt perfect! use ArchGenXML 2.0 for a 73 # better result! 74 workflowTool._setOb('ombudsman_claim_workflow', workflow) 75 print >> out, '%s added in workflows.' % workflow.getId() 54 76 workflowTool.setChainForPortalTypes(['OmbudsmanClaim'], workflow.getId()) 55 77 … … 57 79 ##/code-section after-workflow-install 58 80 59 return workflowTool81 return out 60 82 61 83 def uninstallWorkflows(self, package, out): … … 65 87 code here in the protected section. 66 88 """ 89 workflowTool = getToolByName(self, 'portal_workflow') 90 workflowTool.manage_delObjects(['ombudsman_workflow']) 91 workflowTool.manage_delObjects(['ombudsman_claim_workflow']) 67 92 68 93 ##code-section workflow-uninstall #fill in your manual code here -
Ombudsman/trunk/Extensions/ombudsman_claim_workflow.py
r6423 r6528 1 # -*- coding: utf-8 -*- 2 # 1 3 # File: Ombudsman.py 2 4 # 3 # Copyright (c) 20 06 by Rafahela Garcia Bazzanella4 # Generator: ArchGenXML Version 1.5. 0 svn/devel5 # Copyright (c) 2012 by Interlegis 6 # Generator: ArchGenXML Version 1.5.3 dev/svn 5 7 # http://plone.org/products/archgenxml 6 8 # … … 23 25 # 24 26 25 __author__ = """Rafahela Bazzanella <rafabazzanella@yahoo.com.br>, Jean Rodrigo Ferri26 <jean rodrigoferri@yahoo.com.br>"""27 __author__ = """Rafahela Garcia Bazzanella <rafahela@gmail.com>, Jean Rodrigo Ferri 28 <jeanferri@gmail.com>""" 27 29 __docformat__ = 'plaintext' 28 30 29 31 30 32 from Products.CMFCore.utils import getToolByName 31 from Products.CMFCore.WorkflowTool import addWorkflowFactory32 33 from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition 33 34 from Products.ExternalMethod.ExternalMethod import ExternalMethod … … 75 76 stateDef = workflow.states['pending'] 76 77 stateDef.setProperties(title="""Pending""", 78 description="""""", 77 79 transitions=['reject', 'accept', 'move']) 78 80 stateDef.setPermission('Modify portal content', … … 88 90 stateDef = workflow.states['accepted'] 89 91 stateDef.setProperties(title="""Accepted""", 92 description="""""", 90 93 transitions=['move', 'resolve']) 91 94 stateDef.setPermission('Modify portal content', … … 101 104 stateDef = workflow.states['rejected'] 102 105 stateDef.setProperties(title="""Rejected""", 106 description="""""", 103 107 transitions=[]) 104 108 stateDef.setPermission('Modify portal content', … … 114 118 stateDef = workflow.states['resolved'] 115 119 stateDef.setProperties(title="""Resolved""", 120 description="""""", 116 121 transitions=[]) 117 122 stateDef.setPermission('Modify portal content', … … 127 132 stateDef = workflow.states['moving'] 128 133 stateDef.setProperties(title="""Moving""", 134 description="""""", 129 135 transitions=['resolve', 'move']) 130 136 stateDef.setPermission('Modify portal content', … … 140 146 stateDef = workflow.states['new'] 141 147 stateDef.setProperties(title="""Being created""", 148 description="""""", 142 149 transitions=['post']) 143 150 stateDef.setPermission('Modify portal content', … … 307 314 return ob 308 315 309 addWorkflowFactory(createombudsman_claim_workflow,310 id='ombudsman_claim_workflow',311 title='ombudsman_claim_workflow')316 #addWorkflowFactory(createombudsman_claim_workflow, 317 # id='ombudsman_claim_workflow', 318 # title='ombudsman_claim_workflow') 312 319 313 320 ##code-section create-workflow-module-footer #fill in your manual code here -
Ombudsman/trunk/Extensions/ombudsman_claim_workflow_scripts.py
r6423 r6528 1 # -*- coding: utf-8 -*- 2 # 1 3 # File: Ombudsman.py 2 4 # 3 # Copyright (c) 20 06 by Rafahela Garcia Bazzanella4 # Generator: ArchGenXML Version 1.5. 0 svn/devel5 # Copyright (c) 2012 by Interlegis 6 # Generator: ArchGenXML Version 1.5.3 dev/svn 5 7 # http://plone.org/products/archgenxml 6 8 # … … 23 25 # 24 26 25 __author__ = """Rafahela Bazzanella <rafabazzanella@yahoo.com.br>, Jean Rodrigo Ferri26 <jean rodrigoferri@yahoo.com.br>"""27 __author__ = """Rafahela Garcia Bazzanella <rafahela@gmail.com>, Jean Rodrigo Ferri 28 <jeanferri@gmail.com>""" 27 29 __docformat__ = 'plaintext' 28 30 -
Ombudsman/trunk/Extensions/ombudsman_workflow.py
r6423 r6528 1 # -*- coding: utf-8 -*- 2 # 1 3 # File: Ombudsman.py 2 4 # 3 # Copyright (c) 20 06 by Rafahela Garcia Bazzanella4 # Generator: ArchGenXML Version 1.5. 0 svn/devel5 # Copyright (c) 2012 by Interlegis 6 # Generator: ArchGenXML Version 1.5.3 dev/svn 5 7 # http://plone.org/products/archgenxml 6 8 # … … 23 25 # 24 26 25 __author__ = """Rafahela Bazzanella <rafabazzanella@yahoo.com.br>, Jean Rodrigo Ferri26 <jean rodrigoferri@yahoo.com.br>"""27 __author__ = """Rafahela Garcia Bazzanella <rafahela@gmail.com>, Jean Rodrigo Ferri 28 <jeanferri@gmail.com>""" 27 29 __docformat__ = 'plaintext' 28 30 29 31 30 32 from Products.CMFCore.utils import getToolByName 31 from Products.CMFCore.WorkflowTool import addWorkflowFactory32 33 from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition 33 34 from Products.ExternalMethod.ExternalMethod import ExternalMethod … … 49 50 if not role in data: 50 51 data.append(role) 52 # add to portal_role_manager 53 # first try to fetch it. if its not there, we probaly have no PAS 54 # or another way to deal with roles was configured. 55 try: 56 prm = portal.acl_users.get('portal_role_manager', None) 57 if prm is not None: 58 try: 59 prm.addRole(role, role, 60 "Added by product 'Ombudsman'/workflow 'ombudsman_workflow'") 61 except KeyError: # role already exists 62 pass 63 except AttributeError: 64 pass 51 65 portal.__ac_roles__ = tuple(data) 52 66 … … 86 100 stateDef = workflow.states['published'] 87 101 stateDef.setProperties(title="""Published""", 102 description="""""", 88 103 transitions=['publish_post', 'publish_view', 'authenticate', 'authenticate_post', 'authenticate_view']) 89 104 stateDef.setPermission('View', … … 111 126 stateDef = workflow.states['authenticated'] 112 127 stateDef.setProperties(title="""Authenticated""", 128 description="""""", 113 129 transitions=['authenticate_post', 'authenticate_view', 'publish']) 114 130 stateDef.setPermission('View', … … 136 152 stateDef = workflow.states['published_post'] 137 153 stateDef.setProperties(title="""Published Post""", 154 description="""""", 138 155 transitions=['publish']) 139 156 stateDef.setPermission('View', … … 161 178 stateDef = workflow.states['published_view'] 162 179 stateDef.setProperties(title="""Published View""", 180 description="""""", 163 181 transitions=['publish']) 164 182 stateDef.setPermission('View', … … 186 204 stateDef = workflow.states['autheticated_post'] 187 205 stateDef.setProperties(title="""Authenticated Post""", 206 description="""""", 188 207 transitions=['authenticate']) 189 208 stateDef.setPermission('View', … … 211 230 stateDef = workflow.states['authenticated_view'] 212 231 stateDef.setProperties(title="""Authenticated View""", 232 description="""""", 213 233 transitions=['authenticate']) 214 234 stateDef.setPermission('View', … … 376 396 return ob 377 397 378 addWorkflowFactory(createombudsman_workflow,379 id='ombudsman_workflow',380 title='ombudsman_workflow')398 #addWorkflowFactory(createombudsman_workflow, 399 # id='ombudsman_workflow', 400 # title='ombudsman_workflow') 381 401 382 402 ##code-section create-workflow-module-footer #fill in your manual code here
Note: Veja
TracChangeset
para ajuda no uso do visualizador de conjunto de mudanças.