source: products/qPloneGoogleMaps/tags/0.1.0/content/Marker.py

Last change on this file was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 2.3 KB
RevLine 
[1]1from AccessControl import ClassSecurityInfo
2try:
3    from Products.CMFCore.permissions import ModifyPortalContent, View
4except ImportError:
5    from Products.CMFCore.CMFCorePermissions import ModifyPortalContent, View
6try:
7  from Products.LinguaPlone.public import *
8except ImportError:
9  from Products.Archetypes.public import *
10
11#from Products.ATContentTypes.content.base import ATCTContent
12from Products.ATContentTypes.content.document import ATDocumentSchema
13from Products.ATContentTypes.content.document import ATDocument
14from Products.ATContentTypes.content.schemata import finalizeATCTSchema
15
16from Products.qPloneGoogleMaps.field import *
17from Products.qPloneGoogleMaps.config import *
18
19MarkerSchema = ATDocumentSchema.copy() + Schema((
20    MapField('location',
21        default=None,
22        required=True,
23        validators=('isLocation',),
24        widget=MapWidget(
25            label='Marker Location',
26            label_msgid='label_marker_center',
27            description='Here you can choose marker location on the map by mouse clicking',
28            description_msgid='help_marker_center',
29            i18n_domain='googlemaps',
30        )
31    ),
32
33    StringField('color',
34        vocabulary=('default', 'red', 'green', 'blue'),
35        default='default',
36        widget=SelectionWidget(
37            label='Marker Color',
38            label_msgid='label_marker_color',
39            description_msgid='help_marker_color',
40            i18n_domain='googlemaps',
41        )
42    ),
43
44),
45)
46
47finalizeATCTSchema(MarkerSchema)
48
49class Marker(ATDocument):
50    """ Map Marker """
51
52    schema          = MarkerSchema
53
54    content_icon    = 'marker_icon.gif'
55    portal_type     = 'Marker'
56    meta_type       = 'Marker'
57    archetype_name  = 'Marker'
58    default_view    = 'marker_view'
59    immediate_view  = 'marker_view'
60    suppl_views     = ()
61    typeDescription = 'Marker document'
62    typeDescMsgId   = 'marker_description_edit'
63
64    security        = ClassSecurityInfo()
65
66    # Get the standard actions (tabs)
67    #actions = ATCTContent.actions
68
69    # Make sure we get title-to-id generation when an object is created
70    _at_rename_after_creation = True
71
72    security.declareProtected(View, 'geoLocation')
73    def geoLocation(self):
74        return self.getLocation()
75
76registerType(Marker, PROJECTNAME)
Note: See TracBrowser for help on using the repository browser.