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 | searchable = True, |
---|
20 | required = True, |
---|
21 | #languageIndependent=True, |
---|
22 | storage=atapi.AnnotationStorage(), |
---|
23 | widget = atapi.StringWidget( |
---|
24 | label = _( |
---|
25 | u'label_spreadsheet_id', |
---|
26 | default=u'Spreadsheet ID'), |
---|
27 | description=_( |
---|
28 | u'help_spreadsheet_id', |
---|
29 | default=u"Input spreadsheet ID."), |
---|
30 | size = 40, |
---|
31 | ), |
---|
32 | ), |
---|
33 | |
---|
34 | atapi.StringField( |
---|
35 | name = 'worksheet_id', |
---|
36 | default='', |
---|
37 | searchable = True, |
---|
38 | required = True, |
---|
39 | #languageIndependent=True, |
---|
40 | storage=atapi.AnnotationStorage(), |
---|
41 | widget = atapi.StringWidget( |
---|
42 | label = _( |
---|
43 | u'label_worksheet_id', |
---|
44 | default=u'Worksheet ID'), |
---|
45 | description=_( |
---|
46 | u'help_worksheet_id', |
---|
47 | default=u"Input worksheet ID."), |
---|
48 | size = 40, |
---|
49 | ), |
---|
50 | ), |
---|
51 | |
---|
52 | # -*- Your Archetypes field definitions here ... -*- |
---|
53 | |
---|
54 | )) |
---|
55 | |
---|
56 | # Set storage on fields copied from ATContentTypeSchema, making sure |
---|
57 | # they work well with the python bridge properties. |
---|
58 | |
---|
59 | GSpreadsheetSchema['title'].storage = atapi.AnnotationStorage() |
---|
60 | GSpreadsheetSchema['description'].storage = atapi.AnnotationStorage() |
---|
61 | |
---|
62 | schemata.finalizeATCTSchema(GSpreadsheetSchema, moveDiscussion=False) |
---|
63 | |
---|
64 | class GSpreadsheet(base.ATCTContent): |
---|
65 | """Lets you select google spreadsheet and worksheet id""" |
---|
66 | implements(IGSpreadsheet) |
---|
67 | |
---|
68 | meta_type = "GSpreadsheet" |
---|
69 | schema = GSpreadsheetSchema |
---|
70 | |
---|
71 | title = atapi.ATFieldProperty('title') |
---|
72 | description = atapi.ATFieldProperty('description') |
---|
73 | spreadsheet_id = atapi.ATFieldProperty('spreadsheet_id') |
---|
74 | worksheet_id = atapi.ATFieldProperty('worksheet_id') |
---|
75 | |
---|
76 | # -*- Your ATSchema to Python Property Bridges Here ... -*- |
---|
77 | |
---|
78 | atapi.registerType(GSpreadsheet, PROJECTNAME) |
---|