Commit bd6cf732 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add PDF report for harvester(s) operation.

parent 99bf9e19
......@@ -96,6 +96,11 @@ def run():
selector = Selector(virtdb.harvester_selector,
exclude_fields=('mode', 'year_start', 'year_end'))
# download the result of the processing in a given format
iframe = selector.download()
if iframe:
return iframe
tool_class = get_harvester_tool(selector.controller)
if not tool_class:
return T('Select an harvester.')
......@@ -111,8 +116,8 @@ def run():
msg += CODE(traceback.format_exc()).xml()
msg += '<hr/>'
return msg
response.view = 'harvest/layout.html'
response.view = 'harvest/layout.%s' % request.extension
return tool.report()
......@@ -129,6 +134,10 @@ def run_all():
try:
selector = Selector(virtdb.run_all_harvesters_selector,
exclude_fields=('mode', 'year_start', 'year_end'))
iframe = selector.download()
if iframe:
return iframe
query = None
for fieldname in ('id_teams', 'id_projects'):
......@@ -169,7 +178,7 @@ def run_all():
msg += '<hr/>'
return msg
response.view = 'harvest/layout.html'
response.view = 'harvest/layout.%s' % request.extension
return dict(harvester=Storage(controller='all harvesters',
collections=','.join(collections)),
logs=logs,
......
......@@ -73,6 +73,7 @@
'Code': 'Code',
'Collaboration': 'Collaboration',
'collaborations': 'collaborations',
'Collection': 'Collection',
'Collections': 'Collections',
'Colonnes': 'Colonnes',
'Columns': 'Colonnes',
......@@ -152,6 +153,7 @@
'Group uniquely assigned to user %(id)s': 'Group uniquely assigned to user %(id)s',
'Harvest': 'Moissonner',
'Harvester parameters not defined in the database.': 'Les paramètres du moissoneur ne sont pas définis dans la base de données.',
'Harvester(s)': 'Moissonneur(s)',
'harvesters': 'moissonneurs',
'Header': 'En tête',
'Header / Footer': 'Header / Footer',
......@@ -194,8 +196,8 @@
'List of sections separated by a comma: Articles, Proceedings.': 'List of sections separated by a comma: Articles, Proceedings.',
'lists': 'listes',
'Load': 'Charger',
'load in the database': 'charger dans la base de données',
'Load in the database': 'Charger dans la base de données',
'load in the database': 'chargé dans la base de données',
'Load in the database': 'Chargé dans la base de données',
'Logged in': 'Logged in',
'Logged out': 'Logged out',
'Login': 'Login',
......@@ -231,6 +233,7 @@
'Number of records already validated: %s': "Nombre d'enregistrements déjà validé : %s",
'Number of records found': "Nombre d'enregistrements trouvés",
'Number of records found: %s': "Nombre d'enregistrements trouvés : %s",
'Number of records inserted in the database': "Nombre d'enregistrements ajoutés à la base de donnée",
'Number of records inserted in the database: %s': "Nombre d'enregistrements ajoutés à la base de donnée : %s",
'Number of records validated': "Nombre d'enregistrements validé",
'Number of records validated: %s': "Nombre d'enregistrements validé : %s",
......@@ -247,6 +250,7 @@
'Password changed': 'Password changed',
"Password fields don't match": "Password fields don't match",
'Password reset': 'Password reset',
'Period': 'Période',
'PhDs': 'PhDs',
'please input your password again': 'please input your password again',
'Please select a list....': 'Sélectionner une liste....',
......@@ -279,6 +283,7 @@
'Ratio': 'Ratio',
'record id': 'record id',
'Record ID': 'Record ID',
'Records': 'Enregistrements',
'Register': 'Register',
'Registration identifier': 'Registration identifier',
'Registration is pending approval': 'Registration is pending approval',
......@@ -286,21 +291,22 @@
'Registration successful': 'Registration successful',
'Reject': 'Rejeter',
'Reject article is not published': "Rejeter l'article n'est pas publié",
'Reject no authors': "Rejeter pas d'auteurs",
'Reject no conference information': 'Reject no conference information',
'Reject no CPPM authors': "Rejeter pas d'auteurs du CPPM",
'Reject no preprint number nor submission date': 'Rejeter pas de numéro de preprint ou de date de soumission',
'Reject not a thesis record': "Rejeter cet enregistement n'est pas une thèse",
'Reject preprint is a conference': 'Rejeter ce preprint est une conférence',
'Reject preprint is a published paper': 'Rejeter ce preprint est un article publié',
'Reject preprint is a thesis': 'Rejeter ce preprint est une thèse',
'Reject the talk match a proceeding': 'Rejeter cette présentation est un actes de conférence',
'Reject no authors': "Rejeté pas d'auteurs",
'Reject no conference information': "Rejeté pas d'information sur la conférence",
'Reject no CPPM authors': "Rejeté pas d'auteurs du CPPM",
'Reject no preprint number nor submission date': 'Rejeté pas de numéro de preprint ou de date de soumission',
'Reject not a thesis record': "Rejeté cet enregistement n'est pas une thèse",
'Reject preprint is a conference': 'Rejeté ce preprint est une conférence',
'Reject preprint is a published paper': 'Rejeté ce preprint est un article publié',
'Reject preprint is a thesis': 'Rejeté ce preprint est une thèse',
'Reject the talk match a proceeding': 'Rejeté cette présentation est un actes de conférence',
'Removing affiliation failed. Rules might be missing for the given string. Contact the author.': 'Removing affiliation failed. Rules might be missing for the given string. Contact the author.',
'Render': 'Moteur de rendu',
'Renderer': 'Moteur de rendu',
'renderers': 'moteurs de rendu',
'Renew': 'Renew',
'Report': 'Rapport',
'Report format': 'Format du rapport',
'Report identifier separated by comma: LHCb-PROC-2008-04': 'Numéro(s) du rapport séparé par des virgules : LHCb-PROC-2008-04',
'Report number is missing': "Le numéro du rapport n'est pas défini",
'reports': 'rapports',
......@@ -351,6 +357,7 @@
'Submitted date is not valid': "La date de soumission n'est pas valide",
'Substitute': 'Substitution',
'substitution mechanism: {tablename.fieldname} or {foreigntablename.fieldname}': 'régle de substitution : {tablename.fieldname} or {foreigntablename.fieldname}',
'Summary per collections': 'Résumé par collection',
'table': 'table',
'Tablename': 'Table',
'Tables': 'Tables',
......
......@@ -88,7 +88,10 @@ virtdb.define_table('harvester_selector',
Field('id_teams', 'reference teams', label='Team'),
Field('id_projects', 'reference projects', label='Project'),
Field('controller', 'string', label='Harvest'),
Field('mode', 'string', default=MODE_LOAD_IN_DB))
Field('mode', 'string', default=MODE_LOAD_IN_DB),
Field('format', 'string', default='html', label='Report format'))
virtdb.harvester_selector.format.requires = IS_IN_SET(['html', 'tex', 'pdf'])
virtdb.harvester_selector.id_projects.requires = \
IS_IN_DB(db, 'projects.project')
......@@ -171,7 +174,11 @@ virtdb.define_table('run_all_harvesters_selector',
Field('year_end', 'integer'),
Field('id_teams', 'reference teams', label='Team'),
Field('id_projects', 'reference projects', label='Project'),
Field('mode', 'string', default=MODE_LOAD_IN_DB))
Field('mode', 'string', default=MODE_LOAD_IN_DB),
Field('format', 'string', default='html', label='Report format'))
virtdb.run_all_harvesters_selector.format.requires = \
IS_IN_SET(['html', 'tex', 'pdf'])
virtdb.run_all_harvesters_selector.mode.requires = \
IS_IN_SET([MODE_DRY_RUN, MODE_LOAD_IN_DB])
......
......@@ -6,7 +6,8 @@ HEAD
- More stringent tests in the validation procedure
including duplicate entries.
- Add the generic pdf converter to be used in view (view/tex2pdf.html).
- Pdf reports cna be generated for "check and validate" operation.
- Pdf reports can be generated for "check and validate" and
"run harvester(s)" operations.
0.8.2 (Apr 2013)
- Consolidation version.
......
{{extend '%s/layout.tex' % request.controller}}
{{include 'tex2pdf.html'}}
\ No newline at end of file
\documentclass[11pt,english]{paper}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
\usepackage{babel}
\usepackage{textcomp}
\usepackage{amstext}
\usepackage[unicode=true]
{hyperref}
\usepackage{breakurl}
\usepackage{color}
\makeatletter
\makeatother
\begin{document}
{{
from datetime import datetime
write = response.write
#--------------------------------------------------------------------------
#
# title section
#
#--------------------------------------------------------------------------
write("\\title{%s}" % T("Harvester(s)"))
write("\maketitle")
#--------------------------------------------------------------------------
#
# Summary table
#
#--------------------------------------------------------------------------
write("\\begin{tabular}{|l|r|}")
write("\hline")
txt = datetime.now().strftime("%d %B %Y %H:%M")
write(" %s & %s \\\\" % ("", txt), escape=False)
write("\hline")
#
# User requirements
#
period = ""
if selector.year_start and selector.year_end:
period = T("from %s to %s") % (selector.year_start, selector.year_end)
elif selector.year_start:
period = str(selector.year_start)
pass
project = ""
if selector.id_projects:
project = db.projects[selector.id_projects].project
pass
write(" %s & %s \\\\" % (T("Period"), period), escape=False)
write(" %s & %s \\\\" % (T("Project"), project), escape=False)
write("\hline")
#
# summary of the processing
#
write(" %s & %s \\\\" % (T("Number of records found"), nfound), escape=False)
write(" %s & %s \\\\" % (T("Number of records inserted in the database"), ninsert), escape=False)
write("\hline")
write("\end{tabular}")
#--------------------------------------------------------------------------
#
# Summary per collections
#
#--------------------------------------------------------------------------
write("\\section*{%s}" % T("Summary per collections"))
write("\\begin{tabular}{|l|r|}")
write("\hline")
write(" %s & %s \\\\" % (T("Collection"), T("Records")), escape=False)
write("\hline")
if harvester.collections:
collections = harvester.collections.split(',')
for i in range(len(urls)):
url, ncount = urls[i]
url = url.replace("of=id", "")
href = "\href{%s}{%s}" % (url, collections[i].strip())
if isinstance(ncount, int):
txt = "{\color{grey} %i}" % ncount
else:
txt = "{\color{red} %s" % ncount
pass
write(" %s & %s \\\\" % (href, txt), escape=False)
pass
pass
write("\hline")
write("\end{tabular}")
#--------------------------------------------------------------------------
#
# Action per record
#
#--------------------------------------------------------------------------
write("\\section*{Action per record}")
write("\\begin{enumerate}")
for msg in logs:
title = msg.title
if msg.url:
title = "\href{%s}{%s}" % (msg.url, msg.title)
pass
if msg.action == 'reject':
colour = "red"
elif msg.action == 'load':
colour = "green"
else:
colour = "grey"
pass
txt = "\item %s. {\color{%s} %s}." % (title.encode('utf8'), colour, msg.txt)
write(txt, escape=False)
pass
write("\end{enumerate}")
}}
\end{document}
{{include}}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment