59c7eb663ed337b6dfee7fa8e885c7c78042b7f5
[myslice.git] / plugins / googlemap / googlemap.py
1 from unfold.plugin import Plugin
2
3 class GoogleMap (Plugin):
4
5     # set checkboxes if a final column with checkboxes is desired
6     # pass columns as the initial set of columns
7     #   if None then this is taken from the query's fields
8     # latitude,longitude, zoom : the starting point
9     def __init__ (self, query, query_all_uuid = None, latitude=43., longitude=7., zoom=4, **settings):
10         Plugin.__init__ (self, **settings)
11         self.query=query
12         self.query_all_uuid = query_all_uuid
13         self.latitude=latitude
14         self.longitude=longitude
15         self.zoom=zoom
16
17     def template_file (self):
18         return "googlemap.html"
19
20     def template_env (self, request):
21         env={}
22         return env
23
24     def requirements (self):
25         reqs = {
26             'js_files' : [ "https://maps.googleapis.com/maps/api/js?sensor=false", 
27                            "/js/googlemap.js",
28                            "/js/markerclusterer.js",
29                             "js/manifold.js", "js/manifold-query.js", 
30                             "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", 
31                             "js/unfold-helper.js",
32                            ],
33             'css_files' : [ "css/googlemap.css",
34                             ],
35             }
36         return reqs
37
38     # the list of things passed to the js plugin
39     def json_settings_list (self): return ['plugin_uuid','query_uuid', 'query_all_uuid', 'latitude', 'longitude', 'zoom', ]