| 1 | from Globals import DTMLFile |
|---|
| 2 | from AccessControl import ClassSecurityInfo |
|---|
| 3 | from Products.Archetypes.public import * |
|---|
| 4 | from Products.CMFCore.permissions import ModifyPortalContent |
|---|
| 5 | from Products.CMFDefault.utils import _dtmldir |
|---|
| 6 | from Products.ATContentTypes.content.base import ATCTContent |
|---|
| 7 | from Products.ATContentTypes.content.schemata import ATContentTypeSchema, finalizeATCTSchema |
|---|
| 8 | from Products.ATContentTypes.lib.historyaware import HistoryAwareMixin |
|---|
| 9 | from config import RSS_LIST, PROJECTNAME |
|---|
| 10 | |
|---|
| 11 | from Products.qPingTool import qPingToolMessageFactory as _ |
|---|
| 12 | |
|---|
| 13 | PingInfoSchema = ATContentTypeSchema.copy() + Schema(( |
|---|
| 14 | TextField('description', |
|---|
| 15 | default='', |
|---|
| 16 | searchable=False, |
|---|
| 17 | widget=TextAreaWidget( |
|---|
| 18 | label=_( |
|---|
| 19 | u'label_description', |
|---|
| 20 | default=u'Description'), |
|---|
| 21 | description=_( |
|---|
| 22 | u'help_description', |
|---|
| 23 | default=u'Description of ping info'), |
|---|
| 24 | ), |
|---|
| 25 | ), |
|---|
| 26 | StringField('url', |
|---|
| 27 | default='', |
|---|
| 28 | required=1, |
|---|
| 29 | searchable=False, |
|---|
| 30 | widget=StringWidget( |
|---|
| 31 | label=_( |
|---|
| 32 | u'label_url', |
|---|
| 33 | default=u'Url ping servies'), |
|---|
| 34 | description=_( |
|---|
| 35 | u'help_url', |
|---|
| 36 | default=u''), |
|---|
| 37 | ), |
|---|
| 38 | ), |
|---|
| 39 | StringField('method_name', |
|---|
| 40 | default='weblogUpdates.ping', |
|---|
| 41 | required=1, |
|---|
| 42 | searchable=False, |
|---|
| 43 | widget=StringWidget( |
|---|
| 44 | label=_( |
|---|
| 45 | u'label_method_name', |
|---|
| 46 | default=u'Method name'), |
|---|
| 47 | description=_( |
|---|
| 48 | u'help_method_name', |
|---|
| 49 | default=u''), |
|---|
| 50 | ), |
|---|
| 51 | ), |
|---|
| 52 | StringField('rss_version', |
|---|
| 53 | default='Weblog', |
|---|
| 54 | searchable=False, |
|---|
| 55 | vocabulary=RSS_LIST, |
|---|
| 56 | widget=SelectionWidget( |
|---|
| 57 | label=_( |
|---|
| 58 | u'label_rss_version', |
|---|
| 59 | default=u'RSS version'), |
|---|
| 60 | description=_( |
|---|
| 61 | u'help_rss_version', |
|---|
| 62 | default=u''), |
|---|
| 63 | ), |
|---|
| 64 | ), |
|---|
| 65 | ),marshall=RFC822Marshaller()) |
|---|
| 66 | |
|---|
| 67 | #finalizeATCTSchema(PingInfoSchema) |
|---|
| 68 | |
|---|
| 69 | class PingInfo(ATCTContent, HistoryAwareMixin): |
|---|
| 70 | """Ping Info container |
|---|
| 71 | id - name of the server to ping |
|---|
| 72 | url - server ping url |
|---|
| 73 | method_name - ping method |
|---|
| 74 | rss_version - rss version supported by the server |
|---|
| 75 | """ |
|---|
| 76 | __implements__ = (ATCTContent.__implements__, |
|---|
| 77 | HistoryAwareMixin.__implements__, |
|---|
| 78 | ) |
|---|
| 79 | schema = PingInfoSchema |
|---|
| 80 | |
|---|
| 81 | """ |
|---|
| 82 | Added some support of DublinCore |
|---|
| 83 | """ |
|---|
| 84 | security = ClassSecurityInfo() |
|---|
| 85 | |
|---|
| 86 | def Contributors(self): |
|---|
| 87 | return self.contributors |
|---|
| 88 | |
|---|
| 89 | security.declareProtected(ModifyPortalContent, 'manage_metadata' ) |
|---|
| 90 | manage_metadata = DTMLFile('zmi_metadata', _dtmldir) |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | registerType(PingInfo, PROJECTNAME) |
|---|