This commit is contained in:
IDK 2021-02-05 22:16:30 +01:00
parent 031c877afb
commit 860ca5d8f7
10 changed files with 104 additions and 56 deletions

View File

@ -9,7 +9,7 @@
v 1.2
"""
from types import *
from types import BooleanType, StringType
def TrivialFormulator(
@ -44,7 +44,7 @@ def TrivialFormulator(
-1 cancel (if cancelbutton specified)
HTML form: html string (form to insert in your web page)
values: None or, when the form is submitted and correctly filled,
a dictionnary with the requeted values.
a dictionnary with the requeted values.
formdescription: sequence [ (field, description), ... ]
where description is a dict with following (optional) keys:
default : default value for this field ('')
@ -63,7 +63,7 @@ def TrivialFormulator(
withcheckbox: if true, place a checkbox at the left of the input
elem. Checked items will be returned in 'tf-checked'
attributes: a liste of strings to put in the HTML form element
template: HTML template for element
template: HTML template for element
HTML elements:
input_type : 'text', 'textarea', 'password',
'radio', 'menu', 'checkbox',
@ -368,9 +368,6 @@ class TF:
idx = 0
for idx in range(len(self.formdescription)):
(field, descr) = self.formdescription[idx]
nextitemname = None
if idx < len(self.formdescription) - 2:
nextitemname = self.formdescription[idx + 1][0]
if descr.get("readonly", False):
R.append(self._ReadOnlyElement(field, descr))
continue
@ -682,7 +679,6 @@ class TF:
"Generate HTML for an element, read-only"
R = []
title = descr.get("title", field.capitalize())
withcheckbox = descr.get("withcheckbox", False)
input_type = descr.get("input_type", "text")
klass = descr.get("cssclass", "")
klass = " " + klass

View File

@ -1,11 +1,15 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "7.21"
SCOVERSION = "7.22"
SCONAME = "ScoDoc"
SCONEWS = """
<h4>Année 2021</h4>
<ul>
<li>Modernisation du code Python.</li>
</ul>
<h4>Année 2020</h4>
<ul>
<li>Corrections d'erreurs, améliorations saise absences< et affichage bulletins</li>

View File

