コード例 #1
0
ファイル: webjournal.py プロジェクト: adsabs/invenio
def perform_request_index(req, journal_name, issue_number, ln, category, editor=False, verbose=0):
    """
    Central logic function for index pages.
    Brings together format templates and MARC rules from the config, with
    the requested index page, given by the url parameters.
    From config:
        - page template for index pages -> formatting
        - MARC rule list -> Category Navigation
        - MARC tag used for issue numbers -> search (later in the format
          elements)
    Uses BibFormatObject and format_with_format_template to produce the
    required HTML.
    """
    current_issue = get_current_issue(ln, journal_name)
    if not get_release_datetime(issue_number, journal_name):
        # Unreleased issue. Display latest released issue?
        unreleased_issues_mode = get_unreleased_issue_hiding_mode(journal_name)
        if not editor and (
            unreleased_issues_mode == "all"
            or (unreleased_issues_mode == "future" and issue_is_later_than(issue_number, current_issue))
        ):
            redirect_to_url(
                req,
                "%s/journal/%s/%s/%s?ln=%s"
                % (CFG_SITE_URL, journal_name, current_issue.split("/")[1], current_issue.split("/")[0], ln),
            )
    try:
        index_page_template = get_journal_template("index", journal_name, ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)
コード例 #2
0
ファイル: webjournal.py プロジェクト: adsabs/invenio
def perform_request_article(req, journal_name, issue_number, ln, category, recid, editor=False, verbose=0):
    """
    Central logic function for article pages.
    Loads the format template for article display and displays the requested
    article using BibFormat.
    'Editor' mode generates edit links on the article view page and disables
    caching.
    """
    current_issue = get_current_issue(ln, journal_name)
    if not get_release_datetime(issue_number, journal_name):
        # Unreleased issue. Display latest released issue?
        unreleased_issues_mode = get_unreleased_issue_hiding_mode(journal_name)
        if not editor and (
            unreleased_issues_mode == "all"
            or (unreleased_issues_mode == "future" and issue_is_later_than(issue_number, current_issue))
        ):
            redirect_to_url(
                req,
                "%s/journal/%s/%s/%s?ln=%s"
                % (CFG_SITE_URL, journal_name, current_issue.split("/")[1], current_issue.split("/")[0], ln),
            )

    try:
        index_page_template = get_journal_template("detailed", journal_name, ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)
コード例 #3
0
def perform_request_index(req, journal_name, issue_number, ln,
                          category, editor=False, verbose=0):
    """
    Central logic function for index pages.
    Brings together format templates and MARC rules from the config, with
    the requested index page, given by the url parameters.
    From config:
        - page template for index pages -> formatting
        - MARC rule list -> Category Navigation
        - MARC tag used for issue numbers -> search (later in the format
          elements)
    Uses BibFormatObject and format_with_format_template to produce the
    required HTML.
    """
    current_issue = get_current_issue(ln, journal_name)
    if not get_release_datetime(issue_number, journal_name):
        # Unreleased issue. Display latest released issue?
        unreleased_issues_mode = get_unreleased_issue_hiding_mode(journal_name)
        if not editor and \
               (unreleased_issues_mode == 'all' or \
                (unreleased_issues_mode == 'future' and \
                 issue_is_later_than(issue_number, current_issue))):
            redirect_to_url(req, "%s/journal/%s/%s/%s?ln=%s" % \
                            (CFG_SITE_URL,
                             journal_name,
                             current_issue.split('/')[1],
                             current_issue.split('/')[0],
                             ln))
    try:
        index_page_template = get_journal_template('index',
                                                   journal_name,
                                                   ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box()
コード例 #4
0
def perform_request_article(req, journal_name, issue_number, ln,
                            category, recid, editor=False, verbose=0):
    """
    Central logic function for article pages.
    Loads the format template for article display and displays the requested
    article using BibFormat.
    'Editor' mode generates edit links on the article view page and disables
    caching.
    """
    current_issue = get_current_issue(ln, journal_name)
    if not get_release_datetime(issue_number, journal_name):
        # Unreleased issue. Display latest released issue?
        unreleased_issues_mode = get_unreleased_issue_hiding_mode(journal_name)
        if not editor and \
               (unreleased_issues_mode == 'all' or \
                (unreleased_issues_mode == 'future' and \
                 issue_is_later_than(issue_number, current_issue))):
            redirect_to_url(req, "%s/journal/%s/%s/%s?ln=%s" % \
                            (CFG_SITE_URL,
                             journal_name,
                             current_issue.split('/')[1],
                             current_issue.split('/')[0],
                             ln))

    try:
        index_page_template = get_journal_template('detailed',
                                                   journal_name,
                                                   ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box()
コード例 #5
0
ファイル: webjournal.py プロジェクト: adsabs/invenio
def perform_request_popup(req, ln, journal_name, record):
    """
    Display the popup window
    """
    try:
        popup_page_template = get_journal_template("popup", journal_name, ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)
コード例 #6
0
ファイル: webjournal.py プロジェクト: adsabs/invenio
def perform_request_contact(req, ln, journal_name, verbose=0):
    """
    Display contact information
    """
    try:
        contact_page_template = get_journal_template("contact", journal_name, ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)
コード例 #7
0
ファイル: webjournal.py プロジェクト: bopopescu/invenio
def perform_request_popup(req, ln, journal_name, record):
    """
    Display the popup window
    """
    try:
        popup_page_template = get_journal_template('popup', journal_name, ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)
コード例 #8
0
ファイル: webjournal.py プロジェクト: bopopescu/invenio
def perform_request_contact(req, ln, journal_name, verbose=0):
    """
    Display contact information
    """
    try:
        contact_page_template = get_journal_template('contact', journal_name,
                                                     ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)
コード例 #9
0
ファイル: webjournal.py プロジェクト: adsabs/invenio
def perform_request_search(
    req, journal_name, ln, archive_issue, archive_select, archive_date, archive_search, verbose=0
):
    """
    Logic for the search / archive page.
    """
    try:
        search_page_template = get_journal_template("search", journal_name, ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)
コード例 #10
0
def perform_request_search(req, journal_name, ln,
                           archive_issue, archive_select,
                           archive_date, archive_search, verbose=0):
    """
    Logic for the search / archive page.
    """
    try:
        search_page_template = get_journal_template('search',
                                                    journal_name,
                                                    ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box()
コード例 #11
0
 def test_get_journal_template(self):
     """webjournal - returns the journal templates name for the given template type"""
     value = wju.get_journal_template('index',
                                      'AtlantisTimes',
                                      ln=CFG_SITE_LANG)
     self.assertEqual(value, 'webjournal/AtlantisTimes_Index.bft')
 def test_get_journal_template(self):
     """webjournal - returns the journal templates name for the given template type"""
     value = wju.get_journal_template('index', 'AtlantisTimes', ln=CFG_SITE_LANG)
     self.assertEqual(value, 'webjournal/AtlantisTimes_Index.bft')