2021-07-04 12:32:13 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# ScoDoc
|
|
|
|
#
|
|
|
|
# Copyright (c) 1999 - 2021 Emmanuel Viennet. All rights reserved.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""
|
|
|
|
Module main: page d'accueil, avec liste des départements
|
|
|
|
|
|
|
|
Emmanuel Viennet, 2021
|
|
|
|
"""
|
|
|
|
import flask
|
2021-07-09 13:45:10 +02:00
|
|
|
from flask import render_template
|
2021-07-28 09:51:18 +02:00
|
|
|
from flask import request
|
|
|
|
from flask_login.utils import login_required
|
2021-07-04 12:32:13 +02:00
|
|
|
|
2021-08-13 09:31:49 +02:00
|
|
|
from app.models import Departement
|
2021-08-21 17:07:44 +02:00
|
|
|
import sco_version
|
2021-07-28 09:51:18 +02:00
|
|
|
from app.scodoc import sco_find_etud
|
2021-07-04 12:32:13 +02:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
2021-08-13 09:31:49 +02:00
|
|
|
from app.views import scodoc_bp as bp
|
2021-07-04 12:32:13 +02:00
|
|
|
|
|
|
|
|
2021-08-17 22:11:35 +02:00
|
|
|
@bp.route("/")
|
2021-07-04 12:32:13 +02:00
|
|
|
@bp.route("/ScoDoc")
|
|
|
|
@bp.route("/ScoDoc/index")
|
2021-08-13 09:31:49 +02:00
|
|
|
def index():
|
|
|
|
"Page d'accueil: liste des départements"
|
|
|
|
depts = Departement.query.filter_by(visible=True).all()
|
2021-07-04 12:32:13 +02:00
|
|
|
return render_template(
|
|
|
|
"scodoc.html",
|
2021-08-21 17:07:44 +02:00
|
|
|
title=sco_version.SCONAME,
|
2021-07-04 12:32:13 +02:00
|
|
|
current_app=flask.current_app,
|
2021-08-13 09:31:49 +02:00
|
|
|
depts=depts,
|
2021-07-04 12:32:13 +02:00
|
|
|
Permission=Permission,
|
|
|
|
)
|
2021-07-28 09:51:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/ScoDoc/table_etud_in_accessible_depts", methods=["POST"])
|
|
|
|
@login_required
|
|
|
|
def table_etud_in_accessible_depts():
|
|
|
|
"""recherche étudiants sur plusieurs départements"""
|
|
|
|
return sco_find_etud.table_etud_in_accessible_depts(expnom=request.form["expnom"])
|
2021-08-29 19:57:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
# essais
|
2021-08-29 22:42:38 +02:00
|
|
|
# @bp.route("/testlog")
|
|
|
|
# def testlog():
|
|
|
|
# import time
|
|
|
|
# from flask import current_app
|
|
|
|
# from app import log
|
2021-08-29 19:57:32 +02:00
|
|
|
|
2021-08-29 22:42:38 +02:00
|
|
|
# log(f"testlog called: handlers={current_app.logger.handlers}")
|
|
|
|
# current_app.logger.debug(f"testlog message DEBUG")
|
|
|
|
# current_app.logger.info(f"testlog message INFO")
|
|
|
|
# current_app.logger.warning(f"testlog message WARNING")
|
|
|
|
# current_app.logger.error(f"testlog message ERROR")
|
|
|
|
# current_app.logger.critical(f"testlog message CRITICAL")
|
|
|
|
# raise SyntaxError("une erreur de syntaxe")
|
|
|
|
# return "testlog completed at " + str(time.time())
|