def tmpl_admin_alert_plain_text(self, journal_name, ln, issue):
        """
        Default plain text message for email alert of journal updates.
        This will be used to pre-fill the content of the mail alert, that
        can be modified by the admin.

        Customize this function to return different default texts
        based on journal name and language,
        """
        current_publication = get_issue_number_display(issue, journal_name, ln)
        plain_text = u"""Dear Subscriber,

    The latest issue of %(journal_name)s, no. %(current_publication)s, has been released.
    You can access it at the following URL:
    %(CFG_SITE_URL)s/journal/%(journal_name)s/

    Best Wishes,
    %(journal_name)s team

    ----
Cher Abonné,

    Le nouveau numéro de %(journal_name)s, no. %(current_publication)s, vient de paraître.
    Vous pouvez y accéder à cette adresse :
    %(CFG_SITE_URL)s/journal/%(journal_name)s/?ln=fr

    Bonne lecture,
    L'équipe de %(journal_name)s
    """ % {
            "journal_name": journal_name,
            "current_publication": current_publication,
            "CFG_SITE_URL": CFG_SITE_URL,
        }
        return plain_text
    def tmpl_admin_alert_plain_text(self, journal_name, ln, issue):
        """
        Default plain text message for email alert of journal updates.
        This will be used to pre-fill the content of the mail alert, that
        can be modified by the admin.

        Customize this function to return different default texts
        based on journal name and language,
        """
        current_publication = get_issue_number_display(issue, journal_name, ln)
        plain_text = u'''Dear Subscriber,

    The latest issue of %(journal_name)s, no. %(current_publication)s, has been released.
    You can access it at the following URL:
    %(CFG_SITE_URL)s/journal/%(journal_name)s/

    Best Wishes,
    %(journal_name)s team

    ----
Cher Abonné,

    Le nouveau numéro de %(journal_name)s, no. %(current_publication)s, vient de paraître.
    Vous pouvez y accéder à cette adresse :
    %(CFG_SITE_URL)s/journal/%(journal_name)s/?ln=fr

    Bonne lecture,
    L'équipe de %(journal_name)s
    ''' % {
            'journal_name': journal_name,
            'current_publication': current_publication,
            'CFG_SITE_URL': CFG_SITE_URL
        }
        return plain_text
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, e:
        return e.user_box()
    def tmpl_admin_alert_subject(self, journal_name, ln, issue):
        """
        Default subject for email alert of journal updates.

        Customize this function to return different default texts
        based on journal name and language,
        """
        return "%s %s released" % (journal_name, get_issue_number_display(issue, journal_name, ln))
    def tmpl_admin_alert_subject(self, journal_name, ln, issue):
        """
        Default subject for email alert of journal updates.

        Customize this function to return different default texts
        based on journal name and language,
        """
        return "%s %s released" % (journal_name, \
                                   get_issue_number_display(issue,
                                                            journal_name,
                                                            ln))
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 = args["ln"]
    _ = gettext_set_language(ln)

    try:
        issue_display = get_issue_number_display(issue_number, journal_name,
                                                 ln)
    except InvenioWebJournalJournalIdNotFoundDBError, e:
        return e.user_box()
        with_editor_rights  -  True if can edit configuration. Read-only mode otherwise
    """
    if journal_name is None:
        try:
            journal_name = guess_journal_name(ln)
        except InvenioWebJournalNoJournalOnServerError, e:
            return e.user_box()

    if not can_read_xml_config(journal_name):
        return (
            '<span style="color:#f00">Configuration could not be read. Please check that %s/webjournal/%s/%s-config.xml exists and can be read by the server.</span><br/>'
            % (CFG_ETCDIR, journal_name, journal_name)
        )

    current_issue = get_current_issue(ln, journal_name)
    current_publication = get_issue_number_display(current_issue, journal_name, ln)
    issue_list = get_grouped_issues(journal_name, current_issue)
    next_issue_number = get_next_journal_issues(issue_list[-1], journal_name, 1)

    return wjt.tmpl_admin_administrate(
        journal_name, current_issue, current_publication, issue_list, next_issue_number[0], ln, as_editor=as_editor
    )


def perform_feature_record(journal_name, recid, img_url="", action="", ln=CFG_SITE_LANG):
    """
    Interface to feature a record

    Used to list, add and remove featured records of the journal.

    Parameters:
 def test_get_issue_number_display(self):
     """webjournal - returns the display string for a given issue number"""
     issue_nb = wju.get_issue_number_display('03/2009',
                                             'AtlantisTimes',
                                             ln=CFG_SITE_LANG)
     self.assertEqual(issue_nb, '02-03/2009')
 def test_get_issue_number_display(self):
     """webjournal - returns the display string for a given issue number"""
     issue_nb = wju.get_issue_number_display('03/2009', 'AtlantisTimes', ln=CFG_SITE_LANG)
     self.assertEqual(issue_nb, '02-03/2009')
Beispiel #10
0
        journal_name  -  the journal to be administrated
                  ln  -  language
        with_editor_rights  -  True if can edit configuration. Read-only mode otherwise
    """
    if journal_name is None:
        try:
            journal_name = guess_journal_name(ln)
        except InvenioWebJournalNoJournalOnServerError, e:
            return e.user_box()

    if not can_read_xml_config(journal_name):
        return '<span style="color:#f00">Configuration could not be read. Please check that %s/webjournal/%s/%s-config.xml exists and can be read by the server.</span><br/>' % (
            CFG_ETCDIR, journal_name, journal_name)

    current_issue = get_current_issue(ln, journal_name)
    current_publication = get_issue_number_display(current_issue, journal_name,
                                                   ln)
    issue_list = get_grouped_issues(journal_name, current_issue)
    next_issue_number = get_next_journal_issues(issue_list[-1], journal_name,
                                                1)

    return wjt.tmpl_admin_administrate(journal_name,
                                       current_issue,
                                       current_publication,
                                       issue_list,
                                       next_issue_number[0],
                                       ln,
                                       as_editor=as_editor)


def perform_feature_record(journal_name,
                           recid,