[2646] | 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 | |
---|
[2649] | 16 | atapi.StringField( |
---|
[2661] | 17 | name = 'spreadsheet_id', |
---|
[2649] | 18 | default='', |
---|
| 19 | required = True, |
---|
[2659] | 20 | languageIndependent=True, |
---|
[2649] | 21 | storage=atapi.AnnotationStorage(), |
---|
| 22 | widget = atapi.StringWidget( |
---|
| 23 | label = _( |
---|
[2661] | 24 | u'label_spreadsheet_id', |
---|
| 25 | default=u'Spreadsheet ID'), |
---|
[2649] | 26 | description=_( |
---|
[2661] | 27 | u'help_spreadsheet_id', |
---|
| 28 | default=u"Please input spreadsheet ID."), |
---|
[2649] | 29 | size = 40, |
---|
| 30 | ), |
---|
| 31 | ), |
---|
| 32 | |
---|
[2661] | 33 | atapi.StringField( |
---|
| 34 | name = 'worksheet_id', |
---|
[2649] | 35 | default='', |
---|
| 36 | required = True, |
---|
[2659] | 37 | languageIndependent=True, |
---|
[2649] | 38 | storage=atapi.AnnotationStorage(), |
---|
[2661] | 39 | widget = atapi.StringWidget( |
---|
[2649] | 40 | label = _( |
---|
[2661] | 41 | u'label_worksheet_id', |
---|
| 42 | default=u'Worksheet ID'), |
---|
[2649] | 43 | description=_( |
---|
[2661] | 44 | u'help_worksheet_id', |
---|
| 45 | default=u"Please input worksheet ID."), |
---|
| 46 | size = 40, |
---|
[2649] | 47 | ), |
---|
| 48 | ), |
---|
| 49 | |
---|
[2646] | 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') |
---|
[2661] | 71 | spreadsheet_id = atapi.ATFieldProperty('spreadsheet_id') |
---|
| 72 | worksheet_id = atapi.ATFieldProperty('worksheet_id') |
---|
[2646] | 73 | |
---|
| 74 | # -*- Your ATSchema to Python Property Bridges Here ... -*- |
---|
| 75 | |
---|
| 76 | atapi.registerType(GSpreadsheet, PROJECTNAME) |
---|