Last change
on this file since 1 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1] | 1 | ## Script (Python) "prefs_seo_config" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= portalTypes= [], exposeDCMetaTags= None |
---|
| 8 | ##title=add action tab for selected portal types |
---|
| 9 | ## |
---|
| 10 | from Products.CMFCore.utils import getToolByName |
---|
| 11 | |
---|
| 12 | site_props = getToolByName(context, 'portal_properties').site_properties |
---|
| 13 | site_props.manage_changeProperties(exposeDCMetaTags = exposeDCMetaTags) |
---|
| 14 | |
---|
| 15 | pt = getToolByName(context, 'portal_types') |
---|
| 16 | for ptype in pt.objectValues(): |
---|
| 17 | action = ptype.getActionById('seo_properties', default=None ) |
---|
| 18 | |
---|
| 19 | if ptype.getId() in portalTypes: |
---|
| 20 | if action is None: |
---|
| 21 | ptype.addAction('seo_properties', |
---|
| 22 | 'SEO Properties', |
---|
| 23 | 'string:${object_url}/qseo_properties_edit_form', |
---|
| 24 | '', |
---|
| 25 | 'Modify portal content', |
---|
| 26 | 'object', |
---|
| 27 | visible=1) |
---|
| 28 | else: |
---|
| 29 | if action !=None: |
---|
| 30 | actions = list(ptype.listActions()) |
---|
| 31 | ptype.deleteActions([actions.index(a) for a in actions if a.getId()=='seo_properties']) |
---|
| 32 | |
---|
| 33 | return state.set(portal_status_message = 'Search Engine Optimizer configuration updated.') |
---|
Note: See
TracBrowser
for help on using the repository browser.