# -*- mode: python -*- # -*- coding: utf-8 -*- ############################################################################## # # Gestion scolarite IUT # # Copyright (c) 1999 - 2024 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 # ############################################################################## """HTML Header/Footer for ScoDoc pages""" from flask import g, render_template, url_for from flask_login import current_user import app.scodoc.sco_utils as scu from app import scodoc_flash_status_messages from app.scodoc import html_sidebar import sco_version # Some constants: BOOTSTRAP_JS = ["libjs/bootstrap/js/bootstrap.min.js", "libjs/purl.js"] BOOTSTRAP_CSS = ["libjs/bootstrap/css/bootstrap.min.css"] def standard_html_header(): """Standard HTML header for pages outside depts""" # not used in ZScolar, see sco_header return f""" ScoDoc: accueil {scu.CUSTOM_HTML_HEADER_CNX}""" def standard_html_footer(): """Le pied de page HTML de la page d'accueil.""" return f"""

Problèmes et suggestions sur le logiciel: {scu.SCO_USERS_LIST}

ScoDoc est un logiciel libre développé par Emmanuel Viennet.

""" _HTML_BEGIN = f""" %(page_title)s """ def scodoc_top_html_header(page_title="ScoDoc: bienvenue"): """HTML header for top level pages""" H = [ _HTML_BEGIN % {"page_title": page_title, "encoding": scu.SCO_ENCODING}, """""", scu.CUSTOM_HTML_HEADER_CNX, ] return "\n".join(H) # Header: def sco_header( # optional args page_title="", # page title no_sidebar=False, # hide sidebar cssstyles=(), # additionals CSS sheets javascripts=(), # additionals JS filenames to load scripts=(), # script to put in page header init_google_maps=False, # Google maps titrebandeau="", # titre dans bandeau superieur etudid=None, formsemestre_id=None, ): """Main HTML page header for ScoDoc Utilisé dans les anciennes pages. Les nouvelles pages utilisent le template Jinja. """ from app.scodoc.sco_formsemestre_status import formsemestre_page_title if etudid is not None: g.current_etudid = etudid scodoc_flash_status_messages() params = { "page_title": page_title or sco_version.SCONAME, "no_sidebar": no_sidebar, "ScoURL": url_for("scolar.index_html", scodoc_dept=g.scodoc_dept), "encoding": scu.SCO_ENCODING, "titrebandeau_mkup": "" + titrebandeau + "", "authuser": current_user.user_name, } if no_sidebar: params["margin_left"] = "1em" else: params["margin_left"] = "140px" H = [_HTML_BEGIN % params] if init_google_maps: # It may be necessary to add an API key: H.append('') # Feuilles de style additionnelles: for cssstyle in cssstyles: H.append( f"""\n""" ) H.append( f""" """ ) if init_google_maps: # utilisé uniquement pour carte lycées H.append( f'' ) # JS additionels for js in javascripts: H.append(f"""\n""") H.append( f""" """ ) # Scripts de la page: if scripts: H.append("""""") # Fin head, Body et bandeau haut: H.append( f""" {scu.CUSTOM_HTML_HEADER} {'' if no_sidebar else html_sidebar.sidebar(etudid)}
""" ) # En attendant le replacement complet de cette fonction, # inclusion ici des messages flask H.append(render_template("flashed_messages.j2")) # # Barre menu semestre: H.append(formsemestre_page_title(formsemestre_id)) # div pour affichage messages temporaires H.append('
') # H.append('
') return "".join(H) def sco_footer(): """Main HTMl pages footer""" return ( """
""" + scu.CUSTOM_HTML_FOOTER + """""" ) def html_sem_header( title, with_page_header=True, with_h2=True, page_title=None, **args ): "Titre d'une page semestre avec lien vers tableau de bord" # sem now unused and thus optional... if with_page_header: h = sco_header(page_title="%s" % (page_title or title), **args) else: h = "" if with_h2: return h + f"""

{title}

""" else: return h