| | 87 | LinesField('tags', |
|---|
| | 88 | accessor = 'EntryTag', |
|---|
| | 89 | mutator = 'setEntryTag', |
|---|
| | 90 | index = 'KeywordIndex', |
|---|
| | 91 | enforseVocabulary = 1, |
|---|
| | 92 | vocabulary = 'listTags', |
|---|
| | 93 | widget = KeywordWidget(label_msgid = "label_entry_tags", |
|---|
| | 94 | description_msgid = "help_entry_tags", |
|---|
| | 95 | i18n_domain = "SimpleBlog", |
|---|
| | 96 | label = 'Tags', |
|---|
| | 97 | description = 'Select tags for technorati.com')), |
|---|
| | 98 | |
|---|
| | 99 | BooleanField('alwaysOnTop', |
|---|
| | 100 | default = 0, |
|---|
| | 101 | index = 'FieldIndex:schema', |
|---|
| | 102 | widget = BooleanWidget(label = 'Entry is always listed on top.', |
|---|
| | 103 | label_msgid = "label_always_top", |
|---|
| | 104 | description_msgid = "help_always_top", |
|---|
| | 105 | i18n_domain = "SimpleBlog", |
|---|
| | 106 | description = 'Controls if the Entry (when published) shown as the first Entry. If not checked, the effective date is used.')), |
|---|
| 91 | | |
|---|
| | 115 | BooleanField('enableTopAdsence', |
|---|
| | 116 | widget = BooleanWidget(format = 'select', |
|---|
| | 117 | label_msgid = "label_enable_top_adsence", |
|---|
| | 118 | description_msgid = "help_enable_top_adsence", |
|---|
| | 119 | i18n_domain = "SimpleBlog", |
|---|
| | 120 | label = 'Enable top Adsence block', |
|---|
| | 121 | description = None)), |
|---|
| | 122 | StringField('topAdsence', |
|---|
| | 123 | vocabulary = 'listAdesnceTemplates', |
|---|
| | 124 | widget = SelectionWidget(format = 'select', |
|---|
| | 125 | label_msgid = "label_top_adsence", |
|---|
| | 126 | description_msgid = "help_top_adsence", |
|---|
| | 127 | i18n_domain = "SimpleBlog", |
|---|
| | 128 | label = 'Top Adsence', |
|---|
| | 129 | description = None)), |
|---|
| | 130 | BooleanField('enableBottomAdsence', |
|---|
| | 131 | widget = BooleanWidget(format = 'select', |
|---|
| | 132 | label_msgid = "label_enable_bottom_adsence", |
|---|
| | 133 | description_msgid = "help_enable_bottom_adsence", |
|---|
| | 134 | i18n_domain = "SimpleBlog", |
|---|
| | 135 | label = 'Enable bottom Adsence block', |
|---|
| | 136 | description = None)), |
|---|
| | 137 | StringField('bottomAdsence', |
|---|
| | 138 | vocabulary = 'listAdesnceTemplates', |
|---|
| | 139 | widget = SelectionWidget(format = 'select', |
|---|
| | 140 | label_msgid = "label_bottom_adsence", |
|---|
| | 141 | description_msgid = "help_bottom_adsence", |
|---|
| | 142 | i18n_domain = "SimpleBlog", |
|---|
| | 143 | label = 'Bottom Adsence', |
|---|
| | 144 | description = None)), |
|---|
| | 145 | StringField('diggTopic', |
|---|
| | 146 | default='offbeat_news', |
|---|
| | 147 | vocabulary=DIGG_TOPICS, |
|---|
| | 148 | widget=SelectionWidget(label='Digg topic', |
|---|
| | 149 | label_msgid="label_digg_topic", |
|---|
| | 150 | description_msgid="help_digg_topic", |
|---|
| | 151 | i18n_domain="SimpleBlog", |
|---|
| | 152 | description='Choose the digg topic.')), |
|---|
| 220 | | #def setEntryTag(self, value, **kwargs): |
|---|
| 221 | | #""" Update tags in the Entry in parent Blog """ |
|---|
| 222 | | #value = list(value) |
|---|
| 223 | | #value.sort() |
|---|
| 224 | | #self.getField('tags').set(self, value, **kwargs) |
|---|
| 225 | | |
|---|
| 226 | | #tags = self.listTags() |
|---|
| 227 | | #newEntries = [v for v in value if not v in tags] |
|---|
| 228 | | #if not newEntries: |
|---|
| 229 | | #return |
|---|
| 230 | | #newTagsList = list(tags)+ list(newEntries) |
|---|
| 231 | | #parent = self.aq_parent |
|---|
| 232 | | #portal = self.portal_url.getPortalObject() |
|---|
| 233 | | #while parent != portal: |
|---|
| 234 | | #if parent.portal_type == 'Blog': |
|---|
| 235 | | #break |
|---|
| 236 | | #parent = parent.aq_parent |
|---|
| 237 | | #parent.setTags(newTagsList, **kwargs) |
|---|
| 238 | | |
|---|
| 239 | | #def listTags(self): |
|---|
| 240 | | #""" Get the list of Tags from parent Blog """ |
|---|
| 241 | | #tags = [] |
|---|
| 242 | | #parent = self.aq_parent |
|---|
| 243 | | #portal = self.portal_url.getPortalObject() |
|---|
| 244 | | #while parent != portal: |
|---|
| 245 | | #if parent.portal_type == 'Blog': |
|---|
| 246 | | #tags = parent.getTags() |
|---|
| 247 | | #break |
|---|
| 248 | | #parent = parent.aq_parent |
|---|
| 249 | | #return tuple(tags) |
|---|
| 250 | | |
|---|
| 251 | | #def listAdesnceTemplates(self): |
|---|
| 252 | | #""" return list of available adsence blocks """ |
|---|
| 253 | | #pp = getToolByName(self, 'portal_properties') |
|---|
| 254 | | #templates = () |
|---|
| 255 | | #try: |
|---|
| 256 | | #templates = pp.simpleblog_properties.getProperty('adsence_templates',()) |
|---|
| 257 | | #except: |
|---|
| 258 | | #pass |
|---|
| 259 | | #return templates |
|---|
| 260 | | |
|---|
| | 275 | def setEntryTag(self, value, **kwargs): |
|---|
| | 276 | """ Update tags in the Entry in parent Blog """ |
|---|
| | 277 | value = list(value) |
|---|
| | 278 | value.sort() |
|---|
| | 279 | self.getField('tags').set(self, value, **kwargs) |
|---|
| | 280 | |
|---|
| | 281 | tags = self.listTags() |
|---|
| | 282 | newEntries = [v for v in value if not v in tags] |
|---|
| | 283 | if not newEntries: |
|---|
| | 284 | return |
|---|
| | 285 | newTagsList = list(tags)+ list(newEntries) |
|---|
| | 286 | parent = self.aq_parent |
|---|
| | 287 | portal = self.portal_url.getPortalObject() |
|---|
| | 288 | while parent != portal: |
|---|
| | 289 | if parent.portal_type == 'Blog': |
|---|
| | 290 | break |
|---|
| | 291 | parent = parent.aq_parent |
|---|
| | 292 | parent.setTags(newTagsList, **kwargs) |
|---|
| | 293 | |
|---|
| | 294 | def listTags(self): |
|---|
| | 295 | """ Get the list of Tags from parent Blog """ |
|---|
| | 296 | tags = [] |
|---|
| | 297 | parent = self.aq_parent |
|---|
| | 298 | portal = self.portal_url.getPortalObject() |
|---|
| | 299 | while parent != portal: |
|---|
| | 300 | if parent.portal_type == 'Blog': |
|---|
| | 301 | tags = parent.getTags() |
|---|
| | 302 | break |
|---|
| | 303 | parent = parent.aq_parent |
|---|
| | 304 | return tuple(tags) |
|---|
| | 305 | |
|---|
| | 306 | def listAdesnceTemplates(self): |
|---|
| | 307 | """ return list of available adsence blocks """ |
|---|
| | 308 | pp = getToolByName(self, 'portal_properties') |
|---|
| | 309 | templates = () |
|---|
| | 310 | try: |
|---|
| | 311 | templates = pp.simpleblog_properties.getProperty('adsence_templates',()) |
|---|
| | 312 | except: |
|---|
| | 313 | pass |
|---|
| | 314 | return templates |
|---|