Example #1
0
 def edit(self, almanac_slug, page_slug):
     c.almanac = h.get_almanac_by_slug(almanac_slug)
     c.page = h.get_page_by_slug(c.almanac, page_slug)
     c.media_items = h.render_media_items(c.page.media, editable=True)
     map_features = h.map_features_for_media(c.page.media)
     c.map_features = h.literal(simplejson.dumps(map_features))
     flow_data = h.flowplayer_data_for_media(c.page.media)
     c.flow_data = h.literal(simplejson.dumps(flow_data))
     c.is_add = False
     c.behalf = render('/page/behalf.mako')
     return render('/page/add_edit.mako')
Example #2
0
 def create(self, almanac_slug):
     c.almanac = h.get_almanac_by_slug(almanac_slug)
     c.page = page = c.almanac.new_page(self.ensure_user)
     media_items = page.media
     c.media_items = h.render_media_items(media_items, editable=True)
     map_features = h.map_features_for_media(media_items)
     c.map_features = h.literal(simplejson.dumps(map_features))
     flow_data = h.flowplayer_data_for_media(media_items)
     c.flow_data = h.literal(simplejson.dumps(flow_data))
     c.is_add = True
     c.behalf = render('/page/behalf.mako')
     return render('/page/add_edit.mako')
Example #3
0
 def login(self):
     c.no_maps = True
     c.active_section = request.params.get('show','login-new')
     c.captcha_html = h.literal(recaptcha.client.captcha.displayhtml(
               g.captcha_pubkey))
     if request.environ.get('repoze.who.identity') == None:
         return render('/user/login.mako')
     redirect(request.params.get('came_from', h.url_for('home')))
Example #4
0
 def register(self):
     c.no_maps = True
     if request.environ.get('repoze.who.identity') == None:
         c.active_section = request.params.get('show','login-new')
         c.captcha_html = h.literal(recaptcha.client.captcha.displayhtml(
                   g.captcha_pubkey))
         return render('/user/login.mako')
     h.flash(u'Can\'t register while logged in.  Please logout first.')
     redirect_to(h.url_for('home'))
Example #5
0
    def view(self, almanac_slug, page_slug):
        c.almanac = h.get_almanac_by_slug(almanac_slug)
        c.page = h.get_page_by_slug(c.almanac, page_slug)
        c.media_items = h.render_media_items(c.page.media, editable=False)
        c.no_maps = True
        for media in c.page.media:
            if isinstance(media, Map):
                c.no_maps = False
                break
        map_features = h.map_features_for_media(c.page.media)
        c.map_features = h.literal(simplejson.dumps(map_features))
        flow_data = h.flowplayer_data_for_media(c.page.media)
        c.flow_data = h.literal(simplejson.dumps(flow_data))

        page_navigation = c.page.page_navigation()
        c.next_page = page_navigation['next']
        c.prev_page = page_navigation['prev']
        c.latest_pages = Page.latest(almanac_id=c.almanac.id)
        if g.captcha_enabled and not c.user:
            c.captcha_html = h.literal(recaptcha.client.captcha.displayhtml(g.captcha_pubkey))
        c.is_page_owner = is_met(is_page_owner())
        c.is_admin = is_met(has_permission('manage'))
        return render('/page/view.mako')