Example #1
0
def format_template_add(req, ln=CFG_SITE_LANG):
    """
    Adds a new format template

    @param req: the request object
    @param ln: language
    @return: a web page (or redirection to a web page)
    """
    ln = wash_language(ln)
    _ = gettext_set_language(ln)

    try:
        uid = getUid(req)
    except:
        return error_page('Error', req)

    (auth_code, auth_msg) = check_user(req, 'cfgbibformat')
    if not auth_code:

        bft = bibformatadminlib.add_format_template()
        redirect_to_url(
            req,
            "format_template_show_attributes?ln=%(ln)s&bft=%(bft)s&new=1" % {
                'ln': ln,
                'bft': bft
            })
    else:
        return page_not_authorized(req=req, text=auth_msg)
Example #2
0
def format_template_add(req, ln=CFG_SITE_LANG):
    """
    Adds a new format template

    @param req: the request object
    @param ln: language
    @return: a web page (or redirection to a web page)
    """
    ln = wash_language(ln)
    _ = gettext_set_language(ln)

    try:
        uid = getUid(req)
    except:
        return error_page('Error', req)

    (auth_code, auth_msg) = check_user(req, 'cfgbibformat')
    if not auth_code:

        bft = bibformatadminlib.add_format_template()
        redirect_to_url(req, "format_template_show_attributes?ln=%(ln)s&bft=%(bft)s&new=1" % {'ln':ln, 'bft':bft})
    else:
        return page_not_authorized(req=req, text=auth_msg)
    @param req: the request object
    @param ln: language
    @return: a web page (or redirection to a web page)
    """
    ln = wash_language(ln)
    _ = gettext_set_language(ln)

    try:
        uid = getUid(req)
    except MySQLdb.Error, e:
        return error_page(req)

    (auth_code, auth_msg) = check_user(req, "cfgbibformat")
    if not auth_code:

        bft = bibformatadminlib.add_format_template()
        redirect_to_url(req, "format_template_show_attributes?ln=%(ln)s&bft=%(bft)s&new=1" % {"ln": ln, "bft": bft})
    else:
        return page_not_authorized(req=req, text=auth_msg)


def format_template_show_preview_or_save(
    req,
    bft,
    ln=CFG_SITE_LANG,
    code=None,
    ln_for_preview=CFG_SITE_LANG,
    pattern_for_preview="",
    content_type_for_preview="text/html",
    save_action=None,
    navtrail="",
Example #4
0
    @param req: the request object
    @param ln: language
    @return: a web page (or redirection to a web page)
    """
    ln = wash_language(ln)
    _ = gettext_set_language(ln)

    try:
        uid = getUid(req)
    except MySQLdb.Error, e:
        return error_page(req)

    (auth_code, auth_msg) = check_user(req, 'cfgbibformat')
    if not auth_code:

        bft = bibformatadminlib.add_format_template()
        redirect_to_url(
            req,
            "format_template_show_attributes?ln=%(ln)s&bft=%(bft)s&new=1" % {
                'ln': ln,
                'bft': bft
            })
    else:
        return page_not_authorized(req=req, text=auth_msg)


def format_template_show_preview_or_save(req,
                                         bft,
                                         ln=CFG_SITE_LANG,
                                         code=None,
                                         ln_for_preview=CFG_SITE_LANG,