Esempio n. 1
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 as e:
        register_exception(req=req)
        return e.user_box(req)

    temp_marc = '''<record>
                        <controlfield tag="001">0</controlfield>
                    </record>'''
    # create a record and get HTML back from bibformat
    user_info = collect_user_info(req)
    bfo = BibFormatObject(0, ln=ln, xml_record=temp_marc,
                          user_info=user_info)
    bfo.req = req
    verbosity = 0
    if editor:
        # Increase verbosity only for editors/admins
        verbosity = verbose

    html = format_with_format_template(index_page_template,
                                       bfo,
                                       verbose=verbosity)
    return html
Esempio n. 2
0
def perform_request_alert(journal_name, issue,
                          sent, plain_text, subject, recipients,
                          html_mail, force, ln=CFG_SITE_LANG):
    """
    All the logic for alert emails.

    Display a form to edit email/recipients and options to send the
    email.  Sent in HTML/PlainText or only PlainText if wished so.
    Also prevent mistake of sending the alert more than one for a
    particular issue.

    Parameters:
        journal_name  -  the journal for which the alert is sent
               issue  -  the issue for which the alert is sent
                sent  -  Display interface to edit email if "False"
                         (string). Else send the email.
          plain_text  -  the text of the mail
             subject  -  the subject of the mail
          recipients  -  the recipients of the mail (string with
                         comma-separated emails)
           html_mail  -  if 'html', also send email as HTML (copying
                         from the current issue on the web)
               force  -  if different than "False", the email is sent
                         even if it has already been sent.
                  ln  -  language
    """
    # FIXME: more flexible options to choose the language of the alert
    languages = get_journal_languages(journal_name)
    if languages:
        alert_ln = languages[0]
    else:
        alert_ln = CFG_SITE_LANG

    if not get_release_datetime(issue, journal_name, ln):
        # Trying to send an alert for an unreleased issue
        return wjt.tmpl_admin_alert_unreleased_issue(ln,
                                                     journal_name)
    if sent == "False":
        # Retrieve default message, subject and recipients, and
        # display email editor
        subject = wjt.tmpl_admin_alert_subject(journal_name,
                                               alert_ln,
                                               issue)
        plain_text = wjt.tmpl_admin_alert_plain_text(journal_name,
                                                     alert_ln,
                                                     issue)
        plain_text = plain_text.encode('utf-8')
        recipients = get_journal_alert_recipient_email(journal_name)
        return wjt.tmpl_admin_alert_interface(ln,
                                              journal_name,
                                              subject,
                                              plain_text,
                                              recipients,
                                              alert_ln)
    else:
        # User asked to send the mail
        if was_alert_sent_for_issue(issue,
                                    journal_name,
                                    ln) != False and force == "False":
            # Mmh, email already sent before for this issue. Ask
            # confirmation
            return wjt.tmpl_admin_alert_was_already_sent(ln,
                                                         journal_name,
                                                         subject,
                                                         plain_text,
                                                         recipients,
                                                         html_mail,
                                                         issue)
        html_string = None
        if html_mail == "html":
            # Also send as HTML: retrieve from current issue
            html_file = WEBJOURNAL_OPENER.open('%s/journal/%s?ln=%s'
                                % (CFG_SITE_URL, journal_name, alert_ln))
            html_string = html_file.read()
            html_file.close()
            html_string = put_css_in_file(html_string, journal_name)
            html_string = insert_journal_link(html_string, journal_name, issue, ln)
            html_string = wash_alert(html_string)

        sender_email = get_journal_alert_sender_email(journal_name)
        send_email(sender_email, recipients, subject, plain_text,
                   html_string, header='', footer='', html_header='',
                   html_footer='', charset='utf-8')

        update_DB_for_alert(issue, journal_name, ln)
        return wjt.tmpl_admin_alert_success_msg(ln,
                                                journal_name)
