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