# -*- mode: python -*- # -*- coding: utf-8 -*- ############################################################################## # # Gestion scolarite IUT # # 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 # ############################################################################## import cgi import sco_utils as scu from sco_formsemestre_status import formsemestre_page_title """ HTML Header/Footer for ScoDoc pages """ # Some constants: # Multiselect menus are used on a few pages and not loaded by default BOOTSTRAP_MULTISELECT_JS = [ "libjs/bootstrap-3.1.1-dist/js/bootstrap.min.js", "libjs/bootstrap-multiselect/bootstrap-multiselect.js", "libjs/purl.js", ] BOOTSTRAP_MULTISELECT_CSS = [ "libjs/bootstrap-3.1.1-dist/css/bootstrap.min.css", "libjs/bootstrap-3.1.1-dist/css/bootstrap-theme.min.css", "libjs/bootstrap-multiselect/bootstrap-multiselect.css", ] # Header: def sco_header( context, REQUEST=None, # optional args container=None, # objet qui a lancé la demande page_title="", # page title no_side_bar=False, # hide sidebar cssstyles=[], # additionals CSS sheets javascripts=[], # additionals JS filenames to load scripts=[], # script to put in page header bodyOnLoad="", # JS init_jquery=True, # load and init jQuery init_jquery_ui=True, # include all stuff for jquery-ui and initialize scripts init_qtip=False, # include qTip init_google_maps=False, # Google maps init_datatables=True, titrebandeau="", # titre dans bandeau superieur head_message="", # message action (petit cadre jaune en haut) user_check=True, # verifie passwords temporaires ): "Main HTML page header for ScoDoc" # If running for first time, initialize roles and permissions try: ri = context.roles_initialized except: ri = None # old instances does not have this attribute if ri == "0": context._setup_initial_roles_and_permissions() # context est une instance de ZScolar. container est une instance qui "acquiert" ZScolar if container: context = container # je pense que cela suffit pour ce qu'on veut. # Add a HTTP header (can be used by Apache to log requests) if REQUEST.AUTHENTICATED_USER: REQUEST.RESPONSE.setHeader("X-ScoDoc-User", str(REQUEST.AUTHENTICATED_USER)) # Get more parameters from REQUEST if not head_message and REQUEST.form.has_key("head_message"): head_message = REQUEST.form["head_message"] params = { "page_title": page_title or context.title_or_id(), "no_side_bar": no_side_bar, "ScoURL": context.ScoURL(), "encoding": scu.SCO_ENCODING, "titrebandeau_mkup": "" + titrebandeau + "", "authuser": str(REQUEST.AUTHENTICATED_USER), } if bodyOnLoad: params["bodyOnLoad_mkup"] = """onload="%s" """ % bodyOnLoad else: params["bodyOnLoad_mkup"] = "" if no_side_bar: params["margin_left"] = "1em" else: params["margin_left"] = "140px" if init_jquery_ui or init_qtip or init_datatables: init_jquery = True H = [ """ %(page_title)s """ % params ] # jQuery UI if init_jquery_ui: # can modify loaded theme here H.append( '\n' ) 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( """\n""" % cssstyle ) H.append( """ """ % params ) # jQuery if init_jquery: H.append( """ """ ) H.append( '' ) # qTip if init_qtip: H.append( '' ) H.append( '' ) if init_jquery_ui: H.append( '' ) # H.append('') H.append( '' ) if init_google_maps: H.append( '' ) if init_datatables: H.append( '' ) H.append( '' ) # JS additionels for js in javascripts: H.append( """\n""" % js ) H.append( """ """ % params ) # Scripts de la page: if scripts: H.append("""""") H.append("") # Body et bandeau haut: H.append("""""" % params) H.append(scu.CUSTOM_HTML_HEADER) # if not no_side_bar: H.append(context.sidebar(REQUEST)) H.append("""
""") # # Barre menu semestre: H.append(formsemestre_page_title(context, REQUEST)) # Avertissement si mot de passe à changer if user_check: authuser = REQUEST.AUTHENTICATED_USER passwd_temp = context.Users.user_info(user_name=str(authuser))["passwd_temp"] if passwd_temp: H.append( """
Attention !
Vous avez reçu un mot de passe temporaire.
Vous devez le changer: cliquez ici
""" % (context.ScoURL(), str(authuser)) ) # if head_message: H.append('
' + cgi.escape(head_message) + "
") # # div pour affichage messages temporaires H.append('
') # return "".join(H) def sco_footer(context, REQUEST=None): """Main HTMl pages footer""" return ( """
""" + scu.CUSTOM_HTML_FOOTER + """""" )