Ejemplo n.º 1
0
    def POST(self, worldkey, savekey):
        world = world_exists(worldkey)
        save = save_exists(savekey)
        self.redirect_if_not_exists(world, "/yours/saves")
        self.redirect_if_not_exists(save, "/yours/saves")
        #self.can_access_world(world)
        self.can_edit_save(save)
        if not world.publish:
            raise web.notfound()

        i = web.input()
        key = int(i.key)

        room_ftr = Room.get_by_id_async(key)
        save_ftr = SavePath.get_by_id_async(int(savekey))
        room = room_ftr.get_result()
        thesave = save_ftr.get_result()
        new_texts = thesave.texts
        new_texts.append(room.key)
        thesave.texts = new_texts
        new_save_ftr = thesave.put_async()
        json = self.js_make_room_json(room)
        new_save_ftr.get_result()

        return json
Ejemplo n.º 2
0
    def POST(self, worldkey, savekey):
        world = world_exists(worldkey)
        save = save_exists(savekey)
        self.redirect_if_not_exists(world, "/yours/saves")
        self.redirect_if_not_exists(save, "/yours/saves")
        #self.can_access_world(world)
        self.can_edit_save(save)
        if not world.publish:
            raise web.notfound()

        i = web.input()
        key = int(i.key)

        room_ftr = Room.get_by_id_async(key)
        save_ftr = SavePath.get_by_id_async(int(savekey))
        room = room_ftr.get_result()
        thesave = save_ftr.get_result()
        new_texts = thesave.texts
        new_texts.append(room.key)
        thesave.texts = new_texts
        new_save_ftr = thesave.put_async()
        json = self.js_make_room_json(room)
        new_save_ftr.get_result()

        return json
Ejemplo n.º 3
0
    def GET(self, worldkey, save):
        world = world_exists(worldkey)
        save = save_exists(save)
        self.redirect_if_not_exists(world, "/yours/saves")
        self.redirect_if_not_exists(save, "/yours/saves")
        #self.can_access_world(world)
        self.can_edit_save(save)
        if not world.publish:
            raise web.notfound()

        sofaUrl = "/%s/save/%s?s=1" % (world.key.id(), save.key.id())

        param = web.input()
        if hasattr(param, 's'): # In sofa mode
            post = ['/js/maps.google.polygon.containsLatLng.js', '/js/page_scroll.js', '/js/text_queue.js', '/js/room_expand.js','/js/sofa_location.js', '/js/toggle_info.js']
        else:
            post = ['/js/maps.google.polygon.containsLatLng.js', '/js/page_scroll.js', '/js/text_queue.js', '/js/room_expand.js','/js/get_location.js', '/js/toggle_info.js']
        
        js = self.js_coords_list(world, "/%s/save/%s" % (world.key.id(), save.key.id()), sofaUrl)

        return render().go(title="%s on Palimpsest" % world.title
                        ,navleft=[('Back to %s' % world.title,'/%s' % world.key.id())]
                        ,pre=['http://maps.google.com/maps/api/js?sensor=false', '/js/set_page_height.js']
                        ,js=js
                        ,post=post
                    )
Ejemplo n.º 4
0
    def GET(self, worldkey, save):
        world = world_exists(worldkey)
        save = save_exists(save)
        self.redirect_if_not_exists(world, "/yours/saves")
        self.redirect_if_not_exists(save, "/yours/saves")
        #self.can_access_world(world)
        self.can_edit_save(save)
        if not world.publish:
            raise web.notfound()

        sofaUrl = "/%s/save/%s?s=1" % (world.key.id(), save.key.id())

        param = web.input()
        if hasattr(param, 's'):  # In sofa mode
            post = [
                '/js/maps.google.polygon.containsLatLng.js',
                '/js/page_scroll.js', '/js/text_queue.js',
                '/js/room_expand.js', '/js/sofa_location.js',
                '/js/toggle_info.js'
            ]
        else:
            post = [
                '/js/maps.google.polygon.containsLatLng.js',
                '/js/page_scroll.js', '/js/text_queue.js',
                '/js/room_expand.js', '/js/get_location.js',
                '/js/toggle_info.js'
            ]

        js = self.js_coords_list(
            world, "/%s/save/%s" % (world.key.id(), save.key.id()), sofaUrl)

        return render().go(
            title="%s on Palimpsest" % world.title,
            navleft=[('Back to %s' % world.title, '/%s' % world.key.id())],
            pre=[
                'http://maps.google.com/maps/api/js?sensor=false',
                '/js/set_page_height.js'
            ],
            js=js,
            post=post)