2020-09-26 16:19:37 +02:00
# -*- mode: python -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Gestion scolarite IUT
#
2021-01-01 17:51:08 +01:00
# Copyright (c) 1999 - 2021 Emmanuel Viennet. All rights reserved.
2020-09-26 16:19:37 +02:00
#
# 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
#
##############################################################################
""" Formulaires gestion des groupes
"""
2021-06-19 23:21:37 +02:00
from app . scodoc import html_sco_header
from app . scodoc import sco_groups
from app . scodoc . sco_exceptions import AccessDenied
2020-09-26 16:19:37 +02:00
2021-09-27 10:20:10 +02:00
def affectGroups ( partition_id ) :
2020-09-26 16:19:37 +02:00
""" Formulaire affectation des etudiants aux groupes de la partition.
Permet aussi la creation et la suppression de groupes .
"""
# Ported from DTML and adapted to new group management (nov 2009)
2021-08-19 10:28:35 +02:00
partition = sco_groups . get_partition ( partition_id )
2020-09-26 16:19:37 +02:00
formsemestre_id = partition [ " formsemestre_id " ]
2021-07-29 16:31:15 +02:00
if not sco_groups . sco_permissions_check . can_change_groups ( formsemestre_id ) :
2020-09-26 16:19:37 +02:00
raise AccessDenied ( " vous n ' avez pas la permission d ' effectuer cette opération " )
H = [
2021-06-19 23:21:37 +02:00
html_sco_header . sco_header (
2020-09-26 16:19:37 +02:00
page_title = " Affectation aux groupes " ,
javascripts = [ " js/groupmgr.js " ] ,
cssstyles = [ " css/groups.css " ] ,
) ,
""" <h2 class= " formsemestre " >Affectation aux groupes de %s </h2><form id= " sp " > """
% partition [ " partition_name " ] ,
]
H + = [
""" </select></form> """ ,
""" <p>Faites glisser les étudiants d ' un groupe à l ' autre. Les modifications ne sont enregistrées que lorsque vous cliquez sur le bouton " <em>Enregistrer ces groupes</em> " . Vous pouvez créer de nouveaux groupes. Pour <em>supprimer</em> un groupe, utiliser le lien " suppr. " en haut à droite de sa boite. Vous pouvez aussi <a class= " stdlink " href= " groups_auto_repartition?partition_id= %(partition_id)s " >répartir automatiquement les groupes</a>.
< / p > """
% partition ,
""" <div id= " gmsg " class= " head_message " ></div> """ ,
""" <div id= " ginfo " ></div> """ ,
""" <div id= " savedinfo " ></div> """ ,
""" <form name= " formGroup " id= " formGroup " onSubmit= " return false; " > """ ,
""" <input type= " hidden " name= " partition_id " value= " %s " /> """ % partition_id ,
""" <input name= " groupName " size= " 6 " />
< input type = " button " onClick = " createGroup(); " value = " Créer groupe " / >
& nbsp ; & nbsp ; & nbsp ; & nbsp ; & nbsp ; & nbsp ;
< input type = " button " onClick = " submitGroups( target= ' gmsg ' ); " value = " Enregistrer ces groupes " / >
& nbsp ; & nbsp ; & nbsp ; & nbsp ; & nbsp ; & nbsp ;
< input type = " button " onClick = " document.location = ' formsemestre_status?formsemestre_id= %s ' " value = " Annuler " / > & nbsp ; & nbsp ; & nbsp ; & nbsp ;
Editer groupes de
< select name = " other_partition_id " onchange = " GotoAnother(); " > """
% formsemestre_id ,
]
2021-08-19 10:28:35 +02:00
for p in sco_groups . get_partitions_list ( formsemestre_id , with_default = False ) :
2020-09-26 16:19:37 +02:00
H . append ( ' <option value= " %s " ' % p [ " partition_id " ] )
if p [ " partition_id " ] == partition_id :
H . append ( " selected " )
H . append ( " > %s </option> " % p [ " partition_name " ] )
H + = [
""" </select>
< / form >
< div id = " groups " >
< / div >
< div style = " clear: left; margin-top: 15px; " >
< p class = " help " > < / p >
< / div >
< / div >
""" ,
2021-07-29 10:19:00 +02:00
html_sco_header . sco_footer ( ) ,
2020-09-26 16:19:37 +02:00
]
return " \n " . join ( H )