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

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

reverting commit [3698] (svn merge -r 3698:3697 http://svn.quintagroup.com/products/quintagroup.gdocs.spreadsheet/trunk/).

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        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
57GSpreadsheetSchema['title'].storage = atapi.AnnotationStorage()
58GSpreadsheetSchema['description'].storage = atapi.AnnotationStorage()
59
60schemata.finalizeATCTSchema(GSpreadsheetSchema, moveDiscussion=False)
61
62class 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
76atapi.registerType(GSpreadsheet, PROJECTNAME)
Note: See TracBrowser for help on using the repository browser.