source: products/quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/content/gspreadsheet.py @ 2649

Last change on this file since 2649 was 2649, checked in by liebster, 14 years ago

Added spreadsheet_id and worksheet_id fields to GSpreadsheet content type

File size: 2.4 KB
Line 
1"""Definition of the GSpreadsheet content type
2"""
3
4from zope.interface import implements, directlyProvides
5
6from Products.Archetypes import atapi
7from Products.ATContentTypes.content import base
8from Products.ATContentTypes.content import schemata
9
10from quintagroup.gdocs.spreadsheet import spreadsheetMessageFactory as _
11from quintagroup.gdocs.spreadsheet.interfaces import IGSpreadsheet
12from quintagroup.gdocs.spreadsheet.config import PROJECTNAME
13
14GSpreadsheetSchema = 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
59GSpreadsheetSchema['title'].storage = atapi.AnnotationStorage()
60GSpreadsheetSchema['description'].storage = atapi.AnnotationStorage()
61
62schemata.finalizeATCTSchema(GSpreadsheetSchema, moveDiscussion=False)
63
64class 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
78atapi.registerType(GSpreadsheet, PROJECTNAME)
Note: See TracBrowser for help on using the repository browser.