Ejemplo n.º 1
0
    def tmpl_admin_update_issue(self, ln, journal_name, next_issue,
                                current_issue):
        """
        A form that lets a user make an update to an issue number.
        """
        _ = gettext_set_language(ln)
        current_articles = get_number_of_articles_for_issue(current_issue,
                                                            journal_name,
                                                            ln)
        next_articles = get_number_of_articles_for_issue(next_issue,
                                                         journal_name,
                                                         ln)

        html = '''
        <p>The Issue that was released on week %(current_issue)s has pending updates scheduled. The
        next update for this issue is %(next_issue)s.</p>
        <p><em>Note: If you want to make a new release, please click through all the
        pending updates first.</em></p>
        <p>Do you want to release the update from issue: <br/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>%(current_issue)s</em> (%(current_articles)s) <br/>
        to issue: <br/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>%(next_issue)s</em> (%(next_articles)s) <br/>
        now?</p>
        <form action="%(CFG_SITE_URL)s/admin/webjournal/webjournaladmin.py/issue_control" name="publish">
            <input type="hidden" name="journal_name" value="%(journal_name)s"/>
            <input type="hidden" name="issue" value="%(next_issue)s"/>
            <input class="formbutton" type="submit" value="%(update)s" name="action"/>
        </form>
        ''' % {'current_issue': current_issue,
               'next_issue' : next_issue,
               'current_articles': ",".join(["%s : %s" % (item[0], item[1]) \
                                             for item in iteritems(current_articles)]),
               'next_articles': ",".join(["%s : %s" % (item[0], item[1]) \
                                          for item in iteritems(next_articles)]),
               'CFG_SITE_URL' : CFG_SITE_URL,
               'journal_name': journal_name,
               'update': _("Update")}
        return html
Ejemplo n.º 2
0
    def tmpl_admin_update_issue(self, ln, journal_name, next_issue,
                                current_issue):
        """
        A form that lets a user make an update to an issue number.
        """
        _ = gettext_set_language(ln)
        current_articles = get_number_of_articles_for_issue(
            current_issue, journal_name, ln)
        next_articles = get_number_of_articles_for_issue(
            next_issue, journal_name, ln)

        html = '''
        <p>The Issue that was released on week %(current_issue)s has pending updates scheduled. The
        next update for this issue is %(next_issue)s.</p>
        <p><em>Note: If you want to make a new release, please click through all the
        pending updates first.</em></p>
        <p>Do you want to release the update from issue: <br/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>%(current_issue)s</em> (%(current_articles)s) <br/>
        to issue: <br/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>%(next_issue)s</em> (%(next_articles)s) <br/>
        now?</p>
        <form action="%(CFG_SITE_URL)s/admin/webjournal/webjournaladmin.py/issue_control" name="publish">
            <input type="hidden" name="journal_name" value="%(journal_name)s"/>
            <input type="hidden" name="issue" value="%(next_issue)s"/>
            <input class="formbutton" type="submit" value="%(update)s" name="action"/>
        </form>
        ''' % {'current_issue': current_issue,
               'next_issue' : next_issue,
               'current_articles': ",".join(["%s : %s" % (item[0], item[1]) \
                                             for item in iteritems(current_articles)]),
               'next_articles': ",".join(["%s : %s" % (item[0], item[1]) \
                                          for item in iteritems(next_articles)]),
               'CFG_SITE_URL' : CFG_SITE_URL,
               'journal_name': journal_name,
               'update': _("Update")}
        return html
Ejemplo 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
Ejemplo 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