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 Products.ATContentTypes.content.base import ATCTContent |
---|
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 | |
---|
19 | MarkerSchema = 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 | |
---|
47 | finalizeATCTSchema(MarkerSchema) |
---|
48 | |
---|
49 | class 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 | |
---|
76 | registerType(Marker, PROJECTNAME) |
---|