source: products/qPloneGoogleMaps/branches/qPloneGoogleMaps_with_geo_interfaces/content/Marker.py @ 1591

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

Building directory structure

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
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
11from zope.interface import implements
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 *
18from geo.interfaces import IPlacemark
19
20MarkerSchema = ATDocumentSchema.copy() + Schema((
21    MapField('location',
22        default=None,
23        required=True,
24        validators=('isLocation',),
25        widget=MapWidget(
26            label='Marker Location',
27            label_msgid='label_marker_center',
28            description='Here you can choose marker location on the map by mouse clicking',
29            description_msgid='help_marker_center',
30            i18n_domain='googlemaps',
31        )
32    ),
33
34    StringField('color',
35        vocabulary=('default', 'red', 'green', 'blue'),
36        default='default',
37        widget=SelectionWidget(
38            label='Marker Color',
39            label_msgid='label_marker_color',
40            description_msgid='help_marker_color',
41            i18n_domain='googlemaps',
42        )
43    ),
44
45),
46)
47
48finalizeATCTSchema(MarkerSchema)
49
50class Marker(ATDocument):
51    """ Map Marker """
52
53    implements(IPlacemark)
54    schema          = MarkerSchema
55
56    content_icon    = 'marker_icon.gif'
57    portal_type     = 'Marker'
58    meta_type       = 'Marker'
59    archetype_name  = 'Marker'
60    default_view    = 'marker_view'
61    immediate_view  = 'marker_view'
62    suppl_views     = ()
63    typeDescription = 'Marker document'
64    typeDescMsgId   = 'marker_description_edit'
65
66    security        = ClassSecurityInfo()
67
68    # Get the standard actions (tabs)
69    #actions = ATCTContent.actions
70
71    # Make sure we get title-to-id generation when an object is created
72    _at_rename_after_creation = True
73
74    security.declareProtected(View, 'geoLocation')
75    def geoLocation(self):
76        return self.getLocation()
77
78    name = property(""" see interface """)
79    visibility = property(""" see interface """)
80    open = property(""" see interface """)
81    address = property(""" see interface """)
82    AddressDetails = property(""" see interface """)
83    phoneNumber = property(""" see interface """)
84    Snippet = property(""" see interface """)
85    LookAt = property(""" see interface """)
86    StyleSelector = property(""" see interface """)
87    Region = property(""" see interface """)
88    geometry = property(""" see interface """)
89
90registerType(Marker, PROJECTNAME)
Note: See TracBrowser for help on using the repository browser.