Esempio n. 3
0
    def tmpl_admin_administrate(self, journal_name, current_issue,
                                current_publication, issue_list,
                                next_issue_number, ln=CFG_SITE_LANG,
                                as_editor=True):
        """
        Returns an administration interface that shows the current publication and
        supports links to all important actions.

        @param as_editor: True if can make changes to the configuration. Else read-only mode.
        """
        _ = gettext_set_language(ln)
        out = ''

        if as_editor:
            admin_menu = '''<table class="admin_wvar">
            <tr><th colspan="5" class="adminheaderleft" cellspacing="0">%(menu)s</th></tr>
            <tr>
            <td>0.&nbsp;<small>Administrate</small>&nbsp;</td>
            <td>1.&nbsp;<small><a href="feature_record?journal_name=%(journal_name)s">Feature a Record</a></small>&nbsp;</td>
            <td>2.&nbsp;<small><a href="configure?action=edit&amp;journal_name=%(journal_name)s">Edit Configuration</a></small>&nbsp;</td>
            <td>3.&nbsp;<small><a href="%(CFG_SITE_URL)s/journal/%(journal_name)s">Go to the Journal</a></small>&nbsp;</td>
            </tr>
            </table><br/>'''
        else:
            admin_menu = '''<table class="admin_wvar">
            <tr><th colspan="5" class="adminheaderleft" cellspacing="0">%(menu)s</th></tr>
            <tr>
            <td>0.&nbsp;<small>Administrate</small>&nbsp;</td>
            <td>1.&nbsp;<small><a href="%(CFG_SITE_URL)s/journal/%(journal_name)s">Go to the Journal</a></small>&nbsp;</td>
            </tr>
            </table><br/>'''

        out += admin_menu % {'journal_name': journal_name,
                             'menu': _("Menu"),
                             'CFG_SITE_URL': CFG_SITE_URL}

        # format the issues
        issue_boxes = []
        issue_list.append(next_issue_number)
        for issue in issue_list:
            articles = get_number_of_articles_for_issue(issue,
                                                        journal_name,
                                                        ln)
            released_on = get_release_datetime(issue, journal_name, ln)
            announced_on = get_announcement_datetime(issue, journal_name, ln)
            issue_box = '''
                <tr style="%s">
                    <td class="admintdright" style="vertical-align: middle;"></td>
                    <td class="admintdleft" style="white-space: nowrap; vertical-align: middle;">
                        <p>Issue: %s</p>
                        <p>Publication: %s</p>
                    </td>
                    <td class="admintdright" style="vertical-align: middle;">
                        %s
                    </td>
                    <td class="admintdright" style="vertical-align: middle;">
                        <p>%s</p>
                        <p>%s</p>
                    </td>
                    <td class="admintdright" style="vertical-align: middle;">
                        <p><a href="%s/admin/webjournal/webjournaladmin.py/regenerate?journal_name=%s&amp;issue=%s&amp;ln=%s">&gt;regenerate</a></p>
                    </td>
                <tr>
            ''' % ((issue==current_issue) and "background:#00FF00;" or "background:#F1F1F1;",

                    issue, (issue==next_issue_number) and "?" or current_publication,

                    "\n".join(['<p>%s : %s <a href="%s/journal/%s/%s/%s/%s">&gt;view</a></p>' %
                               (item[0], item[1],
                                CFG_SITE_URL, journal_name,
                                issue.split('/')[1], issue.split('/')[0], item[0]) \
                               for item in iteritems(articles)]),

                    (not released_on) and
                    ('<em>not released</em>' + (as_editor and '<br/><a href="%s/admin/webjournal/webjournaladmin.py/issue_control?journal_name=%s">&gt;release now</a>' % (CFG_SITE_URL, journal_name) or '')) or
                    'released on: %s' % released_on.strftime("%d.%m.%Y"),

                    (not announced_on)
                    and ('<em>not announced</em>' + (as_editor and '<br/><a href="%s/admin/webjournal/webjournaladmin.py/alert?journal_name=%s&issue=%s">&gt;announce now</a>' % (CFG_SITE_URL, journal_name, issue) or '')) or
                    'announced on: %s <br/><a href="%s/admin/webjournal/webjournaladmin.py/alert?journal_name=%s&issue=%s">&gt;re-announce</a>' % (announced_on.strftime("%d.%m.%Y"), CFG_SITE_URL, journal_name, issue),

                    CFG_SITE_URL, journal_name, issue, ln
                )
            issue_boxes.append(issue_box)
        out += '''
                 <table class="admin_wvar" width="80%%" cellspacing="0">
                    <tbody>
                        <tr>
                            <th class="adminheaderleft"></th>
                            <th class="adminheaderleft">Issue / Publication</th>
                            <th class="adminheader">Articles</th>
                            <th class="adminheaderleft">Release / Announcement</th>
                            <th class="adminheaderleft">Cache Status</th>
                        <tr>
                        %s
                    </tbody>
                 </table>
                 ''' % ("\n".join([issue_box for issue_box in issue_boxes]))

        return out
