コード例 #1
0
 def article_front(self):
     r = _('{xml_name} is an invalid XML file').format(
         xml_name=self.article_identification)
     if self.article.tree is not None:
         r = "".join((
             self.sps,
             self.language,
             self.toc_section,
             self.article_type,
             self.display_titles(),
             self.article_id,
             self.article_id_other,
             self.previous_article_pid,
             self.order,
             self.fpage,
             self.fpage_seq,
             self.elocation_id,
             self.article_dates,
             self.contrib_names,
             self.contrib_collabs,
             self.affiliations,
             self.abstracts,
             self.keywords,
             self.graphical_abstracts,
         ))
     return html_reports.tag('h2', 'article/front') + html_reports.tag(
         'div', r, 'article-data')
コード例 #2
0
 def affiliations(self):
     r = html_reports.tag('p', 'Affiliations:', 'label')
     for aff_xml in self.article.affiliations:
         r += html_reports.tag(
             'p', html_reports.format_html_data(aff_xml.aff.xml))
     th, w, data = self.affiliations_sheet_data()
     r += html_reports.sheet(th, data)
     return r
コード例 #3
0
 def files_and_href(self):
     r = ''
     r += html_reports.tag('h4', _('Files in the package'))
     th, data = self.package_files()
     r += html_reports.sheet(th, data, table_style='validation_sheet')
     r += html_reports.tag('h4', '@href')
     th, data = self.hrefs_sheet_data()
     r += html_reports.sheet(th, data, table_style='validation_sheet')
     return r
コード例 #4
0
 def footnotes(self):
     r = ''
     for item in self.article.article_fn_list:
         scope, fn_xml = item
         r += html_reports.tag('p', scope, 'label')
         r += html_reports.tag('p', fn_xml)
     if len(r) > 0:
         r = html_reports.tag('p', 'foot notes:', 'label') + r
     return r
コード例 #5
0
 def errors_reports(self):
     if not hasattr(self, '_errors_reports'):
         reports = (
             self.report_missing_required_issue_data,
             self.report_issue_data_conflicting_values,
             self.report_issue_data_duplicated_values,
         )
         self._errors_reports = (
             html_reports.tag('h2', _('Checking issue data consistency')) +
             html_reports.tag('div', ''.join(reports), 'issue-messages'))
     return self._errors_reports + self.report_issue_page_values
コード例 #6
0
def display_article_data_in_toc(_article):
    r = ''
    style = 'excluded' if _article.is_ex_aop else None
    #status = validation_status.STATUS_INFO + ': ' + _('This article is an ex-aop article. ') + _('Order of ex-aop is reserved, it is not allowed to reuse it for other article. ') if _article.is_ex_aop else ''

    #r += html_reports.p_message(status)
    r += html_reports.tag('p', _article.toc_section, 'toc-section')
    r += html_reports.tag('p', _article.article_type, 'article-type')

    r += display_article_metadata(_article, '; ')
    return html_reports.tag('div', r, style)
コード例 #7
0
 def report_articles_order_conflicts(self):
     if not hasattr(self, '_report_articles_order_conflicts'):
         r = []
         if len(self.docs_merger.pkg_order_conflicts) > 0:
             html_reports.tag('h2', _('Order conflicts'))
             for order, names in self.docs_merger.pkg_order_conflicts.items(
             ):
                 r.append(html_reports.tag('h3', order))
                 r.append(html_reports.format_html_data(names))
         self._report_articles_order_conflicts = ''.join(r)
     return self._report_articles_order_conflicts
コード例 #8
0
def display_author(author):
    texts = []
    if isinstance(author, PersonAuthor):
        labels = ('surname', 'suffix', 'name', 'orcid')
        values = (author.surname, author.suffix, author.fname,
                  author.contrib_id.get("orcid", ""))
        for label, value in zip(labels, values):
            if value:
                texts.append(html_reports.tag('span', value, label))
    else:
        texts.append(html_reports.tag('span', author.collab, 'collab'))
    return ", ".join([text for text in texts if text])
コード例 #9
0
 def report_articles_changed_names(self):
     if not hasattr(self, '_report_articles_changed_names'):
         r = []
         if len(self.docs_merger.name_changes) > 0:
             r.append(html_reports.tag('h3', _('Names changes')))
             for old, new in self.docs_merger.name_changes.items():
                 r.append(
                     html_reports.tag(
                         'p', '{old} => {new}'.format(old=old, new=new),
                         'info'))
         self._report_articles_changed_names = ''.join(r)
     return self._report_articles_changed_names
