# -*- 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 # ############################################################################## """Menu "custom" (défini par l'utilisateur) dans les semestres """ from sco_utils import * import notesdb as ndb from notes_log import log from TrivialFormulator import TrivialFormulator, TF import sco_formsemestre import sco_formsemestre_status import sco_edt_cal _custommenuEditor = ndb.EditableTable( "notes_formsemestre_custommenu", "custommenu_id", ("custommenu_id", "formsemestre_id", "title", "url", "idx"), sortkey="idx", ) notes_formsemestre_custommenu_create = _custommenuEditor.create notes_formsemestre_custommenu_list = _custommenuEditor.list notes_formsemestre_custommenu_edit = _custommenuEditor.edit def formsemestre_custommenu_get(context, formsemestre_id): "returns dict [ { 'title' : xxx, 'url' : xxx } ]" cnx = context.GetDBConnexion() vals = notes_formsemestre_custommenu_list(cnx, {"formsemestre_id": formsemestre_id}) return vals def formsemestre_custommenu_html(context, formsemestre_id, base_url=""): "HTML code for custom menu" menu = [] # Calendrier électronique ? sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) ics_url = sco_edt_cal.formsemestre_get_ics_url(context, sem) if ics_url: menu.append({"title": "Emploi du temps (ics)", "url": ics_url}) menu += formsemestre_custommenu_get(context, formsemestre_id) menu.append( { "title": "Modifier ce menu...", "url": base_url + "formsemestre_custommenu_edit?formsemestre_id=" + formsemestre_id, } ) return sco_formsemestre_status.htmlutils.make_menu("Liens", menu) def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None): """Dialog to edit the custom menu""" sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) H = [ context.html_sem_header(REQUEST, "Modification du menu du semestre ", sem), """
Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.
Procédez en plusieurs fois si vous voulez ajouter plusieurs items.
""", ] descr = [ ("formsemestre_id", {"input_type": "hidden"}), ( "sep", { "input_type": "separator", "template": "