Changeset 1902 in products
- Timestamp:
- Mar 12, 2010 2:56:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/browser/seo_configlet.py
r1884 r1902 6 6 from zope.schema.vocabulary import SimpleVocabulary 7 7 from zope.schema import Bool, Text, Choice, Tuple, List 8 from zope.schema import SourceText 8 9 from zope.app.form.browser import RadioWidget 9 10 … … 16 17 17 18 from Products.CMFCore.utils import getToolByName 19 from Products.CMFPlone.utils import safe_unicode 18 20 from Products.CMFDefault.formlib.schema import ProxyFieldProperty 19 21 from Products.CMFDefault.formlib.schema import SchemaAdapterBase … … 64 66 required=False) 65 67 68 custom_script = SourceText( 69 title=_("label_custom_script", default=u'Header JavaScript'), 70 description=_("help_custom_script", 71 default=u"This JavaScript code will be included in " 72 "the rendered HTML as entered in the page header."), 73 default=u'', 74 required=False) 75 76 fields = List( 77 title=_("label_fields", default='Fields for keywords statistic calculation.'), 78 description=_("help_fields", 79 default='Fill in filds (one per line) which statistics of keywords usage' 80 'should be calculated for.'), 81 required=False) 82 83 stop_words = List( 84 title=_("label_stop_words", default='Stop words.'), 85 description=_("help_stop_words", 86 default='Fill in stop words (one per line) which will ' 87 'be excluded from kewords statistics calculation.'), 88 required=False) 66 89 67 90 class SEOConfigletAdapter(SchemaAdapterBase): … … 92 115 self.context._updateProperty('content_types_with_seoproperties', value) 93 116 117 def getCustomScript(self): 118 description = getattr(self.context, 'custom_script', u'') 119 return safe_unicode(description) 120 121 def setCustomScript(self, value): 122 if value is not None: 123 self.context.custom_script = value.encode(self.encoding) 124 else: 125 self.context.custom_script = '' 94 126 95 127 exposeDCMetaTags = property(getExposeDC, setExposeDC) … … 97 129 metatags_order = ProxyFieldProperty(ISEOConfigletSchema['metatags_order']) 98 130 types_seo_enabled = property(getTypesSEOEnabled, setTypesSEOEnabled) 131 custom_script = property(getCustomScript, setCustomScript) 132 fields = ProxyFieldProperty(ISEOConfigletSchema['fields']) 133 stop_words = ProxyFieldProperty(ISEOConfigletSchema['stop_words']) 99 134 100 135 101 class SmallTextAreaWidget(TextAreaWidget):136 class Text2ListWidget(TextAreaWidget): 102 137 height = 5 103 138 splitter = re.compile(u'\\r?\\n', re.S|re.U) … … 119 154 120 155 form_fields = FormFields(ISEOConfigletSchema) 121 form_fields['default_custom_metatags'].custom_widget = SmallTextAreaWidget122 form_fields['metatags_order'].custom_widget = SmallTextAreaWidget156 form_fields['default_custom_metatags'].custom_widget = Text2ListWidget 157 form_fields['metatags_order'].custom_widget = Text2ListWidget 123 158 form_fields['types_seo_enabled'].custom_widget = MultiCheckBoxThreeColumnWidget 124 159 form_fields['types_seo_enabled'].custom_widget.cssClass='label' 160 form_fields['fields'].custom_widget = Text2ListWidget 161 form_fields['stop_words'].custom_widget = Text2ListWidget 125 162 126 163 label = _("Search Engine Optimizer configuration")
Note: See TracChangeset
for help on using the changeset viewer.