コード例 #10
0
 def invalid_xml_report(self):
     r = ''
     if len(self.invalid_xml_name_items) > 0:
         r += html_reports.tag(
             'div',
             html_reports.p_message(
                 _('{status}: invalid XML files. ').format(
                     status=validation_status.STATUS_BLOCKING_ERROR)))
         r += html_reports.tag(
             'div',
             html_reports.format_list('', 'ol', self.invalid_xml_name_items,
                                      'issue-problem'))
     return r
コード例 #11
0
 def issue_header(self):
     if self.article.tree is not None:
         r = [
             self.article.journal_title, self.article.journal_id_nlm_ta,
             self.article.issue_label,
             article_utils.format_date(self.article.expected_pubdate)
         ]
         return html_reports.tag(
             'div', '\n'.join([
                 html_reports.tag('h5', item) for item in r
                 if item is not None
             ]), 'issue-data')
     else:
         return ''
コード例 #12
0
 def report_rejected_articles(self):
     if self.docs_merger.rejected_articles:
         r = [html_reports.tag('h3', _('Rejected documents'))]
         r.append(
             html_reports.tag(
                 'p',
                 _('These documents were rejected because they are not '
                   '"ahead of print" anymore, they were published in a '
                   'regular issue, '
                   'so they are not allowed to be reinserted as '
                   '"ahead of print".'), 'blockingerror'))
         for name in self.docs_merger.rejected_articles:
             r.append(html_reports.tag('p', name))
         return ''.join(r)
     return ''
コード例 #13
0
 def report_missing_required_issue_data(self):
     if not hasattr(self, '_report_missing_required_issue_data'):
         r = ''
         for label, items in self.group.missing_required_data.items():
             r += html_reports.tag(
                 'div',
                 html_reports.p_message(
                     _('{status}: missing {label} in: ').format(
                         status=validation_status.STATUS_BLOCKING_ERROR,
                         label=label)))
             r += html_reports.tag(
                 'div',
                 html_reports.format_list('', 'ol', items, 'issue-problem'))
         self._report_missing_required_issue_data = r
     return self._report_missing_required_issue_data
コード例 #14
0
ファイル: pkg_processors.py プロジェクト: patymori/prodtools
 def conversion_status_report(self):
     title = _('Conversion results')
     status = self.conversion_status
     style = 'conversion'
     text = ''
     if status is not None:
         for category in sorted(status.keys()):
             _style = style
             if status.get(category) is None:
                 ltype = 'ul'
                 list_items = ['None']
                 _style = None
             elif len(status[category]) == 0:
                 ltype = 'ul'
                 list_items = ['None']
                 _style = None
             else:
                 ltype = 'ol'
                 list_items = status[category]
             text += html_reports.format_list(
                 categories_messages.get(category, category), ltype,
                 list_items, _style)
     if len(text) > 0:
         text = html_reports.tag('h3', title) + text
     return text
コード例 #15
0
def validations_table(results):
    r = ''
    if results is not None:
        rows = []
        for result in results:
            result = list(result)
            if len(result) == 3:
                result.append('')
            if len(result) == 4:
                label, status, msg, xml = result
                rows.append({
                    'label': attributes.sps_help(label),
                    'status': status,
                    'message': msg,
                    'xml': xml,
                    _('why it is not a valid message?'): ' '
                })
            else:
                logger.debug('validations_table: ', result)
        r = html_reports.tag(
            'div',
            html_reports.sheet([
                'label', 'status', 'message', 'xml',
                _('why it is not a valid message?')
            ],
                               rows,
                               table_style='validation_sheet'))
    return r
コード例 #16
0
    def articles_dates_report(self):
        labels = [
            'name', '@article-type', 'received', 'accepted',
            'receive to accepted (days)', 'SciELO date', 'editorial date',
            'accepted to SciELO (days)', 'accepted to nowadays (days)'
        ]
        items = []
        for xml_name, doc in self.articles:
            values = []
            values.append(xml_name)
            values.append(doc.article_type)
            values.append(utils.display_datetime(doc.received_dateiso))
            values.append(utils.display_datetime(doc.accepted_dateiso))
            values.append(str(doc.history_days))
            values.append(
                utils.display_datetime(doc.isoformat(doc.real_pubdate)))
            values.append(
                utils.display_datetime(doc.isoformat(doc.expected_pubdate)))
            values.append(str(doc.accepted_to_real_in_days))
            values.append(str(doc.accepted_to_nowadays_in_days))
            items.append(html_reports.label_values(labels, values))
        article_dates = html_reports.sheet(labels, items, 'dbstatus')

        labels = [_('year'), _('location')]
        items = []
        for year in sorted(self.years.keys()):
            values = []
            values.append(year)
            values.append(self.years[year])
            items.append(html_reports.label_values(labels, values))
        reference_dates = html_reports.sheet(labels, items, 'dbstatus')

        return html_reports.tag(
            'h4', _('Articles Dates Report')) + article_dates + reference_dates
