Esempio n. 1
0
def admin_jobs(req):
    check_login(req)
    check_right(req, 'super')

    pager = Pager()
    pager.bind(req.args)

    rows = Job.list(req, pager)
    return generate_page(req, "admin/jobs.html", pager=pager, rows=rows)
Esempio n. 2
0
def articles_list_full(req, locale=None, tag=None):
    pager = Pager(limit=5, sort='desc', order='create_date')
    pager.bind(req.args)

    kwargs = {'locale': (locale, '')} if locale else {}
    items = Article.list(req, pager, perex=True, public=1, tag=tag, **kwargs)
    for it in items:
        if it.format == FORMAT_RST:
            it.perex = rst2html(it.perex)

    lang = locale if locale else get_lang(req)
    return generate_page(req, "articles_list.html", pager=pager, items=items,
                         lang=lang, staticmenu=req.cfg.get_static_menu(req))
Esempio n. 3
0
def admin_pages(req):
    check_login(req)
    match_right(req, module_rights)

    error = req.args.getfirst('error', 0, int)

    pager = Pager()
    pager.bind(req.args)

    if not do_match_right(req, ('pages_modify', 'pages_listall')):
        rows = Page.list(req, pager, author_id=req.login.id)
    else:
        rows = Page.list(req, pager)
    return generate_page(req, "admin/pages.html",
                         token=do_create_token(req, '/admin/pages'),
                         pager=pager, rows=rows, error=error)
Esempio n. 4
0
def admin_redirects(req):
    check_login(req)
    check_right(req, module_right)

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

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

    if search:
        pager.set_params(search=search)

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

    return generate_page(req, "admin/redirects.html",
                         token=create_token(req),
                         pager=pager, items=items, search=search)
Esempio n. 5
0
def admin_articles(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, right_editor):
        kwargs['author_id'] = req.login.id

    items = Article.list(req, pager, **kwargs)
    return generate_page(req, "admin/articles.html", pager=pager, items=items,
                         show=show)
Esempio n. 6
0
def admin_options(req):
    check_login(req)
    check_right(req, module_right)

    section = req.args.getfirst('section', '', uni)
    module = req.args.getfirst('module', '', uni)
    kwargs = {}
    if section != 'all':
        kwargs['section'] = section
    if module != 'all':
        kwargs['module'] = module

    pager = Pager()
    pager.bind(req.args)
    options = Option.list(req, pager, **kwargs)
    for option in options:
        option.defaults_json = json.dumps(list(option.defaults))

    return generate_page(req, "admin/options.html", pager=pager,
                         options=options, sections=Option.sections_list(req),
                         modules=Option.modules_list(req), section=section,
                         module=module)
Esempio n. 7
0
def admin_attachments(req):
    check_login(req)
    check_right(req, R_ADMIN)

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

    kwargs = {}

    if 'obty' in req.args:
        kwargs['object_type'] = req.args.getfirst('obty', fce=uni) or None
        pager.set_params(obty=kwargs['object_type'])
    if 'obid' in req.args:
        kwargs['object_id'] = req.args.getfirst('obid', fce=int)
        pager.set_params(obid=kwargs['object_id'])

    rows = Attachment.list(req, pager, **kwargs)
    return generate_page(req, "admin/attachments.html",
                         pager=pager, rows=rows)