1 | from AccessControl import ClassSecurityInfo |
---|
2 | try: |
---|
3 | from Products.CMFCore.permissions import ModifyPortalContent, View |
---|
4 | except ImportError: |
---|
5 | from Products.CMFCore.CMFCorePermissions import ModifyPortalContent, View |
---|
6 | try: |
---|
7 | from Products.LinguaPlone.public import * |
---|
8 | except ImportError: |
---|
9 | from Products.Archetypes.public import * |
---|
10 | |
---|
11 | from zope.interface import implements |
---|
12 | from Products.ATContentTypes.content.document import ATDocumentSchema |
---|
13 | from Products.ATContentTypes.content.document import ATDocument |
---|
14 | from Products.ATContentTypes.content.schemata import finalizeATCTSchema |
---|
15 | |
---|
16 | from Products.qPloneGoogleMaps.field import * |
---|
17 | from Products.qPloneGoogleMaps.config import * |
---|
18 | from geo.interfaces import IPlacemark |
---|
19 | |
---|
20 | MarkerSchema = 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 | |
---|
48 | finalizeATCTSchema(MarkerSchema) |
---|
49 | |
---|
50 | class 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 | |
---|
90 | registerType(Marker, PROJECTNAME) |
---|