コード例 #17
0
 def table_tables(self):
     labels = ['xml', 'data']
     tablewraps_data = []
     for tablewrap in self.article.tables:
         graphics = []
         for g in tablewrap.graphics:
             tag, f = g
             href = os.path.join('{IMG_PATH}', f)
             link = html_reports.link(href, html_reports.thumb_image(href))
             graphics.append('<h4>{}</h4>'.format(tag) + link)
         _codes = [
             u'<h4>{}</h4><div>{}</div>'.format(tag, c)
             for tag, c in tablewrap.codes
         ]
         content = []
         content += ['<b>@id</b>: {}'.format(tablewrap.id)]
         content += [u'<b>label</b>: {}'.format(tablewrap.label)]
         content += graphics
         content += _codes
         content = '<hr/>'.join(content)
         tablewraps_data.append({
             'xml': tablewrap.xml,
             'data': ' ' + content + ' '
         })
     return html_reports.tag('h1', 'table-wrap') + html_reports.sheet(
         labels,
         tablewraps_data,
         table_style='none',
         html_cell_content=['data'])
コード例 #18
0
 def pkg_issue_validations(self):
     items = validations_module.ValidationsResultItems()
     for name, validation in self.pkg_articles_validations.items():
         items[name] = validation.issue_validations
     items.title = html_reports.tag(
         'h2', _('Checking issue data: XML files and registered data'))
     return items
コード例 #19
0
 def item_report(self, item):
     image_id, name, image_origin, image_src, image_doc = item
     elem_name, elem_id = image_id.split(' ')
     style = 'inline'
     if elem_name in ['tabwrap', 'figgrp', 'equation']:
         style = elem_name
     compare_style = "compare_" + style
     rows = []
     rows.append('<li>')
     rows.append(html_reports.tag('h3', image_id))
     rows.append(
         self.item_report_replacement(
             name, self.href_replacements.get(name)))
     if image_src:
         rows.append('<div class="compare_images">')
         rows.append(
             self.display_image(
                 image_src, compare_style, 'src', image_origin))
         rows.append('</div>')
     if image_doc:
         rows.append('<div class="compare_images">')
         rows.append(
             self.display_image(
                 image_doc, compare_style, 'doc', image_origin))
         rows.append('</div>')
     rows.append('</li>')
     return '\n'.join(rows)
コード例 #20
0
def article_history(history):
    r = []

    h = [_(status) for status in history]
    r.append(
        html_reports.tag('div', html_reports.format_html_data_list(h),
                         'hist-' + history[-1]))
    return ''.join(r)
コード例 #21
0
 def journal_issue_header_report(self):
     if not hasattr(self, '_journal_issue_header_report'):
         common_data = ''
         for label, values in self.group.common_data.items():
             if len(values.keys()) == 1:
                 common_data += html_reports.tag(
                     'p',
                     html_reports.display_label_value(
                         label,
                         list(values.keys())[0]))
             else:
                 common_data += html_reports.format_list(
                     label + ':', 'ol', values.keys())
         self._journal_issue_header_report = html_reports.tag(
             'h2', _('Data in the XML Files')) + html_reports.tag(
                 'div', common_data, 'issue-data')
     return self._journal_issue_header_report
コード例 #22
0
 def table_of_contents_data_with_lang(self):
     r = ''
     for lang in sorted(self.article.title_abstract_kwd_languages):
         label = html_reports.tag(
             'smaller',
             attributes.LANGUAGES.get(lang, _('unknown')) + ' [' + lang +
             ']')
         r += '<h4>' + label + '</h4>'
         r += '<p>' + '; '.join([
             k.text for k in self.article.abstracts_by_lang.get(lang, [])
         ]) + '</p>'
         r += html_reports.tag(
             'h5', '; '.join([
                 k.text
                 for k in self.article.keywords_by_lang.get(lang, [])
             ]))
     return r
