d6ea883ad1e89e7b5b36bd12944001bce5506b25
[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, latitude=43., longitude=7., zoom=4, **settings):
10         Plugin.__init__ (self, **settings)
11         self.query=query
12         self.latitude=latitude
13         self.longitude=longitude
14         self.zoom=zoom
15
16     def template_file (self):
17         return "googlemap.html"
18
19     def template_env (self, request):
20         env={}
21         return env
22
23     def requirements (self):
24         reqs = {
25             'js_files' : [ "https://maps.googleapis.com/maps/api/js?sensor=false", 
26                            "/js/googlemap.js",
27                            "/js/markerclusterer.js",
28                             "js/manifold.js", "js/manifold-query.js", 
29                             "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", 
30                             "js/unfold-helper.js",
31                            ],
32             'css_files' : [ "css/googlemap.css",
33                             ],
34             }
35         return reqs
36
37     # the list of things passed to the js plugin
38     def json_settings_list (self): return ['plugin_uuid','query_uuid', 'latitude', 'longitude', 'zoom', ]