How to use the invenio.webpage.page function in invenio

To help you get started, we’ve selected a few invenio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EUDAT-B2SHARE / b2share / invenio / lib / websearch_webinterface.py View on Github external
if em != "":
        em = em.split(",")
    # get user ID:
    try:
        uid = getUid(req)
        user_preferences = {}
        if uid == -1:
            return page_not_authorized(req, "../",
                text="You are not authorized to view this collection",
                                       navmenuid='search')
        elif uid > 0:
            user_preferences = get_user_preferences(uid)
    except Error:
        register_exception(req=req, alert_admin=True)
        return page(title=_("Internal Error"),
                    body=create_error_box(req, verbose=verbose, ln=ln),
                    description="%s - Internal Error" % CFG_SITE_NAME,
                    keywords="%s, Internal Error" % CFG_SITE_NAME,
                    language=ln,
                    req=req,
                    navmenuid='search')
    # start display:
    req.content_type = "text/html"
    req.send_http_header()
    # deduce collection id:
    colID = get_colID(get_coll_normalised_name(c))
    if type(colID) is not int:
        page_body = '<p>' + (_("Sorry, collection %s does not seem to exist.") % ('<strong>' + str(c) + '</strong>')) + '</p>'
        page_body = '<p>' + (_("You may want to start browsing from %s.") % ('<a href="' + CFG_SITE_URL + '?ln=' + ln + '">' + get_coll_i18nname(CFG_SITE_NAME, ln) + '</a>')) + '</p>'
        if req.method == 'HEAD':
            raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
github inveniosoftware / invenio / modules / bibedit / web / admin / bibeditadmin.py View on Github external
if auth_code == 0:
            (body, errors, warnings) = perform_request_index(ln, recid,
                cancel, delete, confirm_delete, uid, format_tag,
                edit_tag, delete_tag, num_field, add, args)
        else:
            return page_not_authorized(req=req, text=auth_message,
                                       navtrail=navtrail)

    if recid != 0:
        title = _("Record") + " #" + str(recid)
        if add == 3:
            title = _("Record %s - Add a field") % ('#' + str(recid))
    else:
        title = _("BibEdit Admin Interface")

    return page(title       = title,
                body        = body,
                errors      = errors,
                warnings    = warnings,
                uid         = getUid(req),
                language    = ln,
                navtrail    = navtrail,
                lastupdated = __lastupdated__,
                req         = req)
github inveniosoftware / invenio / modules / websearch / web / admin / websearchadmin.py View on Github external
def removeoutputformat(req, colID, ln=CFG_SITE_LANG, fmtID='', callback='yes', confirm=0):
    navtrail_previous_links = wsc.getnavtrail() + """&gt; <a href="%s/admin/websearch/websearchadmin.py/" class="navtrail">WebSearch Admin</a> """ % (CFG_SITE_URL)

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

    auth = check_user(req,'cfgwebsearch')
    if not auth[0]:
        return page(title="Edit Collection",
                body=wsc.perform_removeoutputformat(colID=colID,
                                                    ln=ln,
                                                    fmtID=fmtID,
                                                    callback=callback,
                                                    confirm=confirm),
                uid=uid,
                language=ln,
                req=req,
                navtrail = navtrail_previous_links,
                lastupdated=__lastupdated__)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / bibknowledge / lib / bibknowledgeadmin.py View on Github external