Esempio n. 4
0
    def tmpl_admin_administrate(self,
                                journal_name,
                                current_issue,
                                current_publication,
                                issue_list,
                                next_issue_number,
                                ln=CFG_SITE_LANG,
                                as_editor=True):
        """
        Returns an administration interface that shows the current publication and
        supports links to all important actions.

        @param as_editor: True if can make changes to the configuration. Else read-only mode.
        """
        _ = gettext_set_language(ln)
        out = ''

        if as_editor:
            admin_menu = '''<table class="admin_wvar">
            <tr><th colspan="5" class="adminheaderleft" cellspacing="0">%(menu)s</th></tr>
            <tr>
            <td>0.&nbsp;<small>Administrate</small>&nbsp;</td>
            <td>1.&nbsp;<small><a href="feature_record?journal_name=%(journal_name)s">Feature a Record</a></small>&nbsp;</td>
            <td>2.&nbsp;<small><a href="configure?action=edit&amp;journal_name=%(journal_name)s">Edit Configuration</a></small>&nbsp;</td>
            <td>3.&nbsp;<small><a href="%(CFG_SITE_URL)s/journal/%(journal_name)s">Go to the Journal</a></small>&nbsp;</td>
            </tr>
            </table><br/>'''
        else:
            admin_menu = '''<table class="admin_wvar">
            <tr><th colspan="5" class="adminheaderleft" cellspacing="0">%(menu)s</th></tr>
            <tr>
            <td>0.&nbsp;<small>Administrate</small>&nbsp;</td>
            <td>1.&nbsp;<small><a href="%(CFG_SITE_URL)s/journal/%(journal_name)s">Go to the Journal</a></small>&nbsp;</td>
            </tr>
            </table><br/>'''

        out += admin_menu % {
            'journal_name': journal_name,
            'menu': _("Menu"),
            'CFG_SITE_URL': CFG_SITE_URL
        }

        # format the issues
        issue_boxes = []
        issue_list.append(next_issue_number)
        for issue in issue_list:
            articles = get_number_of_articles_for_issue(
                issue, journal_name, ln)
            released_on = get_release_datetime(issue, journal_name, ln)
            announced_on = get_announcement_datetime(issue, journal_name, ln)
            issue_box = '''
                <tr style="%s">
                    <td class="admintdright" style="vertical-align: middle;"></td>
                    <td class="admintdleft" style="white-space: nowrap; vertical-align: middle;">
                        <p>Issue: %s</p>
                        <p>Publication: %s</p>
                    </td>
                    <td class="admintdright" style="vertical-align: middle;">
                        %s
                    </td>
                    <td class="admintdright" style="vertical-align: middle;">
                        <p>%s</p>
                        <p>%s</p>
                    </td>
                    <td class="admintdright" style="vertical-align: middle;">
                        <p><a href="%s/admin/webjournal/webjournaladmin.py/regenerate?journal_name=%s&amp;issue=%s&amp;ln=%s">&gt;regenerate</a></p>
                    </td>
                <tr>
            ''' % ((issue==current_issue) and "background:#00FF00;" or "background:#F1F1F1;",

                    issue, (issue==next_issue_number) and "?" or current_publication,

                    "\n".join(['<p>%s : %s <a href="%s/journal/%s/%s/%s/%s">&gt;view</a></p>' %
                               (item[0], item[1],
                                CFG_SITE_URL, journal_name,
                                issue.split('/')[1], issue.split('/')[0], item[0]) \
                               for item in iteritems(articles)]),

                    (not released_on) and
                    ('<em>not released</em>' + (as_editor and '<br/><a href="%s/admin/webjournal/webjournaladmin.py/issue_control?journal_name=%s">&gt;release now</a>' % (CFG_SITE_URL, journal_name) or '')) or
                    'released on: %s' % released_on.strftime("%d.%m.%Y"),

                    (not announced_on)
                    and ('<em>not announced</em>' + (as_editor and '<br/><a href="%s/admin/webjournal/webjournaladmin.py/alert?journal_name=%s&issue=%s">&gt;announce now</a>' % (CFG_SITE_URL, journal_name, issue) or '')) or
                    'announced on: %s <br/><a href="%s/admin/webjournal/webjournaladmin.py/alert?journal_name=%s&issue=%s">&gt;re-announce</a>' % (announced_on.strftime("%d.%m.%Y"), CFG_SITE_URL, journal_name, issue),

                    CFG_SITE_URL, journal_name, issue, ln
                )
            issue_boxes.append(issue_box)
        out += '''
                 <table class="admin_wvar" width="80%%" cellspacing="0">
                    <tbody>
                        <tr>
                            <th class="adminheaderleft"></th>
                            <th class="adminheaderleft">Issue / Publication</th>
                            <th class="adminheader">Articles</th>
                            <th class="adminheaderleft">Release / Announcement</th>
                            <th class="adminheaderleft">Cache Status</th>
                        <tr>
                        %s
                    </tbody>
                 </table>
                 ''' % ("\n".join([issue_box for issue_box in issue_boxes]))

        return out
