Beispiel #1
0
def admin_news(req):
    check_login(req)
    match_right(req, module_rights)

    show = req.args.getfirst("show", "", uni)

    pager = Pager(sort="desc")
    pager.bind(req.args)

    kwargs = {}

    if show == "ready":
        pager.set_params(show=show)
        kwargs["state"] = 2
        kwargs["public_date"] = 0
    elif show == "drafts":
        pager.set_params(show=show)
        kwargs["state"] = 1
    else:
        show = None

    if not do_check_right(req, "news_editor"):
        kwargs["author_id"] = req.login.id

    rows = New.list(req, pager, **kwargs)
    return generate_page(req, "admin/news.html", pager=pager, rows=rows, show=show)
Beispiel #2
0
def admin_codebook_view(req, codebook):
    check_login(req)
    check_right(req, module_right)

    Codebook = build_class(codebook)
    search = req.args.getfirst('search', fce=nuni)

    pager = Pager(order='value')
    pager.bind(req.args)

    if search:
        pager.set_params(search=search)

    items = Codebook.list(req, Codebook, pager, search=search)

    return generate_page(req, "admin/codebook.html",
                         token=create_token(req), codebook=codebook,
                         pager=pager, items=items, search=search)
Beispiel #3
0
def admin_store(req):
    check_login(req)
    check_right(req, module_right)

    pager = Pager(sort='desc')
    pager.bind(req.args)

    show = req.args.getfirst('show', '', uni)
    if show == 'visible':
        kwargs = {'state': STATE_VISIBLE}
        pager.set_params(show=show)
    elif show == 'hidden':
        kwargs = {'state': STATE_HIDDEN}
        pager.set_params(show=show)
    elif show == 'disabled':
        kwargs = {'state': STATE_DISABLED}
        pager.set_params(show=show)
    else:
        kwargs = {}

    items = Item.list(req, pager, **kwargs)

    return generate_page(req, "admin/eshop/store.html",
                         token=create_token(req),
                         pager=pager, items=items, show=show)