forked from ScoDoc/ScoDoc
PV jury: fonds de page par departement
This commit is contained in:
parent
b01a4dff13
commit
63a18176ea
@ -779,7 +779,7 @@ vu l'arrêté n° %(Decnum)s du Président de l'%(UnivName)s;
|
||||
vu la délibération de la commission %(Type)s en date du %(Date)s présidée par le Chef du département;
|
||||
""",
|
||||
"title": """Paragraphe d'introduction sur le PV""",
|
||||
"explanation": """Balises remplacées: %(Univname)s = nom de l'université, %(DecNum)s = numéro de l'arrêté, %(Date)s = date de la commission, %(Type)s = type de commission (passage ou délivrance) """,
|
||||
"explanation": """Balises remplacées: %(Univname)s = nom de l'université, %(DecNum)s = numéro de l'arrêté, %(Date)s = date de la commission, %(Type)s = type de commission (passage ou délivrance), %(VDICode)s = code diplôme""",
|
||||
"input_type": "textarea",
|
||||
"cols": 80,
|
||||
"rows": 10,
|
||||
@ -816,6 +816,17 @@ vu la délibération de la commission %(Type)s en date du %(Date)s présidée pa
|
||||
"category": "pvpdf",
|
||||
},
|
||||
),
|
||||
(
|
||||
"PV_TITLE_WITH_VDI",
|
||||
{
|
||||
"initvalue": 0, # legacy
|
||||
"title": "Indiquer VDI et code dans le titre du PV",
|
||||
"explanation": "il est souvent préférable de l'inclure dans le paragraphe d'introduction.",
|
||||
"input_type": "boolcheckbox",
|
||||
"labels": ["non", "oui"],
|
||||
"category": "pvpdf",
|
||||
},
|
||||
),
|
||||
# marges PV paysages (en millimètres)
|
||||
(
|
||||
"pv_left_margin",
|
||||
|
71
sco_pvpdf.py
71
sco_pvpdf.py
@ -138,12 +138,12 @@ class CourrierIndividuelTemplate(PageTemplate):
|
||||
def __init__(
|
||||
self,
|
||||
document,
|
||||
context=None,
|
||||
pagesbookmarks={},
|
||||
author=None,
|
||||
title=None,
|
||||
subject=None,
|
||||
margins=(0, 0, 0, 0), # additional margins in mm (left,top,right, bottom)
|
||||
image_dir="",
|
||||
preferences=None, # dictionnary with preferences, required
|
||||
force_header=False,
|
||||
force_footer=False, # always add a footer (whatever the preferences, use for PV)
|
||||
@ -154,7 +154,6 @@ class CourrierIndividuelTemplate(PageTemplate):
|
||||
self.pdfmeta_author = author
|
||||
self.pdfmeta_title = title
|
||||
self.pdfmeta_subject = subject
|
||||
self.image_dir = image_dir
|
||||
self.preferences = preferences
|
||||
self.force_header = force_header
|
||||
self.force_footer = force_footer
|
||||
@ -187,29 +186,34 @@ class CourrierIndividuelTemplate(PageTemplate):
|
||||
self.background_image_filename = None
|
||||
self.logo_footer = None
|
||||
self.logo_header = None
|
||||
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:
|
||||
if template_name == "PVJuryTemplate":
|
||||
fn = image_dir + "/pvjury_background" + "." + suffix
|
||||
else:
|
||||
fn = image_dir + "/letter_background" + "." + suffix
|
||||
if os.path.exists(fn):
|
||||
self.background_image_filename = fn
|
||||
# Search logos in dept specific dir, then in global config dir
|
||||
for image_dir in (
|
||||
SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/",
|
||||
SCODOC_LOGOS_DIR + "/", # global logos
|
||||
):
|
||||
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:
|
||||
if template_name == "PVJuryTemplate":
|
||||
fn = image_dir + "/pvjury_background" + "." + suffix
|
||||
else:
|
||||
fn = image_dir + "/letter_background" + "." + suffix
|
||||
if not self.background_image_filename and os.path.exists(fn):
|
||||
self.background_image_filename = fn
|
||||
|
||||
fn = image_dir + "/logo_footer" + "." + suffix
|
||||
if os.path.exists(fn):
|
||||
self.logo_footer = Image(
|
||||
fn,
|
||||
height=LOGO_FOOTER_HEIGHT,
|
||||
width=LOGO_FOOTER_WIDTH,
|
||||
)
|
||||
fn = image_dir + "/logo_footer" + "." + suffix
|
||||
if not self.logo_footer and os.path.exists(fn):
|
||||
self.logo_footer = Image(
|
||||
fn,
|
||||
height=LOGO_FOOTER_HEIGHT,
|
||||
width=LOGO_FOOTER_WIDTH,
|
||||
)
|
||||
|
||||
fn = image_dir + "/logo_header" + "." + suffix
|
||||
if os.path.exists(fn):
|
||||
self.logo_header = Image(
|
||||
fn,
|
||||
height=LOGO_HEADER_HEIGHT,
|
||||
width=LOGO_HEADER_WIDTH,
|
||||
)
|
||||
fn = image_dir + "/logo_header" + "." + suffix
|
||||
if not self.logo_header and os.path.exists(fn):
|
||||
self.logo_header = Image(
|
||||
fn,
|
||||
height=LOGO_HEADER_HEIGHT,
|
||||
width=LOGO_HEADER_WIDTH,
|
||||
)
|
||||
|
||||
def beforeDrawPage(self, canvas, doc):
|
||||
"""Draws a logo and an contribution message on each page."""
|
||||
@ -258,11 +262,11 @@ class PVTemplate(CourrierIndividuelTemplate):
|
||||
def __init__(
|
||||
self,
|
||||
document,
|
||||
context=None,
|
||||
author=None,
|
||||
title=None,
|
||||
subject=None,
|
||||
margins=None, # additional margins in mm (left,top,right, bottom)
|
||||
image_dir="",
|
||||
preferences=None, # dictionnary with preferences, required
|
||||
):
|
||||
if margins is None:
|
||||
@ -275,11 +279,11 @@ class PVTemplate(CourrierIndividuelTemplate):
|
||||
CourrierIndividuelTemplate.__init__(
|
||||
self,
|
||||
document,
|
||||
context=context,
|
||||
author=author,
|
||||
title=title,
|
||||
subject=subject,
|
||||
margins=margins,
|
||||
image_dir=image_dir,
|
||||
preferences=preferences,
|
||||
force_header=True,
|
||||
force_footer=True,
|
||||
@ -369,18 +373,15 @@ def pdf_lettres_individuelles(
|
||||
# ----- Build PDF
|
||||
report = cStringIO.StringIO() # in-memory document, no disk file
|
||||
document = BaseDocTemplate(report)
|
||||
image_dir = SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/"
|
||||
if not os.path.exists(image_dir):
|
||||
image_dir = SCODOC_LOGOS_DIR + "/" # use global logos
|
||||
document.addPageTemplates(
|
||||
CourrierIndividuelTemplate(
|
||||
document,
|
||||
context=context,
|
||||
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
|
||||
title="Lettres décision %s" % sem["titreannee"],
|
||||
subject="Décision jury",
|
||||
margins=margins,
|
||||
pagesbookmarks=bookmarks,
|
||||
image_dir=image_dir,
|
||||
preferences=prefs,
|
||||
)
|
||||
)
|
||||
@ -642,16 +643,13 @@ def pvjury_pdf(
|
||||
report = cStringIO.StringIO() # in-memory document, no disk file
|
||||
document = BaseDocTemplate(report)
|
||||
document.pagesize = landscape(A4)
|
||||
image_dir = SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/"
|
||||
if not os.path.exists(image_dir):
|
||||
image_dir = SCODOC_LOGOS_DIR + "/" # use global logos
|
||||
document.addPageTemplates(
|
||||
PVTemplate(
|
||||
document,
|
||||
context=context,
|
||||
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
|
||||
title=SU("PV du jury de %s" % sem["titre_num"]),
|
||||
subject="PV jury",
|
||||
image_dir=image_dir,
|
||||
preferences=context.get_preferences(formsemestre_id),
|
||||
)
|
||||
)
|
||||
@ -730,8 +728,11 @@ def _pvjury_pdf_type(
|
||||
objects += makeParas(
|
||||
"""<para align="center"><b>Semestre: %s</b></para>""" % sem["titre"], style
|
||||
)
|
||||
if VDICode:
|
||||
objects += makeParas("""<para align="center">%s</para>""" % VDICode, style)
|
||||
if context.get_preference("PV_TITLE_WITH_VDI", formsemestre_id):
|
||||
objects += makeParas(
|
||||
"""<para align="center">VDI et Code: %s</para>""" % (VDICode or ""), style
|
||||
)
|
||||
|
||||
if date_jury:
|
||||
objects += makeParas(
|
||||
"""<para align="center">Jury tenu le %s</para>""" % date_jury, style
|
||||
|
Loading…
Reference in New Issue
Block a user