Esempio n. 5
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 as e:
        register_exception(req=req)
        return e.user_box(req)

    user_info = collect_user_info(req)
    bfo = BibFormatObject(recid, ln=ln, user_info=user_info)
    bfo.req = req

    # if it is cached, return it
    cached_html = get_article_page_from_cache(journal_name, category,
                                              recid, issue_number, ln,
                                              bfo)

    if cached_html and not editor:
        return cached_html

    # Check that this recid is indeed an article
    is_article = False
    articles = get_journal_articles(journal_name, issue_number, category)
    for order, recids in iteritems(articles):
        if recid in recids:
            is_article = True
            break

    if not is_article:
        redirect_to_url(req, "%s/journal/%s/%s/%s?ln=%s" % \
                        (CFG_SITE_URL,
                         journal_name,
                         issue_number.split('/')[1],
                         issue_number.split('/')[0],
                         ln))


    # create a record and get HTML back from bibformat
    verbosity = 0
    if editor:
        # Increase verbosity only for editors/admins
        verbosity = verbose
    html_out = format_with_format_template(index_page_template,
                                           bfo,
                                           verbose=verbosity)
    # cache if not in editor mode, and if database is not down
    if not editor and not CFG_ACCESS_CONTROL_LEVEL_SITE == 2:
        cache_article_page(html_out, journal_name, category,
                           recid, issue_number, ln)

    return html_out
Esempio n. 6
0
def perform_request_alert(journal_name, issue,
                          sent, plain_text, subject, recipients,
                          html_mail, force, ln=CFG_SITE_LANG):
    """
    All the logic for alert emails.

    Display a form to edit email/recipients and options to send the
    email.  Sent in HTML/PlainText or only PlainText if wished so.
    Also prevent mistake of sending the alert more than one for a
    particular issue.

    Parameters:
        journal_name  -  the journal for which the alert is sent
               issue  -  the issue for which the alert is sent
                sent  -  Display interface to edit email if "False"
                         (string). Else send the email.
          plain_text  -  the text of the mail
             subject  -  the subject of the mail
          recipients  -  the recipients of the mail (string with
                         comma-separated emails)
           html_mail  -  if 'html', also send email as HTML (copying
                         from the current issue on the web)
               force  -  if different than "False", the email is sent
                         even if it has already been sent.
                  ln  -  language
    """
    # FIXME: more flexible options to choose the language of the alert
    languages = get_journal_languages(journal_name)
    if languages:
        alert_ln = languages[0]
    else:
        alert_ln = CFG_SITE_LANG

    if not get_release_datetime(issue, journal_name, ln):
        # Trying to send an alert for an unreleased issue
        return wjt.tmpl_admin_alert_unreleased_issue(ln,
                                                     journal_name)
    if sent == "False":
        # Retrieve default message, subject and recipients, and
        # display email editor
        subject = wjt.tmpl_admin_alert_subject(journal_name,
                                               alert_ln,
                                               issue)
        plain_text = wjt.tmpl_admin_alert_plain_text(journal_name,
                                                     alert_ln,
                                                     issue)
        plain_text = plain_text.encode('utf-8')
        recipients = get_journal_alert_recipient_email(journal_name)
        return wjt.tmpl_admin_alert_interface(ln,
                                              journal_name,
                                              subject,
                                              plain_text,
                                              recipients,
                                              alert_ln)
    else:
        # User asked to send the mail
        if was_alert_sent_for_issue(issue,
                                    journal_name,
                                    ln) != False and force == "False":
            # Mmh, email already sent before for this issue. Ask
            # confirmation
            return wjt.tmpl_admin_alert_was_already_sent(ln,
                                                         journal_name,
                                                         subject,
                                                         plain_text,
                                                         recipients,
                                                         html_mail,
                                                         issue)
        html_string = None
        if html_mail == "html":
            # Also send as HTML: retrieve from current issue
            html_file = WEBJOURNAL_OPENER.open('%s/journal/%s?ln=%s'
                                % (CFG_SITE_URL, journal_name, alert_ln))
            html_string = html_file.read()
            html_file.close()
            html_string = put_css_in_file(html_string, journal_name)
            html_string = insert_journal_link(html_string, journal_name, issue, ln)
            html_string = wash_alert(html_string)

        sender_email = get_journal_alert_sender_email(journal_name)
        send_email(sender_email, recipients, subject, plain_text,
                   html_string, header='', footer='', html_header='',
                   html_footer='', charset='utf-8')

        update_DB_for_alert(issue, journal_name, ln)
        return wjt.tmpl_admin_alert_success_msg(ln,
                                                journal_name)
