equal
deleted
inserted
replaced
2 |
2 |
3 import simplejson |
3 import simplejson |
4 |
4 |
5 from cubicweb.interfaces import IGeocodable |
5 from cubicweb.interfaces import IGeocodable |
6 from cubicweb.common.view import EntityView |
6 from cubicweb.common.view import EntityView |
7 from cubicweb.common.selectors import interface_selector |
7 from cubicweb.common.selectors import implement_interface |
8 |
8 |
9 class GeocodingJsonView(EntityView): |
9 class GeocodingJsonView(EntityView): |
10 id = 'geocoding-json' |
10 id = 'geocoding-json' |
11 binary = True |
11 binary = True |
12 templatable = False |
12 templatable = False |
13 content_type = 'application/json' |
13 content_type = 'application/json' |
14 |
14 |
15 __selectors__ = (interface_selector,) |
15 __selectors__ = (implement_interface,) |
16 accepts_interfaces = (IGeocodable,) |
16 accepts_interfaces = (IGeocodable,) |
17 |
17 |
18 def call(self): |
18 def call(self): |
19 extraparams = self.req.form.copy() |
19 extraparams = self.req.form.copy() |
20 extraparams.pop('vid', None) |
20 extraparams.pop('vid', None) |
42 |
42 |
43 |
43 |
44 class GoogleMapBubbleView(EntityView): |
44 class GoogleMapBubbleView(EntityView): |
45 id = 'gmap-bubble' |
45 id = 'gmap-bubble' |
46 |
46 |
47 __selectors__ = (interface_selector,) |
47 __selectors__ = (implement_interface,) |
48 accepts_interfaces = (IGeocodable,) |
48 accepts_interfaces = (IGeocodable,) |
49 |
49 |
50 def cell_call(self, row, col): |
50 def cell_call(self, row, col): |
51 entity = self.entity(row, col) |
51 entity = self.entity(row, col) |
52 self.w(u'<div>%s</div>' % entity.view('oneline')) |
52 self.w(u'<div>%s</div>' % entity.view('oneline')) |
54 |
54 |
55 |
55 |
56 class GoogleMapsView(EntityView): |
56 class GoogleMapsView(EntityView): |
57 id = 'gmap-view' |
57 id = 'gmap-view' |
58 |
58 |
59 __selectors__ = (interface_selector,) |
59 __selectors__ = (implement_interface,) |
60 accepts_interfaces = (IGeocodable,) |
60 accepts_interfaces = (IGeocodable,) |
61 need_navigation = False |
61 need_navigation = False |
62 |
62 |
63 def call(self, gmap_key, width=400, height=400, uselabel=True, urlparams=None): |
63 def call(self, gmap_key, width=400, height=400, uselabel=True, urlparams=None): |
64 self.req.add_js('http://maps.google.com/maps?file=api&v=2&key=%s' % gmap_key, |
64 self.req.add_js('http://maps.google.com/maps?file=api&v=2&key=%s' % gmap_key, |