Changeset 1782 in products for quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/browser/views.py
- Timestamp:
- Feb 18, 2010 9:15:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/browser/views.py
r1752 r1782 22 22 """ This class contains methods that allows to edit html header meta tags. 23 23 """ 24 25 def isSEOTabVisibile(self): 26 context = aq_inner(self.context) 27 portal_properties = getToolByName(context, 'portal_properties') 28 seo_properties = getToolByName(portal_properties, 'seo_properties') 29 content_types_with_seoproperties = seo_properties.getProperty('content_types_with_seoproperties', '') 30 return bool(self.context.portal_type in content_types_with_seoproperties) 31 24 32 def getSEOProperty( self, property_name, accessor='' ): 25 33 """ Get value from seo property by property name. … … 232 240 return getToolByName(context, 'portal_types') 233 241 234 def hasSEOAction( self, type_info ):235 """236 """237 return filter(lambda x:x.id == 'seo_properties', type_info.listActions())242 #def hasSEOAction( self, type_info ): 243 #""" 244 #""" 245 #return filter(lambda x:x.id == 'seo_properties', type_info.listActions()) 238 246 239 247 def test( self, condition, first, second ): … … 276 284 return [slist] 277 285 286 def isSEOTabVisibile(self, type): 287 context = aq_inner(self.context) 288 portal_properties = getToolByName(context, 'portal_properties') 289 seo_properties = getToolByName(portal_properties, 'seo_properties') 290 content_types_with_seoproperties = seo_properties.getProperty('content_types_with_seoproperties', '') 291 return bool(type in content_types_with_seoproperties) 292 278 293 def __call__( self ): 279 294 """ Perform the update and redirect if necessary, or render the page. … … 282 297 request = self.request 283 298 284 content_types_seoprops_enabled = request.get( 'contentTypes', [] )285 299 exposeDCMetaTags = request.get( 'exposeDCMetaTags', None ) 286 300 additionalKeywords = request.get('additionalKeywords', []) … … 289 303 settingsUseKeywordsSG = int(request.get('settingsUseKeywordsSG', 1)) 290 304 settingsUseKeywordsLG = int(request.get('settingsUseKeywordsLG', 1)) 305 content_types_with_seoproperties = request.get('contentTypes', []) 291 306 292 307 site_props = getToolByName(self.portal_properties, 'site_properties') … … 295 310 form = self.request.form 296 311 submitted = form.get('form.submitted', False) 297 298 312 if submitted: 299 313 site_props.manage_changeProperties(exposeDCMetaTags=exposeDCMetaTags) … … 301 315 seo_props.manage_changeProperties(default_custom_metatags=default_custom_metatags) 302 316 seo_props.manage_changeProperties(metatags_order=metatags_order) 303 seo_props.manage_changeProperties(content_types_seoprops_enabled=content_types_seoprops_enabled)304 317 seo_props.manage_changeProperties(settings_use_keywords_sg=settingsUseKeywordsSG) 305 318 seo_props.manage_changeProperties(settings_use_keywords_lg=settingsUseKeywordsLG) 306 307 for ptype in self.portal_types.objectValues(): 308 acts = filter(lambda x: x.id == 'seo_properties', ptype.listActions()) 309 action = acts and acts[0] or None 310 if ptype.getId() in content_types_seoprops_enabled: 311 if action is None: 312 ptype.addAction('seo_properties', 313 'SEO Properties', 314 'string:${object_url}/@@seo-context-properties', 315 "python:exists('portal/@@seo-context-properties')", 316 'Modify portal content', 317 'object', 318 visible=1) 319 else: 320 if action !=None: 321 actions = list(ptype.listActions()) 322 ptype.deleteActions([actions.index(a) for a in actions if a.getId()=='seo_properties']) 319 seo_props.manage_changeProperties(content_types_with_seoproperties=content_types_with_seoproperties) 320 323 321 context.plone_utils.addPortalMessage(pmf(u'Changes saved.')) 324 322 return request.response.redirect('%s/%s'%(self.context.absolute_url(), 'plone_control_panel')) 325 323 else: 326 return self.template(contentTypes=content_types_ seoprops_enabled, exposeDCMetaTags=exposeDCMetaTags)324 return self.template(contentTypes=content_types_with_seoproperties, exposeDCMetaTags=exposeDCMetaTags) 327 325 328 326 def typeInfo( self, type_name ):
Note: See TracChangeset
for help on using the changeset viewer.