Esempio n. 7
0
def format_element(bfo, display_date='yes', display_issue_number='yes',
           estimate_release_date='No', granularity='',
           group_issues_date='yes', display_month='long',
           display_week_day='long'):
    """
    Returns the string used for the issue number in the format:<br/>
    Issue No.<is1>-<is2>/<year> - <date>, <br/>
    e.g. Issue No.32-33/2007 – Tuesday 6 August 2007

    if <code>estimate_release_date</code> is set to <code>yes</code>,
    a 'theoretical' release date is shown instead of the release date:
    if issue if released on Friday, display next week date. Also if
    journal has not been released, display an approximative release
    date (based on history and config)

    @param display_date: if 'yes', display issue date
    @param display_issue_number: if 'yes', display issue date
    @param estimate_release_date: if 'yes', display the theoretical release date
    @param granularity: <code>day</code>, <code>week</code> or <code>month</code>
    @param group_issues_date: if 'yes' and issue are grouped, display first issue date of the group
    @param display_month: type of display for month: 'short' ('Jan', 'Feb', etc.) or 'long' ('January', 'February', etc.)
    @param display_week_day: Can display day of the week ('Monday', etc.). Parameter can be 'short' ('Mon', 'Tue' etc), 'long' ('Monday', 'Tuesday', etc.) or '' (no value displayed)
    """
    args = parse_url_string(bfo.user_info['uri'])
    journal_name = args["journal_name"]
    issue_number = args["issue"]
    ln = bfo.lang
    _ = gettext_set_language(ln)

    try:
        issue_display = get_issue_number_display(issue_number,
                                                 journal_name,
                                                 ln)
    except InvenioWebJournalJournalIdNotFoundDBError as e:
        return e.user_box()
    except Exception as e:
        issue_display = issue_number

    issues = issue_display.split("/")[0]
    year = issue_display.split("/")[1]
    week_numbers = issues.split("-")

    if group_issues_date.lower() == 'yes':
        # Get release time of this issue (do not consider issue
        # "updates": take the earliest issue number of this group of
        # issues)
        grouped_issues = get_grouped_issues(journal_name, issue_number)
        if grouped_issues:
            issue_number = grouped_issues[0]

    if estimate_release_date.lower() == 'yes':
        # Get theoretical release date
        if granularity.lower() == 'day':
            granularity = DAILY
        elif granularity.lower() == 'week':
            granularity = WEEKLY
        elif granularity.lower() == 'month':
            granularity = MONTHLY
        else:
            granularity = None
        issue_release_time = issue_to_datetime(issue_number,
                                               journal_name,
                                               granularity)
    else:
        issue_release_time = get_release_datetime(issue_number,
                                                  journal_name)

    # Get a nice internationalized representation of this date
    date_text = ''
    if issue_release_time:
        if display_week_day:
            date_text = get_i18n_day_name(issue_release_time.isoweekday(),
                                          display_week_day,
                                          ln) + ' '
        month = get_i18n_month_name(issue_release_time.month,
                                    display_month,
                                    ln=ln)
        date_text += issue_release_time.strftime("%d " + month + " %Y").lstrip('0')

    issue_url = make_journal_url(bfo.user_info['uri'],
                                 {'recid': '',
                                  'ln': bfo.lang,
                                  'category': ''})
    out = '<a class="issue" href="%s">' % issue_url
    if display_issue_number.lower() == 'yes':
        out += _("Issue No.") + ' ' + issue_display + ' - '

    if display_date.lower() == 'yes':
        out += date_text

    out += '</a>'

    return out