ln = wash_language(ln)
    _ = gettext_set_language(ln)
    navtrail_previous_links = ''' &gt; <a href="%s/kb?ln=%s" class="navtrail">%s</a>''' % (CFG_SITE_SECURE_URL, ln, _("Manage Knowledge Bases"))

    try:
        dummy = getUid(req)
    except:
        return error_page('Error', req)
    (auth_code, auth_msg) = check_user(req, 'cfgbibknowledge')
    if not auth_code:
        #actual config call
        err = bibknowledgeadminlib.perform_update_kb_config(kb_id, field,
                                                            expression,
                                                            collection)
        if err:
            return page(title=_("Error"),
                        body = err,
                        language=ln,
                        navtrail = navtrail_previous_links,
                        lastupdated=__lastupdated__,
                        req=req)

        else:
            redirect_to_url(req, "kb?ln=%(ln)s&amp;kb=%(kb_id)s" % {'ln':ln, 'kb_id': kb_id })
    else:
        return page_not_authorized(req=req,
                                   text=auth_msg,
                                   navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / bibsort / web / admin / bibsortadmin.py View on Github external
try:
        uid = getUid(req)
    except:
        return error_page('Error', req)

    auth = bsc.check_user(req,'cfgbibsort')
    if not auth[0]:
        action = wash_url_argument(action, 'str')
        bsrID = wash_url_argument(bsrID, 'int')
        sm_name = wash_url_argument(sm_name, 'str')
        sm_def_type = wash_url_argument(sm_def_type, 'str')
        sm_def_value = wash_url_argument(sm_def_value, 'str')
        sm_washer = wash_url_argument(sm_washer, 'str')
        sm_locale = wash_url_argument(sm_locale, 'str')
        return page(title="BibSort Admin Interface",
                body=bsc.perform_index(ln, action, bsrID, sm_name, sm_def_type, sm_def_value, sm_washer, sm_locale),
                uid=uid,
                language=ln,
                navtrail = navtrail_previous_links,
                lastupdated=__lastupdated__,
                req=req)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / websubmit / web / direct.py View on Github external
def errorMsg(title,req,c=cdsname,ln=cdslang):
    return page(title="error",
                    body = create_error_box(req, title=title,verbose=0, ln=ln),
                    description="%s - Internal Error" % c, 
                    keywords="%s, CDS Invenio, Internal Error" % c,
                    language=ln,
                    req=req)
github inveniosoftware / invenio / modules / bibharvest / web / admin / oaiharvestadmin.py View on Github external
def harvest(req, oai_src_id = None, ln=CFG_SITE_LANG, confirm=0, record_id=None):
    navtrail_previous_links = oha.getnavtrail(' &gt; <a href="%s/admin/bibharvest/oaiharvestadmin.py?ln=%s" class="navtrail">OAI Harvest Admin Interface</a> ' % (CFG_SITE_URL, ln), ln=ln)
    try:
        uid = getUid(req)
    except Error, e:
        return page(title="OAI Harvest Admin Interface - Error",
                    body=e,
                    uid=uid,
                    language=ln,
                    navtrail = navtrail_previous_links,
                    lastupdated=__lastupdated__,
                    req=req)
    auth = check_user(req,'cfgoaiharvest')
    if not auth[0]:
        return page(title="OAI source - harvesting new records",
                    body=oha.perform_request_harvest_record(oai_src_id = oai_src_id,
                                                    ln=ln,
                                                    confirm=confirm, record_id = record_id),
                    uid=uid,
                    language=ln,
                    req=req,
                    navtrail = navtrail_previous_links,
github inveniosoftware / invenio / modules / bibcirculation / lib / bibcirculationadminlib.py View on Github external
result = db.get_borrower_details(borrower_id)

    navtrail_previous_links = '<a href="%s/help/admin" class="navtrail">Admin Area' \
                              '</a>' % (CFG_SITE_URL,)

    id_user = getUid(req)
    (auth_code, auth_message) = is_adminuser(req)
    if auth_code != 0:
        return mustloginpage(req, auth_message)

    body = bibcirculation_templates.tmpl_update_borrower_info_step3(result=result,
                                                                    ln=ln)

    return page(title="Update borrower information - III",
                uid=id_user,
                req=req,
                body=body,
                navtrail=navtrail_previous_links,
                lastupdated=__lastupdated__)
github inveniosoftware / invenio / modules / bibharvest / web / admin / oaiharvestadmin.py View on Github external
year = d_date.year
    if month == None:
        month = d_date.month
    try:
        uid = getUid(req)
    except Error, e:
        return page(title="OAI Harvest Admin Interface - Error",
                    body=e,
                    uid=uid,
                    language=ln,
                    navtrail = navtrail_previous_links,
                    lastupdated=__lastupdated__,
                    req=req)
    auth = check_user(req,'cfgoaiharvest')
    if not auth[0]:
        return page(title="View OAI source harvesting history",
                    body=oha.perform_request_viewhistory(oai_src_id=oai_src_id,
                                                    ln=ln,
                                                    confirm=confirm,
                                                    year = int(year),
                                                    month = int(month)),
                    uid=uid,
                    language=ln,
                    req=req,
                    navtrail = navtrail_previous_links,
                    lastupdated=__lastupdated__)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / websession / lib / websession_webinterface.py View on Github external
def access(self, req, form):
        args = wash_urlargd(form, {'mailcookie' : (str, '')})
        _ = gettext_set_language(args['ln'])
        title = _("Mail Cookie Service")
        try:
            kind = mail_cookie_retrieve_kind(args['mailcookie'])
            if kind == 'pw_reset':
                redirect_to_url(req, '%s/youraccount/resetpassword?k=%s&amp;ln=%s' % (CFG_SITE_SECURE_URL, args['mailcookie'], args['ln']))
            elif kind == 'role':
                uid = webuser.getUid(req)
                try:
                    (role_name, expiration) = mail_cookie_check_role(args['mailcookie'], uid)
                except InvenioWebAccessMailCookieDeletedError:
                    return page(title=_("Role authorization request"), req=req, body=_("This request for an authorization has already been authorized."), uid=webuser.getUid(req), navmenuid='youraccount', language=args['ln'], secure_page_p=1)
                return page(title=title,
                body=webaccount.perform_back(
                    _("You have successfully obtained an authorization as %(x_role)s! "
                    "This authorization will last until %(x_expiration)s and until "
                    "you close your browser if you are a guest user.") %
                    {'x_role' : '<strong>%s</strong>' % role_name,
                     'x_expiration' : '<em>%s</em>' % expiration.strftime("%Y-%m-%d %H:%M:%S")},
                    '/youraccount/display?ln=%s' % args['ln'], _('login'), args['ln']),
                req=req,
                uid=webuser.getUid(req),
                language=args['ln'],
                lastupdated=__lastupdated__,
                navmenuid='youraccount',
                secure_page_p=1)
            elif kind == 'mail_activation':
                try:
                    email = mail_cookie_check_mail_activation(args['mailcookie'])