예제 #1
0
def output_format_delete(req, bfo, ln=CFG_SITE_LANG, chosen_option=""):
    """
    Delete an output format

    @param req: the request object
    @param bfo: the filename of the output format to delete
    @param ln: language
    @param chosen_option: empty string when user has not yet confirmed, else "Delete" to apply
    @return: a web page (or redirection to a web page)
    """
    ln = wash_language(ln)
    _ = gettext_set_language(ln)
    navtrail_previous_links = bibformatadminlib.getnavtrail(
        ''' &gt; <a class="navtrail" href="%s/admin/bibformat/bibformatadmin.py/output_formats_manage?ln=%s">%s</a> &gt; %s'''
        % (CFG_SITE_SECURE_URL, ln, _("Manage Output Formats"),
           _("Delete Output Format")))

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

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

        #Ask confirmation to user if not already done
        chosen_option = wash_url_argument(chosen_option, 'str')
        if chosen_option == "":
            bfo = wash_url_argument(bfo, 'str')
            format_name = bibformat_dblayer.get_output_format_names(
                bfo)['generic']
            return dialog_box(req=req,
                              ln=ln,
                              title="Delete %s"%format_name,
                              message="Are you sure you want to" \
                              "delete output format <i>%s</i>?" % format_name,
                              navtrail=navtrail_previous_links,
                              options=[_("Cancel"), _("Delete")])

        elif chosen_option == _("Delete"):
            bibformatadminlib.delete_output_format(bfo)
        redirect_to_url(req, "output_formats_manage?ln=%(ln)s" % {'ln': ln})
    else:
        return page_not_authorized(req=req, text=auth_msg)
예제 #2
0
def output_format_delete(req, bfo, ln=CFG_SITE_LANG, chosen_option=""):
    """
    Delete an output format

    @param req: the request object
    @param bfo: the filename of the output format to delete
    @param ln: language
    @param chosen_option: empty string when user has not yet confirmed, else "Delete" to apply
    @return: a web page (or redirection to a web page)
    """
    ln = wash_language(ln)
    _ = gettext_set_language(ln)
    navtrail_previous_links = bibformatadminlib.getnavtrail(''' &gt; <a class="navtrail" href="%s/admin/bibformat/bibformatadmin.py/output_formats_manage?ln=%s">%s</a> &gt; %s''' % (CFG_SITE_SECURE_URL, ln, _("Manage Output Formats"), _("Delete Output Format")))

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

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

        #Ask confirmation to user if not already done
        chosen_option = wash_url_argument(chosen_option, 'str')
        if chosen_option == "":
            bfo = wash_url_argument(bfo, 'str')
            format_name = bibformat_dblayer.get_output_format_names(bfo)['generic']
            return dialog_box(req=req,
                              ln=ln,
                              title="Delete %s"%format_name,
                              message="Are you sure you want to" \
                              "delete output format <i>%s</i>?" % format_name,
                              navtrail=navtrail_previous_links,
                              options=[_("Cancel"), _("Delete")])

        elif chosen_option==_("Delete"):
            bibformatadminlib.delete_output_format(bfo)
        redirect_to_url(req, "output_formats_manage?ln=%(ln)s"%{'ln':ln})
    else:
        return page_not_authorized(req=req, text=auth_msg)
예제 #3
0
        # Ask confirmation to user if not already done
        chosen_option = wash_url_argument(chosen_option, "str")
        if chosen_option == "":
            bfo = wash_url_argument(bfo, "str")
            format_name = bibformat_dblayer.get_output_format_names(bfo)["generic"]
            return dialog_box(
                req=req,
                ln=ln,
                title="Delete %s" % format_name,
                message="Are you sure you want to" "delete output format <i>%s</i>?" % format_name,
                navtrail=navtrail_previous_links,
                options=[_("Cancel"), _("Delete")],
            )

        elif chosen_option == _("Delete"):
            bibformatadminlib.delete_output_format(bfo)
        redirect_to_url(req, "output_formats_manage?ln=%(ln)s" % {"ln": ln})
    else:
        return page_not_authorized(req=req, text=auth_msg)


def output_format_add(req, ln=CFG_SITE_LANG):
    """
    Adds a new output format

    @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)
예제 #4
0
        #Ask confirmation to user if not already done
        chosen_option = wash_url_argument(chosen_option, 'str')
        if chosen_option == "":
            bfo = wash_url_argument(bfo, 'str')
            format_name = bibformat_dblayer.get_output_format_names(
                bfo)['generic']
            return dialog_box(req=req,
                              ln=ln,
                              title="Delete %s"%format_name,
                              message="Are you sure you want to" \
                              "delete output format <i>%s</i>?" % format_name,
                              navtrail=navtrail_previous_links,
                              options=[_("Cancel"), _("Delete")])

        elif chosen_option == _("Delete"):
            bibformatadminlib.delete_output_format(bfo)
        redirect_to_url(req, "output_formats_manage?ln=%(ln)s" % {'ln': ln})
    else:
        return page_not_authorized(req=req, text=auth_msg)


def output_format_add(req, ln=CFG_SITE_LANG):
    """
    Adds a new output format

    @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)