web/views/igeocodable.py
branchtls-sprint
changeset 728 a95b284150d1
parent 692 800592b8d39b
child 984 536e421b082b
equal deleted inserted replaced
727:30fe8f5afbd8 728:a95b284150d1
    16     id = 'geocoding-json'
    16     id = 'geocoding-json'
    17     binary = True
    17     binary = True
    18     templatable = False
    18     templatable = False
    19     content_type = 'application/json'
    19     content_type = 'application/json'
    20 
    20 
    21     __selectors__ = implements(IGeocodable)
    21     __select__ = implements(IGeocodable)
    22 
    22 
    23     def call(self):
    23     def call(self):
    24         zoomlevel = self.req.form.pop('zoomlevel', 8)
    24         zoomlevel = self.req.form.pop('zoomlevel', 8)
    25         extraparams = self.req.form.copy()
    25         extraparams = self.req.form.copy()
    26         extraparams.pop('vid', None)
    26         extraparams.pop('vid', None)
    49 
    49 
    50 
    50 
    51 class GoogleMapBubbleView(EntityView):
    51 class GoogleMapBubbleView(EntityView):
    52     id = 'gmap-bubble'
    52     id = 'gmap-bubble'
    53 
    53 
    54     __selectors__ = implements(IGeocodable)
    54     __select__ = implements(IGeocodable)
    55 
    55 
    56     def cell_call(self, row, col):
    56     def cell_call(self, row, col):
    57         entity = self.entity(row, col)
    57         entity = self.entity(row, col)
    58         self.w(u'<div>%s</div>' % entity.view('oneline'))
    58         self.w(u'<div>%s</div>' % entity.view('oneline'))
    59         # FIXME: we should call something like address-view if available
    59         # FIXME: we should call something like address-view if available
    60 
    60 
    61 
    61 
    62 class GoogleMapsView(EntityView):
    62 class GoogleMapsView(EntityView):
    63     id = 'gmap-view'
    63     id = 'gmap-view'
    64 
    64 
    65     __selectors__ = implements(IGeocodable)
    65     __select__ = implements(IGeocodable)
    66     need_navigation = False
    66     need_navigation = False
    67 
    67 
    68     def call(self, gmap_key, width=400, height=400, uselabel=True, urlparams=None):
    68     def call(self, gmap_key, width=400, height=400, uselabel=True, urlparams=None):
    69         self.req.add_js('http://maps.google.com/maps?file=api&amp;v=2&amp;key=%s' % gmap_key,
    69         self.req.add_js('http://maps.google.com/maps?file=api&amp;v=2&amp;key=%s' % gmap_key,
    70                         localfile=False);
    70                         localfile=False);