def format_template_delete(req, bft, ln=CFG_SITE_LANG, chosen_option=""): """ Delete a format template @param req: the request object @param bft: the filename of the template to delete @param ln: language @param chosen_option: empty string when user has not yet confirm. Else "Delete" to confirm @return: a web page (or redirection to a web page) """ ln = wash_language(ln) _ = gettext_set_language(ln) navtrail_previous_links = bibformatadminlib.getnavtrail( ''' > <a class="navtrail" href="%s/admin/bibformat/bibformatadmin.py/format_templates_manage?ln=%s">%s</a> > %s''' % (CFG_SITE_SECURE_URL, ln, _("Manage Format Templates"), _("Delete Format Template"))) 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 == "": format_template = wash_url_argument(bft, 'str') format_name = bibformat_engine.get_format_template_attrs( bft)['name'] return dialog_box(req=req, ln=ln, title="Delete %s" % format_name, message="Are you sure you want to delete" \ "format template <i>%s</i>?" % format_name, navtrail=navtrail_previous_links, options=[_("Cancel"), _("Delete")]) elif chosen_option == _("Delete"): bibformatadminlib.delete_format_template(bft) redirect_to_url(req, "format_templates_manage?ln=%(ln)s" % {'ln': ln}) else: return page_not_authorized(req=req, text=auth_msg)
def format_template_delete(req, bft, ln=CFG_SITE_LANG, chosen_option=""): """ Delete a format template @param req: the request object @param bft: the filename of the template to delete @param ln: language @param chosen_option: empty string when user has not yet confirm. Else "Delete" to confirm @return: a web page (or redirection to a web page) """ ln = wash_language(ln) _ = gettext_set_language(ln) navtrail_previous_links = bibformatadminlib.getnavtrail(''' > <a class="navtrail" href="%s/admin/bibformat/bibformatadmin.py/format_templates_manage?ln=%s">%s</a> > %s''' % (CFG_SITE_SECURE_URL, ln ,_("Manage Format Templates"),_("Delete Format Template"))) 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 == "": format_template = wash_url_argument(bft, 'str') format_name = bibformat_engine.get_format_template_attrs(bft)['name'] return dialog_box(req=req, ln=ln, title="Delete %s" % format_name, message="Are you sure you want to delete" \ "format template <i>%s</i>?" % format_name, navtrail=navtrail_previous_links, options=[_("Cancel"), _("Delete")]) elif chosen_option==_("Delete"): bibformatadminlib.delete_format_template(bft) redirect_to_url(req, "format_templates_manage?ln=%(ln)s" % {'ln':ln}) else: return page_not_authorized(req=req, text=auth_msg)
# Ask confirmation to user if not already done chosen_option = wash_url_argument(chosen_option, "str") if chosen_option == "": format_template = wash_url_argument(bft, "str") format_name = bibformat_engine.get_format_template_attrs(bft)["name"] return dialog_box( req=req, ln=ln, title="Delete %s" % format_name, message="Are you sure you want to delete" "format template <i>%s</i>?" % format_name, navtrail=navtrail_previous_links, options=[_("Cancel"), _("Delete")], ) elif chosen_option == _("Delete"): bibformatadminlib.delete_format_template(bft) redirect_to_url(req, "format_templates_manage?ln=%(ln)s" % {"ln": ln}) else: return page_not_authorized(req=req, text=auth_msg) 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)
#Ask confirmation to user if not already done chosen_option = wash_url_argument(chosen_option, 'str') if chosen_option == "": format_template = wash_url_argument(bft, 'str') format_name = bibformat_engine.get_format_template_attrs( bft)['name'] return dialog_box(req=req, ln=ln, title="Delete %s" % format_name, message="Are you sure you want to delete" \ "format template <i>%s</i>?" % format_name, navtrail=navtrail_previous_links, options=[_("Cancel"), _("Delete")]) elif chosen_option == _("Delete"): bibformatadminlib.delete_format_template(bft) redirect_to_url(req, "format_templates_manage?ln=%(ln)s" % {'ln': ln}) else: return page_not_authorized(req=req, text=auth_msg) 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)