Esempio n. 8
0
def format_element(bfo, display_date='yes', display_issue_number='yes',
           estimate_release_date='No', granularity='',
           group_issues_date='yes', display_month='long',
           display_week_day='long'):
    """
    Returns the string used for the issue number in the format:<br/>
    Issue No.<is1>-<is2>/<year> - <date>, <br/>
    e.g. Issue No.32-33/2007 – Tuesday 6 August 2007

    if <code>estimate_release_date</code> is set to <code>yes</code>,
    a 'theoretical' release date is shown instead of the release date:
    if issue if released on Friday, display next week date. Also if
    journal has not been released, display an approximative release
    date (based on history and config)

    @param display_date: if 'yes', display issue date
    @param display_issue_number: if 'yes', display issue date
    @param estimate_release_date: if 'yes', display the theoretical release date
    @param granularity: <code>day</code>, <code>week</code> or <code>month</code>
    @param group_issues_date: if 'yes' and issue are grouped, display first issue date of the group
    @param display_month: type of display for month: 'short' ('Jan', 'Feb', etc.) or 'long' ('January', 'February', etc.)
    @param display_week_day: Can display day of the week ('Monday', etc.). Parameter can be 'short' ('Mon', 'Tue' etc), 'long' ('Monday', 'Tuesday', etc.) or '' (no value displayed)
    """
    args = parse_url_string(bfo.user_info['uri'])
    journal_name = args["journal_name"]
    issue_number = args["issue"]
    ln = bfo.lang
    _ = gettext_set_language(ln)

    try:
        issue_display = get_issue_number_display(issue_number,
                                                 journal_name,
                                                 ln)
    except InvenioWebJournalJournalIdNotFoundDBError as e:
        return e.user_box()
    except Exception as e:
        issue_display = issue_number

    issues = issue_display.split("/")[0]
    year = issue_display.split("/")[1]
    week_numbers = issues.split("-")

    if group_issues_date.lower() == 'yes':
        # Get release time of this issue (do not consider issue
        # "updates": take the earliest issue number of this group of
        # issues)
        grouped_issues = get_grouped_issues(journal_name, issue_number)
        if grouped_issues:
            issue_number = grouped_issues[0]

    if estimate_release_date.lower() == 'yes':
        # Get theoretical release date
        if granularity.lower() == 'day':
            granularity = DAILY
        elif granularity.lower() == 'week':
            granularity = WEEKLY
        elif granularity.lower() == 'month':
            granularity = MONTHLY
        else:
            granularity = None
        issue_release_time = issue_to_datetime(issue_number,
                                               journal_name,
                                               granularity)
    else:
        issue_release_time = get_release_datetime(issue_number,
                                                  journal_name)

    # Get a nice internationalized representation of this date
    date_text = ''
    if issue_release_time:
        if display_week_day:
            date_text = get_i18n_day_name(issue_release_time.isoweekday(),
                                          display_week_day,
                                          ln) + ' '
        month = get_i18n_month_name(issue_release_time.month,
                                    display_month,
                                    ln=ln)
        date_text += issue_release_time.strftime("%d " + month + " %Y").lstrip('0')

    issue_url = make_journal_url(bfo.user_info['uri'],
                                 {'recid': '',
                                  'ln': bfo.lang,
                                  'category': ''})
    out = '<a class="issue" href="%s">' % issue_url
    if display_issue_number.lower() == 'yes':
        out += _("Issue No.") + ' ' + issue_display + ' - '

    if display_date.lower() == 'yes':
        out += date_text

    out += '</a>'

    return out