Changeset 1265 in products
- Timestamp:
- Sep 8, 2009 5:52:25 PM (15 years ago)
- Location:
- quintagroup.seoptimizer/trunk/quintagroup/seoptimizer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/configure.zcml
r955 r1265 75 75 layer=".interfaces.IPloneSEOLayer" 76 76 permission="zope2.View" 77 allowed_attributes="seo_globalCustomMetaTags" 77 78 /> 78 79 -
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/viewlets.py
r1261 r1265 124 124 custom_meta_tags = seo_context.seo_customMetaTags() 125 125 for tag in custom_meta_tags: 126 metaTags[tag['meta_name']] = tag['meta_content'] 126 if tag['meta_content']: 127 metaTags[tag['meta_name']] = tag['meta_content'] 127 128 128 129 # Set the additional matching keywords, if any -
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/views.py
r1183 r1265 67 67 def seo_customMetaTags( self ): 68 68 """ 69 Return context's properties prefixed with qSEO_custom_ 69 """ 70 tags = self.seo_globalCustomMetaTags() 71 loc = self.seo_localCustomMetaTags() 72 73 names = [i['meta_name'] for i in tags] 74 add_tags = [] 75 for i in loc: 76 if i['meta_name'] in names: 77 for t in tags: 78 if t['meta_name'] == i['meta_name']: 79 t['meta_content'] = i['meta_content'] 80 else: 81 add_tags.append(i) 82 tags.extend(add_tags) 83 return tags 84 85 def seo_globalWithoutLocalCustomMetaTags( self ): 86 """ 87 """ 88 glob = self.seo_globalCustomMetaTags() 89 loc = self.seo_localCustomMetaTags() 90 names = [i['meta_name'] for i in loc] 91 tags = [] 92 for i in glob: 93 if i['meta_name'] not in names: 94 tags.append(i) 95 return tags 96 97 def seo_localCustomMetaTags( self ): 98 """ 70 99 """ 71 100 result = [] 72 added = []73 101 property_prefix = 'qSEO_custom_' 74 75 context = aq_inner(self.context) 76 102 context = aq_inner(self.context) 77 103 for property, value in context.propertyItems(): 78 idx = property.find(property_prefix) 79 if idx == 0 and len(property) > len(property_prefix): 80 added.append(property[len(property_prefix):]) 104 if property.startswith(property_prefix) and property[len(property_prefix):]: 81 105 result.append({'meta_name' : property[len(property_prefix):], 82 106 'meta_content' : value}) 83 107 return result 108 109 def seo_globalCustomMetaTags( self ): 110 """ 111 """ 112 result = [] 113 context = aq_inner(self.context) 84 114 site_properties = getToolByName(context, 'portal_properties') 85 115 if hasattr(site_properties, 'seo_properties'): … … 87 117 for tag in custom_meta_tags: 88 118 name_value = tag.split(SEPERATOR) 89 if name_value[0] and name_value[0] not in added: 90 if len(name_value) == 1: 91 result.append({'meta_name' : name_value[0], 92 'meta_content' : ''}) 93 else: 94 result.append({'meta_name' : name_value[0], 95 'meta_content' : name_value[1]}) 119 if name_value[0]: 120 result.append({'meta_name' : name_value[0], 121 'meta_content' : len(name_value) == 1 and '' or name_value[1]}) 96 122 return result 97 123 124 def seo_nonEmptylocalMetaTags( self ): 125 """ 126 """ 127 return bool(self.seo_localCustomMetaTags()) 128 98 129 def seo_html_comment( self ): 99 130 """ -
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/skins/quintagroup.seoptimizer/qseo_properties_edit.cpy
r896 r1265 7 7 ##bind subpath=traverse_subpath 8 8 ##title=Update SEO Properties 9 ##parameters=title=None,description=None,canonical=None,keywords=None,html_comment=None,robots=None,distribution=None,title_override=0,description_override=0,canonical_override=0,keywords_override=0,html_comment_override=0,robots_override=0,distribution_override=0,custommetatags=[] 9 ##parameters=title=None,description=None,canonical=None,keywords=None,html_comment=None,robots=None,distribution=None,title_override=0,description_override=0,canonical_override=0,keywords_override=0,html_comment_override=0,robots_override=0,distribution_override=0,custommetatags=[],custommetatags_override=0 10 10 11 11 def setProperty(context, property, value, type='string'): … … 24 24 custom_existing.append(property) 25 25 26 if not custommetatags_override: custommetatags=[] 27 28 globalCustomMetaTags = context.restrictedTraverse('@@seo_context').seo_globalCustomMetaTags() 26 29 custom_updated = [] 27 30 for tag in custommetatags: 28 31 meta_name, meta_content = tag['meta_name'], tag['meta_content'] 29 if meta_name and meta_content: 30 setProperty(context, '%s%s' % (property_prefix, meta_name), meta_content) 32 if meta_name: 33 if not [gmt for gmt in globalCustomMetaTags if (gmt['meta_name']==meta_name and gmt['meta_content']==meta_content)]: 34 setProperty(context, '%s%s' % (property_prefix, meta_name), meta_content) 31 35 custom_updated.append('%s%s' % (property_prefix, meta_name)) 32 36 -
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/skins/quintagroup.seoptimizer/qseo_properties_edit_form.cpt
r1183 r1265 255 255 </div> 256 256 <div class="field" 257 tal:define="fieldName string:custommetatags;"> 257 tal:define="fieldName string:custommetatags; 258 nonEmptylocalMetaTags here/@@seo_context/seo_nonEmptylocalMetaTags;"> 258 259 <label i18n:translate="label_custom_metatags" for="custom_metatags"> 259 260 Custom Meta Tags … … 262 263 Here you can manage your custom meta tags. 263 264 </div> 265 <input type="checkbox" 266 id="custommetatags_override" 267 name="custommetatags_override" 268 tabindex="" 269 tal:attributes="checked python:test(nonEmptylocalMetaTags, 'on', None); 270 tabindex tabindex/next;" 271 /> 272 <label i18n:translate="label_override" for="custommetatags_override"> 273 Override 274 </label><br /> 264 275 <table class="custom-metatags-table" 265 276 id="datagridwidget-table-custommetatags" … … 267 278 tal:define="columnNames python:['meta name', 'meta content']; 268 279 columnIds python:['meta_name', 'meta_content']; 269 fielddata here/@@seo_context/seo_customMetaTags;"> 280 globalMT here/@@seo_context/seo_globalWithoutLocalCustomMetaTags; 281 localMT here/@@seo_context/seo_localCustomMetaTags;"> 270 282 <thead> 271 283 <tr> … … 279 291 </thead> 280 292 <tbody id="datagridwidget-tbody-custommetatags"> 281 <tal:row-loop tal:repeat="row fielddata"> 293 <tal:row-loop tal:repeat="row globalMT"> 294 <tr id="datagridwidget-row"> 295 <tal:vars define="fieldId string:${fieldName}_${repeat/row/number}"> 296 <td class="datagridwidget-cell" 297 tal:repeat="column columnIds"> 298 <tal:cell tal:define="cell_value python:row.get(column);"> 299 <input type="text" 300 id="columnId_fieldId" 301 value="" 302 name="fieldId.columnId:records" 303 style="width: 100%;" 304 tal:attributes="name string:${fieldName}.${column}:records; 305 id string:${column}_${fieldId}; 306 value cell_value"/> 307 </tal:cell> 308 </td> 309 </tal:vars> 310 </tr> 311 </tal:row-loop> 312 <tal:row-loop tal:repeat="row localMT"> 282 313 <tr id="datagridwidget-row"> 283 314 <tal:vars define="fieldId string:${fieldName}_${repeat/row/number}">
Note: See TracChangeset
for help on using the changeset viewer.