def delete(self, uid): ''' Delete the map layout of user. :param uid: :return: ''' MLayout.delete(uid)
def save_layout(self): ''' Save the map layout. :return: ''' post_data = self.get_post_data() if 'zoom' in post_data: pass else: self.set_status(403) return post_data['user'] = self.userinfo.uid MLayout.add_or_update(post_data)
def render(self, *args, **kwargs): app_id = args[0] user_id = args[1] mlayout = MLayout() layout_recs = mlayout.query_by_app(app_id, user_id) kwd = {'pager': '', 'tdesc': '', 'site_url': SITE_CFG['site_url']} return self.render_string('modules/map/map_layout.html', layout_recs=layout_recs, kwd=kwd)
def render(self, app_id, user_id): self.mlayout = MLayout() layout_recs = self.mlayout.query_by_app(app_id, user_id) print(layout_recs.count()) kwd = { 'pager': '', 'tdesc': '', 'site_url': config.site_url, } return self.render_string('modules/map/map_layout.html', layout_recs = layout_recs, kwd=kwd)
class LayoutHandler(BaseHandler): def initialize(self): self.init() self.mequa = MApp() self.mlayout = MLayout() def get(self, url_str): if len(url_str) > 0: url_arr = url_str.split('/') if len(url_arr) == 2: if url_arr[0] == 'delete': self.delete(url_arr[1]) @tornado.web.authenticated def delete(self, uid): self.mlayout.delete_by_uid(uid) def post(self, url_str=''): if url_str == 'save': self.save_layout() @tornado.web.authenticated def save_layout(self): # post_data = {} # for key in self.request.arguments: # post_data[key] = self.get_arguments(key) post_data = self.get_post_data() if 'zoom' in post_data: pass else: self.set_status(403) return post_data['user'] = self.userinfo.uid self.mlayout.add_or_update(post_data)
def render(self, app_id,user_id): self.mjson = MJson() self.mlayout = MLayout() json_recs = self.mjson.query_by_app(app_id, user_id) print('map data count: ', json_recs.count()) kwd = { 'pager': '', 'signature': app_id, 'tdesc': '', 'site_url': config.site_url, } return self.render_string('modules/map/map_json.html', json_recs = json_recs, app_id = app_id, kwd=kwd)
def initialize(self): self.init() self.mequa = MApp() self.mlayout = MLayout()