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;
|
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""",
|
"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",
|
"input_type": "textarea",
|
||||||
"cols": 80,
|
"cols": 80,
|
||||||
"rows": 10,
|
"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",
|
"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)
|
# marges PV paysages (en millimètres)
|
||||||
(
|
(
|
||||||
"pv_left_margin",
|
"pv_left_margin",
|
||||||
|
71
sco_pvpdf.py
71
sco_pvpdf.py
@ -138,12 +138,12 @@ class CourrierIndividuelTemplate(PageTemplate):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
document,
|
document,
|
||||||
|
context=None,
|
||||||
pagesbookmarks={},
|
pagesbookmarks={},
|
||||||
author=None,
|
author=None,
|
||||||
title=None,
|
title=None,
|
||||||
subject=None,
|
subject=None,
|
||||||
margins=(0, 0, 0, 0), # additional margins in mm (left,top,right, bottom)
|
margins=(0, 0, 0, 0), # additional margins in mm (left,top,right, bottom)
|
||||||
image_dir="",
|
|
||||||
preferences=None, # dictionnary with preferences, required
|
preferences=None, # dictionnary with preferences, required
|
||||||
force_header=False,
|
force_header=False,
|
||||||
force_footer=False, # always add a footer (whatever the preferences, use for PV)
|
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_author = author
|
||||||
self.pdfmeta_title = title
|
self.pdfmeta_title = title
|
||||||
self.pdfmeta_subject = subject
|
self.pdfmeta_subject = subject
|
||||||
self.image_dir = image_dir
|
|
||||||
self.preferences = preferences
|
self.preferences = preferences
|
||||||
self.force_header = force_header
|
self.force_header = force_header
|
||||||
self.force_footer = force_footer
|
self.force_footer = force_footer
|
||||||
@ -187,29 +186,34 @@ class CourrierIndividuelTemplate(PageTemplate):
|
|||||||
self.background_image_filename = None
|
self.background_image_filename = None
|
||||||
self.logo_footer = None
|
self.logo_footer = None
|
||||||
self.logo_header = None
|
self.logo_header = None
|
||||||
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:
|
# Search logos in dept specific dir, then in global config dir
|
||||||
if template_name == "PVJuryTemplate":
|
for image_dir in (
|
||||||
fn = image_dir + "/pvjury_background" + "." + suffix
|
SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/",
|
||||||
else:
|
SCODOC_LOGOS_DIR + "/", # global logos
|
||||||
fn = image_dir + "/letter_background" + "." + suffix
|
):
|
||||||
if os.path.exists(fn):
|
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:
|
||||||
self.background_image_filename = fn
|
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
|
fn = image_dir + "/logo_footer" + "." + suffix
|
||||||
if os.path.exists(fn):
|
if not self.logo_footer and os.path.exists(fn):
|
||||||
self.logo_footer = Image(
|
self.logo_footer = Image(
|
||||||
fn,
|
fn,
|
||||||
height=LOGO_FOOTER_HEIGHT,
|
height=LOGO_FOOTER_HEIGHT,
|
||||||
width=LOGO_FOOTER_WIDTH,
|
width=LOGO_FOOTER_WIDTH,
|
||||||
)
|
)
|
||||||
|
|
||||||
fn = image_dir + "/logo_header" + "." + suffix
|
fn = image_dir + "/logo_header" + "." + suffix
|
||||||
if os.path.exists(fn):
|
if not self.logo_header and os.path.exists(fn):
|
||||||
self.logo_header = Image(
|
self.logo_header = Image(
|
||||||
fn,
|
fn,
|
||||||
height=LOGO_HEADER_HEIGHT,
|
height=LOGO_HEADER_HEIGHT,
|
||||||
width=LOGO_HEADER_WIDTH,
|
width=LOGO_HEADER_WIDTH,
|
||||||
)
|
)
|
||||||
|
|
||||||
def beforeDrawPage(self, canvas, doc):
|
def beforeDrawPage(self, canvas, doc):
|
||||||
"""Draws a logo and an contribution message on each page."""
|
"""Draws a logo and an contribution message on each page."""
|
||||||
@ -258,11 +262,11 @@ class PVTemplate(CourrierIndividuelTemplate):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
document,
|
document,
|
||||||
|
context=None,
|
||||||
author=None,
|
author=None,
|
||||||
title=None,
|
title=None,
|
||||||
subject=None,
|
subject=None,
|
||||||
margins=None, # additional margins in mm (left,top,right, bottom)
|
margins=None, # additional margins in mm (left,top,right, bottom)
|
||||||
image_dir="",
|
|
||||||
preferences=None, # dictionnary with preferences, required
|
preferences=None, # dictionnary with preferences, required
|
||||||
):
|
):
|
||||||
if margins is None:
|
if margins is None:
|
||||||
@ -275,11 +279,11 @@ class PVTemplate(CourrierIndividuelTemplate):
|
|||||||
CourrierIndividuelTemplate.__init__(
|
CourrierIndividuelTemplate.__init__(
|
||||||
self,
|
self,
|
||||||
document,
|
document,
|
||||||
|
context=context,
|
||||||
author=author,
|
author=author,
|
||||||
title=title,
|
title=title,
|
||||||
subject=subject,
|
subject=subject,
|
||||||
margins=margins,
|
margins=margins,
|
||||||
image_dir=image_dir,
|
|
||||||
preferences=preferences,
|
preferences=preferences,
|
||||||
force_header=True,
|
force_header=True,
|
||||||
force_footer=True,
|
force_footer=True,
|
||||||
@ -369,18 +373,15 @@ def pdf_lettres_individuelles(
|
|||||||
# ----- Build PDF
|
# ----- Build PDF
|
||||||
report = cStringIO.StringIO() # in-memory document, no disk file
|
report = cStringIO.StringIO() # in-memory document, no disk file
|
||||||
document = BaseDocTemplate(report)
|
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(
|
document.addPageTemplates(
|
||||||
CourrierIndividuelTemplate(
|
CourrierIndividuelTemplate(
|
||||||
document,
|
document,
|
||||||
|
context=context,
|
||||||
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
|
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
|
||||||
title="Lettres décision %s" % sem["titreannee"],
|
title="Lettres décision %s" % sem["titreannee"],
|
||||||
subject="Décision jury",
|
subject="Décision jury",
|
||||||
margins=margins,
|
margins=margins,
|
||||||
pagesbookmarks=bookmarks,
|
pagesbookmarks=bookmarks,
|
||||||
image_dir=image_dir,
|
|
||||||
preferences=prefs,
|
preferences=prefs,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -642,16 +643,13 @@ def pvjury_pdf(
|
|||||||
report = cStringIO.StringIO() # in-memory document, no disk file
|
report = cStringIO.StringIO() # in-memory document, no disk file
|
||||||
document = BaseDocTemplate(report)
|
document = BaseDocTemplate(report)
|
||||||
document.pagesize = landscape(A4)
|
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(
|
document.addPageTemplates(
|
||||||
PVTemplate(
|
PVTemplate(
|
||||||
document,
|
document,
|
||||||
|
context=context,
|
||||||
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
|
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
|
||||||
title=SU("PV du jury de %s" % sem["titre_num"]),
|
title=SU("PV du jury de %s" % sem["titre_num"]),
|
||||||
subject="PV jury",
|
subject="PV jury",
|
||||||
image_dir=image_dir,
|
|
||||||
preferences=context.get_preferences(formsemestre_id),
|
preferences=context.get_preferences(formsemestre_id),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -730,8 +728,11 @@ def _pvjury_pdf_type(
|
|||||||
objects += makeParas(
|
objects += makeParas(
|
||||||
"""<para align="center"><b>Semestre: %s</b></para>""" % sem["titre"], style
|
"""<para align="center"><b>Semestre: %s</b></para>""" % sem["titre"], style
|
||||||
)
|
)
|
||||||
if VDICode:
|
if context.get_preference("PV_TITLE_WITH_VDI", formsemestre_id):
|
||||||
objects += makeParas("""<para align="center">%s</para>""" % VDICode, style)
|
objects += makeParas(
|
||||||
|
"""<para align="center">VDI et Code: %s</para>""" % (VDICode or ""), style
|
||||||
|
)
|
||||||
|
|
||||||
if date_jury:
|
if date_jury:
|
||||||
objects += makeParas(
|
objects += makeParas(
|
||||||
"""<para align="center">Jury tenu le %s</para>""" % date_jury, style
|
"""<para align="center">Jury tenu le %s</para>""" % date_jury, style
|
||||||
|
Loading…
Reference in New Issue
Block a user