@ -8,8 +8,8 @@ import psycopg2.pool
import psycopg2.extras
import thread
from notes_log import log
from sco_exceptions import *
from types import *
from sco_exceptions import ScoException, ScoValueError, NoteProcessError
from types import StringType
from cgi import escape
import datetime
@ -175,7 +175,7 @@ def DBSelectArgs(
cond = ""
i = 1
cl = []
for (aux_tab, aux_id) in aux_tables:
for (_, aux_id) in aux_tables:
cl.append("T0.%s = T%d.%s" % (id_name, i, aux_id))
i = i + 1
cond += " and ".join(cl)

View File

@ -36,7 +36,7 @@ Created on Fri Sep 9 09:15:05 2016
@author: barasc
"""
from pe_tools import *
from pe_tools import pe_print, PE_DEBUG
import pe_tagtable
import pe_semestretag

View File

@ -44,7 +44,7 @@ from gen_tables import GenTable
import sco_codes_parcours
import pe_tools
from pe_tools import *
from pe_tools import PE_LATEX_ENCODING
import pe_tagtable
import pe_semestretag
import pe_settag

View File

@ -172,7 +172,7 @@ def module_create(context, matiere_id=None, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
else:
moduleid = context.do_module_create(tf[2], REQUEST)
context.do_module_create(tf[2], REQUEST)
return REQUEST.RESPONSE.redirect(
REQUEST.URL1 + "/ue_list?formation_id=" + UE["formation_id"]
)
@ -397,7 +397,6 @@ def edit_module_set_code_apogee(context, id=None, value=None, REQUEST=None):
modules = context.do_module_list(args={"module_id": module_id})
if not modules:
return "module invalide" # shoud not occur
module = modules[0]
context.do_module_edit({"module_id": module_id, "code_apogee": value})
if not value:

View File

@ -27,11 +27,37 @@
"""Semestres: gestion parcours DUT (Arreté du 13 août 2005)
"""
from types import FloatType
import sco_utils as scu
import notesdb as ndb
from notes_log import log
from scolog import logdb
import sco_formsemestre
from sco_codes_parcours import *
from sco_codes_parcours import (
CMP,
ADC,
ADJ,
ADM,
AJ,
ATT,
NO_SEMESTRE_ID,
BUG,
NEXT,
NEXT2,
NEXT_OR_NEXT2,
REO,
REDOANNEE,
REDOSEM,
RA_OR_NEXT,
RA_OR_RS,
RS_OR_NEXT,
CODES_SEM_VALIDES,
NOTES_BARRE_GEN_COMPENSATION,
code_semestre_attente,
code_semestre_validant,
)
from dutrules import DUTRules # regles generees a partir du CSV
from sco_exceptions import ScoValueError
@ -166,7 +192,7 @@ class SituationEtudParcoursGeneric:
if rule.conclusion[5] == BUG:
log("get_possible_choices: inconsistency: state=%s" % str(state))
#
valid_semestre = code_semestre_validant(rule.conclusion[0])
# valid_semestre = code_semestre_validant(rule.conclusion[0])
choices.append(
DecisionSem(
code_etat=rule.conclusion[0],
@ -391,7 +417,7 @@ class SituationEtudParcoursGeneric:
)
self.moy_gen = self.nt.get_etud_moy_gen(self.etudid)
self.barre_moy_ok = (type(self.moy_gen) == FloatType) and (
self.moy_gen >= (self.parcours.BARRE_MOY - NOTES_TOLERANCE)
self.moy_gen >= (self.parcours.BARRE_MOY - scu.NOTES_TOLERANCE)
)
# conserve etat UEs
ue_ids = [

View File

@ -29,24 +29,37 @@
"""
import os
import types
import re
import cStringIO
import reportlab
from reportlab.lib.units import cm, mm
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Frame, PageBreak
from reportlab.platypus import Table, TableStyle, Image, KeepInFrame
from reportlab.platypus.flowables import Flowable
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib import styles
from reportlab.lib.colors import Color
from sco_pdf import *
import sco_utils as scu
import sco_pdf
from sco_pdf import SU
import sco_formsemestre
import sco_pvjury
import sco_codes_parcours
from sco_pdf import PDFLOCK
import sco_preferences
import sco_bulletins_pdf
import VERSION
LOGO_FOOTER_ASPECT = scu.CONFIG.LOGO_FOOTER_ASPECT # XXX A AUTOMATISER
LOGO_FOOTER_HEIGHT = scu.CONFIG.LOGO_FOOTER_HEIGHT * mm
LOGO_FOOTER_WIDTH = LOGO_FOOTER_HEIGHT * scu.CONFIG.LOGO_FOOTER_ASPECT
LOGO_FOOTER_ASPECT = CONFIG.LOGO_FOOTER_ASPECT # XXX A AUTOMATISER
LOGO_FOOTER_HEIGHT = CONFIG.LOGO_FOOTER_HEIGHT * mm
LOGO_FOOTER_WIDTH = LOGO_FOOTER_HEIGHT * CONFIG.LOGO_FOOTER_ASPECT
LOGO_HEADER_ASPECT = CONFIG.LOGO_HEADER_ASPECT # XXX logo IUTV (A AUTOMATISER)
LOGO_HEADER_HEIGHT = CONFIG.LOGO_HEADER_HEIGHT * mm
LOGO_HEADER_WIDTH = LOGO_HEADER_HEIGHT * CONFIG.LOGO_HEADER_ASPECT
LOGO_HEADER_ASPECT = scu.CONFIG.LOGO_HEADER_ASPECT # XXX logo IUTV (A AUTOMATISER)
LOGO_HEADER_HEIGHT = scu.CONFIG.LOGO_HEADER_HEIGHT * mm
LOGO_HEADER_WIDTH = LOGO_HEADER_HEIGHT * scu.CONFIG.LOGO_HEADER_ASPECT
def pageFooter(canvas, doc, logo, preferences, with_page_numbers=True):
@ -76,7 +89,7 @@ def pageFooter(canvas, doc, logo, preferences, with_page_numbers=True):
RightFootStyle.fontSize = preferences["SCOLAR_FONT_SIZE_FOOT"]
RightFootStyle.alignment = TA_RIGHT
p = makeParas(
p = sco_pdf.makeParas(
"""<para>%s</para><para>%s</para>"""
% (preferences["INSTITUTION_NAME"], preferences["INSTITUTION_ADDRESS"]),
LeftFootStyle,
@ -186,12 +199,12 @@ class CourrierIndividuelTemplate(PageTemplate):
self.background_image_filename = None
self.logo_footer = None
self.logo_header = None
# Search logos in dept specific dir, then in global config dir
# Search logos in dept specific dir, then in global scu.CONFIG dir
for image_dir in (
SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/",
SCODOC_LOGOS_DIR + "/", # global logos
scu.SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/",
scu.SCODOC_LOGOS_DIR + "/", # global logos
):
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:
for suffix in scu.LOGOS_IMAGES_ALLOWED_TYPES:
if template_name == "PVJuryTemplate":
fn = image_dir + "/pvjury_background" + "." + suffix
else:
@ -377,7 +390,7 @@ def pdf_lettres_individuelles(
CourrierIndividuelTemplate(
document,
context=context,
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
author="%s %s (E. Viennet)" % (VERSION.SCONAME, VERSION.SCOVERSION),
title="Lettres décision %s" % sem["titreannee"],
subject="Décision jury",
margins=margins,
@ -514,7 +527,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
% params
)
sig = _simulate_br(sig, '<para leftindent="%(htab1)s">')
objects += makeParas(
objects += sco_pdf.makeParas(
(
"""<para leftindent="%(htab1)s" spaceBefore="25mm">"""
+ sig
@ -529,7 +542,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
% params
)
sig = _simulate_br(sig, '<para leftindent="%(htab1)s">')
objects += makeParas(
objects += sco_pdf.makeParas(
(
"""<para leftindent="%(htab1)s" spaceBefore="25mm">"""
+ sig
@ -650,7 +663,7 @@ def pvjury_pdf(
PVTemplate(
document,
context=context,
author="%s %s (E. Viennet)" % (SCONAME, SCOVERSION),
author="%s %s (E. Viennet)" % (VERSION.SCONAME, VERSION.SCOVERSION),
title=SU("PV du jury de %s" % sem["titre_num"]),
subject="PV jury",
preferences=context.get_preferences(formsemestre_id),
@ -683,7 +696,7 @@ def _pvjury_pdf_type(
sem = dpv["formsemestre"]
formsemestre_id = sem["formsemestre_id"]
titre_jury, titre_court_jury = _descr_jury(sem, diplome)
titre_jury, _ = _descr_jury(sem, diplome)
titre_diplome = pv_title or dpv["formation"]["titre_officiel"]
objects = []
@ -708,7 +721,7 @@ def _pvjury_pdf_type(
bulletStyle.spaceAfter = 5 * mm
objects += [Spacer(0, 5 * mm)]
objects += makeParas(
objects += sco_pdf.makeParas(
"""
<para align="center"><b>Procès-verbal de %s du département %s - Session unique %s</b></para>
"""
@ -720,7 +733,7 @@ def _pvjury_pdf_type(
style,
)
objects += makeParas(
objects += sco_pdf.makeParas(
"""
<para align="center"><b><i>%s</i></b></para>
"""
@ -729,20 +742,20 @@ def _pvjury_pdf_type(
)
if showTitle:
objects += makeParas(
objects += sco_pdf.makeParas(
"""<para align="center"><b>Semestre: %s</b></para>""" % sem["titre"], style
)
if context.get_preference("PV_TITLE_WITH_VDI", formsemestre_id):
objects += makeParas(
objects += sco_pdf.makeParas(
"""<para align="center">VDI et Code: %s</para>""" % (VDICode or ""), style
)
if date_jury:
objects += makeParas(
objects += sco_pdf.makeParas(
"""<para align="center">Jury tenu le %s</para>""" % date_jury, style
)
objects += makeParas(
objects += sco_pdf.makeParas(
"<para>"
+ context.get_preference("PV_INTRO", formsemestre_id)
% {
@ -757,7 +770,7 @@ def _pvjury_pdf_type(
bulletStyle,
)
objects += makeParas(
objects += sco_pdf.makeParas(
"""<para>Le jury propose les décisions suivantes :</para>""", style
)
objects += [Spacer(0, 4 * mm)]
@ -809,7 +822,7 @@ def _pvjury_pdf_type(
objects.append(Table(Pt, repeatRows=1, colWidths=widths, style=table_style))
# Signature du directeur
objects += makeParas(
objects += sco_pdf.makeParas(
"""<para spaceBefore="10mm" align="right">
Le %s, %s</para>"""
% (
@ -822,7 +835,7 @@ def _pvjury_pdf_type(
# Légende des codes
codes = sco_codes_parcours.CODES_EXPL.keys()
codes.sort()
objects += makeParas(
objects += sco_pdf.makeParas(
"""<para spaceBefore="15mm" fontSize="14">
<b>Codes utilisés :</b></para>""",
style,

View File

@ -28,16 +28,27 @@
"""Photos: trombinoscopes
"""
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
from cStringIO import StringIO
from zipfile import ZipFile, BadZipfile
import xml
import tempfile
import reportlab
from reportlab.lib.units import cm, mm
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Frame, PageBreak
from reportlab.platypus import Table, TableStyle, Image, KeepInFrame
from reportlab.platypus.flowables import Flowable
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib import styles
from reportlab.lib.colors import Color
from reportlab.lib import colors
from PIL import Image as PILImage
from notes_log import log
import sco_utils as scu
import sco_pdf
from sco_pdf import SU
from sco_exceptions import ScoValueError
from TrivialFormulator import TrivialFormulator
import scolars
@ -47,11 +58,8 @@ import sco_groups
import sco_groups_view
import sco_portal_apogee
import htmlutils
from sco_pdf import *
import ImportScolars
import sco_excel
from reportlab.lib import colors
from PIL import Image as PILImage
def trombino(
@ -368,7 +376,7 @@ def _trombino_pdf(context, groups_infos, REQUEST):
# Build document
document = BaseDocTemplate(report)
document.addPageTemplates(
ScolarsPageTemplate(
sco_pdf.ScolarsPageTemplate(
document,
context=context,
preferences=context.get_preferences(sem["formsemestre_id"]),
@ -451,7 +459,7 @@ def _listeappel_photos_pdf(context, groups_infos, REQUEST):
# Build document
document = BaseDocTemplate(report)
document.addPageTemplates(
ScolarsPageTemplate(
sco_pdf.ScolarsPageTemplate(
document,
context,
preferences=context.get_preferences(sem["formsemestre_id"]),

View File

@ -26,8 +26,10 @@
##############################################################################
import pdb, os, sys
from sco_exceptions import *
import pdb
import os
import sys
import notesdb as ndb
from notes_log import retreive_request