1 | """Definition of the GSpreadsheet content type |
---|
2 | """ |
---|
3 | |
---|
4 | from zope.interface import implements, directlyProvides |
---|
5 | |
---|
6 | from Products.Archetypes import atapi |
---|
7 | from Products.ATContentTypes.content import base |
---|
8 | from Products.ATContentTypes.content import schemata |
---|
9 | |
---|
10 | from quintagroup.gdocs.spreadsheet import spreadsheetMessageFactory as _ |
---|
11 | from quintagroup.gdocs.spreadsheet.interfaces import IGSpreadsheet |
---|
12 | from quintagroup.gdocs.spreadsheet.config import PROJECTNAME |
---|
13 | |
---|
14 | GSpreadsheetSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema(( |
---|
15 | |
---|
16 | atapi.StringField( |
---|
17 | name = 'spreadsheet_id', |
---|
18 | default='', |
---|
19 | required = True, |
---|
20 | languageIndependent=True, |
---|
21 | storage=atapi.AnnotationStorage(), |
---|
22 | widget = atapi.StringWidget( |
---|
23 | label = _( |
---|
24 | u'label_spreadsheet_id', |
---|
25 | default=u'Spreadsheet ID'), |
---|
26 | description=_( |
---|
27 | u'help_spreadsheet_id', |
---|
28 | default=u"Please input spreadsheet ID."), |
---|
29 | size = 40, |
---|
30 | ), |
---|
31 | ), |
---|
32 | |
---|
33 | atapi.StringField( |
---|
34 | name = 'worksheet_id', |
---|
35 | default='', |
---|
36 | required = True, |
---|
37 | languageIndependent=True, |
---|
38 | storage=atapi.AnnotationStorage(), |
---|
39 | widget = atapi.StringWidget( |
---|
40 | label = _( |
---|
41 | u'label_worksheet_id', |
---|
42 | default=u'Worksheet ID'), |
---|
43 | description=_( |
---|
44 | u'help_worksheet_id', |
---|
45 | default=u"Please input worksheet ID."), |
---|
46 | size = 40, |
---|
47 | ), |
---|
48 | ), |
---|
49 | |
---|
50 | # -*- Your Archetypes field definitions here ... -*- |
---|
51 | |
---|
52 | )) |
---|
53 | |
---|
54 | # Set storage on fields copied from ATContentTypeSchema, making sure |
---|
55 | # they work well with the python bridge properties. |
---|
56 | |
---|
57 | GSpreadsheetSchema['title'].storage = atapi.AnnotationStorage() |
---|
58 | GSpreadsheetSchema['description'].storage = atapi.AnnotationStorage() |
---|
59 | |
---|
60 | schemata.finalizeATCTSchema(GSpreadsheetSchema, moveDiscussion=False) |
---|
61 | |
---|
62 | class GSpreadsheet(base.ATCTContent): |
---|
63 | """Lets you select google spreadsheet and worksheet id""" |
---|
64 | implements(IGSpreadsheet) |
---|
65 | |
---|
66 | meta_type = "GSpreadsheet" |
---|
67 | schema = GSpreadsheetSchema |
---|
68 | |
---|
69 | title = atapi.ATFieldProperty('title') |
---|
70 | description = atapi.ATFieldProperty('description') |
---|
71 | spreadsheet_id = atapi.ATFieldProperty('spreadsheet_id') |
---|
72 | worksheet_id = atapi.ATFieldProperty('worksheet_id') |
---|
73 | |
---|
74 | # -*- Your ATSchema to Python Property Bridges Here ... -*- |
---|
75 | |
---|
76 | atapi.registerType(GSpreadsheet, PROJECTNAME) |
---|