コード例 #23
0
    def tables(self):
        r = '<!-- no tables -->'
        if len(self.article.tables) > 0:
            r = html_reports.tag('p', 'Tables:', 'label')

            for t in self.article.tables:
                header = html_reports.tag('h3', t.id)
                table_data = []
                table_data.append(
                    html_reports.display_labeled_value('label', t.label,
                                                       'label'))
                table_data.append(
                    html_reports.display_labeled_value('caption', t.caption,
                                                       'label'))
                table_data.append(
                    html_reports.tag('p', 'table-wrap/table (xml)', 'label'))
                for _table in t.codes:
                    table_data.append(
                        html_reports.tag(
                            'div', html_reports.format_html_data(_table[1]),
                            'xml'))
                    table_data.append(
                        html_reports.tag('p', 'table-wrap/table', 'label'))
                    table_data.append(
                        html_reports.tag('div', _table[1], 'element-table'))
                for _graphic in t.graphics:
                    table_data.append(
                        html_reports.display_labeled_value(
                            'table-wrap/graphic',
                            html_reports.thumb_image(
                                os.path.join('{IMG_PATH}', _graphic[1])),
                            'value'))
                r += header + html_reports.tag('div', ''.join(table_data),
                                               'block')
        return r
コード例 #24
0
 def report_articles_data_conflicts(self):
     if not hasattr(self, '_report_articles_data_conflicts'):
         self._report_articles_data_conflicts = ''
         r = self.report_articles_order_conflicts(
         ) + self.report_articles_merging_conflicts()
         if len(r) > 0:
             self._report_articles_data_conflicts = html_reports.tag(
                 'h2', _('Data Conflicts Report')) + r
     return self._report_articles_data_conflicts
コード例 #25
0
 def report_articles_data_changes(self):
     if not hasattr(self, '_report_articles_data_changes'):
         r = ''
         r += self.report_articles_changed_orders
         r += self.report_articles_changed_names
         if len(r) > 0:
             r = html_reports.tag('h2', _('Changes Report')) + r
         self._report_articles_data_changes = r
     return self._report_articles_data_changes
コード例 #26
0
 def pkg_journal_validations(self):
     items = validations_module.ValidationsResultItems()
     for name, validation in self.pkg_articles_validations.items():
         items[name] = validation.journal_validations
     signal = ''
     msg = ''
     if not self.is_db_generation:
         signal = '<sup>*</sup>'
         msg = html_reports.tag(
             'h5', '<a name="note"><sup>*</sup></a>' +
             _('Journal data in the XML files must be consistent with {link}'
               ).format(link=html_reports.link(
                   'http://static.scielo.org/sps/titles-tab-v2-utf-8.csv',
                   'http://static.scielo.org/sps/titles-tab-v2-utf-8.csv')),
             'note')
     items.title = html_reports.tag(
         'h2',
         _('Journal data: XML files and registered data') + signal) + msg
     return items
コード例 #27
0
 def report(self, errors_only=False):
     _reports = ''
     for xml_name in sorted(self.keys()):
         results = self[xml_name]
         if results.total() > 0 or errors_only is False:
             _reports += html_reports.tag('h4', xml_name)
             _reports += results.message
     if len(_reports) > 0:
         _reports = self.title + _reports
     return _reports
コード例 #28
0
 def embedded_pdf_items(self, page_id='', width='400px', height='400px'):
     items = []
     for item in self.article.expected_pdf_files.values():
         logger.debug(page_id + item)
         items.append(
             html_reports.tag(
                 'p',
                 html_reports.display_embedded_object(
                     item, os.path.basename(item), page_id + item, width,
                     height)))
     return ''.join(items)
コード例 #29
0
 def link_to_pdf_and_xml_files(self):
     items = []
     for item in list(self.article.expected_pdf_files.values()) + [
             self.article.filename
     ]:
         location = '{PDF_PATH}' if item.endswith('.pdf') else '{XML_PATH}'
         items.append(
             html_reports.tag(
                 'p', html_reports.link(os.path.join(location, item),
                                        item)))
     return ''.join(items)
コード例 #30
0
 def display_articles_differences(self):
     comparison_result = self.exact_comparison_result
     msg = []
     if len(comparison_result) > 0:
         msg.append(html_reports.p_message(self.status))
         for label, differences in comparison_result:
             diff = [differences[0], differences[1]]
             diff = '&#160;=>&#160;'.join(
                 [d for d in diff if d is not None])
             msg.append(html_reports.tag('p', diff))
     return ''.join(msg)