Пример #1
0
    def show_geojson(self, gid):
        gsoninfo = MJson.get_by_uid(gid)
        kwd = {
            'pager': '',
            'url': self.request.uri,
            'geojson': gid,
            'tdesc': '',
            'login': 1 if self.get_current_user() else 0
        }

        map_hist = []
        if self.get_secure_cookie('map_hist'):
            for xx in range(0, len(self.get_secure_cookie('map_hist').decode('utf-8')), 4):
                map_hist.append(self.get_secure_cookie('map_hist').decode('utf-8')[xx: xx + 4])

        self.render(
            # 'post_m/full_screen_draw.html',
            'post_m_v2/full_screen_draw_v2.html',
            kwd=kwd,
            userinfo=self.userinfo,
            unescape=tornado.escape.xhtml_unescape,
            gsoninfo=gsoninfo,
            recent_apps=MUsage.query_recent(
                self.userinfo.uid,
                'm',
                6)[1:] if self.userinfo else []
        )
Пример #2
0
    def edit(self, uid):

        postinfo = MJson.get_by_uid(uid)

        if postinfo:
            pass
        else:
            return self.show404()

        self.render('geoinfo/geojson/gson_edit.html',
                    postinfo=postinfo,
                    userinfo=self.userinfo)
Пример #3
0
    def get(self, *args, **kwargs):
        print('Get')
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "x-requested-with")
        self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
        print(args)
        uid = args[0]
        gson = MJson.get_by_uid(uid)

        if gson:
            out_dic = {
                'uid': uid,
                'geojson': gson.json,
            }
        else:
            out_dic = {'uid': 0}
        return json.dump(out_dic, self)
Пример #4
0
    def get(self, *args, **kwargs):
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "x-requested-with")
        self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
        # print(args)
        url_arr = self.parse_url(args[0])

        if url_arr[0] == '_draw':
            uid = url_arr[1]
            gson = MJson.get_by_uid(uid)
            if gson:
                out_dic = {
                    'uid': uid,
                    # 'geojson': gson.json,
                    'geojson': json.dumps(gson.json),
                }
            else:
                out_dic = {'uid': 0}
        else:
            out_dic = {'uid': 0}
        print('From GeoJson Ajax get ...')
        print(out_dic)
        return json.dump(out_dic, self)