PreferencesEtablissementAbsences preferencesEtablissement
Boolean modifiable = true
+ Integer ordre
static belongsto = [preferencesEtablissement: PreferencesEtablissementAbsences]
SortedSet motifs
String couleur
GroupeMotif groupeMotif
Boolean modifiable = true
+ Boolean dispoBulletin = true
+ Boolean dispoStats = true
static belongsto = [groupeMotif: GroupeMotif]
* PreferencesEtablissementAbsences.DECOMPTE_DEMIJOUR
* PreferencesEtablissementAbsences.DECOMPTE_JOUR
*/
- Map calculeBilanForEleveAndPeriode(SecuriteSession securiteSession,
- Autorite eleve,
- Date dateDebut,
- Date dateFin,
- StructureEnseignement classeEleve = null) {
+ Map calculeBilanForEleveAndPeriode(
+ SecuriteSession securiteSession,
+ Autorite eleve,
+ Date dateDebut,
+ Date dateFin,
+ StructureEnseignement classeEleve = null,
+ PriseEnCompteMotif priseEnCompteMotif = PriseEnCompteMotif.TOUS
+ ) {
Personne personneEleve = localPersonneService.findPersonneByAutorite(eleve)
if (!classeEleve) {
classeEleve = localStructureEnseignementService.
)
Map result = (Map) [:]
- result.put(ABSENCES_EXCUSEES_NB, calculeAbsencesExcuseesForEleveAndPeriode(
- pref,
- personneEleve,
- dateDebut,
- dateFin
- ))
- result.put(ABSENCES_NON_EXCUSEES_NB,
+ result.put(
+ ABSENCES_EXCUSEES_NB,
+ calculeAbsencesExcuseesForEleveAndPeriode(
+ pref,
+ personneEleve,
+ dateDebut,
+ dateFin,
+ priseEnCompteMotif
+ )
+ )
+ result.put(
+ ABSENCES_NON_EXCUSEES_NB,
calculeAbsencesNonExcuseesForEleveAndPeriode(
pref,
personneEleve,
dateDebut,
- dateFin
- ))
- result.put(RETARDS_NB, calculeRetardsForEleveAndPeriode(
- personneEleve,
- dateDebut,
- dateFin
- ))
+ dateFin,
+ priseEnCompteMotif
+ )
+ )
+ result.put(
+ RETARDS_NB,
+ calculeRetardsForEleveAndPeriode(
+ personneEleve,
+ dateDebut,
+ dateFin,
+ priseEnCompteMotif
+ )
+ )
result.put(PAS_DECOMPTE, pref.pasDecompte)
return result
}
private Integer calculeRetardsForEleveAndPeriode(
Personne eleve,
Date dateDebut,
- Date dateFin) {
+ Date dateFin,
+ PriseEnCompteMotif priseEnCompteMotif) {
List appelsDatas = findRetardsForEleveAndPeriode(
eleve,
dateDebut,
- dateFin
+ dateFin,
+ priseEnCompteMotif
)
return appelsDatas.size()
}
* @param detaFin : fin de la période
* @return une liste de Map
*/
- private List findRetardsForEleveAndPeriode(Personne eleve,
- Date dateDebut,
- Date dateFin) {
+ private List findRetardsForEleveAndPeriode(
+ Personne eleve,
+ Date dateDebut,
+ Date dateFin,
+ PriseEnCompteMotif priseEnCompteMotif
+ ) {
String hql = HQL_DE_BASE + """
and al.retard = true
and al.presence = true
-""" + ORDER_BY
+"""
+ hql += getRestrictionForPriseEnCompteMotifs(priseEnCompteMotif)
+
+ hql += ORDER_BY
+
return AppelLigne.executeQuery(hql, [
eleveId: eleve.autorite.id,
dateFin: dateFin,
])
}
+ /**
+ * @param priseEnCompteMotif
+ * @return la restriction HQL pour tenir compte de la prise en compte des
+ * motifs dans les bulletins ou les stats
+ */
+ String getRestrictionForPriseEnCompteMotifs(
+ PriseEnCompteMotif priseEnCompteMotif
+ ){
+ switch (priseEnCompteMotif) {
+ case PriseEnCompteMotif.BULLETIN:
+ return "and al.motif.dispoBulletin = true"
+ break
+ case PriseEnCompteMotif.STATS:
+ return "and al.motif.dispoStats = true"
+ }
+ return ""
+ }
+
/**
* Calcule le noombre d'absences non excusées pour un élève et une période
* @param pref : les préférences de l'établissement
PreferencesEtablissementAbsences pref,
Personne eleve,
Date dateDebut,
- Date dateFin) {
+ Date dateFin,
+ PriseEnCompteMotif priseEnCompteMotif) {
List appelsDatas = findAbsencesNonExcuseesForEleveAndPeriode(
eleve,
dateDebut,
- dateFin
+ dateFin,
+ priseEnCompteMotif
)
return calculeCount(pref, appelsDatas)
}
* @param detaFin : fin de la période
* @return une liste de Map
*/
- private List findAbsencesNonExcuseesForEleveAndPeriode(Personne eleve,
- Date dateDebut,
- Date dateFin) {
+ private List findAbsencesNonExcuseesForEleveAndPeriode(
+ Personne eleve,
+ Date dateDebut,
+ Date dateFin,
+ PriseEnCompteMotif priseEnCompteMotif) {
String hql = HQL_DE_BASE + """
and al.presence = false
and al.motif.modifiable = false
-""" + ORDER_BY
+"""
+ hql += getRestrictionForPriseEnCompteMotifs(priseEnCompteMotif)
+
+ hql += ORDER_BY
return AppelLigne.executeQuery(hql, [
eleveId: eleve.autorite.id,
dateFin: dateFin,
PreferencesEtablissementAbsences pref,
Personne eleve,
Date dateDebut,
- Date dateFin) {
+ Date dateFin,
+ PriseEnCompteMotif priseEnCompteMotif) {
List appelsDatas = findAbsencesExcuseesForEleveAndPeriode(
eleve,
dateDebut,
- dateFin
+ dateFin,
+ priseEnCompteMotif
)
return calculeCount(pref, appelsDatas)
}
- private List findAbsencesExcuseesForEleveAndPeriode(Personne eleve,
- Date dateDebut,
- Date dateFin) {
+ private List findAbsencesExcuseesForEleveAndPeriode(
+ Personne eleve,
+ Date dateDebut,
+ Date dateFin,
+ PriseEnCompteMotif priseEnCompteMotif) {
String hql = HQL_DE_BASE + """
and al.presence = false
and al.motif.modifiable = true
-""" + ORDER_BY
+"""
+ hql += getRestrictionForPriseEnCompteMotifs(priseEnCompteMotif)
+
+ hql += ORDER_BY
return AppelLigne.executeQuery(hql, [
eleveId: eleve.autorite.id,
dateFin: dateFin,
* @return
*/
List<StatAbsences> getByEleveStatsExcusesNonExcusesFromData(BilanAbsencesParPersonneInfo datas,
- Etablissement etablissement
+ Etablissement etablissement
) {
List<StatAbsences> listEleveStats = []
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot.applications.absences
+
+/**
+ * Indique le filtrage à appliquer sur les motifs
+ * @author jbui
+ */
+public enum PriseEnCompteMotif {
+ TOUS,
+ BULLETIN,
+ STATS
+}
\ No newline at end of file
import org.apache.commons.lang.time.DateUtils
import org.lilie.services.eliot.applications.absences.BilanAbsencesParPersonneInfo
import org.lilie.services.eliot.applications.absences.BilanAbsenceInfo
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
+import org.lilie.services.eliot.parametrages.motifs.MotifService
/**
* Cette classe a pour but de rechercher les données associées aux demandes d'impression
LocalPersonneService localPersonneService
PeriodeService periodeService
ImpressionRegroupementAbsencesService impressionRegroupementAbsencesService
+ MotifService motifService
private final static String CODE_MESSAGE_DEMI_PENSION = "Demi-pension"//message(code: 'absences.menu.publipostage.selection.heure.demi-pension')
private final static String CODE_MESSAGE_INTERNAT = "Internat" //message(code: 'absences.menu.publipostage.selection.heure.internat')
* @return
*
*/
- public List<EleveImpressionInfo> findAllInfoForRetards(SecuriteSession securiteSession,
- Etablissement etablissement,
- List<Personne> eleves,
- TypePeriode typePeriode,
- List<EleveImpressionInfo> eleveImpressionInfos,
- Boolean ajouteDetailsRetards = true
+ public List<EleveImpressionInfo> findAllInfoForRetards(
+ SecuriteSession securiteSession,
+ Etablissement etablissement,
+ List<Personne> eleves,
+ TypePeriode typePeriode,
+ List<EleveImpressionInfo> eleveImpressionInfos,
+ Boolean ajouteDetailsRetards = true,
+ PriseEnCompteMotif priseEnCompteMotif = PriseEnCompteMotif.TOUS
) {
// Filtre les élèves par classe
BasicCriteresRecherche criteres = new BasicCriteresRecherche(
retards: true,
eleveIds: elevesClasse*.autorite.id,
- motifIds: []
+ motifIds: motifService.findAllMotifForPriseEnCompteMotif(
+ etablissement,
+ priseEnCompteMotif
+ )*.id
)
criteres.dateDebut.setTime(periode.dateDebut)
criteres.dateFin.setTime(periode.dateFin)
* @return
*
*/
- public List<EleveImpressionInfo> findAllInfoForAbsences(SecuriteSession securiteSession,
- Etablissement etablissement,
- List<Personne> eleves,
- TypePeriode typePeriode,
- List<EleveImpressionInfo> eleveImpressionInfos,
- Boolean ajouteDetailsAbsences = true
+ public List<EleveImpressionInfo> findAllInfoForAbsences(
+ SecuriteSession securiteSession,
+ Etablissement etablissement,
+ List<Personne> eleves,
+ TypePeriode typePeriode,
+ List<EleveImpressionInfo> eleveImpressionInfos,
+ Boolean ajouteDetailsAbsences = true,
+ PriseEnCompteMotif priseEnCompteMotif = PriseEnCompteMotif.TOUS
) {
// Filtre les élèves par classe
absencesValables: true,
absencesNonValables: true,
eleveIds: elevesClasse*.autorite.id,
- motifIds: []
+ motifIds: motifService.findAllMotifForPriseEnCompteMotif(
+ etablissement,
+ priseEnCompteMotif
+ )*.id
)
criteres.dateDebut.setTime(periode.dateDebut)
criteres.dateFin.setTime(periode.dateFin)
result.retards = false
result.departsAnticipes = false
- if (!parametresSelectionPublipostage.typeAbsenceId && parametresSelectionPublipostage.tab == 'retard'){
+ if (!parametresSelectionPublipostage.typeAbsenceId && parametresSelectionPublipostage.tab == 'retard') {
result.retards = true
}
/**
* @author jbui
* @author sdim
+ * @author othe
*/
public class GroupeMotifService {
SecuriteSession session)
throws AutorisationException, GroupeMotifException {
eliotDroitsService.verificationDroitModificationParam(
- pref.etablissement,
- session
+ pref.etablissement,
+ session
)
+ Integer ordre = getOrdreMax(pref) + 1
verifieUniciteGroupeMotif(pref, libelle)
- return internalCreerGroupeMotif(pref, libelle, true)
+ return internalCreerGroupeMotif(pref, libelle, true, ordre)
+ }
+
+ /**
+ * @param pref
+ * @return l'ordre max pour les groupes de motifs de la base
+ */
+ Integer getOrdreMax(PreferencesEtablissementAbsences pref) {
+ def result = GroupeMotif.withCriteria {
+ eq('preferencesEtablissement', pref)
+ projections {
+ max('ordre')
+ }
+ }
+ if (result) {
+ return result[0]
+ } else {
+ return 0
+ }
+
}
/**
* @return le GroupeMotif créé
*/
GroupeMotif creerGroupeMotifAsAdmin(PreferencesEtablissementAbsences pref,
- String libelle, Boolean modifiable) {
- return internalCreerGroupeMotif(pref, libelle, modifiable)
+ String libelle,
+ Boolean modifiable,
+ Integer ordre) {
+ return internalCreerGroupeMotif(pref, libelle, modifiable, ordre)
}
/**
*/
private GroupeMotif internalCreerGroupeMotif(PreferencesEtablissementAbsences pref,
String libelle,
- Boolean modifiable) {
+ Boolean modifiable,
+ Integer ordre
+ ) {
if (!pref) {
throw new IllegalArgumentException(PREF_INVALIDE)
}
Closure action = {
GroupeMotif groupeMotif = new GroupeMotif(
- libelle: libelle,
- modifiable: modifiable,
- preferencesEtablissement: pref
- )
+ libelle: libelle,
+ modifiable: modifiable,
+ preferencesEtablissement: pref,
+ ordre: ordre
+ )
if (!groupeMotif.save(flush: true)) {
throw new GroupeMotifException(
- codeMessage: GROUPE_MOTIF_NON_ENREGISTRE,
- groupeMotif: groupeMotif
+ codeMessage: GROUPE_MOTIF_NON_ENREGISTRE,
+ groupeMotif: groupeMotif
)
}
Closure onDataIntegrityViolation = { DataIntegrityViolationException e ->
GroupeMotif groupeMotif =
GroupeMotif.findByLibelleAndPreferencesEtablissement(
- libelle,
- pref
- )
+ libelle,
+ pref
+ )
if (!groupeMotif) {
throw new IllegalStateException(
- 'Création du groupe de motif impossible.'
+ 'Création du groupe de motif impossible.'
)
}
return groupeMotif
}
- GroupeMotif groupeMotif= (GroupeMotif)GormUtils.withSavepoint(
+ GroupeMotif groupeMotif = (GroupeMotif) GormUtils.withSavepoint(
action,
onDataIntegrityViolation
)
if (!pref.save()) {
throw new GroupeMotifException(codeMessage: GROUPE_MOTIF_NON_ENREGISTRE,
- groupeMotif: groupeMotif);
+ groupeMotif: groupeMotif);
}
return groupeMotif
GroupeMotif.withTransaction { DefaultTransactionStatus transactionStatus ->
JdbcTransactionObjectSupport transaction =
- (JdbcTransactionObjectSupport) transactionStatus.transaction
+ (JdbcTransactionObjectSupport) transactionStatus.transaction
transaction.setSavepointAllowed(true)
def savepoint = transaction.createSavepoint()
eliotDroitsService.verificationDroitModificationParam(
- groupeMotif.preferencesEtablissement.etablissement,
- session
+ groupeMotif.preferencesEtablissement.etablissement,
+ session
)
try {
transaction.rollbackToSavepoint(savepoint)
throw new GroupeMotifDeleteException(
- messageCode: 'absences.groupeMotifs.supprimer.echec'
+ messageCode: 'absences.groupeMotifs.supprimer.echec'
)
}
}
if (exceptionGroupMotifUtilise) {
throw new GroupeMotifDeleteUtiliseException(
- messageCode: 'absences.groupeMotifs.supprimer.echec.motifutilise'
+ messageCode: 'absences.groupeMotifs.supprimer.echec.motifutilise'
)
}
}
* @param securiteSession : session de l'utilisateur
* @return le groupe de motif modifié
*/
- GroupeMotif modifieGroupeMotif(Long identifiant,
+ GroupeMotif modifieGroupeMotif(SecuriteSession securiteSession,
+ Long identifiant,
String libelle,
- SecuriteSession securiteSession
+ Integer ordre
+
) throws GroupeMotifException, AutorisationException {
GroupeMotif groupeMotif = GroupeMotif.get(identifiant)
eliotDroitsService.verificationDroitModificationParam(
- groupeMotif.preferencesEtablissement.etablissement,
- securiteSession
+ groupeMotif.preferencesEtablissement.etablissement,
+ securiteSession
)
- return internalModifiegroupeMotif(groupeMotif, libelle)
+ return internalModifiegroupeMotif(
+ groupeMotif,
+ libelle,
+ ordre)
}
/**
* @param libelle : libellé à affecter
* @return le groupe de motif modifié
*/
- private GroupeMotif internalModifiegroupeMotif(GroupeMotif groupeMotif,
- String libelle
+ private GroupeMotif internalModifiegroupeMotif(
+ GroupeMotif groupeMotif,
+ String libelle,
+ Integer ordre
) {
// Si le libellé change, vérifie que le nouveau libellé n'existe pas déjà
if (libelle != groupeMotif.libelle) {
if (GroupeMotif.findByLibelleAndPreferencesEtablissement(
- libelle,
- groupeMotif.preferencesEtablissement
+ libelle,
+ groupeMotif.preferencesEtablissement
)) {
throw new GroupeMotifException(
- codeMessage: GROUPE_MOTIF_EXISTE_DEJA
+ codeMessage: GROUPE_MOTIF_EXISTE_DEJA
)
}
}
- groupeMotif.libelle = libelle
+ if (libelle) {
+ groupeMotif.libelle = libelle
+ }
+
+ if (ordre) {
+ groupeMotif.ordre = ordre
+ }
+
return groupeMotif
}
* @param pref : la préférence établissement
*/
private void creerGroupeMotif0(PreferencesEtablissementAbsences pref) {
- GroupeMotif groupeMotif0 = creerGroupeMotifAsAdmin(pref,
- "Sans motif", false)
- //modif "Sans motif" non modifiable
+ GroupeMotif groupeMotif0 = creerGroupeMotifAsAdmin(
+ pref,
+ "Sans motif",
+ false,
+ 0
+ )
motifService.creerMotifAsAdmin(groupeMotif0, "Sans motif",
- COULEUR_MOTIF_SANS_MOTIF, false)
+ COULEUR_MOTIF_SANS_MOTIF, false)
}
/**
*/
private void creerGroupeMotif1(PreferencesEtablissementAbsences pref) {
// groupemoti1
- GroupeMotif groupeMotif1 = creerGroupeMotifAsAdmin(pref,
- "Absent en cours mais présent dans l’établissement", true)
+ GroupeMotif groupeMotif1 = creerGroupeMotifAsAdmin(
+ pref,
+ "Absent en cours mais présent dans l’établissement",
+ true,
+ 1
+ )
motifService.creerMotifAsAdmin(groupeMotif1, "Infirmerie", "#FF00FF")
motifService.creerMotifAsAdmin(groupeMotif1, "CDI", "#FF0000")
motifService.creerMotifAsAdmin(groupeMotif1, "Bureau du CPE", "#800000")
*/
private void creerGroupeMotif2(PreferencesEtablissementAbsences pref) {
// groupemotif2
- GroupeMotif groupeMotif2 = creerGroupeMotifAsAdmin(pref,
- "Raisons de santé", true)
+ GroupeMotif groupeMotif2 = creerGroupeMotifAsAdmin(
+ pref,
+ "Raisons de santé",
+ true,
+ 2
+ )
motifService.creerMotifAsAdmin(groupeMotif2, "Maladie avec certificat",
- "#FF9900")
+ "#FF9900")
motifService.creerMotifAsAdmin(groupeMotif2, "Maladie sans certificat",
- "#FFCC99")
+ "#FFCC99")
motifService.creerMotifAsAdmin(groupeMotif2, "RDV médical", "#FFFF99")
}
*/
private void creerGroupeMotif3(PreferencesEtablissementAbsences pref) {
// groupemotif3
- GroupeMotif groupeMotif3 = creerGroupeMotifAsAdmin(pref,
- "Raisons personnelles", true)
+ GroupeMotif groupeMotif3 = creerGroupeMotifAsAdmin(
+ pref,
+ "Raisons personnelles",
+ true,
+ 3
+ )
motifService.creerMotifAsAdmin(groupeMotif3, "Départ anticipé en vacances",
- "#000080")
+ "#000080")
motifService.creerMotifAsAdmin(groupeMotif3, "Panne de réveil", "#0000FF")
}
*/
private void creerGroupeMotif4(PreferencesEtablissementAbsences pref) {
// groupemotif4
- GroupeMotif groupeMotif4 = creerGroupeMotifAsAdmin(pref,
- "Raisons familiales", true)
+ GroupeMotif groupeMotif4 = creerGroupeMotifAsAdmin(
+ pref,
+ "Raisons familiales",
+ true,
+ 4
+ )
motifService.creerMotifAsAdmin(groupeMotif4, "Fêtes religieuses", "#00CCFF")
motifService.creerMotifAsAdmin(groupeMotif4, "Décès", "#3366FF")
motifService.creerMotifAsAdmin(groupeMotif4, "Mariage", "#99CCFF")
*/
private void creerGroupeMotif5(PreferencesEtablissementAbsences pref) {
// groupemotif5
- GroupeMotif groupeMotif5 = creerGroupeMotifAsAdmin(pref,
- "Rendez-vous extérieur", true)
+ GroupeMotif groupeMotif5 = creerGroupeMotifAsAdmin(
+ pref,
+ "Rendez-vous extérieur",
+ true,
+ 5
+ )
motifService.creerMotifAsAdmin(groupeMotif5, "Rendez-vous éducateur",
- "#CCFFCC")
+ "#CCFFCC")
motifService.creerMotifAsAdmin(groupeMotif5, "Compétition sportive",
- "#00FF00")
+ "#00FF00")
}
/**
*/
private void creerGroupeMotif6(PreferencesEtablissementAbsences pref) {
// groupemotif6
- GroupeMotif groupeMotif6 = creerGroupeMotifAsAdmin(pref,
- "Problèmes d'emploi du temps", true)
+ GroupeMotif groupeMotif6 = creerGroupeMotifAsAdmin(
+ pref,
+ "Problèmes d'emploi du temps",
+ true,
+ 6
+ )
motifService.creerMotifAsAdmin(groupeMotif6, "Confusion emploi du temps",
- "#CCCCCC")
+ "#CCCCCC")
}
/**
*/
private void creerGroupeMotif7(PreferencesEtablissementAbsences pref) {
// groupemotif7
- GroupeMotif groupeMotif7 = creerGroupeMotifAsAdmin(pref,
- "Problèmes de transport", true)
+ GroupeMotif groupeMotif7 = creerGroupeMotifAsAdmin(
+ pref,
+ "Problèmes de transport",
+ true,
+ 7
+ )
motifService.creerMotifAsAdmin(groupeMotif7, "Grève transport en commun",
- "#99CC00")
+ "#99CC00")
motifService.creerMotifAsAdmin(groupeMotif7, "Grève de la SNCF", "#808000")
}
*/
private void creerGroupeMotif8(PreferencesEtablissementAbsences pref) {
// groupemotif8
- GroupeMotif groupeMotif8 = creerGroupeMotifAsAdmin(pref,
- "Aucun motif", true)
+ GroupeMotif groupeMotif8 = creerGroupeMotifAsAdmin(
+ pref,
+ "Aucun motif",
+ true,
+ 8
+ )
motifService.creerMotifAsAdmin(groupeMotif8, "Autres", "#000000")
}
creerGroupeMotif7(pref)
creerGroupeMotif8(pref)
}
+
+ /**
+ * Retourne la liste des groupes de motifs trié par ordre
+ * @return
+ */
+ public List<GroupeMotif> findAllGroupeMotifByPreferencesEtablissement(PreferencesEtablissementAbsences pref) {
+ List<GroupeMotif> allMotif = GroupeMotif.findAllByPreferencesEtablissement(pref)
+ allMotif.sort {a, b -> a.ordre <=> b.ordre}
+ return allMotif
+ }
+
+ /**
+ * Retrouve le numéro d'ordre du groupeMotif précédent le groupeMotif passé en paramètre dans la liste des
+ * groupeMotif de la PreferencesEtablissementAbsences
+ * @param groupeMotif
+ * @param pref
+ * @return
+ */
+ public Integer getNumeroOrdrePrecedent(GroupeMotif groupeMotif, PreferencesEtablissementAbsences pref) {
+
+ String hql = "select max(g.ordre) from GroupeMotif g where g.ordre<:ordre and g.preferencesEtablissement=:pref"
+ List max = GroupeMotif.executeQuery(hql, [ordre: groupeMotif.ordre, pref: pref])
+ return (Integer) max[0]
+
+ }
+
+ /**
+ * Retrouve le numéro d'ordre du groupeMotif suivant le groupeMotif passé en paramètre dans la liste des
+ * groupeMotif de la PreferencesEtablissementAbsences
+ * @param groupeMotif
+ * @param pref
+ * @return
+ */
+ public Integer getNumeroOrdreSuivant(GroupeMotif groupeMotif, PreferencesEtablissementAbsences pref) {
+
+ String hql = "select min(g.ordre) from GroupeMotif g where g.ordre>:ordre and g.preferencesEtablissement=:pref"
+ List min = GroupeMotif.executeQuery(hql, [ordre: groupeMotif.ordre, pref: pref])
+ return (Integer) min[0]
+
+ }
+
+ /**
+ * monter un groupe motif dans la liste des groupes motif
+ * @param groupeMotif
+ * @param pref
+ * @return les 2 groupeinfos modifiés par l'opération
+ */
+ public List<GroupeMotif> monterGroupeMotif(GroupeMotif groupeMotif, PreferencesEtablissementAbsences pref) {
+
+ Integer numeroOrdrePrecedent = getNumeroOrdrePrecedent(
+ groupeMotif,
+ pref
+ )
+
+ List<GroupeMotif> resultat = []
+
+ if (numeroOrdrePrecedent) {
+
+ Integer numeroOrdreCourant = groupeMotif.ordre
+
+ GroupeMotif precedent = GroupeMotif.findByOrdreAndPreferencesEtablissement(numeroOrdrePrecedent, pref)
+ precedent.ordre = -1000
+ precedent.save(failOnError: true, flush: true)
+
+ groupeMotif.ordre = numeroOrdrePrecedent
+ groupeMotif.save(failOnError: true, flush: true)
+
+ precedent.ordre = numeroOrdreCourant
+ precedent.save(failOnError: true, flush: true)
+
+ resultat << precedent
+ resultat << groupeMotif
+
+ }
+
+ return resultat
+
+ }
+
+ /**
+ * descendre un groupe motif dans la liste des groupes motif
+ * @param groupeMotif
+ * @param pref
+ * @return les 2 groupeinfos modifiés par l'opération
+ */
+ public List<GroupeMotif> descendreGroupeMotif(GroupeMotif groupeMotif, PreferencesEtablissementAbsences pref) {
+
+ Integer numeroOrdreSuivant = getNumeroOrdreSuivant(
+ groupeMotif,
+ pref
+ )
+
+ List<GroupeMotif> resultat = []
+
+ if (numeroOrdreSuivant) {
+
+ Integer numeroOrdreCourant = groupeMotif.ordre
+
+ GroupeMotif suivant = GroupeMotif.findByOrdreAndPreferencesEtablissement(numeroOrdreSuivant, pref)
+ suivant.ordre = -1000
+ suivant.save(failOnError: true, flush: true)
+
+ groupeMotif.ordre = numeroOrdreSuivant
+ groupeMotif.save(failOnError: true, flush: true)
+
+ suivant.ordre = numeroOrdreCourant
+ suivant.save(failOnError: true, flush: true)
+
+ resultat << suivant
+ resultat << groupeMotif
+ }
+
+ return resultat
+ }
+
+
}
import org.lilie.services.eliot.GormUtils
import org.springframework.transaction.support.DefaultTransactionStatus
import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
+import org.lilie.services.eliot.scolarite.Etablissement
+import org.lilie.services.eliot.scolarite.etablissement.PreferencesEtablissementAbsencesService
-/*
-@author sdim
-@author jbui
-@author ywan
-@author bahj
-*/
+/**
+ * Service CRUD des motifs
+ * @author sdim
+ * @author jbui
+ * @author ywan
+ * @author bahj
+ * @author othe
+ */
public class MotifService {
private static final String MOTIF_NON_ENREGISTRE = "absences.motifs.enregistrer.succes"
private static final String CODE_MESSAGE_SUPPRIMER_ECHEC = "absences.motifs.supprimer.echec"
EliotDroitsService eliotDroitsService
+ PreferencesEtablissementAbsencesService preferencesEtablissementAbsencesService
/**
* Création d'un motif par un utilisateur
* @param securiteSession : session de l'utilisateur
* @return le motif créé
*/
- Motif creerMotif(SecuriteSession securiteSession,
- GroupeMotif groupeMotif,
- String libelle,
- String couleur
- ) throws MotifException {
+ public Motif creerMotif(SecuriteSession securiteSession,
+ GroupeMotif groupeMotif,
+ String libelle,
+ String couleur,
+ Boolean dispoBulletin,
+ Boolean dispoStats) {
eliotDroitsService.verificationDroitModificationParam(
groupeMotif.preferencesEtablissement.etablissement,
securiteSession
)
- return internalCreerMotif(groupeMotif, libelle, couleur)
+ return internalCreerMotif(
+ groupeMotif,
+ libelle,
+ couleur,
+ dispoBulletin,
+ dispoStats
+ )
}
/**
* @param couleur : couleur du motif
* @return le motif créé
*/
- Motif creerMotifAsAdmin(GroupeMotif groupeMotif,
- String libelle,
- String couleur,
- Boolean modifiable = true
+ public Motif creerMotifAsAdmin(GroupeMotif groupeMotif,
+ String libelle,
+ String couleur,
+ Boolean dispoBulletin = true,
+ Boolean dispoStats = true,
+ Boolean modifiable = true
) throws MotifException {
- return internalCreerMotif(groupeMotif, libelle, couleur, modifiable)
- }
-
- /**
- * Création interne d'un motif
- * @param groupeMotif : groupe de motif du motif
- * @param libelle : libellé du motif
- * @param couleur : couleur du motif
- * @return le motif créé
- */
- private Motif internalCreerMotif(GroupeMotif groupe,
- String libelle,
- String couleur,
- Boolean modifiable = true) throws MotifException {
- libelle = libelle.trim()
- def critere = Motif.createCriteria()
-
- List<Motif> listeMotif = critere.list {
- and {
- eq("libelle", libelle)
- groupeMotif {
- eq("preferencesEtablissement", groupe.preferencesEtablissement)
- }
- }
- }
-
- if (listeMotif.size() > 0) {
- throw new MotifException(
- codeMessage: CODE_MESSAGE_LIBELLE_DUPLIQUE,
- argsMessage: libelle
- )
- }
-
- Closure action = {
- Motif motif = new Motif(
- libelle: libelle,
- couleur: couleur,
- modifiable: modifiable
- )
-
- GroupeMotif groupeMotif = GroupeMotif.get(groupe.id)
-
- groupeMotif.addToMotifs(motif)
-
- if (!motif.save(flush: true)) {
- throw new MotifException(
- codeMessage: MOTIF_NON_ENREGISTRE,
- motif: motif
- )
- }
-
- return motif
- }
-
- Closure onDataIntegrityViolation = { DataIntegrityViolationException e ->
- Motif motif = Motif.findByLibelleAndGroupeMotif(libelle, groupe)
- if (!motif) {
- throw new IllegalStateException('Création du motif impossible.')
- }
- }
-
- Motif motif = (Motif)GormUtils.withSavepoint(action, onDataIntegrityViolation)
-
- return motif
+ return internalCreerMotif(
+ groupeMotif,
+ libelle,
+ couleur,
+ dispoBulletin,
+ dispoStats,
+ modifiable
+ )
}
/**
* @param securiteSession : session utilisateur
* @return le motif modifié
*/
- Motif modifieMotif(GroupeMotif groupe,
- Long identifiant,
- String libelle,
- String couleur,
- SecuriteSession securiteSession) {
+ public Motif modifieMotif(SecuriteSession securiteSession,
+ GroupeMotif groupe,
+ Long identifiant,
+ String libelle,
+ String couleur) {
Motif motif = Motif.get(identifiant)
eliotDroitsService.verificationDroitModificationParam(
motif.groupeMotif.preferencesEtablissement.etablissement,
securiteSession
)
- return internalModifieMotif(groupe, motif, libelle, couleur)
+ return internalModifieMotif(
+ groupe,
+ motif,
+ libelle,
+ couleur
+ )
+ }
+
+ /**
+ * Modifie le disponibilité d'un motif
+ * @param securiteSession
+ * @param motif
+ * @param dispoBulletin
+ * @param dispoStats
+ */
+ public void modifieDisponibiliteMotif(
+ SecuriteSession securiteSession,
+ Motif motif,
+ Boolean dispoBulletin,
+ Boolean dispoStats
+ ) {
+
+ eliotDroitsService.verificationDroitModificationParam(
+ motif.groupeMotif.preferencesEtablissement.etablissement,
+ securiteSession
+ )
+
+ try {
+ if (dispoBulletin != null) {
+ motif.dispoBulletin = dispoBulletin
+ }
+
+ if (dispoStats != null) {
+ motif.dispoStats = dispoStats
+ }
+ motif.save(failOnError: true, flush: true)
+ } catch (Exception e) {
+ log.error('Erreur modification dispo motif', e)
+ throw new MotifException(
+ codeMessage: MOTIF_NON_ENREGISTRE,
+ motif: motif
+ )
+
+ }
+
}
/**
* @param session : session de l'utilisateur
*/
@SuppressWarnings('CatchException')
- void supprimerMotif(Long identifiant, SecuriteSession session)
- throws MotifDeleteException, MotifDeleteUtiliseException {
+ public void supprimerMotif(Long identifiant, SecuriteSession session) {
Motif motif = Motif.get(identifiant)
if (motif) {
}
}
+/**
+ * Retourne le motif "Sans motif" de l'établissement
+ * @param pref : la préférence établissement à laquelle le groupe de
+ */
+ public Motif getMotifSansMotif(PreferencesEtablissementAbsences pref) {
+ def crit = Motif.createCriteria()
+ List<Motif> motifs = crit.list {
+ and {
+ eq('couleur', GroupeMotifService.COULEUR_MOTIF_SANS_MOTIF)
+ groupeMotif {
+ eq('preferencesEtablissement', pref)
+ }
+ }
+ }
+ if (motifs.size() == 1) {
+ return motifs.get(0)
+ } else if (motifs.size() == 0) {
+ throw org.lilie.services.eliot.absences.exceptions.MotifSansMotifException.motifSansMotifInexistant()
+ } else {
+ throw org.lilie.services.eliot.absences.exceptions.MotifSansMotifException.motifSansMotifDuplique()
+ }
+ }
+
+ /**
+ * Retourne la liste de tous les motifs de l'établissement
+ * @param etab
+ * @param exclureMotifNonModifiable : si true, ne renvoie pas les motif
+ * non modifiables ("sans motif")
+ * @return une liste de Motifs
+ */
+ public List<Motif> getMotifsForPreferencesEtablissement(
+ PreferencesEtablissementAbsences pref,
+ Boolean exclureMotifNonModifiable = false
+ ) {
+ def crit = Motif.createCriteria()
+ List<Motif> result = crit.list {
+ groupeMotif {
+ eq('preferencesEtablissement', pref)
+ if (exclureMotifNonModifiable) {
+ eq('modifiable', true)
+ }
+ }
+ order('libelle', 'asc')
+ }
+ return result
+ }
+
/**
* Suppression interne d'un motif
* @param motif : motif à modifier
private Motif internalModifieMotif(GroupeMotif groupe,
Motif motif,
String libelle,
- String couleur) {
+ String couleur,
+ Boolean dispoBulletin = null,
+ Boolean dispoStats = null) {
+
def isMotifierLuiMeme = false
libelle = libelle.trim()
def critere = Motif.createCriteria()
if (listeMotif.size() > 0) {
listeMotif.each {
Motif motifDansListe ->
- if (motifDansListe.id == motif.id) {
- isMotifierLuiMeme = true
- }
+ if (motifDansListe.id == motif.id) {
+ isMotifierLuiMeme = true
+ }
}
if (!isMotifierLuiMeme) {
throw new MotifException(
}
motif.libelle = libelle
motif.couleur = couleur
+
+ if (dispoBulletin) {
+ motif.dispoBulletin = dispoBulletin
+ }
+
+ if (dispoStats) {
+ motif.dispoStats = dispoStats
+ }
+
return motif
}
-/**
- * Retourne le motif "Sans motif" de l'établissement
- * @param pref : la préférence établissement à laquelle le groupe de
- */
- Motif getMotifSansMotif(PreferencesEtablissementAbsences pref) {
- def crit = Motif.createCriteria()
- List<Motif> motifs = crit.list {
+ /**
+ * Création interne d'un motif
+ * @param groupeMotif : groupe de motif du motif
+ * @param libelle : libellé du motif
+ * @param couleur : couleur du motif
+ * @return le motif créé
+ */
+ private Motif internalCreerMotif(GroupeMotif groupe,
+ String libelle,
+ String couleur,
+ Boolean dispoBulletin,
+ Boolean dispoStats,
+ Boolean modifiable = true) throws MotifException {
+ libelle = libelle.trim()
+ def critere = Motif.createCriteria()
+
+ List<Motif> listeMotif = critere.list {
and {
- eq('couleur', GroupeMotifService.COULEUR_MOTIF_SANS_MOTIF)
+ eq("libelle", libelle)
groupeMotif {
- eq('preferencesEtablissement', pref)
+ eq("preferencesEtablissement", groupe.preferencesEtablissement)
}
}
}
- if (motifs.size() == 1) {
- return motifs.get(0)
- } else if (motifs.size() == 0) {
- throw org.lilie.services.eliot.absences.exceptions.MotifSansMotifException.motifSansMotifInexistant()
- } else {
- throw org.lilie.services.eliot.absences.exceptions.MotifSansMotifException.motifSansMotifDuplique()
+
+ if (listeMotif.size() > 0) {
+ throw new MotifException(
+ codeMessage: CODE_MESSAGE_LIBELLE_DUPLIQUE,
+ argsMessage: libelle
+ )
}
+
+ Closure action = {
+ Motif motif = new Motif(
+ libelle: libelle,
+ couleur: couleur,
+ modifiable: modifiable,
+ dispoBulletin: dispoBulletin,
+ dispoStats: dispoStats
+ )
+
+ GroupeMotif groupeMotif = GroupeMotif.get(groupe.id)
+
+ groupeMotif.addToMotifs(motif)
+
+ if (!motif.save(flush: true)) {
+ throw new MotifException(
+ codeMessage: MOTIF_NON_ENREGISTRE,
+ motif: motif
+ )
+ }
+
+ return motif
+ }
+
+ Closure onDataIntegrityViolation = { DataIntegrityViolationException e ->
+ Motif motif = Motif.findByLibelleAndGroupeMotif(libelle, groupe)
+ if (!motif) {
+ throw new IllegalStateException('Création du motif impossible.')
+ }
+ }
+
+ Motif motif = (Motif) GormUtils.withSavepoint(action, onDataIntegrityViolation)
+
+ return motif
}
/**
- * Retourne la liste de tous les motifs de l'établissement
- * @param etab
- * @param exclureMotifNonModifiable : si true, ne renvoie pas les motif
- * non modifiables ("sans motif")
- * @return une liste de Motifs
+ * @param etablissement : établissement dont on veut les motifs
+ * @param priseEnCompteMotif : Paramètre de prise en compte
+ * @param listeVideEgalTous : si true, retourne une liste vide au lieu de
+ * tous les motifs
+ * @return
+ */
+ List<Motif> findAllMotifForPriseEnCompteMotif(
+ Etablissement etablissement,
+ PriseEnCompteMotif priseEnCompteMotif,
+ Boolean listeVideEgalTous = true
+ ) {
+ PreferencesEtablissementAbsences pref = preferencesEtablissementAbsencesService.
+ getPreferencesEtablissementForEtablissement(etablissement)
+ return findAllMotifForPriseEnCompteMotif(
+ pref,
+ priseEnCompteMotif,
+ listeVideEgalTous
+ )
+ }
+
+ /**
+ * @param etablissement : établissement dont on veut les motifs
+ * @param priseEnCompteMotif : Paramètre de prise en compte
+ * @param listeVideEgalTous : si true, retourne une liste vide au lieu de
+ * tous les motifs
+ * @return
*/
- List<Motif> getMotifsForPreferencesEtablissement(
+ List<Motif> findAllMotifForPriseEnCompteMotif(
PreferencesEtablissementAbsences pref,
- Boolean exclureMotifNonModifiable = false
+ PriseEnCompteMotif priseEnCompteMotif,
+ Boolean listeVideEgalTous = true
) {
+ switch (priseEnCompteMotif) {
+ case PriseEnCompteMotif.TOUS:
+ if (listeVideEgalTous) {
+ return []
+ } else {
+ return getMotifsForPreferencesEtablissement(pref)
+ }
+ break
+ case PriseEnCompteMotif.BULLETIN:
+ return getMotifsForBulletin(pref)
+ case PriseEnCompteMotif.STATS:
+ return getMotifsForStats(pref)
+ }
+ }
+
+ /**
+ * @param pref
+ * @return Les motifs à prendre en compte pour les stats
+ */
+ List<Motif> getMotifsForStats(PreferencesEtablissementAbsences pref) {
+ def crit = Motif.createCriteria()
+ List<Motif> result = crit.list {
+ groupeMotif {
+ eq('preferencesEtablissement', pref)
+ }
+ eq('dispoStats', true)
+ order('libelle', 'asc')
+ }
+ return result
+ }
+
+ /**
+ * @param pref
+ * @return Les motifs à prendre en compte pour les bulletin
+ */
+ List<Motif> getMotifsForBulletin(PreferencesEtablissementAbsences pref) {
def crit = Motif.createCriteria()
List<Motif> result = crit.list {
groupeMotif {
eq('preferencesEtablissement', pref)
- if (exclureMotifNonModifiable) {
- eq('modifiable', true)
- }
}
+ eq('dispoBulletin', true)
order('libelle', 'asc')
}
return result
import org.lilie.services.eliot.scolarite.Etablissement
import org.lilie.services.eliot.scolarite.anneescolaire.AnneeScolaireService
+import org.lilie.services.eliot.scolarite.AnneeScolaire
/**
* @author jbui
/**
* Retourne les préférences d'un établissement
* @param etab : l'établissement dont on veut les préférences
+ * @param anneeScolaire anne scolaire - si pas specifie, on prend l'anne scolaire en cours
* @return les préférences de l'établissement
*/
PreferencesEtablissementAbsences getPreferencesEtablissementForEtablissement(
- Etablissement etab) {
- PreferencesEtablissementAbsences pref = PreferencesEtablissementAbsences.findByEtablissement(etab)
+ Etablissement etab,
+ AnneeScolaire anneeScolaire = null) {
+
+ if (anneeScolaire == null) {
+ anneeScolaire = anneeScolaireService.anneeScolaireEnCours()
+ }
+ PreferencesEtablissementAbsences pref =
+ PreferencesEtablissementAbsences.findByEtablissementAndAnneeScolaire(
+ etab,
+ anneeScolaire
+ )
+
if (!pref) {
pref = new PreferencesEtablissementAbsences(etablissement: etab)
- pref.anneeScolaire = anneeScolaireService.anneeScolaireEnCours()
+ pref.anneeScolaire = anneeScolaireService.anneeScolaireEnCours()
pref.save(flush: true, failOnError: true)
}
if ((!pref?.groupeMotifs) || (pref.groupeMotifs?.size() == 0)) {
*/
private PreferencesEtablissementAbsences internalGetPref(String idExterne) {
Etablissement etab = etablissementService.findEtablissementByIdExterne(
- idExterne
+ idExterne
)
return getPreferencesEtablissementForEtablissement(etab)
}
PreferencesEtablissementAbsences pref = PreferencesEtablissementAbsences.get(identifiant)
eliotDroitsServiceBean = (EliotDroitsService) applicationContext.getBean("eliotDroitsService")
eliotDroitsServiceBean.verificationDroitModificationParam(
- pref.etablissement,
- securiteSession
+ pref.etablissement,
+ securiteSession
)
return internalModifiePreferencesEtablissement(pref, pasDecompte)
}
* @return les préférences modifiées
*/
private PreferencesEtablissementAbsences internalModifiePreferencesEtablissement(
- PreferencesEtablissementAbsences pref, String pasDecompte) {
+ PreferencesEtablissementAbsences pref, String pasDecompte) {
pref.pasDecompte = pasDecompte
pref.validate()
if (pref.hasErrors()) {
throw org.lilie.services.eliot.absences.PreferencesEtablissementIncorrectesException.
- pasDeDecompteIncorrectException()
+ pasDeDecompteIncorrectException()
}
pref.save(flush: true, failOnError: true)
return pref
* @return la List des GroupeMotif
*/
List buildModelGroupeMotifForJason(PreferencesEtablissementAbsences pref,
- Boolean listerTousMotifs) {
- List lesGroupesMotifs = []
-
- def libelleGroupeMotif
- def idGroupeMotif
+ Boolean inclureMotifsNonModifiables) {
- for (Iterator<GroupeMotif> iter = pref.groupeMotifs.iterator(); iter.hasNext();) {
- def motif = []
- GroupeMotif item = iter.next();
- if (item.modifiable) {
- libelleGroupeMotif = item.libelle
- idGroupeMotif = item.id
- for (Iterator<Motif> iter2 = item.motifs.iterator(); iter2.hasNext();) {
- Motif item2 = iter2.next();
- motif << [
- nom: item2.libelle,
- codeCouleur: item2.couleur,
- id: 'm' +
- item2.id,
- leaf: true,
- uiProvider: 'col',
- iconCls: 'no-icon'
- ]
- }
- lesGroupesMotifs << [
- nom: libelleGroupeMotif,
- id: 'g' + idGroupeMotif,
- children: motif,
- uiProvider: 'col'
- ]
- }
- }
-
- if (listerTousMotifs) {
+ // motifs non-modifiables, sans groupe
+ List motifsSansGroupe = []
+ if (inclureMotifsNonModifiables) {
def criteria = Motif.createCriteria()
- List motifsSansGroupe = criteria.list {
+ criteria.list {
and {
eq('modifiable', false)
groupeMotif {
eq('preferencesEtablissement', pref)
}
}
- }
- motifsSansGroupe.each() {
+ }.each() {
Motif item ->
- lesGroupesMotifs << [
- nom: item.libelle,
- codeCouleur: item.couleur,
- id: 'm' + item.id,
- leaf: true,
- uiProvider: 'col',
- iconCls: 'no-icon'
+ motifsSansGroupe << [
+ nom: item.libelle,
+ codeCouleur: item.couleur,
+ id: 'm' + item.id,
+ leaf: true,
+ uiProvider: 'col',
+ iconCls: 'no-icon'
+ ]
+ }
+ }
+
+ List groupesMotif = []
+ // motifs dans les groupes
+ for (Iterator<GroupeMotif> iter = pref.groupeMotifs.iterator(); iter.hasNext();) {
+ def motif = []
+ GroupeMotif groupeMotif = iter.next();
+ if (groupeMotif.modifiable) {
+ for (Iterator<Motif> iter2 = groupeMotif.motifs.iterator(); iter2.hasNext();) {
+ Motif item2 = iter2.next();
+ motif << [
+ nom: item2.libelle,
+ codeCouleur: item2.couleur,
+ id: 'm' +
+ item2.id,
+ leaf: true,
+ uiProvider: 'col',
+ iconCls: 'no-icon'
+ ]
+ }
+ groupesMotif << [
+ nom: groupeMotif.libelle,
+ id: 'g' + groupeMotif.id,
+ ordre: groupeMotif.ordre,
+ children: motif,
+ uiProvider: 'col'
]
}
}
- Collections.reverse(lesGroupesMotifs);
+ List lesGroupesMotifs = motifsSansGroupe + groupesMotif.sort { it.ordre }
return lesGroupesMotifs
}
disabled : true,
text : this.Modele.libelle.exporter,
style : config.style,
+ width:config.width ? config.width : 60,
handler : function () {
this.fireEvent(
this.Constantes.eventId.actionExporter
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ ~ This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ ~
+ ~ Lilie is free software. You can redistribute it and/or modify since
+ ~ you respect the terms of either (at least one of the both license) :
+ ~ - under the terms of the GNU Affero General Public License as
+ ~ published by the Free Software Foundation, either version 3 of the
+ ~ License, or (at your option) any later version.
+ ~ - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ ~ License, or any later version
+ ~
+ ~ There are special exceptions to the terms and conditions of the
+ ~ licenses as they are applied to this software. View the full text of
+ ~ the exception in file LICENSE.txt in the directory of this software
+ ~ distribution.
+ ~
+ ~ Lilie 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
+ ~ Licenses for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ and the CeCILL-C along with Lilie. If not, see :
+ ~ <http://www.gnu.org/licenses/> and
+ ~ <http://www.cecill.info/licences.fr.html>.
+ -->
+<databaseChangeLog
+ xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
+ <changeSet id="1" author="jbui">
+ <comment>Ajout de l'ordre dans les tables enttemps.groupe_motif et
+ enttemps_2011_2012.groupe-motif
+ </comment>
+
+ <addColumn schemaName="enttemps" tableName="groupe_motif">
+ <column name="ordre" type="integer" defaultValueNumeric="-1">
+ <constraints nullable="false"/>
+ </column>
+ </addColumn>
+
+ <addColumn schemaName="enttemps_2011_2012" tableName="groupe_motif">
+ <column name="ordre" type="integer" defaultValueNumeric="-1"/>
+ </addColumn>
+
+ <createProcedure>
+ CREATE OR REPLACE FUNCTION enttemps.ordonne_groupe_motifs()
+ RETURNS integer AS
+ $BODY$
+ DECLARE
+ pref_data RECORD;
+ groupe_motif_data RECORD;
+ cpt_ordre integer;
+ BEGIN
+
+ FOR pref_data IN select * from enttemps.preference_etablissement_absences
+ LOOP
+ cpt_ordre = 0;
+ FOR groupe_motif_data IN select id from enttemps.groupe_motif
+ where preference_etablissement_absences_id = pref_data.id
+ order by libelle LOOP
+
+ update enttemps.groupe_motif
+ set ordre = cpt_ordre
+ where id = groupe_motif_data.id;
+
+ cpt_ordre = cpt_ordre + 1;
+
+ END LOOP;
+ END LOOP;
+
+ RETURN 1;
+ END;
+ $BODY$
+ LANGUAGE 'plpgsql';
+ </createProcedure>
+
+ <sql>
+ ALTER FUNCTION enttemps.ordonne_groupe_motifs() OWNER TO ${owner.name};
+ </sql>
+
+ <sql>
+ select enttemps.ordonne_groupe_motifs()
+ </sql>
+
+ <sql>
+ drop function enttemps.ordonne_groupe_motifs()
+ </sql>
+
+ <addNotNullConstraint
+ schemaName="enttemps"
+ tableName="groupe_motif"
+ columnName="ordre"/>
+
+ <addUniqueConstraint
+ schemaName="enttemps"
+ tableName="groupe_motif"
+ columnNames="ordre,preference_etablissement_absences_id"
+ constraintName="uk_ordre_preference_etablissement_absences_id"/>
+
+ <createProcedure>
+ CREATE OR REPLACE FUNCTION enttemps_2011_2012.ordonne_groupe_motifs()
+ RETURNS integer AS
+ $BODY$
+ DECLARE
+ pref_data RECORD;
+ groupe_motif_data RECORD;
+ cpt_ordre integer;
+ BEGIN
+
+ FOR pref_data IN select * from enttemps_2011_2012.preference_etablissement_absences
+ LOOP
+ cpt_ordre = 0;
+ FOR groupe_motif_data IN select id from enttemps_2011_2012.groupe_motif
+ where preference_etablissement_absences_id = pref_data.id
+ order by libelle LOOP
+
+ update enttemps_2011_2012.groupe_motif
+ set ordre = cpt_ordre
+ where id = groupe_motif_data.id;
+
+ cpt_ordre = cpt_ordre + 1;
+
+ END LOOP;
+ END LOOP;
+
+ RETURN 1;
+ END;
+ $BODY$
+ LANGUAGE 'plpgsql';
+ </createProcedure>
+
+ <sql>
+ ALTER FUNCTION enttemps_2011_2012.ordonne_groupe_motifs() OWNER TO ${owner.name};
+ </sql>
+
+ <sql>
+ select enttemps_2011_2012.ordonne_groupe_motifs()
+ </sql>
+
+ <sql>
+ drop function enttemps_2011_2012.ordonne_groupe_motifs()
+ </sql>
+
+ <addNotNullConstraint
+ schemaName="enttemps_2011_2012"
+ tableName="groupe_motif"
+ columnName="ordre"/>
+
+ <addUniqueConstraint
+ schemaName="enttemps_2011_2012"
+ tableName="groupe_motif"
+ columnNames="ordre,preference_etablissement_absences_id"
+ constraintName="uk_ordre_preference_etablissement_absences_id"/>
+
+ </changeSet>
+
+ <changeSet id="2" author="jbui">
+ <comment>Ajout des colonnes dispo_bulletin et dispo_stats dans la table
+ enttemps.motif et enttemps_2011_2012.motif.
+ </comment>
+
+ <addColumn schemaName="enttemps" tableName="motif">
+ <column name="dispo_bulletin" type="boolean" defaultValueBoolean="true">
+ <constraints nullable="false"/>
+ </column>
+ </addColumn>
+
+ <addColumn schemaName="enttemps" tableName="motif">
+ <column name="dispo_stats" type="boolean" defaultValueBoolean="true">
+ <constraints nullable="false"/>
+ </column>
+ </addColumn>
+
+ <addColumn schemaName="enttemps_2011_2012" tableName="motif">
+ <column name="dispo_bulletin" type="boolean" defaultValueBoolean="true">
+ <constraints nullable="false"/>
+ </column>
+ </addColumn>
+
+ <addColumn schemaName="enttemps_2011_2012" tableName="motif">
+ <column name="dispo_stats" type="boolean" defaultValueBoolean="true">
+ <constraints nullable="false"/>
+ </column>
+ </addColumn>
+ </changeSet>
+
+ <changeSet id="3" author="jbui">
+ <update schemaName="enttemps" tableName="groupe_motif">
+ <column name="ordre" valueComputed="ordre + 1001"/>
+ </update>
+ <update schemaName="enttemps" tableName="groupe_motif">
+ <column name="ordre" valueComputed="ordre - 1000"/>
+ </update>
+ </changeSet>
+
+</databaseChangeLog>
-->
<databaseChangeLog
- xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
+ xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
- <include file="changelogs/securite/2011-12-14-0011796.xml"/>
- <include file="changelogs/securite/2011-12-15-0011796.xml"/>
- <include file="changelogs/securite/2011-12-15-0014296.xml"/>
- <include file="changelogs/securite/2011-12-19-0016895.xml"/>
- <include file="changelogs/securite/2011-12-20-0016866.xml"/>
- <include file="changelogs/securite/2012-01-19-0011796.xml"/>
- <include file="changelogs/securite/2012-03-30-0011796.xml"/>
- <include file="changelogs/securite/2012-04-03-0011796.xml"/>
- <include file="changelogs/securite/2012-06-06-0011796.xml"/>
- <include file="changelogs/securite/2012-06-08-0011796.xml"/>
- <include file="changelogs/securite/2012-06-06-0020568.xml"/>
- <include file="changelogs/securite/2012-06-13-0020725.xml"/>
- <include file="changelogs/securite/2012-06-21-0020901.xml"/>
- <include file="changelogs/securite/2012-06-27-0021088.xml"/>
- <include file="changelogs/securite/2012-07-10-0021428.xml"/>
- <include file="changelogs/securite/2012-07-20-0021632.xml"/>
- <include file="changelogs/securite/2012-12-14-0024627.xml"/>
+ <include file="changelogs/securite/2011-12-14-0011796.xml"/>
+ <include file="changelogs/securite/2011-12-15-0011796.xml"/>
+ <include file="changelogs/securite/2011-12-15-0014296.xml"/>
+ <include file="changelogs/securite/2011-12-19-0016895.xml"/>
+ <include file="changelogs/securite/2011-12-20-0016866.xml"/>
+ <include file="changelogs/securite/2012-01-19-0011796.xml"/>
+ <include file="changelogs/securite/2012-03-30-0011796.xml"/>
+ <include file="changelogs/securite/2012-04-03-0011796.xml"/>
+ <include file="changelogs/securite/2012-06-06-0011796.xml"/>
+ <include file="changelogs/securite/2012-06-08-0011796.xml"/>
+ <include file="changelogs/securite/2012-06-06-0020568.xml"/>
+ <include file="changelogs/securite/2012-06-13-0020725.xml"/>
+ <include file="changelogs/securite/2012-06-21-0020901.xml"/>
+ <include file="changelogs/securite/2012-06-27-0021088.xml"/>
+ <include file="changelogs/securite/2012-07-10-0021428.xml"/>
+ <include file="changelogs/securite/2012-07-20-0021632.xml"/>
+ <include file="changelogs/securite/2012-12-14-0024627.xml"/>
- <include file="changelogs/scolarite/2011-09-19-0014645.xml"/>
- <include file="changelogs/scolarite/2011-09-20-0014292.xml"/>
- <include file="changelogs/scolarite/2011-09-21-0014721.xml"/>
- <include file="changelogs/scolarite/2011-09-26-0014836.xml"/>
- <include file="changelogs/scolarite/2011-09-28-0014836.xml"/>
- <include file="changelogs/scolarite/2011-09-30-0014617.xml"/>
- <include file="changelogs/scolarite/2011-10-05-0014955.xml"/>
- <include file="changelogs/scolarite/2011-11-16-0016053.xml"/>
- <include file="changelogs/scolarite/2011-11-22-0016112.xml"/>
- <include file="changelogs/scolarite/2011-11-24-0016194.xml"/>
- <include file="changelogs/scolarite/2011-11-24-0016294.xml"/>
- <include file="changelogs/scolarite/2011-11-28-0016350.xml"/>
- <include file="changelogs/scolarite/2011-12-01-0016471.xml"/>
- <include file="changelogs/scolarite/2011-12-02-0016486.xml"/>
- <include file="changelogs/scolarite/2011-12-05-0016246.xml"/>
- <include file="changelogs/scolarite/2011-12-09-0016609.xml"/>
- <include file="changelogs/scolarite/2011-12-15-0014296.xml"/>
- <include file="changelogs/scolarite/2011-12-19-0016895.xml"/>
- <include file="changelogs/scolarite/2011-12-20-0016867.xml"/>
- <include file="changelogs/scolarite/2011-12-20-0016866.xml"/>
- <include file="changelogs/scolarite/2011-12-21-0016866.xml"/>
- <include file="changelogs/scolarite/2011-12-23-0016534.xml"/>
- <include file="changelogs/scolarite/2012-01-02-0016866.xml"/>
- <include file="changelogs/scolarite/2012-01-03-0016866.xml"/>
- <include file="changelogs/scolarite/2012-01-04-0016932.xml"/>
- <include file="changelogs/scolarite/2012-01-04-0014579.xml"/>
- <include file="changelogs/scolarite/2012-01-06-0017199.xml"/>
- <include file="changelogs/scolarite/2012-01-10-0012729.xml"/>
- <include file="changelogs/scolarite/2012-01-11-0016370.xml"/>
- <include file="changelogs/scolarite/2012-01-11-0017223.xml"/>
- <include file="changelogs/scolarite/2012-01-11-0012216.xml"/>
- <include file="changelogs/scolarite/2012-01-12-0012216.xml"/>
- <include file="changelogs/scolarite/2012-01-16-0017424.xml"/>
- <include file="changelogs/scolarite/2012-01-31-0017171.xml"/>
- <include file="changelogs/scolarite/2012-02-06-0017883.xml"/>
- <include file="changelogs/scolarite/2012-02-07-0017883.xml"/>
- <include file="changelogs/scolarite/2012-02-07-0017199.xml"/>
- <include file="changelogs/scolarite/2012-02-08-0017941.xml"/>
- <include file="changelogs/scolarite/2012-02-23-0018228.xml"/>
- <include file="changelogs/scolarite/2012-02-22-0018209.xml"/>
- <include file="changelogs/scolarite/2012-02-28-0018332.xml"/>
- <include file="changelogs/scolarite/2012-02-28-0018332-2.xml"/>
- <include file="changelogs/scolarite/2012-02-29-0018332.xml"/>
- <include file="changelogs/scolarite/2012-03-01-0018401.xml"/>
- <include file="changelogs/scolarite/2012-03-12-0018343.xml"/>
- <include file="changelogs/scolarite/2012-03-29-0018128.xml"/>
- <include file="changelogs/scolarite/2012-03-29-0019221.xml"/>
- <include file="changelogs/scolarite/2012-04-02-0018128.xml"/>
- <include file="changelogs/scolarite/2012-04-03-0019221.xml"/>
- <include file="changelogs/scolarite/2012-04-10-0019469.xml"/>
- <include file="changelogs/scolarite/2012-04-11-0018128.xml"/>
- <include file="changelogs/scolarite/2012-04-17-0018128.xml"/>
- <include file="changelogs/scolarite/2012-04-17-0019367.xml"/>
- <include file="changelogs/scolarite/2012-04-24-0019788.xml"/>
- <include file="changelogs/scolarite/2012-04-26-0019847.xml"/>
- <include file="changelogs/scolarite/2012-05-14-0008904.xml"/>
- <include file="changelogs/scolarite/2012-05-11-0008904.xml"/>
- <include file="changelogs/scolarite/2012-05-15-0018336.xml"/>
- <include file="changelogs/scolarite/2012-05-15-0008904-2.xml"/>
- <include file="changelogs/scolarite/2012-05-15-0008904.xml"/>
- <include file="changelogs/scolarite/2012-05-16-0008904.xml"/>
- <include file="changelogs/scolarite/2012-05-16-0008904-2.xml"/>
- <include file="changelogs/scolarite/2012-05-16-0008904-3.xml"/>
- <include file="changelogs/scolarite/2012-05-21-0008904.xml"/>
- <include file="changelogs/scolarite/2012-05-18-0018337.xml"/>
- <include file="changelogs/scolarite/2012-05-23-0018337.xml"/>
- <include file="changelogs/scolarite/2012-05-24-0020322.xml"/>
- <include file="changelogs/scolarite/2012-05-31-0020438.xml"/>
- <include file="changelogs/scolarite/2012-05-30-0020385.xml"/>
- <include file="changelogs/scolarite/2012-06-01-0020479.xml"/>
- <include file="changelogs/scolarite/2012-06-04-0020429.xml"/>
- <include file="changelogs/scolarite/2012-06-05-0019775.xml"/>
- <include file="changelogs/scolarite/2012-06-12-0020668.xml"/>
- <include file="changelogs/scolarite/2012-06-14-0020668.xml"/>
- <include file="changelogs/scolarite/2012-06-14-0020675.xml"/>
- <include file="changelogs/scolarite/2012-06-14-0020725.xml"/>
- <include file="changelogs/scolarite/2012-06-14-0020668-2.xml"/>
- <include file="changelogs/scolarite/2012-06-15-0020779.xml"/>
- <include file="changelogs/scolarite/2012-06-19-0020672.xml"/>
- <include file="changelogs/scolarite/2012-06-19-0020779.xml"/>
- <include file="changelogs/scolarite/2012-06-21-0020859.xml"/>
- <include file="changelogs/scolarite/2012-06-21-0020809.xml"/>
- <include file="changelogs/scolarite/2012-06-25-0021013.xml"/>
- <include file="changelogs/scolarite/2012-06-27-0021058.xml"/>
- <include
- file="changelogs/scolarite/archivage_2011_2012/bascule_creation_schema.xml"/>
- <include file="changelogs/scolarite/2012-06-27-0021058-2.xml"/>
- <include file="changelogs/scolarite/2012-06-27-0021058-3.xml"/>
- <include file="changelogs/scolarite/2012-06-28-0021058.xml"/>
- <include file="changelogs/scolarite/2012-06-28-0021058-2.xml"/>
- <include file="changelogs/scolarite/2012-07-02-0021058.xml"/>
- <include file="changelogs/scolarite/2012-07-04-0021058.xml"/>
- <include file="changelogs/scolarite/2012-07-06-0021322.xml"/>
- <include file="changelogs/scolarite/2012-07-13-0021479.xml"/>
- <include file="changelogs/scolarite/2012-07-13-0021058.xml"/>
- <include file="changelogs/scolarite/2012-07-13-0021466.xml"/>
- <include file="changelogs/scolarite/2012-07-16-0021058.xml"/>
- <include file="changelogs/scolarite/2012-07-17-0021563.xml"/>
- <include file="changelogs/scolarite/2012-07-18-0021560.xml"/>
- <include file="changelogs/scolarite/2012-07-20-0021619.xml"/>
- <include file="changelogs/scolarite/2012-07-23-0021654.xml"/>
- <include file="changelogs/securite/2012-07-09-0020830.xml"/>
- <include file="changelogs/scolarite/2012-07-09-0020830-2.xml"/>
- <include file="changelogs/securite/2012-07-09-0020830-3.xml"/>
- <include file="changelogs/scolarite/2012-07-27-0021858.xml"/>
- <include file="changelogs/scolarite/2012-08-21-0021984.xml"/>
- <include file="changelogs/scolarite/2012-08-23-0021984.xml"/>
- <include file="changelogs/scolarite/2012-08-27-0022052.xml"/>
- <include file="changelogs/scolarite/2012-08-28-0022055.xml"/>
- <include file="changelogs/scolarite/2012-08-28-0022071.xml"/>
- <include file="changelogs/scolarite/2012-08-29-0022053.xml"/>
- <include file="changelogs/scolarite/2012-09-06-0022142.xml"/>
- <include file="changelogs/scolarite/2012-09-07-0022245.xml"/>
- <include file="changelogs/scolarite/2012-09-07-0022055.xml"/>
- <include file="changelogs/scolarite/2012-10-08-0022910.xml"/>
- <include file="changelogs/scolarite/2012-10-16-0022502.xml"/>
- <include file="changelogs/scolarite/2012-10-02-0022504.xml"/>
- <include file="changelogs/scolarite/2012-10-11-0022504.xml"/>
- <include file="changelogs/scolarite/2012-10-25-0023290.xml"/>
- <include file="changelogs/scolarite/2012-10-26-0023396.xml"/>
- <include file="changelogs/scolarite/2012-10-26-0023360.xml"/>
- <include file="changelogs/scolarite/2012-11-05-0023473.xml"/>
- <include file="changelogs/scolarite/2012-11-16-0023433.xml"/>
- <include file="changelogs/scolarite/2012-11-19-0023473.xml"/>
- <include file="changelogs/scolarite/2012-11-20-0023473.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-21-0023926.xml"/>
- <include file="changelogs/scolarite/2012-11-22-0023473.xml"/>
- <include file="changelogs/scolarite/2012-11-23-0023969.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-23-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-26-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-27-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-26-0024025.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-27-0024025.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-28-0024025.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-11-30-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-03-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-04-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-05-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-06-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-07-0023926.xml"/>
- <include file="changelogs/scolarite/2012-12-07-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-10-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-11-0023926.xml"/>
- <include file="changelogs/scolarite/2012-12-11-0024530.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-14-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-17-0024645.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-19-0024646.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2012-12-21-0023926.xml"/>
- <include file="changelogs/scolarite/2013-01-02-0024797.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2013-01-07-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2013-01-08-0023926.xml"/>
- <include file="changelogs/securite/2013-01-09-0024893.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2013-01-09-0023926.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2013-01-10-0023926.xml"/>
- <include file="changelogs/securite/2013-01-10-0024935.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2013-01-11-0023926.xml"/>
- <include file="changelogs/scolarite/2013-01-21-0021316.xml"/>
- <include file="changelogs/scolarite/2013-01-21-0025254.xml"/>
- <include file="changelogs/scolarite/2013-01-23-0025308.xml"/>
- <include
- file="changelogs/scolarite/annuaire_interface/2013-01-21-0025267.xml"/>
- <include file="changelogs/scolarite/2013-01-24-0025308.xml"/>
- <include file="changelogs/scolarite/2013-01-25-0025308.xml"/>
- <include file="changelogs/scolarite/2013-01-28-0025308.xml"/>
- <include file="changelogs/scolarite/2013-01-29-0025308.xml"/>
- <include file="changelogs/scolarite/2013-01-30-0025308.xml"/>
- <include file="changelogs/scolarite/2013-01-31-0025308.xml"/>
- <include file="changelogs/securite/2013-02-01-0025502.xml"/>
- <include file="changelogs/scolarite/2013-02-01-0025308.xml"/>
- <include file="changelogs/scolarite/2013-02-06-0025563.xml"/>
- <include file="changelogs/scolarite/2013-02-07-0025564.xml"/>
- <include file="changelogs/scolarite/annuaire_interface/2013-02-07-0025251.xml"/>
- <include file="changelogs/scolarite/2013-02-08-0025570.xml"/>
- <include file="changelogs/scolarite/2013-02-11-0025655.xml"/>
- <include file="changelogs/scolarite/2013-02-13-0025725.xml"/>
- <!--<include file="changelogs/scolarite/2013-02-13-0025725-2.xml"/>--> <!--TODO : activer quand postgresql-contrib sera installé-->
- <include file="changelogs/scolarite/2013-02-14-0025741.xml"/>
- <include file="changelogs/securite/2013-02-15-0025761.xml"/>
- <include file="changelogs/scolarite/2013-02-18-0025774.xml"/>
- <include file="changelogs/scolarite/2013-02-18-0025784.xml"/>
- <include file="changelogs/scolarite/2013-02-18-0025782.xml"/>
- <include file="changelogs/scolarite/2013-02-20-0025839.xml"/>
- <include file="changelogs/scolarite/2013-02-20-0025834.xml"/>
- <include file="changelogs/scolarite/2013-02-20-0025782.xml"/>
- <include file="changelogs/scolarite/2013-02-21-0025834.xml"/>
- <include file="changelogs/scolarite/2013-02-21-0025834-2.xml"/>
- <include file="changelogs/scolarite/2013-02-21-0025834-3.xml"/>
- <include file="changelogs/scolarite/2013-02-22-0025834.xml"/>
- <include file="changelogs/scolarite/2013-02-25-0025834.xml"/>
- <include file="changelogs/scolarite/2013-02-25-0025906.xml"/>
- <include file="changelogs/scolarite/2013-02-26-0025834.xml"/>
- <include file="changelogs/scolarite/2013-02-27-0025965.xml"/>
- <include file="changelogs/scolarite/2013-02-27-0025987.xml"/>
- <include file="changelogs/securite/2013-03-07-0025834.xml"/>
- <include file="changelogs/scolarite/2013-03-07-0025834.xml"/>
+ <include file="changelogs/scolarite/2011-09-19-0014645.xml"/>
+ <include file="changelogs/scolarite/2011-09-20-0014292.xml"/>
+ <include file="changelogs/scolarite/2011-09-21-0014721.xml"/>
+ <include file="changelogs/scolarite/2011-09-26-0014836.xml"/>
+ <include file="changelogs/scolarite/2011-09-28-0014836.xml"/>
+ <include file="changelogs/scolarite/2011-09-30-0014617.xml"/>
+ <include file="changelogs/scolarite/2011-10-05-0014955.xml"/>
+ <include file="changelogs/scolarite/2011-11-16-0016053.xml"/>
+ <include file="changelogs/scolarite/2011-11-22-0016112.xml"/>
+ <include file="changelogs/scolarite/2011-11-24-0016194.xml"/>
+ <include file="changelogs/scolarite/2011-11-24-0016294.xml"/>
+ <include file="changelogs/scolarite/2011-11-28-0016350.xml"/>
+ <include file="changelogs/scolarite/2011-12-01-0016471.xml"/>
+ <include file="changelogs/scolarite/2011-12-02-0016486.xml"/>
+ <include file="changelogs/scolarite/2011-12-05-0016246.xml"/>
+ <include file="changelogs/scolarite/2011-12-09-0016609.xml"/>
+ <include file="changelogs/scolarite/2011-12-15-0014296.xml"/>
+ <include file="changelogs/scolarite/2011-12-19-0016895.xml"/>
+ <include file="changelogs/scolarite/2011-12-20-0016867.xml"/>
+ <include file="changelogs/scolarite/2011-12-20-0016866.xml"/>
+ <include file="changelogs/scolarite/2011-12-21-0016866.xml"/>
+ <include file="changelogs/scolarite/2011-12-23-0016534.xml"/>
+ <include file="changelogs/scolarite/2012-01-02-0016866.xml"/>
+ <include file="changelogs/scolarite/2012-01-03-0016866.xml"/>
+ <include file="changelogs/scolarite/2012-01-04-0016932.xml"/>
+ <include file="changelogs/scolarite/2012-01-04-0014579.xml"/>
+ <include file="changelogs/scolarite/2012-01-06-0017199.xml"/>
+ <include file="changelogs/scolarite/2012-01-10-0012729.xml"/>
+ <include file="changelogs/scolarite/2012-01-11-0016370.xml"/>
+ <include file="changelogs/scolarite/2012-01-11-0017223.xml"/>
+ <include file="changelogs/scolarite/2012-01-11-0012216.xml"/>
+ <include file="changelogs/scolarite/2012-01-12-0012216.xml"/>
+ <include file="changelogs/scolarite/2012-01-16-0017424.xml"/>
+ <include file="changelogs/scolarite/2012-01-31-0017171.xml"/>
+ <include file="changelogs/scolarite/2012-02-06-0017883.xml"/>
+ <include file="changelogs/scolarite/2012-02-07-0017883.xml"/>
+ <include file="changelogs/scolarite/2012-02-07-0017199.xml"/>
+ <include file="changelogs/scolarite/2012-02-08-0017941.xml"/>
+ <include file="changelogs/scolarite/2012-02-23-0018228.xml"/>
+ <include file="changelogs/scolarite/2012-02-22-0018209.xml"/>
+ <include file="changelogs/scolarite/2012-02-28-0018332.xml"/>
+ <include file="changelogs/scolarite/2012-02-28-0018332-2.xml"/>
+ <include file="changelogs/scolarite/2012-02-29-0018332.xml"/>
+ <include file="changelogs/scolarite/2012-03-01-0018401.xml"/>
+ <include file="changelogs/scolarite/2012-03-12-0018343.xml"/>
+ <include file="changelogs/scolarite/2012-03-29-0018128.xml"/>
+ <include file="changelogs/scolarite/2012-03-29-0019221.xml"/>
+ <include file="changelogs/scolarite/2012-04-02-0018128.xml"/>
+ <include file="changelogs/scolarite/2012-04-03-0019221.xml"/>
+ <include file="changelogs/scolarite/2012-04-10-0019469.xml"/>
+ <include file="changelogs/scolarite/2012-04-11-0018128.xml"/>
+ <include file="changelogs/scolarite/2012-04-17-0018128.xml"/>
+ <include file="changelogs/scolarite/2012-04-17-0019367.xml"/>
+ <include file="changelogs/scolarite/2012-04-24-0019788.xml"/>
+ <include file="changelogs/scolarite/2012-04-26-0019847.xml"/>
+ <include file="changelogs/scolarite/2012-05-14-0008904.xml"/>
+ <include file="changelogs/scolarite/2012-05-11-0008904.xml"/>
+ <include file="changelogs/scolarite/2012-05-15-0018336.xml"/>
+ <include file="changelogs/scolarite/2012-05-15-0008904-2.xml"/>
+ <include file="changelogs/scolarite/2012-05-15-0008904.xml"/>
+ <include file="changelogs/scolarite/2012-05-16-0008904.xml"/>
+ <include file="changelogs/scolarite/2012-05-16-0008904-2.xml"/>
+ <include file="changelogs/scolarite/2012-05-16-0008904-3.xml"/>
+ <include file="changelogs/scolarite/2012-05-21-0008904.xml"/>
+ <include file="changelogs/scolarite/2012-05-18-0018337.xml"/>
+ <include file="changelogs/scolarite/2012-05-23-0018337.xml"/>
+ <include file="changelogs/scolarite/2012-05-24-0020322.xml"/>
+ <include file="changelogs/scolarite/2012-05-31-0020438.xml"/>
+ <include file="changelogs/scolarite/2012-05-30-0020385.xml"/>
+ <include file="changelogs/scolarite/2012-06-01-0020479.xml"/>
+ <include file="changelogs/scolarite/2012-06-04-0020429.xml"/>
+ <include file="changelogs/scolarite/2012-06-05-0019775.xml"/>
+ <include file="changelogs/scolarite/2012-06-12-0020668.xml"/>
+ <include file="changelogs/scolarite/2012-06-14-0020668.xml"/>
+ <include file="changelogs/scolarite/2012-06-14-0020675.xml"/>
+ <include file="changelogs/scolarite/2012-06-14-0020725.xml"/>
+ <include file="changelogs/scolarite/2012-06-14-0020668-2.xml"/>
+ <include file="changelogs/scolarite/2012-06-15-0020779.xml"/>
+ <include file="changelogs/scolarite/2012-06-19-0020672.xml"/>
+ <include file="changelogs/scolarite/2012-06-19-0020779.xml"/>
+ <include file="changelogs/scolarite/2012-06-21-0020859.xml"/>
+ <include file="changelogs/scolarite/2012-06-21-0020809.xml"/>
+ <include file="changelogs/scolarite/2012-06-25-0021013.xml"/>
+ <include file="changelogs/scolarite/2012-06-27-0021058.xml"/>
+ <include
+ file="changelogs/scolarite/archivage_2011_2012/bascule_creation_schema.xml"/>
+ <include file="changelogs/scolarite/2012-06-27-0021058-2.xml"/>
+ <include file="changelogs/scolarite/2012-06-27-0021058-3.xml"/>
+ <include file="changelogs/scolarite/2012-06-28-0021058.xml"/>
+ <include file="changelogs/scolarite/2012-06-28-0021058-2.xml"/>
+ <include file="changelogs/scolarite/2012-07-02-0021058.xml"/>
+ <include file="changelogs/scolarite/2012-07-04-0021058.xml"/>
+ <include file="changelogs/scolarite/2012-07-06-0021322.xml"/>
+ <include file="changelogs/scolarite/2012-07-13-0021479.xml"/>
+ <include file="changelogs/scolarite/2012-07-13-0021058.xml"/>
+ <include file="changelogs/scolarite/2012-07-13-0021466.xml"/>
+ <include file="changelogs/scolarite/2012-07-16-0021058.xml"/>
+ <include file="changelogs/scolarite/2012-07-17-0021563.xml"/>
+ <include file="changelogs/scolarite/2012-07-18-0021560.xml"/>
+ <include file="changelogs/scolarite/2012-07-20-0021619.xml"/>
+ <include file="changelogs/scolarite/2012-07-23-0021654.xml"/>
+ <include file="changelogs/securite/2012-07-09-0020830.xml"/>
+ <include file="changelogs/scolarite/2012-07-09-0020830-2.xml"/>
+ <include file="changelogs/securite/2012-07-09-0020830-3.xml"/>
+ <include file="changelogs/scolarite/2012-07-27-0021858.xml"/>
+ <include file="changelogs/scolarite/2012-08-21-0021984.xml"/>
+ <include file="changelogs/scolarite/2012-08-23-0021984.xml"/>
+ <include file="changelogs/scolarite/2012-08-27-0022052.xml"/>
+ <include file="changelogs/scolarite/2012-08-28-0022055.xml"/>
+ <include file="changelogs/scolarite/2012-08-28-0022071.xml"/>
+ <include file="changelogs/scolarite/2012-08-29-0022053.xml"/>
+ <include file="changelogs/scolarite/2012-09-06-0022142.xml"/>
+ <include file="changelogs/scolarite/2012-09-07-0022245.xml"/>
+ <include file="changelogs/scolarite/2012-09-07-0022055.xml"/>
+ <include file="changelogs/scolarite/2012-10-08-0022910.xml"/>
+ <include file="changelogs/scolarite/2012-10-16-0022502.xml"/>
+ <include file="changelogs/scolarite/2012-10-02-0022504.xml"/>
+ <include file="changelogs/scolarite/2012-10-11-0022504.xml"/>
+ <include file="changelogs/scolarite/2012-10-25-0023290.xml"/>
+ <include file="changelogs/scolarite/2012-10-26-0023396.xml"/>
+ <include file="changelogs/scolarite/2012-10-26-0023360.xml"/>
+ <include file="changelogs/scolarite/2012-11-05-0023473.xml"/>
+ <include file="changelogs/scolarite/2012-11-16-0023433.xml"/>
+ <include file="changelogs/scolarite/2012-11-19-0023473.xml"/>
+ <include file="changelogs/scolarite/2012-11-20-0023473.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-21-0023926.xml"/>
+ <include file="changelogs/scolarite/2012-11-22-0023473.xml"/>
+ <include file="changelogs/scolarite/2012-11-23-0023969.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-23-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-26-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-27-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-26-0024025.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-27-0024025.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-28-0024025.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-11-30-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-03-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-04-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-05-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-06-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-07-0023926.xml"/>
+ <include file="changelogs/scolarite/2012-12-07-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-10-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-11-0023926.xml"/>
+ <include file="changelogs/scolarite/2012-12-11-0024530.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-14-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-17-0024645.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-19-0024646.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2012-12-21-0023926.xml"/>
+ <include file="changelogs/scolarite/2013-01-02-0024797.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2013-01-07-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2013-01-08-0023926.xml"/>
+ <include file="changelogs/securite/2013-01-09-0024893.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2013-01-09-0023926.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2013-01-10-0023926.xml"/>
+ <include file="changelogs/securite/2013-01-10-0024935.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2013-01-11-0023926.xml"/>
+ <include file="changelogs/scolarite/2013-01-21-0021316.xml"/>
+ <include file="changelogs/scolarite/2013-01-21-0025254.xml"/>
+ <include file="changelogs/scolarite/2013-01-23-0025308.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2013-01-21-0025267.xml"/>
+ <include file="changelogs/scolarite/2013-01-24-0025308.xml"/>
+ <include file="changelogs/scolarite/2013-01-25-0025308.xml"/>
+ <include file="changelogs/scolarite/2013-01-28-0025308.xml"/>
+ <include file="changelogs/scolarite/2013-01-29-0025308.xml"/>
+ <include file="changelogs/scolarite/2013-01-30-0025308.xml"/>
+ <include file="changelogs/scolarite/2013-01-31-0025308.xml"/>
+ <include file="changelogs/securite/2013-02-01-0025502.xml"/>
+ <include file="changelogs/scolarite/2013-02-01-0025308.xml"/>
+ <include file="changelogs/scolarite/2013-02-06-0025563.xml"/>
+ <include file="changelogs/scolarite/2013-02-07-0025564.xml"/>
+ <include
+ file="changelogs/scolarite/annuaire_interface/2013-02-07-0025251.xml"/>
+ <include file="changelogs/scolarite/2013-02-08-0025570.xml"/>
+ <include file="changelogs/scolarite/2013-02-11-0025655.xml"/>
+ <include file="changelogs/scolarite/2013-02-13-0025725.xml"/>
+ <!--<include file="changelogs/scolarite/2013-02-13-0025725-2.xml"/>--> <!--TODO : activer quand postgresql-contrib sera installé-->
+ <include file="changelogs/scolarite/2013-02-14-0025741.xml"/>
+ <include file="changelogs/securite/2013-02-15-0025761.xml"/>
+ <include file="changelogs/scolarite/2013-02-18-0025774.xml"/>
+ <include file="changelogs/scolarite/2013-02-18-0025784.xml"/>
+ <include file="changelogs/scolarite/2013-02-18-0025782.xml"/>
+ <include file="changelogs/scolarite/2013-02-20-0025839.xml"/>
+ <include file="changelogs/scolarite/2013-02-20-0025834.xml"/>
+ <include file="changelogs/scolarite/2013-02-20-0025782.xml"/>
+ <include file="changelogs/scolarite/2013-02-21-0025834.xml"/>
+ <include file="changelogs/scolarite/2013-02-21-0025834-2.xml"/>
+ <include file="changelogs/scolarite/2013-02-21-0025834-3.xml"/>
+ <include file="changelogs/scolarite/2013-02-22-0025834.xml"/>
+ <include file="changelogs/scolarite/2013-02-25-0025834.xml"/>
+ <include file="changelogs/scolarite/2013-02-25-0025906.xml"/>
+ <include file="changelogs/scolarite/2013-02-26-0025834.xml"/>
+ <include file="changelogs/scolarite/2013-02-27-0025965.xml"/>
+ <include file="changelogs/scolarite/2013-02-27-0025987.xml"/>
+ <include file="changelogs/securite/2013-03-07-0025834.xml"/>
+ <include file="changelogs/scolarite/2013-03-07-0025834.xml"/>
+ <include file="changelogs/scolarite/2013-02-27-0025997.xml"/>
</databaseChangeLog>
* @param groupeMotifId : id du groupe de motifs pour filtrage
* @return une liste de Motif
*/
- protected List getMotifs(List listeGroupeMotifId) {
+ protected List<Motif> getMotifs(List listeGroupeMotifId) {
List<Motif> listeMotifs = []
if (listeGroupeMotifId.contains(BasicCriteresRecherche.VALEUR_TOUS.toString())) {
listeMotifs = motifService.getMotifsForPreferencesEtablissement(
* @param listeGroupeMotifId : liste d'id de groupe de motifs pour filtrage
* @return une liste de Map
*/
- protected List getMotifsForJSON(List listeGroupeMotifId) {
+ protected List getMotifsForJSON(List<Motif> motifs) {
def result = []
- def motifs = getMotifs(listeGroupeMotifId)
motifs.each {
Motif motif ->
result << [id: motif.id, libelle: motif.libelle]
List<Map> resultats = []
data.each { it ->
resultats.add(
- [id: it.id,
+ [
+ id: it.id,
libelle: it.libelle
])
}
PreferencesEtablissementAbsences pref = getPreferencesEtablissementCourant()
pref.groupeMotifs.each {
GroupeMotif groupe ->
- result << [id: groupe.id, libelle: groupe.libelle]
+ result << [
+ id: groupe.id,
+ libelle: groupe.libelle,
+ ordre: groupe.ordre
+ ]
}
- result.sort { g1, g2 -> g1.libelle <=> g2.libelle }
+ result.sort { it.ordre }
return result
}
return menuAideInfo
}
+ /**
+ * @param motifDefauts
+ * @param motifs
+ * @return une intersection des 2 listes de motifs
+ */
+ protected List<Motif> getSousListeMotifsDefaut(List<Motif> motifDefauts,
+ List<Motif> motifs) {
+ List<Motif> result = []
+ motifDefauts.each {
+ Motif motif ->
+ if (motifs.find {it.id == motif.id}) {
+ result << motif
+ }
+ }
+ return result
+ }
+
}
import javax.servlet.http.HttpServletResponse
import org.lilie.services.eliot.urllabel.breadcrumbs.BreadCrumbsItemInfo
import org.lilie.services.eliot.urllabel.UrlLabelInfo
+import org.lilie.services.eliot.absences.Motif
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
class ConsultationController extends AbstractConsultationController {
Boolean afficheMessageErreur = chainModel?.afficheMessageErreur ?: false
modele.afficheMessageErreur = afficheMessageErreur
+ modele.motifIdsDefaut = getMotifIdsDefaut()
Calendrier calendrier = getCalendrier()
modele.anneeScolaire = [
modele.bilanLignesParPage = nbLignesParPages
modele.actionListeBilan = 'listerBilanAbsenceRetard'
modele.actionExporteDonnees = 'exporteDonneesAbsences'
+ modele.motifIdsDefaut = getMotifIdsDefaut()
render(
view: '/consultation/absences/index',
modele.bilanLignesParPage = nbLignesParPages
modele.actionListeBilan = 'listerBilanAbsenceRetard'
modele.actionExporteDonnees = 'exporteDonneesAbsences'
+ modele.motifIdsDefaut = getMotifIdsDefaut()
render(
view: '/consultation/retards/index',
)
}
+ /**
+ * @return une chaine contenant les id des motifs par defaut, séparés par
+ * des virgules
+ */
+ private String getMotifIdsDefaut() {
+ List<Motif> motifDefauts = motifService.findAllMotifForPriseEnCompteMotif(
+ preferencesEtablissementCourant,
+ PriseEnCompteMotif.STATS,
+ false
+ )
+ return motifDefauts*.id.join(',')
+ }
+
def departsIndex = {
verificationDroitFonctionnalite(AbsencesFonctionnalite.CONSULTATION_ABSENCES)
// construction du modèle
modele.bilanLignesParPage = nbLignesParPages
modele.actionListeBilan = 'listerBilanAbsenceRetard'
modele.actionExporteDonnees = 'exporteDonneesAbsences'
+ modele.motifIdsDefaut = getMotifIdsDefaut()
render(
view: '/consultation/departs/index',
modele.bilanLignesParPage = nbLignesParPages
modele.actionListeBilan = 'getInternats'
modele.actionExporteDonnees = 'exporteInternats'
+ modele.motifIdsDefaut = getMotifIdsDefaut()
render(
view: '/consultation/demipensioninternat/index',
modele.bilanLignesParPage = nbLignesParPages
modele.actionListeBilan = 'getDemiPensions'
modele.actionExporteDonnees = 'exporteDemiPensions'
+ modele.motifIdsDefaut = getMotifIdsDefaut()
render(
view: '/consultation/demipensioninternat/index',
*/
def listeMotifs = {
if (params.groupeMotifIds) {
- List<String> listeIds = (params.groupeMotifIds as String).split(',') as List
- render getMotifsForJSON(listeIds) as JSON
+ String groupeMotifIds = params.groupeMotifIds
+ List<String> listeIds = groupeMotifIds.split(',') as List
+ List<Motif> motifs = getMotifs(listeIds)
+
+ List<Motif> motifDefauts = motifService.findAllMotifForPriseEnCompteMotif(
+ preferencesEtablissementCourant,
+ PriseEnCompteMotif.STATS,
+ false
+ )
+
+ Map result = [
+ success: true,
+ data: motifs,
+ selectionParDefautIds: getSousListeMotifsDefaut(motifDefauts, motifs)*.id.join(',')
+ ]
+ render result as JSON
} else {
render([] as JSON)
}
* <http://www.cecill.info/licences.fr.html>.
*/
-
-
-
-
-
-
package org.lilie.services.eliot.absences.parametrage.motif
import org.lilie.services.eliot.absences.AbstractAbsencesController
import org.lilie.services.eliot.parametrages.motifs.GroupeMotifDeleteException
import org.lilie.services.eliot.absences.Motif
import org.lilie.services.eliot.parametrages.motifs.MotifException
-
import org.lilie.services.eliot.parametrages.motifs.GroupeMotifService
import org.lilie.services.eliot.parametrages.motifs.MotifDeleteException
import org.lilie.services.eliot.absences.PreferencesEtablissementAbsences
GroupeMotifService groupeMotifService
def index = {
+
verificationDroitFonctionnalite(AbsencesFonctionnalite.PARAMETRAGE_MOTIF)
+ PreferencesEtablissementAbsences preferencesEtablissementAbsences = getPreferencesEtablissementCourant()
+
+ List<GroupeMotif> allGroupeMotif =
+ groupeMotifService.findAllGroupeMotifByPreferencesEtablissement(preferencesEtablissementAbsences)
+
// construction du modèle
Map modele = prepareBaseModele(Page.PARAMETRAGE_MOTIFS)
- // on complète le modèle
- modele.preferencesEtablissement = getPreferencesEtablissementCourant()
+ modele.preferencesEtablissement = preferencesEtablissementAbsences
+
+ modele.arbreMotif = allGroupeMotifVersJson(allGroupeMotif)
render(
- view: '/parametrage/motifs/motif',
- model: modele
+ view: '/parametrage/motifs/motif',
+ model: modele
)
}
+ /**
+ * Convertion de l'objet contenant l'arbre des motif en JSON
+ * @param arbreMotifInfo
+ * @return
+ */
+ private JSON allGroupeMotifVersJson(List<GroupeMotif> allGroupeMotif) {
+
+ List resultat = []
+
+ allGroupeMotif.each {GroupeMotif groupeMotif ->
+ resultat << groupeMotifToMap(groupeMotif)
+ }
+
+ return resultat as JSON
+
+ }
+
+ /**
+ * Convertion d'un groupe motif pour l'interface
+ * @param noeudMotifInfo
+ * @return
+ */
+ public Map groupeMotifToMap(GroupeMotif groupeMotif) {
+
+ Map resultat = [
+ id: "$groupeMotif.id",
+ text: groupeMotif.libelle,
+ draggable: false,
+ ordre: groupeMotif.ordre
+ ]
+
+ // récupération des données enfants
+ List motifs = []
+
+ groupeMotif.motifs.each {Motif motif ->
+ motifs << [
+ id: "$motif.id",
+ nom: motif.libelle,
+ draggable: false,
+ couleur: motif.couleur,
+ dispoBulletin: motif.dispoBulletin,
+ dispoStats: motif.dispoStats,
+ leaf: true,
+ editable: false,
+ uiProvider: "col",
+ iconCls:"no-icon"
+ ]
+ }
+
+ resultat.children = motifs
+
+ return resultat
+
+ }
+
+ def modifierOrdreGroupe = {
+
+ }
+
/**
* Action de création d'un groupe de motif
*/
String etablissementIdExterne = securiteSession.etablissementCourant.idExterne
def prefEtab = getPreferencesEtablissementForIdExterne(
- etablissementIdExterne,
- true
+ etablissementIdExterne,
+ true
)
GroupeMotif groupeMotif
try {
groupeMotif = groupeMotifService.creerGroupeMotif(
- prefEtab,
- libelle,
- securiteSession
+ prefEtab,
+ libelle,
+ securiteSession
)
}
catch (GroupeMotifException e) {
render([
- success: false,
- errorMsg: message(code: e.codeMessage)
+ success: false,
+ errorMsg: message(code: e.codeMessage)
] as JSON)
return
}
Map leGroupeMotifJSON = [
- 'nom': groupeMotif?.libelle,
- 'id': groupeMotif?.id,
- 'success': true
+ 'nom': groupeMotif?.libelle,
+ 'id': groupeMotif?.id,
+ 'success': true
]
render leGroupeMotifJSON as JSON
def modifierGroupeMotif = {
verificationDroitFonctionnalite(AbsencesFonctionnalite.PARAMETRAGE_MOTIF)
SecuriteSession securiteSession = getSecuriteSession()
+
String libelle = params.libelle
Long id = Long.parseLong(params.idGrpMotif)
+ Integer ordre = Integer.parseInt(params.ordre)
log.debug("modifierGroupeMotif:" + libelle + ", id=" + id)
GroupeMotif groupeMotif
try {
groupeMotif = groupeMotifService.modifieGroupeMotif(
- id,
- libelle,
- securiteSession
+ securiteSession,
+ id,
+ libelle,
+ ordre
)
}
catch (GroupeMotifException e) {
render([
- success: false,
- errorMsg: message(code: e.codeMessage)
+ success: false,
+ errorMsg: message(code: e.codeMessage)
] as JSON)
return
}
Map leGroupeMotifJSON = [
- 'nom': groupeMotif?.libelle,
- 'id': groupeMotif?.id,
- 'success': true
+ 'nom': groupeMotif?.libelle,
+ 'id': groupeMotif?.id,
+ 'success': true
]
render leGroupeMotifJSON as JSON
render resultat as JSON
}
+ def monterGroupeMotif = {
+
+ verificationDroitFonctionnalite(AbsencesFonctionnalite.PARAMETRAGE_MOTIF)
+
+ PreferencesEtablissementAbsences preferencesEtablissementAbsences = getPreferencesEtablissementCourant()
+ Long id = Long.parseLong(params.id)
+
+ Map resultat
+ try {
+ List<GroupeMotif> groupesModifies = groupeMotifService.monterGroupeMotif(
+ GroupeMotif.load(id),
+ preferencesEtablissementAbsences
+ )
+ resultat = ['success': true]
+
+ if (groupesModifies) {
+ resultat['groupe1'] = [
+ 'id': groupesModifies[0].id,
+ 'ordre': groupesModifies[0].ordre
+ ]
+
+ resultat['groupe2'] = [
+ 'id': groupesModifies[1].id,
+ 'ordre': groupesModifies[1].ordre
+ ]
+ }
+
+ }
+ catch (GroupeMotifException e) {
+ render([
+ success: false,
+ errorMsg: message(code: e.codeMessage)
+ ] as JSON)
+ return
+ }
+
+ render resultat as JSON
+
+ }
+
+ def descendreGroupeMotif = {
+
+ verificationDroitFonctionnalite(AbsencesFonctionnalite.PARAMETRAGE_MOTIF)
+
+ PreferencesEtablissementAbsences preferencesEtablissementAbsences = getPreferencesEtablissementCourant()
+ Long id = Long.parseLong(params.id)
+
+ Map resultat
+ try {
+
+ List<GroupeMotif> groupesModifies = groupeMotifService.descendreGroupeMotif(
+ GroupeMotif.load(id),
+ preferencesEtablissementAbsences
+ )
+
+ resultat = ['success': true]
+
+ if (groupesModifies) {
+
+ resultat['groupe1'] = [
+ 'id': groupesModifies[0].id,
+ 'ordre': groupesModifies[0].ordre
+ ]
+
+ resultat['groupe2'] = [
+ 'id': groupesModifies[1].id,
+ 'ordre': groupesModifies[1].ordre
+ ]
+ }
+
+ }
+ catch (GroupeMotifException e) {
+ render([
+ success: false,
+ errorMsg: message(code: e.codeMessage)
+ ] as JSON)
+ return
+ }
+
+ render resultat as JSON
+
+ }
+
/**
* Action de création d'un motif
*/
String libelle = params.libelle
String couleur = params.couleur
+ Boolean dispoBulletin = true
+ if (params.dispoBulletin) {
+ dispoBulletin = Boolean.parseBoolean(params.dispoBulletin)
+ }
+
+ Boolean dispoStats = true
+ if (params.dispoBulletin) {
+ dispoStats = Boolean.parseBoolean(params.dispoStats)
+ }
+
Long id = Long.parseLong(params.idGroupe)
+
log.debug("creerMotif:" + libelle + ", id=" + id)
GroupeMotif grMotif = GroupeMotif.get(id)
Motif leMotif
try {
leMotif = motifService.creerMotif(
- securiteSession,
- grMotif,
- libelle,
- couleur
+ securiteSession,
+ grMotif,
+ libelle,
+ couleur,
+ dispoBulletin,
+ dispoStats
)
}
catch (MotifException e) {
render([
- success: false,
- errorMsg: message(code: e.codeMessage, args: [e.argsMessage])
+ success: false,
+ errorMsg: message(code: e.codeMessage, args: [e.argsMessage])
] as JSON)
return
}
Map leMotifJSON = [
- 'nom': leMotif?.libelle,
- 'id': leMotif?.id,
- 'codeCouleur': leMotif?.couleur,
- success: true
+ 'nom': leMotif?.libelle,
+ 'id': leMotif?.id,
+ 'codeCouleur': leMotif?.couleur,
+ success: true
]
render leMotifJSON as JSON
}
+ def modifierDispoMotif = {
+
+ try {
+
+ def allModifs = JSON.parse((String) params.motifs)
+
+ modifieAllDispoMotif(
+
+ (List) allModifs
+ )
+
+ } catch (MotifException e) {
+
+ render(
+ [
+ success: false,
+ errorMsg: message(code: e.codeMessage, args: [e.argsMessage])
+ ] as JSON
+ )
+ return
+ }
+
+ Map reponse = [
+ success: true
+ ]
+
+ render reponse as JSON
+
+ }
+
+ /**
+ * Modification des dispo de la liste de motifs
+ * @param motifs map correspondant à ce qui est envoyé en param en json
+ */
+ private void modifieAllDispoMotif(
+ List motifs
+ ) {
+
+ motifs.each {Map dispoMotif ->
+
+ Motif motif = Motif.load(dispoMotif.id)
+
+ motifService.modifieDisponibiliteMotif(
+ getSecuriteSession(),
+ motif,
+ dispoMotif.dispoBulletin,
+ dispoMotif.dispoStats
+ )
+
+ }
+
+ }
+
/**
* Action de modification d'un motif
*/
String couleur = params.couleur
Long idMotif = Long.parseLong(params.idMotif)
Long idGroupe = Long.parseLong(params.idGroupe)
+
log.debug("modifierMotif: idMotif=" + idMotif + ", idGroupe=" + idGroupe)
- GroupeMotif grMotif = GroupeMotif.get(idGroupe)
+ GroupeMotif motifAModifier = GroupeMotif.get(idGroupe)
Motif leMotif
try {
leMotif = motifService.modifieMotif(
- grMotif,
- idMotif,
- libelle,
- couleur,
- securiteSession
+ securiteSession,
+ motifAModifier,
+ idMotif,
+ libelle,
+ couleur
)
}
catch (MotifException e) {
render(
- [
- success: false,
- errorMsg: message(code: e.codeMessage, args: [e.argsMessage])
- ] as JSON
+ [
+ success: false,
+ errorMsg: message(code: e.codeMessage, args: [e.argsMessage])
+ ] as JSON
)
return
}
Map leMotifJSON = [
- 'nom': leMotif?.libelle,
- 'id': leMotif?.id?.toString(),
- 'codeCouleur': leMotif?.couleur,
- success: true
+ 'nom': leMotif?.libelle,
+ 'id': leMotif?.id?.toString(),
+ 'codeCouleur': leMotif?.couleur,
+ success: true
]
render leMotifJSON as JSON
boolean listerTousMotifs = Boolean.parseBoolean(params?.listerTousMotifs)
PreferencesEtablissementAbsences preferencesEtablissement =
- getPreferencesEtablissementCourant()
+ getPreferencesEtablissementCourant()
if (preferencesEtablissement.groupeMotifs.size() == 0) {
groupeMotifService.creerMotifsParDefault(preferencesEtablissement)
lesGroupesMotifs =
preferencesEtablissementAbsencesService.buildModelGroupeMotifForJason(
- preferencesEtablissement,
- listerTousMotifs
+ preferencesEtablissement,
+ listerTousMotifs
)
render lesGroupesMotifs as JSON
protected List<UrlLabelInfo> getBreadCrumbsInfo() {
List<UrlLabelInfo> breadCrumbsInfo = super.getBreadCrumbsInfo()
- breadCrumbsInfo << new BreadCrumbsItemInfo (
- codeLabel : 'absences.breadCrumbs.parametrage'
+ breadCrumbsInfo << new BreadCrumbsItemInfo(
+ codeLabel: 'absences.breadCrumbs.parametrage'
)
- breadCrumbsInfo << new BreadCrumbsItemInfo (
- codeLabel : 'absences.breadCrumbs.parametrage.motifs'
+ breadCrumbsInfo << new BreadCrumbsItemInfo(
+ codeLabel: 'absences.breadCrumbs.parametrage.motifs'
)
return breadCrumbsInfo
modele.listGroupMotif = getGroupesMotifsForJSON() as JSON
- modele.listMotif =
- getMotifsForJSON([BasicCriteresRecherche.VALEUR_TOUS.toString()]) as JSON
+ modele.listMotif =getMotifsForJSON(
+ getMotifs([BasicCriteresRecherche.VALEUR_TOUS.toString()])
+ ) as JSON
modele.pasDeDecompte = getLibellePasDeDecompte()
def getListMotif = {
if (params.groupeMotif) {
List<String> listeIds = (params.groupeMotif as String).split(',') as List
- render getMotifsForJSON(listeIds) as JSON
+ render getMotifsForJSON(getMotifs(listeIds)) as JSON
} else {
render([] as JSON)
}
* <http://www.gnu.org/licenses/> and
* <http://www.cecill.info/licences.fr.html>.
*/
-
-
-
-
-
-
-
package org.lilie.services.eliot.absences.statistique
import org.lilie.services.eliot.absences.AbstractAbsencesController
import org.lilie.services.eliot.urllabel.breadcrumbs.BreadCrumbsItemInfo
import org.lilie.services.eliot.urllabel.UrlLabelInfo
import org.lilie.services.eliot.scolarite.Etablissement
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
/**
* @author bahj
modele += getDataModeleForPreferencesEtablissement(pref)
+ List<Motif> motifDefauts = motifService.findAllMotifForPriseEnCompteMotif(
+ pref,
+ PriseEnCompteMotif.STATS,
+ false
+ )
+ List selectionParDefautIds = motifDefauts*.id
+
+ List<Motif> motifDisponibles = motifService.getMotifsForPreferencesEtablissement(pref)
+ Map mapParams = [:]
if (params.params) {
- Map mapParams = (Map) JSON.parse(params.params)
+ mapParams = (Map) JSON.parse(params.params)
Map<String, Object> datasTempsReel =
- construitDatasTempsReel(parseParams(mapParams))
+ construitDatasTempsReel(parseParams(mapParams))
modele.paramsTempsReel = params.params
modele.datasTempsReel = datasTempsReel as JSON
if (mapParams.groupesMotif) {
List groupeMotifIds = mapParams.groupesMotif.split(',').toList()
if (!groupeMotifIds.contains('-1')) {
- modele.dataMotifs = parseDataForJSON(getMotifs(groupeMotifIds)) as JSON
+ motifDisponibles = getMotifs(groupeMotifIds)
+ modele.dataMotifs = parseDataForJSON(motifDisponibles) as JSON
+ selectionParDefautIds.retainAll(motifDisponibles*.id)
}
}
}
modele.dataMotifs = getAllMotifs(false) as JSON
}
+ modele.motifIdsDefaut = selectionParDefautIds.join(',')
+
+ if (!mapParams.motifs) {
+ modele.selectionMotifsDefautCoche = true
+ } else {
+ modele.selectionMotifsDefautCoche = listeIdentiques(
+ modele.motifIdsDefaut,
+ mapParams.motifs ?: ''
+ )
+ }
+
+ if (motifDisponibles.size() == selectionParDefautIds.size()) {
+ if (modele.motifIdsDefaut) {
+ modele.motifIdsDefaut = '-1,' + modele.motifIdsDefaut
+ } else {
+ modele.motifIdsDefaut = '-1'
+ }
+ }
+
render(
view: '/statistique/tempsreel/index',
model: modele
)
}
+ /**
+ * @param liste1
+ * @param liste2
+ * @return true si les listes d'ids sont identiques
+ */
+ private Boolean listeIdentiques(String liste1, String liste2) {
+ List l1 = liste1.split(',')
+ List l2 = liste2.split(',')
+ return l1.sort() == l2.sort()
+ }
+
/**
* Retourne dans une map les données du modèles liées aux préférences
* établissement
* @return une Map
*/
private Map getDataModeleForPreferencesEtablissement(PreferencesEtablissementAbsences pref) {
- Map result = (Map)[:]
+ Map result = (Map) [:]
result.anneeScolaire = getInfosCalendrier(pref)
result.dataClasses = getDataClasses(pref.etablissement)
result.dataModesCalcul = getEnumData(ModeCalcul) as JSON
*/
private def getInfosCalendrier(PreferencesEtablissementAbsences pref) {
Calendrier calendrier =
- calendrierService.getCalendrierForEtablissement(
- pref.etablissement
- )
+ calendrierService.getCalendrierForEtablissement(
+ pref.etablissement
+ )
return [
debutAnneeScolaire: formateDate(calendrier.premierJour),
}
private Map construitDatasTempsReel(
- StatsMensuellesParams statsMensuellesParams) {
+ StatsMensuellesParams statsMensuellesParams) {
StatsMensuelles statsMensuelles = statsMensuellesService.
calculeStatsMensuelles(
- statsMensuellesParams,
- preferencesEtablissementCourant
- )
+ statsMensuellesParams,
+ preferencesEtablissementCourant
+ )
paramsIdsGroupesMotif.length() - 1
)
List<String> listeIds = (idsGroupesMotif).split(',') as List
- List dataMotifs = parseDataForJSON(getMotifs(listeIds))
- render dataMotifs as JSON
+
+ List<Motif> motifDefauts = motifService.findAllMotifForPriseEnCompteMotif(
+ preferencesEtablissementCourant,
+ PriseEnCompteMotif.STATS,
+ false
+ )
+ List<Motif> motifs = getMotifs(listeIds)
+
+ List dataMotifs = parseDataForJSON(motifs)
+
+ Map result = [
+ success: true,
+ data: dataMotifs,
+ selectionParDefautIds: getSousListeMotifsDefaut(motifDefauts, motifs)*.id.join(',')
+ ]
+ render result as JSON
}
/**
absences.motifs.creer.echec.libelle.duplique=L''enregistrement du motif a échoué. Un autre motif porte le même nom ({0}).
absences.motifs.modifier.succes=Le motif a été modifié avec succès.
absences.motifs.modifier.echec=La modification du motif a échoué.
+absences.motifs.modifier.dispo.succes=Les disponnibilités des motifs ont été modifiées avec succès.
+absences.motifs.modifier.dispo.echec=La modification des disponnibilités des motifs a échoué.
absences.motifs.supprimer.succes=Le motif a été supprimé avec succès.
absences.motifs.supprimer.echec=La suppression du motif a échoué.
absences.motifs.supprimer.echec.motifutilise=Le motif ne peut pas être supprimé car il est utilisé.
absences.groupeMotifs.modifier.echec=La modification du groupe de motifs a échoué.
absences.groupeMotifs.supprimer.succes=Le groupe de motifs a été supprimé avec succès.
absences.groupeMotifs.supprimer.echec=La suppression du groupe de motifs a échoué.
+absences.groupeMotifs.monter.succes=Le groupe de motifs a été déplacé avec succès.
+absences.groupeMotifs.monter.echec=Le déplacement du groupe de motifs a échoué.
+absences.groupeMotifs.descendre.succes=Le groupe de motifs a été déplacé avec succès.
+absences.groupeMotifs.descendre.echec=Le déplacement du groupe de motifs a échoué.
absences.groupeMotifs.supprimer.echec.motifutilise=La suppression du groupe de motifs est impossible car un des motifs est utilisé.
absences.groupeMotifs.fenetre.creerTitre=Créer un groupe de motifs
absences.libelle.creer=Créer
absences.libelle.modifier=Modifier
absences.libelle.supprimer=Supprimer
+absences.libelle.monter=Monter
+absences.libelle.descendre=Descendre
absences.libelle.creerGroupMotif=Groupe de motifs
absences.libelle.creerMotif=Motif
absences.libelle.nombreElevesAuTotal=Nombre d'élève(s) au total
absences.libelle.creation=Création
absences.libelle.modification=Modification
+absences.libelle.selectionDefaut=Sélection par défaut
eliot.absences.motifs=Motifs
eliot.impression.sms.statut.EN_COURS=En cours
eliot.impression.sms.statut.TERMINE=Terminé
eliot.impression.sms.statut.ERREUR_TECHNIQUE=Erreur technique
+
+absences.libelle.ordre=Ordre
+absences.libelle.bulletin=Bulletin
+absences.libelle.stat=Consult./Stat.
+absences.libelle.selection=Sélection
\ No newline at end of file
* - le 10/09/2010 de 21:00 à 21:55 : APPEL 10
*
* Données de ces appels
- * APPEL5 APPEL6 APPEL7 APPEL8 APPEL9 APPEL10
+ * APPEL5 APPEL6 APPEL7 APPEL8 APPEL9 APPEL10
* ELEVE_1_CLASSE_1 SANS_MOTIF SANS_MOTIF SANS_MOTIF
* ELEVE_2_CLASSE_1 MOTIF1 MOTIF1 MOTIF1
* ELEVE_3_CLASSE_1 SANS_MOTIF MOTIF1 SANS_MOTIF
return result
}
+ /**
+ * Crée 2 appels pour la 2NDE2 (Classe 1) de l'étab 1 ou les motifs sont differents
+ * - le 09/09/2010 de 04:00 à 04:55 : APPEL 15
+ * - le 10/09/2010 de 04:00 à 05:55 (2 plages horaires) : APPEL 16
+ *
+ * Données de ces appels
+ * APPEL15 APPEL16
+ * ELEVE_2_CLASSE_1 MOTIF1 MOTIF2
+ *
+ */
+ void creeAppelsDeTestSeptembreMotifsDifferentes() {
+ List<Long> result = []
+ PreferencesEtablissementAbsences pref = preferencesEtablissementAbsencesService.
+ getPreferencesEtablissementForEtablissement(
+ getEtablissement(PopulationTestEtablissement.ETABLISSEMENT_1)
+ )
+ result << creeAppel15(pref)
+ result << creeAppel16(pref)
+ }
+
/**
* Crée un appel au 09/09/2010, de 04:00 à 04:55 avec :
* - ELEVE_1_CLASSE_1 : absent sans motif
return appelId
}
+
+ /**
+ * Crée un appel au 09/09/2010, de 04:00 à 04:55 avec :
+ * - ELEVE_2_CLASSE_1 : absent, motif 1
+ * @param pref
+ * @return l'id de l'appel créé
+ */
+ Long creeAppel15(PreferencesEtablissementAbsences pref) {
+ Long appelId
+ AppelInfo appelInfo = creeEnteteAppelCLASSE_1()
+ appelInfo.plagesHorairesId << initDonneesCommunesTestPreferencesAbsencesService.
+ getPlagesHorairesDeTest_1(pref).id
+ appelInfo.jour = Date.parse('dd/MM/yyyy', '09/09/2010')
+ appelInfo.preferencesEtablissementAbsences = pref
+
+ appelId = creeAppel(
+ getSecuriteSession(
+ PopulationTestActeur.EDUCATION_1
+ ),
+ appelInfo
+ ).id
+
+ AppelAvecLignesInfo appelAModifier1 = new AppelAvecLignesInfo(
+ id: appelId
+ )
+ // - ELEVE_2_CLASSE_1 : absent, motif de test 1
+ appelAModifier1.lignes << new AppelLigneInfo(
+ eleveId: getAutorite(PopulationTestActeur.ELEVE_2_CLASSE_1).id,
+ motifId: initDonneesCommunesTestPreferencesAbsencesService.getMotif1().id,
+ absence: true
+ )
+
+ appelService.modifieListeAppels(
+ getSecuriteSession(PopulationTestActeur.EDUCATION_1),
+ [appelAModifier1],
+ pref
+ )
+ return appelId
+ }
+
+ /**
+ * Crée un appel au 10/09/2010, de 04:00 à 05:55 (2 plages) avec :
+ * - ELEVE_2_CLASSE_1 : absent, motif 2
+ * @param pref
+ * @return l'id de l'appel créé
+ */
+ Long creeAppel16(PreferencesEtablissementAbsences pref) {
+ Long appelId
+ AppelInfo appelInfo = creeEnteteAppelCLASSE_1()
+ appelInfo.plagesHorairesId << initDonneesCommunesTestPreferencesAbsencesService.
+ getPlagesHorairesDeTest_1(pref).id
+ appelInfo.plagesHorairesId << initDonneesCommunesTestPreferencesAbsencesService.
+ getPlagesHorairesDeTest_2(pref).id
+ appelInfo.jour = Date.parse('dd/MM/yyyy', '10/09/2010')
+ appelInfo.preferencesEtablissementAbsences = pref
+
+ appelId = creeAppel(
+ getSecuriteSession(
+ PopulationTestActeur.EDUCATION_1
+ ),
+ appelInfo
+ ).id
+
+ AppelAvecLignesInfo appelAModifier1 = new AppelAvecLignesInfo(
+ id: appelId
+ )
+
+ // - ELEVE_2_CLASSE_1 : absent, motif de test 2
+ appelAModifier1.lignes << new AppelLigneInfo(
+ eleveId: getAutorite(PopulationTestActeur.ELEVE_2_CLASSE_1).id,
+ motifId: initDonneesCommunesTestPreferencesAbsencesService.getMotif2().id,
+ absence: true
+ )
+
+ appelService.modifieListeAppels(
+ getSecuriteSession(PopulationTestActeur.EDUCATION_1),
+ [appelAModifier1],
+ pref
+ )
+ return appelId
+
+ }
+
+
/**
* Cree un appel
* @param securiteSession
getSecuriteSession(PopulationTestActeur.DIRECTION_1),
groupeMotif,
PREFIXE_MOTIF_TEST + numero,
- 'couleur'
+ 'couleur',
+ true,
+ true
)
}
file: 'Ext.ux.form.LovCombo.css'
)}"/>
+<g:javascript library="src/views/commons/helper/AjaxHelper"/>
<g:javascript library="src/views/commons/Utils"/>
<g:javascript library="src/views/commons/Constantes"/>
<g:javascript library="src/views/commons/Message"/>
<eliotjs:varI18n name="motifs" code="eliot.absences.motifs"/>
<eliotjs:varI18n name="regimes" code="eliot.absences.regimes"/>
<eliotjs:varI18n name="nombreElevesAuTotal" code="absences.libelle.nombreElevesAuTotal"/>
+ <eliotjs:varI18n name="selectionDefaut" code="absences.libelle.selectionDefaut"/>
+
</eliotjs:ns>
<eliotjs:ns name="data">
<eliotjs:varI18n name="date" code="absences.libelle.datePicker"/>
<eliotjs:varI18n name="types" code="absences.formulaire.liste.Types"/>
</eliotjs:ns>
+ <eliotjs:ns name="data">
+ <eliotjs:varString name="motifIdsDefaut" value="${motifIdsDefaut}"/>
+ </eliotjs:ns>
</eliotjs:ns>
// Variables communs à l'export des données
%{--Variables communs à l'export des données--}%
<g:javascript>
+ <eliotjs:ns name="eliot.absences.consultation.Modele">
+ <eliotjs:ns name="data">
+ <eliotjs:varString name="motifIdsDefaut" value="${motifIdsDefaut}"/>
+ </eliotjs:ns>
+ </eliotjs:ns>
+
<eliotjs:ns name="eliot.exportdonnees.BoutonExportViewModele">
<eliotjs:ns name="libelle">
<eliotjs:varI18n name="exporter" code="export.libelle.exporter"/>
<eliotjs:ns name="libelle">
<eliotjs:varI18n name="date" code="absences.libelle.datePicker"/>
</eliotjs:ns>
+ <eliotjs:ns name="data">
+ <eliotjs:varString name="motifIdsDefaut" value="${motifIdsDefaut}"/>
+ </eliotjs:ns>
</eliotjs:ns>
<eliotjs:ns name="data">
<eliotjs:varBoolean name="afficheMessageErreur" value="${afficheMessageErreur}"/>
+ <eliotjs:varString name="motifIdsDefaut" value="${motifIdsDefaut}"/>
</eliotjs:ns>
<eliotjs:ns name="message">
<eliotjs:ns name="libelle">
<eliotjs:varI18n name="date" code="absences.libelle.datePicker"/>
</eliotjs:ns>
+ <eliotjs:ns name="data">
+ <eliotjs:varString name="motifIdsDefaut" value="${motifIdsDefaut}"/>
+ </eliotjs:ns>
</eliotjs:ns>
- <http://www.cecill.info/licences.fr.html>.
--}%
-
<%--
Vue 'paramétrage des motifs'
@author jtra
%{--Div de la barre de progression --}%
<g:render template="/loadingMask"></g:render>
+ <link rel="stylesheet" type="text/css" href="${resource(dir: 'js/lib/extjs/resources/css', file: 'ColumnNodeUI.css')}"/>
+
%{--Constantes javaScript--}%
- <g:javascript library="src/views/parametrage/motifs/Constantes"/>
- <g:javascript library="src/views/parametrage/motifs/Modele"/>
+ <g:javascript library="src/views/parametrage/motif/Constantes"/>
+ <g:javascript library="src/views/parametrage/motif/ConfigServeur"/>
%{-- Modèle --}%
<g:javascript>
- <eliotjs:ns name="eliot.absences.parametrage.motifs.Modele">
-
- <eliotjs:varLink name="urlMotifsLister" action="listerMotifs" controller="parametrageMotif"/>
- <eliotjs:varLink name="urlCreerMotif" action="creerMotif" controller="parametrageMotif"/>
- <eliotjs:varLink name="urlCreerGrpMotif" action="creerGroupeMotif" controller="parametrageMotif"/>
- <eliotjs:varLink name="urlModifierMotif" action="modifierMotif" controller="parametrageMotif"/>
- <eliotjs:varLink name="urlModifierGrpMotif" action="modifierGroupeMotif" controller="parametrageMotif"/>
- <eliotjs:varLink name="urlSupprimerMotif" action="supprimerMotif" controller="parametrageMotif"/>
- <eliotjs:varLink name="urlSupprimerGrpMotif" action="supprimerGroupeMotif" controller="parametrageMotif"/>
+ <eliotjs:ns name="eliot.absences.parametrage.motif.ConfigServeur">
+
+ <eliotjs:ns name="url">
+ <eliotjs:varLink name="urlMotifsLister" action="listerMotifs" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlCreerMotif" action="creerMotif" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlCreerGrpMotif" action="creerGroupeMotif" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlModifierMotif" action="modifierMotif" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlModifierGrpMotif" action="modifierGroupeMotif" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlSupprimerMotif" action="supprimerMotif" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlSupprimerGrpMotif" action="supprimerGroupeMotif" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlMonterGrpMotif" action="monterGroupeMotif" controller="parametrageMotif"/>
+ <eliotjs:varLink name="urlDescendreGrpMotif" action="descendreGroupeMotif" controller="parametrageMotif"/>
+
+ <eliotjs:varLink name="urlModifierDispoMotif" action="modifierDispoMotif" controller="parametrageMotif"/>
+ <eliotjs:varResource name="urlImageAdd16" dir="images" file="add16x16.gif"/>
+ <eliotjs:varResource name="urlImageEdit" dir="images" file="edit.png"/>
+ <eliotjs:varResource name="urlImageSupprimer" dir="images" file="delete.gif"/>
+ <eliotjs:varResource name="urlImageFlecheHaut" dir="images" file="arrow-up-4.png"/>
+ <eliotjs:varResource name="urlImageFlecheBas" dir="images" file="arrow-down-4.png"/>
+ </eliotjs:ns>
- <eliotjs:varResource name="urlImageAdd16" dir="images" file="add16x16.gif"/>
- <eliotjs:varResource name="urlImageEdit" dir="images" file="edit.png"/>
- <eliotjs:varResource name="urlImageSupprimer" dir="images" file="delete.gif"/>
+ <eliotjs:ns name="data">
+ <eliotjs:varJson name="arbreMotif" value="${arbreMotif}"/>
+ </eliotjs:ns>
<eliotjs:ns name="libelle">
<eliotjs:varI18n name="motifDialogSuppressionTitre" code="absences.motifs.suppression.titre"/>
<eliotjs:varI18n name="supprimer" code="absences.libelle.supprimer"/>
<eliotjs:varI18n name="creerGroupMotif" code="absences.libelle.creerGroupMotif"/>
<eliotjs:varI18n name="creerMotif" code="absences.libelle.creerMotif"/>
+ <eliotjs:varI18n name="ordre" code="absences.libelle.ordre"/>
+ <eliotjs:varI18n name="motif" code="absences.libelle.motif"/>
+ <eliotjs:varI18n name="bulletin" code="absences.libelle.bulletin"/>
+ <eliotjs:varI18n name="stat" code="absences.libelle.stat"/>
+ <eliotjs:varI18n name="selection" code="absences.libelle.selection"/>
+
+ <eliotjs:varI18n name="monter" code="absences.libelle.monter"/>
+ <eliotjs:varI18n name="descendre" code="absences.libelle.descendre"/>
+
</eliotjs:ns>
<eliotjs:ns name="message">
<eliotjs:varI18n name="motifEchecCreerLibelleVide" code="absences.motifs.creer.echec.libelleVide"/>
<eliotjs:varI18n name="motifModifierSucces" code="absences.motifs.modifier.succes"/>
<eliotjs:varI18n name="motifModifierEchec" code="absences.motifs.modifier.echec"/>
+ <eliotjs:varI18n name="motifDispoModifierSucces" code="absences.motifs.modifier.dispo.succes"/>
+ <eliotjs:varI18n name="motifDispoModifierEchec" code="absences.motifs.modifier.dispo.echec"/>
<eliotjs:varI18n name="motifSupprimerSucces" code="absences.motifs.supprimer.succes"/>
<eliotjs:varI18n name="motifSupprimerEchec" code="absences.motifs.supprimer.echec"/>
<eliotjs:varI18n name="groupeMotifsCreerSucces" code="absences.groupeMotifs.creer.succes"/>
<eliotjs:varI18n name="groupeMotifsSupprimerSucces" code="absences.groupeMotifs.supprimer.succes"/>
<eliotjs:varI18n name="groupeMotifsSupprimerEchec" code="absences.groupeMotifs.supprimer.echec"/>
<eliotjs:varI18n name="groupeMotifEchecCreerLibelleVide" code="absences.groupeMotifs.creer.echec.libelleVide"/>
+ <eliotjs:varI18n name="grpMotifMonterSucces" code="absences.groupeMotifs.monter.succes"/>
+ <eliotjs:varI18n name="grpMotifMonterEchec" code="absences.groupeMotifs.monter.echec"/>
+ <eliotjs:varI18n name="grpMotifDescendreSucces" code="absences.groupeMotifs.descendre.succes"/>
+ <eliotjs:varI18n name="grpMotifDescendreEchec" code="absences.groupeMotifs.descendre.echec"/>
</eliotjs:ns>
</eliotjs:ns>
</g:javascript>
<g:javascript library="lib/extjs-3.2.0/ColumnNodeUI"/>
+ <g:javascript library="src/views/commons/Ext.ux.grid.ColumnHeaderGroup"/>
+ <g:javascript library="src/views/commons/Ext.ux.CheckColumn"/>
+ <g:javascript library="src/views/commons/helper/AjaxHelper"/>
<g:javascript library="src/views/commons/Message"/>
<g:javascript library="src/views/commons/Utils"/>
<g:javascript library="src/views/commons/Constantes"/>
- <g:javascript library="src/views/parametrage/motifs/ArbreMotifs"/>
- <g:javascript library="src/views/parametrage/motifs/MotifsToolbar"/>
- <g:javascript library="src/views/parametrage/motifs/Application"/>
+ <g:javascript library="src/views/parametrage/motif/ParametrageMotifModel"/>
+ <g:javascript library="src/views/parametrage/motif/ToolbarView"/>
+ <g:javascript library="src/views/parametrage/motif/ParametrageMotifController"/>
+ <g:javascript library="src/views/parametrage/motif/ParametrageMotifView"/>
+ <g:javascript library="src/views/parametrage/motif/Application"/>
</head>
<body>
-%{-- Note jtra : conservé pour assurer la compatibilité avec du code qui n'a pas encore été repris --}%
-%{-- Note msan: si on met idEtab apres messages, il disparrait de temps en temps ce qui fait planter le FO --}%
-<g:hiddenField name="idEtab" value="${preferencesEtablissement?.id}"/>
+ %{-- Note jtra : conservé pour assurer la compatibilité avec du code qui n'a pas encore été repris --}%
+ %{-- Note msan: si on met idEtab apres messages, il disparrait de temps en temps ce qui fait planter le FO --}%
+ <g:hiddenField name="idEtab" value="${preferencesEtablissement?.id}"/>
-%{-- message --}%
-<div id="messages" class="portal-messages"></div>
+ %{-- message --}%
+ <div id="messages" class="portal-messages"></div>
</body>
</html>
\ No newline at end of file
%{--Constantes javaScript--}%
<g:javascript library="src/views/saisie/saisie/Constantes"/>
<g:javascript library="src/views/saisie/saisie/Modele"/>
- <g:javascript library="src/views/parametrage/motifs/Constantes"/>
- <g:javascript library="src/views/parametrage/motifs/Modele"/>
+ <g:javascript library="src/views/parametrage/motif/Constantes"/>
+ <g:javascript library="src/views/parametrage/motif/ConfigServeur"/>
%{-- Modèle --}%
<g:javascript>
- eliot.absences.parametrage.motifs.Modele.urlMotifsLister = '${createLink(action: 'listerMotifs', controller: 'parametrageMotif')}';
+ eliot.absences.parametrage.motif.ConfigServeur.urlMotifsLister = '${createLink(action: 'listerMotifs', controller: 'parametrageMotif')}';
</g:javascript>
<g:javascript library="lib/extjs-3.2.0/SpinnerField"/>
<g:javascript library="src/views/saisie/saisie/MenuContextuelAppelsView"/>
<g:javascript library="src/views/saisie/saisie/WindowEditeAbsenceView"/>
- <g:javascript library="src/views/parametrage/motifs/ArbreMotifs"/>
+ <g:javascript library="src/views/parametrage/motif/ArbreMotifs"/>
<g:javascript library="src/views/saisie/saisie/OptionSaisieView"/>
<g:javascript library="src/views/saisie/saisie/DateView"/>
<g:javascript library="src/views/saisie/saisie/DateController"/>
<eliotjs:varJson name="datasTempsReel" value="${datasTempsReel}"/>
</g:if>
+ <eliotjs:varString name="motifIdsDefaut" value="${motifIdsDefaut}"/>
+ <eliotjs:varBoolean name="selectionMotifsDefautCoche" value="${selectionMotifsDefautCoche}"/>
+
</eliotjs:ns>
<eliotjs:ns name="libelle">
<eliotjs:varI18n name="typePunitions" code="absences.ips.libelle.typePunitions"/>
<eliotjs:varI18n name="reprsentationParGrille" code="absences.statistique.tempsReel.libelle.reprsentationParGrille"/>
<eliotjs:varI18n name="reprsentationParGraphe" code="absences.statistique.tempsReel.libelle.reprsentationParGraphe"/>
+ <eliotjs:varI18n name="selectionDefaut" code="absences.libelle.selectionDefaut"/>
</eliotjs:ns>
<eliotjs:ns name="message">
- <http://www.cecill.info/licences.fr.html>.
--}%
-
-
-
-
-
-
<%--
Vue de consultation des statistiques en temps réel
@author bahj
<!-- Template pour les définitions des constantes de modèle-->
<g:render template="/statistique/tempsreel/modele"/>
+ <g:javascript library="src/views/commons/helper/AjaxHelper"/>
<g:javascript library="src/views/commons/Message"/>
<g:javascript library="src/views/commons/Utils"/>
<g:javascript library="src/views/commons/Constantes"/>
import org.lilie.services.eliot.scolarite.etablissement.PreferencesEtablissementAbsencesService
import org.lilie.services.eliot.applications.absences.BasicCriteresRecherche
import org.lilie.services.eliot.applications.absences.BilanService
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
+import org.lilie.services.eliot.test.InitDonneesCommunesTestPreferencesAbsencesService
+
+import org.lilie.services.eliot.test.PopulationTestClasse
class BilanServiceTests extends GrailsUnitTestCase {
BilanService bilanService
InitDonneesCommunesTestAbsenceService initDonneesCommunesTestAbsenceService
+ InitDonneesCommunesTestPreferencesAbsencesService initDonneesCommunesTestPreferencesAbsencesService
PreferencesEtablissementAbsencesService preferencesEtablissementAbsencesService
LocalInitDonneesCommunesTestService localInitDonneesCommunesTestService
GeneralService generalService
)
}
+ /**
+ * Teste le calcul de bilan avec des motifs differentes.
+ *
+ * - parametre motifs a prende en compte
+ * - motif1 - bulletin OK, stats -
+ * - retard - bulletin - , stats OK
+ * - absences avec motifs varies
+ * - get absences avec TOUS
+ * - get absences avec bulletin - compare difference
+ * - get absences avec stats - compare difference
+ */
+ void testCalculeBilanForEleveAndPeriode() {
+ preferencesEtablissementAbsencesService.modifiePreferencesEtablissement(
+ pref.id,
+ PreferencesEtablissementAbsences.DECOMPTE_JOUR,
+ initDonneesCommunesTestAbsenceService.getSecuriteSession(
+ PopulationTestActeur.DIRECTION_1
+ )
+ )
+
+ generalService.setLongueurPlage(
+ initDonneesCommunesTestAbsenceService.getSecuriteSession(
+ PopulationTestActeur.DIRECTION_1
+ ),
+ pref,
+ GeneralService.CODE_LONGUEUR_PLAGE_HEURE
+ )
+
+ // positionne motifs
+ Motif motif1 = initDonneesCommunesTestPreferencesAbsencesService.getMotif1()
+ Motif motif2 = initDonneesCommunesTestPreferencesAbsencesService.getMotif2()
+ motif1.setDispoBulletin(true)
+ motif1.setDispoStats(false)
+ motif2.setDispoBulletin(false)
+ motif2.setDispoStats(true)
+ motif1.save(failOnError: true)
+ motif2.save(failOnError: true)
+
+ /**
+ * cree les appels
+ * APPEL15 APPEL16
+ * ELEVE_2_CLASSE_1 MOTIF1 MOTIF2
+ */
+ initDonneesCommunesTestAbsenceService.creeAppelsDeTestSeptembreMotifsDifferentes()
+
+ // verifie les recoups d'absences
+ Map bilanTous = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_2_CLASSE_1,
+ '01/09/2010', '30/09/2010',
+ PopulationTestClasse.CLASSE_1,
+ PriseEnCompteMotif.TOUS)
+
+ Map bilanBulletin = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_2_CLASSE_1,
+ '01/09/2010', '30/09/2010',
+ PopulationTestClasse.CLASSE_1,
+ PriseEnCompteMotif.BULLETIN)
+
+ Map bilanStats = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_2_CLASSE_1,
+ '01/09/2010', '30/09/2010',
+ PopulationTestClasse.CLASSE_1,
+ PriseEnCompteMotif.STATS)
+
+ assertEquals(
+ "L'élève doit avoir 1 absences de moins",
+ 1,
+ bilanTous.get(BilanService.ABSENCES_EXCUSEES_NB) -
+ bilanBulletin.get(BilanService.ABSENCES_EXCUSEES_NB)
+ )
+ assertEquals(
+ "L'élève doit avoir 1 absence de moins",
+ 1,
+ bilanTous.get(BilanService.ABSENCES_EXCUSEES_NB) -
+ bilanStats.get(BilanService.ABSENCES_EXCUSEES_NB)
+ )
+
+ }
+
+ /**
+ * Recupere bilan pour un eleve et une periode donnee
+ * @param acteurDir
+ * @param acteurEleve
+ * @param dateDabut
+ * @param dateFin
+ * @param priseEnCompteMotif
+ * @return
+ */
+ private Map getBilan(PopulationTestActeur acteurDir,
+ PopulationTestActeur acteurEleve,
+ String dateDebut,
+ String dateFin,
+ PopulationTestClasse classe = null,
+ PriseEnCompteMotif priseEnCompteMotif = null) {
+ return bilanService.calculeBilanForEleveAndPeriode(
+ initDonneesCommunesTestAbsenceService.getSecuriteSession(acteurDir),
+ initDonneesCommunesTestAbsenceService.getAutorite(acteurEleve),
+ Date.parse('dd/MM/yyyy', dateDebut),
+ Date.parse('dd/MM/yyyy', dateFin),
+ classe? initDonneesCommunesTestAbsenceService.getClasse(classe) : null,
+ priseEnCompteMotif
+ )
+
+ }
+
void testCalculeBilanForEleveAndPeriodeEnHeures() {
preferencesEtablissementAbsencesService.modifiePreferencesEtablissement(
)
- Map bilanInitialEleve4 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_4_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanInitialEleve4 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_4_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
- Map bilanInitialEleve3 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_3_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanInitialEleve3 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_3_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
initDonneesCommunesTestAbsenceService.creeAppelsDeTestSeptembre()
- Map bilanFinalEleve4 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_4_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanFinalEleve4 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_4_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
- Map bilanFinalEleve3 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_3_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanFinalEleve3 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_3_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
assertEquals(
)
- Map bilanInitialEleve4 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_4_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanInitialEleve4 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_4_CLASSE_1,
+ '01/09/2010', '30/09/2010'
)
- Map bilanInitialEleve3 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_3_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanInitialEleve3 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_3_CLASSE_1,
+ '01/09/2010', '30/09/2010'
)
initDonneesCommunesTestAbsenceService.creeAppelsDeTestSeptembre()
- Map bilanFinalEleve4 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_4_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanFinalEleve4 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_4_CLASSE_1,
+ '01/09/2010','30/09/2010'
)
- Map bilanFinalEleve3 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_3_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanFinalEleve3 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_3_CLASSE_1,
+ '01/09/2010', '30/09/2010'
)
assertEquals(
)
- Map bilanInitialEleve4 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_4_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanInitialEleve4 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_4_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
- Map bilanInitialEleve3 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_3_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanInitialEleve3 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_3_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
initDonneesCommunesTestAbsenceService.creeAppelsDeTestSeptembre()
- Map bilanFinalEleve4 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_4_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanFinalEleve4 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_4_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
- Map bilanFinalEleve3 = bilanService.calculeBilanForEleveAndPeriode(
- initDonneesCommunesTestAbsenceService.getSecuriteSession(PopulationTestActeur.DIRECTION_1),
- initDonneesCommunesTestAbsenceService.getAutorite(PopulationTestActeur.ELEVE_3_CLASSE_1),
- Date.parse('dd/MM/yyyy', '01/09/2010'),
- Date.parse('dd/MM/yyyy', '30/09/2010')
+ Map bilanFinalEleve3 = getBilan(
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestActeur.ELEVE_3_CLASSE_1,
+ '01/09/2010',
+ '30/09/2010'
)
assertEquals(
--- /dev/null
+package org.lilie.services.eliot.absences.parametrages.motifs
+
+import grails.test.GrailsUnitTestCase
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
+import org.lilie.services.eliot.test.PopulationTestEtablissement
+import org.lilie.services.eliot.test.LocalInitDonneesCommunesTestService
+import org.lilie.services.eliot.absences.Motif
+import org.lilie.services.eliot.parametrages.motifs.MotifService
+import org.lilie.services.eliot.test.InitDonneesCommunesTestPreferencesAbsencesService
+import org.lilie.services.eliot.scolarite.Etablissement
+
+/**
+ * @author msan
+ */
+class MotifServiceTests extends GrailsUnitTestCase {
+ MotifService motifService
+ LocalInitDonneesCommunesTestService localInitDonneesCommunesTestService
+ InitDonneesCommunesTestPreferencesAbsencesService initDonneesCommunesTestPreferencesAbsencesService
+
+ Etablissement etab = null
+
+ @Override
+ protected void setUp() {
+ super.setUp()
+
+ etab = localInitDonneesCommunesTestService.getEtablissement(
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ )
+
+ }
+
+ @Override
+ protected void tearDown() {
+ super.tearDown()
+ }
+
+ /**
+ * Tests de la methode findAllMotifForPriseEnCompteMotif()
+ */
+ void testFindAllMotifForPriseEnCompteMotif() {
+
+ // positionne motifs
+ Motif motifBulletin = initDonneesCommunesTestPreferencesAbsencesService.getMotif1()
+ Motif motifStats = initDonneesCommunesTestPreferencesAbsencesService.getMotif2()
+ motifBulletin.setDispoBulletin(true)
+ motifBulletin.setDispoStats(false)
+ motifStats.setDispoBulletin(false)
+ motifStats.setDispoStats(true)
+ motifBulletin.save(failOnError: true)
+ motifStats.save(failOnError: true)
+
+ // Verifie filtrage Buletin
+ List<Motif> motifsBulletin = motifService.findAllMotifForPriseEnCompteMotif(
+ etab,
+ PriseEnCompteMotif.BULLETIN)
+ motifsBulletin.each {
+ assertTrue("Motif $it ne doit pas etre trouve "+
+ "par la recherche des motifs disponibles pour Buletins",
+ it.dispoBulletin)
+ }
+ assertTrue("Motif $motifBulletin est absent dans la liste de motifs Buletin",
+ motifsBulletin.contains(motifBulletin))
+
+ // Verifie filtrage Stats
+ List<Motif> motifsStats = motifService.findAllMotifForPriseEnCompteMotif(
+ etab,
+ PriseEnCompteMotif.STATS)
+ motifsStats.each {
+ assertTrue("Motif $it ne doit pas etre trouve "+
+ "par la recherche des motifs disponibles pour Stats",
+ it.dispoStats)
+ }
+ assertTrue("Motif $motifBulletin est absent dans la liste de motifs Stats",
+ motifsStats.contains(motifStats))
+
+ }
+
+
+}
font-weight : bold;
}
+.portal-default_table thead {
+ font-size: 11px;
+ font-weight: bold;
+ color: #3F61A0;
+ text-align: center;
+ background-color: #D7DCE7;
+}
+
+.portal-default_table .footer tr td {
+ font-size: 11px;
+ font-weight: bold; /*color: #3F61A0;*/
+ text-align: center;
+ background-color: #D7DCE7;
+}
+
+.portal-default_table th td {
+ border: 1px solid #728CBD;
+ font-size: 11px;
+ padding: 5px;
+ text-align: center;
+ width: auto;
+}
+
+
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+Ext.ns('Ext.ux.tree');
+
+/**
+ * @class Ext.ux.tree.ColumnTree
+ * @extends Ext.tree.TreePanel
+ *
+ * @xtype columntree
+ */
+Ext.ux.tree.ColumnTree = Ext.extend(Ext.tree.TreePanel, {
+ lines:false,
+ borderWidth:Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell
+ cls:'x-column-tree',
+
+ onRender:function () {
+
+ // call parent
+ Ext.tree.ColumnTree.superclass.onRender.apply(this, arguments);
+
+ // after parent code, e.g. install event handlers on rendered components
+ this.headers = this.body.createChild({
+ cls:'x-tree-headers'}, this.innerCt.dom);
+ // this.headers = this.getEl().createChild( //will make the header stick but takes away horizontal scroll
+ // {cls:'x-tree-headers'},this.body);
+
+ var cols = this.columns, c;
+ var totalWidth = 0;
+
+ var largeurTotaleSansRedim = 0; // =18
+ var largeurTotale = 0;
+ var bw = Ext.isBorderBox ? 0 : 2;
+
+ // Récupère la somme des largeurs des colonnes
+ for (var i = 0, len = cols.length; i < len; i++) {
+ if (i != this.colonneRedim) largeurTotaleSansRedim += cols[i].width;
+ largeurTotale += cols[i].width;
+ }
+
+ var containerSize = this.getSize();
+
+ // Redimensionne la colonne souhaitée afin de s'élargir dans le conteneur
+ if (containerSize.width != largeurTotale) {
+ cols[this.colonneRedim].width = containerSize.width - largeurTotaleSansRedim - bw;
+ }
+
+ for (i = 0, len = cols.length; i < len; i++) {
+ c = cols[i];
+
+ if (c.hidden === true)
+ continue;
+
+ totalWidth += c.width;
+ this.headers.createChild({
+ cls:'x-tree-hd ' + (c.cls ? c.cls + '-hd' : ''),
+ cn:{
+ cls:'x-tree-hd-text',
+ html:c.header
+ },
+ style:'width:' + (c.width - this.borderWidth) + 'px;'
+ });
+ }
+ this.headers.createChild({
+ cls:'x-clear'
+ });
+
+ // prevent floats from wrapping when clipped
+ this.headers.setWidth(totalWidth);
+ this.innerCt.setWidth(totalWidth);
+ },
+
+ onResize:function (a, b, c, d) {
+
+ Ext.ux.tree.ColumnTree.superclass.onResize.call(this, a, b, c, d);
+
+
+ var largeurTotale = 0;
+ var tree = this
+ var cols = this.columns
+ var bw = Ext.isBorderBox ? 0 : 2;
+ var largeurTotaleSansRedim = 0;
+ var totalWidth = 0;
+ var containerSize = this.getSize();
+
+ // Récupère la somme des largeurs des colonnes
+ for (var i = 0, len = cols.length; i < len; i++) {
+ if (i != this.colonneRedim) largeurTotaleSansRedim += cols[i].width;
+ largeurTotale += cols[i].width;
+ }
+
+ if (largeurTotale + bw == containerSize.width) return;
+
+
+
+ // Redimensionne la colonne souhaitée afin de s'élargir dans le conteneur
+ // Uniquement si le conteneur à changé de largeur
+
+ //largeurTotaleSansRedim += 18;
+ if (containerSize.width >= (largeurTotaleSansRedim + 30)) {
+ cols[this.colonneRedim].width = containerSize.width - largeurTotaleSansRedim - bw;
+ }
+
+
+ for (i = 0; i < cols.length; i++) {
+ totalWidth += cols[i].width;
+ Ext.select("div.x-tree-hd:nth-child(" + (i + 1) + ")", false, this.id).setWidth(cols[i].width);
+ Ext.select("div.x-tree-col:nth-child(" + (i + 1) + ")", false, this.id).setWidth(cols[i].width);
+ tree.columns[i].width = cols[i].width;
+ }
+ tree.headers.setWidth(totalWidth);
+ tree.innerCt.setWidth(totalWidth);
+
+ }
+});
+
+Ext.reg('columntree', Ext.ux.tree.ColumnTree);
+
+//backwards compat
+Ext.tree.ColumnTree = Ext.ux.tree.ColumnTree;
+
+
+/**
+ * @class Ext.ux.tree.ColumnNodeUI
+ * @extends Ext.tree.TreeNodeUI
+ */
+Ext.ux.tree.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
+ focus:Ext.emptyFn, // prevent odd scrolling behavior
+
+ renderElements:function (n, a, targetNode, bulkRender) {
+ this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
+
+ var t = n.getOwnerTree();
+ var cols = t.columns;
+ var bw = t.borderWidth;
+ var c = cols[0];
+
+ var buf = [
+ '<li class="x-tree-node"><div ext:tree-node-id="', n.id, '" class="x-tree-node-el x-tree-node-leaf ', a.cls, '">',
+ '<div class="x-tree-col" style="width:', c.width - bw, 'px;" title="', a.title, '">',
+ '<span class="x-tree-node-indent">', this.indentMarkup, "</span>",
+ '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow">',
+ '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon', (a.icon ? " x-tree-node-inline-icon" : ""), (a.iconCls ? " " + a.iconCls : ""), '" unselectable="on">',
+ '<a hidefocus="on" class="x-tree-node-anchor" href="', a.href ? a.href : "#", '" tabIndex="1" ',
+ a.hrefTarget ? ' target="' + a.hrefTarget + '"' : "", '>',
+ '<span unselectable="on" colnum="0">', n.text || (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]), "</span></a>",
+ "</div>"];
+ for (var i = 1, len = cols.length; i < len; i++) {
+ c = cols[i];
+
+ buf.push('<div class="x-tree-col ', (c.cls ? c.cls : ''), '" style="width:', c.width - bw, 'px;">',
+ '<div class="x-tree-col-text" colnum="', i, '">', (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]), "</div>",
+ "</div>");
+ }
+ buf.push(
+ '<div class="x-clear"></div></div>',
+ '<ul class="x-tree-node-ct" style="display:none;"></ul>',
+ "</li>");
+
+ if (bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()) {
+ this.wrap = Ext.DomHelper.insertHtml("beforeBegin",
+ n.nextSibling.ui.getEl(), buf.join(""));
+ } else {
+ this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));
+ }
+
+ this.elNode = this.wrap.childNodes[0];
+ this.ctNode = this.wrap.childNodes[1];
+ var cs = this.elNode.firstChild.childNodes;
+ this.indentNode = cs[0];
+ this.ecNode = cs[1];
+ this.iconNode = cs[2];
+ this.anchor = cs[3];
+ this.textNode = cs[3].firstChild;
+ }
+});
+
+//backwards compat
+Ext.tree.ColumnNodeUI = Ext.ux.tree.ColumnNodeUI;
+
+
+Ext.tree.ColumnTreeEditor = function (tree, config) {
+ config = config || {};
+ this.noEditColumns = config.noEditColumns || [];
+ var field = config.events ? config : new Ext.form.TextField(config);
+ Ext.tree.TreeEditor.superclass.constructor.call(this, field);
+
+ this.tree = tree;
+
+ if (!tree.rendered) {
+ tree.on('render', this.initEditor, this);
+ } else {
+ this.initEditor(tree);
+ }
+};
+
+
+Ext.extend(Ext.tree.ColumnTreeEditor, Ext.Editor, {
+
+ alignment:"l-l",
+ autoSize:false,
+
+ hideEl:false,
+
+ cls:"x-small-editor x-tree-editor",
+
+ shim:false,
+ shadow:"frame",
+
+ maxWidth:250,
+
+ editDelay:100,
+
+
+ initEditor:function (tree) {
+ tree.on('beforeclick', this.beforeNodeClick, this);
+ this.on('complete', this.updateNode, this);
+ this.on('beforestartedit', this.fitToTree, this);
+ this.on('startedit', this.bindScroll, this, {delay:10});
+ this.on('specialkey', this.onSpecialKey, this);
+ },
+
+ fitToTree:function (ed, el) {
+ var td = this.tree.getTreeEl().dom, nd = el.dom;
+ if (td.scrollLeft > nd.offsetLeft) {
+ td.scrollLeft = nd.offsetLeft;
+ }
+ var w = Math.min(
+ this.maxWidth,
+ (td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft - td.scrollLeft) - 5);
+ this.setSize(w, '');
+ },
+
+ triggerEdit:function (node, e) {
+ var obj = e.target;
+
+ if (Ext.select(".x-tree-node-anchor", false, obj).getCount() == 1) {
+ obj = Ext.select(".x-tree-node-anchor", false, obj).elements[0].firstChild;
+ } else if (obj.nodeName == 'SPAN' || obj.nodeName == 'DIV') {
+ obj = e.target;
+ } else {
+ return false;
+ }
+
+ var colIndex = 0;
+ for (var i in node.cols) {
+
+ if (node.cols[i] == obj.innerHTML) {
+ colIndex = i;
+ }
+ }
+
+ // Si le numéro de colonne est dans la variable noEditColumns: return (la colonne n'est pas éditable)
+ if (!node.attributes.editable) return;
+ var colnum = obj.getAttribute('colnum');
+ for (var i in this.noEditColumns) {
+ if (colnum == i) return;
+ }
+
+ this.completeEdit();
+ this.editNode = node;
+ this.editCol = obj;
+ this.editColIndex = colIndex;
+ this.startEdit(obj);
+ if (obj.nodeName == 'DIV') {
+ var width = obj.offsetWidth;
+ this.setSize(width);
+ }
+ },
+
+ bindScroll:function () {
+ this.tree.getTreeEl().on('scroll', this.cancelEdit, this);
+ },
+
+ beforeNodeClick:function (node, e) {
+
+ var sinceLast = (this.lastClick ? this.lastClick.getElapsed() : 0);
+ this.lastClick = new Date();
+ if (sinceLast > this.editDelay) { // && this.tree.getSelectionModel().isSelected(node)) {
+ e.stopEvent();
+ this.triggerEdit(node, e);
+ node.select();
+ return false;
+ } else {
+ this.completeEdit();
+
+ }
+ },
+
+ updateNode:function (ed, value) {
+ this.tree.getTreeEl().un('scroll', this.cancelEdit, this);
+ //this.editNode.cols[this.editColIndex] = value; //for internal use only
+ this.editNode.attributes[this.editColIndex] = value;//duplicate into array of node attributes
+ this.editCol.innerHTML = value;
+ },
+
+ onHide:function () {
+ Ext.tree.TreeEditor.superclass.onHide.call(this);
+ if (this.editNode) {
+ this.editNode.ui.focus();
+ }
+ },
+
+ onSpecialKey:function (field, e) {
+ var k = e.getKey();
+ if (k == e.ESC) {
+ e.stopEvent();
+ this.cancelEdit();
+ } else if (k == e.ENTER && !e.hasModifier()) {
+ e.stopEvent();
+ this.completeEdit();
+ }
+ }
+});
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+.x-column-tree .x-panel-header {
+/*padding: 3px 0px 0px 0px;*/
+ border-bottom-width: 0px;
+}
+
+.x-column-tree .x-panel-header .x-panel-header-text {
+ margin-left: 3px
+}
+
+.x-column-tree .x-tree-node {
+ zoom: 1;
+}
+
+.x-column-tree .x-tree-node-el {
+/*border-bottom:1px solid #eee; borders? */
+ zoom: 1;
+}
+
+.x-column-tree .x-tree-selected {
+ background: #d9e8fb;
+}
+
+.x-column-tree .x-tree-node a {
+ line-height: 18px;
+ vertical-align: middle;
+}
+
+.x-column-tree .x-tree-node a span {
+
+}
+
+.x-column-tree .x-tree-node .x-tree-selected a span {
+ background: transparent;
+ color: #000;
+}
+
+.x-tree-col {
+ float: left;
+ overflow: hidden;
+ padding: 0 1px;
+ zoom: 1;
+}
+
+.x-tree-col-text, .x-tree-hd-text {
+ color: #000;
+ overflow: hidden;
+ -o-text-overflow: ellipsis;
+ text-overflow: ellipsis;
+ padding: 3px 3px 3px 5px;
+ white-space: nowrap;
+ font: normal 11px arial, tahoma, helvetica, sans-serif;
+}
+
+.x-tree-headers {
+ margin-top: 3px;
+ background: #f9f9f9 url(../images/grid3-hrow.gif) repeat-x 0 bottom;
+ cursor: default;
+ zoom: 1;
+}
+
+.x-tree-hd {
+ float: left;
+ overflow: hidden;
+ border-left: 1px solid #eee;
+ border-right: 1px solid #d0d0d0;
+}
--- /dev/null
+/** vim: ts=4:sw=4:nu:fdc=4:nospell
+ *
+ * Ext.ux.form.LovCombo CSS File
+ *
+ * @author Ing.Jozef Sakáloš
+ * @copyright (c) 2008, by Ing. Jozef Sakáloš
+ * @date 5. April 2008
+ * @version $Id: Ext.ux.form.LovCombo.css 189 2008-04-16 21:01:06Z jozo $
+ *
+ * @license Ext.ux.form.LovCombo.css is licensed under the terms of the Open Source
+ * LGPL 3.0 license. Commercial use is permitted to the extent that the
+ * code/component(s) do NOT become part of another Open Source or Commercially
+ * licensed development library or toolkit without explicit permission.
+ *
+ * License details: http://www.gnu.org/licenses/lgpl.html
+ */
+
+.ux-lovcombo-icon {
+ width:16px;
+ height:16px;
+ float:left;
+ background-position: -1px -1px ! important;
+ background-repeat:no-repeat ! important;
+}
+.ux-lovcombo-icon-checked {
+ background: transparent url(../../../extjs-3.4.0/resources/images/default/menu/checked.gif);
+}
+.ux-lovcombo-icon-unchecked {
+ background: transparent url(../../../extjs-3.4.0/resources/images/default/menu/unchecked.gif);
+}
+
+/* eof */
--- /dev/null
+// vim: ts=4:sw=4:nu:fdc=4:nospell
+/**
+ * Ext.ux.form.LovCombo, List of Values Combo
+ *
+ * @author Ing. Jozef Sakáloš
+ * @copyright (c) 2008, by Ing. Jozef Sakáloš
+ * @date 16. April 2008
+ * @version $Id: Ext.ux.form.LovCombo.js 285 2008-06-06 09:22:20Z jozo $
+ *
+ * @license Ext.ux.form.LovCombo.js is licensed under the terms of the Open Source
+ * LGPL 3.0 license. Commercial use is permitted to the extent that the
+ * code/component(s) do NOT become part of another Open Source or Commercially
+ * licensed development library or toolkit without explicit permission.
+ *
+ * License details: http://www.gnu.org/licenses/lgpl.html
+ */
+
+/*global Ext */
+
+// add RegExp.escape if it has not been already added
+if ('function' !== typeof RegExp.escape) {
+ RegExp.escape = function(s) {
+ if ('string' !== typeof s) {
+ return s;
+ }
+ // Note: if pasting from forum, precede ]/\ with backslash manually
+ return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+ }; // eo function escape
+}
+
+// create namespace
+Ext.ns('Ext.ux.form');
+
+/**
+ *
+ * @class Ext.ux.form.LovCombo
+ * @extends Ext.form.ComboBox
+ */
+Ext.ux.form.LovCombo = Ext.extend(Ext.form.ComboBox, {
+
+ // {{{
+ // configuration options
+ /**
+ * @cfg {String} checkField name of field used to store checked state.
+ * It is automatically added to existing fields.
+ * Change it only if it collides with your normal field.
+ */
+ checkField:'checked',
+
+ assertValue: Ext.emptyFn
+
+ /**
+ * @cfg {String} separator separator to use between values and texts
+ */
+ , separator:','
+
+ /**
+ * @cfg {String/Array} tpl Template for items.
+ * Change it only if you know what you are doing.
+ */
+ // }}}
+ // {{{
+ ,initComponent : function() {
+
+ // template with checkbox
+ if (!this.tpl) {
+ this.tpl =
+ '<tpl for=".">'
+ + '<div class="x-combo-list-item">'
+ + '<img src="' + Ext.BLANK_IMAGE_URL + '" '
+ + 'class="ux-lovcombo-icon ux-lovcombo-icon-'
+ + '{[values.' + this.checkField + '?"checked":"unchecked"' + ']}">'
+ + '<div class="ux-lovcombo-item-text">{' + (this.displayField || 'text' ) + '}</div>'
+ + '</div>'
+ + '</tpl>'
+ ;
+ }
+
+ // call parent
+ Ext.ux.form.LovCombo.superclass.initComponent.apply(this, arguments);
+
+ // install internal event handlers
+ this.on({
+ scope:this
+ ,beforequery:this.onBeforeQuery
+ ,blur:this.onRealBlur
+ });
+
+ // remove selection from input field
+ this.onLoad = this.onLoad.createSequence(function() {
+ if (this.el) {
+ var v = this.el.dom.value;
+ this.el.dom.value = '';
+ this.el.dom.value = v;
+ }
+ });
+
+ } // e/o function initComponent
+ // }}}
+ // {{{
+ /**
+ * Disables default tab key bahavior
+ * @private
+ */
+ ,
+ initEvents:function() {
+ Ext.ux.form.LovCombo.superclass.initEvents.apply(this, arguments);
+
+ // disable default tab handling - does no good
+ this.keyNav.tab = false;
+
+ } // eo function initEvents
+ // }}}
+ // {{{
+ /**
+ * clears value
+ */
+ ,
+ clearValue:function() {
+ this.value = '';
+ this.setRawValue(this.value);
+ this.store.clearFilter();
+ this.store.each(function(r) {
+ r.set(this.checkField, false);
+ }, this);
+ if (this.hiddenField) {
+ this.hiddenField.value = '';
+ }
+ this.applyEmptyText();
+ } // eo function clearValue
+ // }}}
+ // {{{
+ /**
+ * @return {String} separator (plus space) separated list of selected displayFields
+ * @private
+ */
+ ,
+ getCheckedDisplay:function() {
+ var re = new RegExp(this.separator, "g");
+ return this.getCheckedValue(this.displayField).replace(re, this.separator + ' ');
+ } // eo function getCheckedDisplay
+ // }}}
+ // {{{
+ /**
+ * @return {String} separator separated list of selected valueFields
+ * @private
+ */
+ ,
+ getCheckedValue:function(field) {
+ field = field || this.valueField;
+ var c = [];
+
+ // store may be filtered so get all records
+ var snapshot = this.store.snapshot || this.store.data;
+
+ snapshot.each(function(r) {
+ if (r.get(this.checkField)) {
+ c.push(r.get(field));
+ }
+ }, this);
+
+ return c.join(this.separator);
+ } // eo function getCheckedValue
+ // }}}
+ // {{{
+ /**
+ * beforequery event handler - handles multiple selections
+ * @param {Object} qe query event
+ * @private
+ */
+ ,
+ onBeforeQuery:function(qe) {
+ var text = RegExp.escape(this.getCheckedDisplay());
+ qe.query = qe.query.replace(new RegExp(text + '[ ' + this.separator + ']*'), '');
+ } // eo function onBeforeQuery
+ // }}}
+ // {{{
+ /**
+ * blur event handler - runs only when real blur event is fired
+ */
+ ,
+ onRealBlur:function() {
+ this.list.hide();
+ var rv = this.getRawValue();
+ var rva = rv.split(new RegExp(RegExp.escape(this.separator) + ' *'));
+ var va = [];
+ var snapshot = this.store.snapshot || this.store.data;
+
+ // iterate through raw values and records and check/uncheck items
+ Ext.each(rva, function(v) {
+ snapshot.each(function(r) {
+ if (v === r.get(this.displayField)) {
+ va.push(r.get(this.valueField));
+ }
+ }, this);
+ }, this);
+ this.setValue(va.join(this.separator));
+ this.store.clearFilter();
+ } // eo function onRealBlur
+ // }}}
+ // {{{
+ /**
+ * Combo's onSelect override
+ * @private
+ * @param {Ext.data.Record} record record that has been selected in the list
+ * @param {Number} index index of selected (clicked) record
+ */
+ ,
+ onSelect:function(record, index) {
+ if (this.fireEvent('beforeselect', this, record, index) !== false) {
+
+ // toggle checked field
+ record.set(this.checkField, !record.get(this.checkField));
+
+ // display full list
+ if (this.store.isFiltered()) {
+ this.doQuery(this.allQuery);
+ }
+ // set (update) value and fire event
+ this.setValue(this.getCheckedValue());
+ this.fireEvent('select', this, record, index);
+ }
+ } // eo function onSelect
+ // }}}
+ // {{{
+ /**
+ * Sets the value of the LovCombo
+ * @param {Mixed} v value
+ */
+ ,
+ setValue:function(v) {
+ if (v) {
+ v = '' + v;
+ if (this.valueField) {
+ this.store.clearFilter();
+ this.store.each(function(r) {
+ var checked = !(!v.match(
+ '(^|' + this.separator + ')' + RegExp.escape(r.get(this.valueField))
+ + '(' + this.separator + '|$)'))
+ ;
+
+ r.set(this.checkField, checked);
+ }, this);
+ this.value = this.getCheckedValue();
+ this.setRawValue(this.getCheckedDisplay());
+ if (this.hiddenField) {
+ this.hiddenField.value = this.value;
+ }
+ }
+ else {
+ this.value = v;
+ this.setRawValue(v);
+ if (this.hiddenField) {
+ this.hiddenField.value = v;
+ }
+ }
+ if (this.el) {
+ this.el.removeClass(this.emptyClass);
+ }
+ }
+ else {
+ this.clearValue();
+ }
+ } // eo function setValue
+ // }}}
+ // {{{
+ /**
+ * Selects all items
+ */
+ ,
+ selectAll:function() {
+ this.store.each(function(record) {
+ // toggle checked field
+ record.set(this.checkField, true);
+ }, this);
+
+ //display full list
+ this.doQuery(this.allQuery);
+ this.setValue(this.getCheckedValue());
+ } // eo full selectAll
+ // }}}
+ // {{{
+ /**
+ * Deselects all items. Synonym for clearValue
+ */
+ ,
+ deselectAll:function() {
+ this.clearValue();
+ } // eo full deselectAll
+ // }}}
+
+}); // eo extend
+
+// register xtype
+Ext.reg('lovcombo', Ext.ux.form.LovCombo);
+
+// eof
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+Ext.ns('Ext.ux.grid');
+
+/**
+ * @class Ext.ux.grid.CheckColumn
+ * @extends Object
+ * GridPanel plugin to add a column with check boxes to a grid.
+ * <p>Example usage:</p>
+ * <pre><code>
+ // create the column
+ var checkColumn = new Ext.grid.CheckColumn({
+ header: 'Indoor?',
+ dataIndex: 'indoor',
+ id: 'check',
+ width: 55
+ });
+
+ // add the column to the column model
+ var cm = new Ext.grid.ColumnModel([{
+ header: 'Foo',
+ ...
+ },
+ checkColumn
+ ]);
+
+ // create the grid
+ var grid = new Ext.grid.EditorGridPanel({
+ ...
+ cm: cm,
+ plugins: [checkColumn], // include plugin
+ ...
+ });
+ * </code></pre>
+ * In addition to storing a Boolean value within the record data, this
+ * class toggles a css class between <tt>'x-grid3-check-col'</tt> and
+ * <tt>'x-grid3-check-col-on'</tt> to alter the background image used for
+ * a column.
+ */
+Ext.ux.grid.CheckColumn = function(config) {
+ Ext.apply(this, config);
+ if (!this.id) {
+ this.id = Ext.id();
+ }
+ this.renderer = this.renderer.createDelegate(this);
+};
+
+Ext.ux.grid.CheckColumn.prototype = {
+ init : function(grid) {
+ this.grid = grid;
+ this.grid.on('render', function() {
+ var view = this.grid.getView();
+ view.mainBody.on('mousedown', this.onMouseDown, this);
+ }, this);
+ },
+
+ onMouseDown : function(e, t) {
+ if (Ext.fly(t).hasClass(this.createId())) {
+ e.stopEvent();
+ var index = this.grid.getView().findRowIndex(t);
+ var record = this.grid.store.getAt(index);
+ record.set(this.dataIndex, !record.data[this.dataIndex]);
+ }
+ },
+
+ renderer : function(v, p, record) {
+ p.css += ' x-grid3-check-col-td';
+ return String.format('<div class="x-grid3-check-col{0} {1}"> </div>', v ? '-on' : '', this.createId());
+ },
+
+ createId : function() {
+ return 'x-grid3-cc-' + this.id;
+ }
+};
+
+// register ptype
+Ext.preg('checkcolumn', Ext.ux.grid.CheckColumn);
+
+// backwards compat
+Ext.grid.CheckColumn = Ext.ux.grid.CheckColumn;
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+Ext.ns('Ext.ux.grid');
+
+Ext.ux.grid.ColumnHeaderGroup = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.config = config;
+ },
+
+ init: function(grid) {
+ Ext.applyIf(grid.colModel, this.config);
+ Ext.apply(grid.getView(), this.viewConfig);
+ },
+
+ viewConfig: {
+ initTemplates: function() {
+ this.constructor.prototype.initTemplates.apply(this, arguments);
+ var ts = this.templates || {};
+ if (!ts.gcell) {
+ ts.gcell = new Ext.XTemplate('<td class="x-grid3-hd x-grid3-gcell x-grid3-td-{id} ux-grid-hd-group-row-{row} {cls}" style="{style}">', '<div {tooltip} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '', '{value}</div></td>');
+ }
+ this.templates = ts;
+ this.hrowRe = new RegExp("ux-grid-hd-group-row-(\\d+)", "");
+ },
+
+ renderHeaders: function() {
+ var ts = this.templates, headers = [], cm = this.cm, rows = cm.rows, tstyle = 'width:' + this.getTotalWidth() + ';';
+
+ for (var row = 0, rlen = rows.length; row < rlen; row++) {
+ var r = rows[row], cells = [];
+ for (var i = 0, gcol = 0, len = r.length; i < len; i++) {
+ var group = r[i];
+ group.colspan = group.colspan || 1;
+ var id = this.getColumnId(group.dataIndex ? cm.findColumnIndex(group.dataIndex) : gcol), gs = Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupStyle.call(this, group, gcol);
+ cells[i] = ts.gcell.apply({
+ cls: 'ux-grid-hd-group-cell',
+ id: id,
+ row: row,
+ style: 'width:' + gs.width + ';' + (gs.hidden ? 'display:none;' : '') + (group.align ? 'text-align:' + group.align + ';' : ''),
+ tooltip: group.tooltip ? (Ext.QuickTips.isEnabled() ? 'ext:qtip' : 'title') + '="' + group.tooltip + '"' : '',
+ istyle: group.align == 'right' ? 'padding-right:16px' : '',
+ btn: this.grid.enableHdMenu && group.header,
+ value: group.header || ' '
+ });
+ gcol += group.colspan;
+ }
+ headers[row] = ts.header.apply({
+ tstyle: tstyle,
+ cells: cells.join('')
+ });
+ }
+ headers.push(this.constructor.prototype.renderHeaders.apply(this, arguments));
+ return headers.join('');
+ },
+
+ onColumnWidthUpdated: function() {
+ this.constructor.prototype.onColumnWidthUpdated.apply(this, arguments);
+ Ext.ux.grid.ColumnHeaderGroup.prototype.updateGroupStyles.call(this);
+ },
+
+ onAllColumnWidthsUpdated: function() {
+ this.constructor.prototype.onAllColumnWidthsUpdated.apply(this, arguments);
+ Ext.ux.grid.ColumnHeaderGroup.prototype.updateGroupStyles.call(this);
+ },
+
+ onColumnHiddenUpdated: function() {
+ this.constructor.prototype.onColumnHiddenUpdated.apply(this, arguments);
+ Ext.ux.grid.ColumnHeaderGroup.prototype.updateGroupStyles.call(this);
+ },
+
+ getHeaderCell: function(index) {
+ return this.mainHd.query(this.cellSelector)[index];
+ },
+
+ findHeaderCell: function(el) {
+ return el ? this.fly(el).findParent('td.x-grid3-hd', this.cellSelectorDepth) : false;
+ },
+
+ findHeaderIndex: function(el) {
+ var cell = this.findHeaderCell(el);
+ return cell ? this.getCellIndex(cell) : false;
+ },
+
+ updateSortIcon: function(col, dir) {
+ var sc = this.sortClasses, hds = this.mainHd.select(this.cellSelector).removeClass(sc);
+ hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
+ },
+
+ handleHdDown: function(e, t) {
+ var el = Ext.get(t);
+ if (el.hasClass('x-grid3-hd-btn')) {
+ e.stopEvent();
+ var hd = this.findHeaderCell(t);
+ Ext.fly(hd).addClass('x-grid3-hd-menu-open');
+ var index = this.getCellIndex(hd);
+ this.hdCtxIndex = index;
+ var ms = this.hmenu.items, cm = this.cm;
+ ms.get('asc').setDisabled(!cm.isSortable(index));
+ ms.get('desc').setDisabled(!cm.isSortable(index));
+ this.hmenu.on('hide', function() {
+ Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
+ }, this, {
+ single: true
+ });
+ this.hmenu.show(t, 'tl-bl?');
+ } else if (el.hasClass('ux-grid-hd-group-cell') || Ext.fly(t).up('.ux-grid-hd-group-cell')) {
+ e.stopEvent();
+ }
+ },
+
+ handleHdMove: function(e, t) {
+ var hd = this.findHeaderCell(this.activeHdRef);
+ if (hd && !this.headersDisabled && !Ext.fly(hd).hasClass('ux-grid-hd-group-cell')) {
+ var hw = this.splitHandleWidth || 5, r = this.activeHdRegion, x = e.getPageX(), ss = hd.style, cur = '';
+ if (this.grid.enableColumnResize !== false) {
+ if (x - r.left <= hw && this.cm.isResizable(this.activeHdIndex - 1)) {
+ cur = Ext.isAir ? 'move' : Ext.isWebKit ? 'e-resize' : 'col-resize'; // col-resize
+ // not
+ // always
+ // supported
+ } else if (r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)) {
+ cur = Ext.isAir ? 'move' : Ext.isWebKit ? 'w-resize' : 'col-resize';
+ }
+ }
+ ss.cursor = cur;
+ }
+ },
+
+ handleHdOver: function(e, t) {
+ var hd = this.findHeaderCell(t);
+ if (hd && !this.headersDisabled) {
+ this.activeHdRef = t;
+ this.activeHdIndex = this.getCellIndex(hd);
+ var fly = this.fly(hd);
+ this.activeHdRegion = fly.getRegion();
+ if (!(this.cm.isMenuDisabled(this.activeHdIndex) || fly.hasClass('ux-grid-hd-group-cell'))) {
+ fly.addClass('x-grid3-hd-over');
+ this.activeHdBtn = fly.child('.x-grid3-hd-btn');
+ if (this.activeHdBtn) {
+ this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight - 1) + 'px';
+ }
+ }
+ }
+ },
+
+ handleHdOut: function(e, t) {
+ var hd = this.findHeaderCell(t);
+ if (hd && (!Ext.isIE || !e.within(hd, true))) {
+ this.activeHdRef = null;
+ this.fly(hd).removeClass('x-grid3-hd-over');
+ hd.style.cursor = '';
+ }
+ },
+
+ handleHdMenuClick: function(item) {
+ var index = this.hdCtxIndex, cm = this.cm, ds = this.ds, id = item.getItemId();
+ switch (id) {
+ case 'asc':
+ ds.sort(cm.getDataIndex(index), 'ASC');
+ break;
+ case 'desc':
+ ds.sort(cm.getDataIndex(index), 'DESC');
+ break;
+ default:
+ if (id.substr(0, 5) == 'group') {
+ var i = id.split('-'), row = parseInt(i[1], 10), col = parseInt(i[2], 10), r = this.cm.rows[row], group, gcol = 0;
+ for (var i = 0, len = r.length; i < len; i++) {
+ group = r[i];
+ if (col >= gcol && col < gcol + group.colspan) {
+ break;
+ }
+ gcol += group.colspan;
+ }
+ if (item.checked) {
+ var max = cm.getColumnsBy(this.isHideableColumn, this).length;
+ for (var i = gcol, len = gcol + group.colspan; i < len; i++) {
+ if (!cm.isHidden(i)) {
+ max--;
+ }
+ }
+ if (max < 1) {
+ this.onDenyColumnHide();
+ return false;
+ }
+ }
+ for (var i = gcol, len = gcol + group.colspan; i < len; i++) {
+ if (cm.config[i].fixed !== true && cm.config[i].hideable !== false) {
+ cm.setHidden(i, item.checked);
+ }
+ }
+ } else {
+ index = cm.getIndexById(id.substr(4));
+ if (index != -1) {
+ if (item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1) {
+ this.onDenyColumnHide();
+ return false;
+ }
+ cm.setHidden(index, item.checked);
+ }
+ }
+ item.checked = !item.checked;
+ if (item.menu) {
+ var updateChildren = function(menu) {
+ menu.items.each(function(childItem) {
+ if (!childItem.disabled) {
+ childItem.setChecked(item.checked, false);
+ if (childItem.menu) {
+ updateChildren(childItem.menu);
+ }
+ }
+ });
+ }
+ updateChildren(item.menu);
+ }
+ var parentMenu = item, parentItem;
+ while (parentMenu = parentMenu.parentMenu) {
+ if (!parentMenu.parentMenu || !(parentItem = parentMenu.parentMenu.items.get(parentMenu.getItemId())) || !parentItem.setChecked) {
+ break;
+ }
+ var checked = parentMenu.items.findIndexBy(function(m) {
+ return m.checked;
+ }) >= 0;
+ parentItem.setChecked(checked, true);
+ }
+ item.checked = !item.checked;
+ }
+ return true;
+ },
+
+ beforeColMenuShow: function() {
+ var cm = this.cm, rows = this.cm.rows;
+ this.colMenu.removeAll();
+ for (var col = 0, clen = cm.getColumnCount(); col < clen; col++) {
+ var menu = this.colMenu, title = cm.getColumnHeader(col), text = [];
+ if (cm.config[col].fixed !== true && cm.config[col].hideable !== false) {
+ for (var row = 0, rlen = rows.length; row < rlen; row++) {
+ var r = rows[row], group, gcol = 0;
+ for (var i = 0, len = r.length; i < len; i++) {
+ group = r[i];
+ if (col >= gcol && col < gcol + group.colspan) {
+ break;
+ }
+ gcol += group.colspan;
+ }
+ if (group && group.header) {
+ if (cm.hierarchicalColMenu) {
+ var gid = 'group-' + row + '-' + gcol;
+ var item = menu.items.item(gid);
+ var submenu = item ? item.menu : null;
+ if (!submenu) {
+ submenu = new Ext.menu.Menu({
+ itemId: gid
+ });
+ submenu.on("itemclick", this.handleHdMenuClick, this);
+ var checked = false, disabled = true;
+ for (var c = gcol, lc = gcol + group.colspan; c < lc; c++) {
+ if (!cm.isHidden(c)) {
+ checked = true;
+ }
+ if (cm.config[c].hideable !== false) {
+ disabled = false;
+ }
+ }
+ menu.add({
+ itemId: gid,
+ text: group.header,
+ menu: submenu,
+ hideOnClick: false,
+ checked: checked,
+ disabled: disabled
+ });
+ }
+ menu = submenu;
+ } else {
+ text.push(group.header);
+ }
+ }
+ }
+ text.push(title);
+ menu.add(new Ext.menu.CheckItem({
+ itemId: "col-" + cm.getColumnId(col),
+ text: text.join(' '),
+ checked: !cm.isHidden(col),
+ hideOnClick: false,
+ disabled: cm.config[col].hideable === false
+ }));
+ }
+ }
+ },
+
+ renderUI: function() {
+ this.constructor.prototype.renderUI.apply(this, arguments);
+ Ext.apply(this.columnDrop, Ext.ux.grid.ColumnHeaderGroup.prototype.columnDropConfig);
+ Ext.apply(this.splitZone, Ext.ux.grid.ColumnHeaderGroup.prototype.splitZoneConfig);
+ }
+ },
+
+ splitZoneConfig: {
+ allowHeaderDrag: function(e) {
+ return !e.getTarget(null, null, true).hasClass('ux-grid-hd-group-cell');
+ }
+ },
+
+ columnDropConfig: {
+ getTargetFromEvent: function(e) {
+ var t = Ext.lib.Event.getTarget(e);
+ return this.view.findHeaderCell(t);
+ },
+
+ positionIndicator: function(h, n, e) {
+ var data = Ext.ux.grid.ColumnHeaderGroup.prototype.getDragDropData.call(this, h, n, e);
+ if (data === false) {
+ return false;
+ }
+ var px = data.px + this.proxyOffsets[0];
+ this.proxyTop.setLeftTop(px, data.r.top + this.proxyOffsets[1]);
+ this.proxyTop.show();
+ this.proxyBottom.setLeftTop(px, data.r.bottom);
+ this.proxyBottom.show();
+ return data.pt;
+ },
+
+ onNodeDrop: function(n, dd, e, data) {
+ var h = data.header;
+ if (h != n) {
+ var d = Ext.ux.grid.ColumnHeaderGroup.prototype.getDragDropData.call(this, h, n, e);
+ if (d === false) {
+ return false;
+ }
+ var cm = this.grid.colModel, right = d.oldIndex < d.newIndex, rows = cm.rows;
+ for (var row = d.row, rlen = rows.length; row < rlen; row++) {
+ var r = rows[row], len = r.length, fromIx = 0, span = 1, toIx = len;
+ for (var i = 0, gcol = 0; i < len; i++) {
+ var group = r[i];
+ if (d.oldIndex >= gcol && d.oldIndex < gcol + group.colspan) {
+ fromIx = i;
+ }
+ if (d.oldIndex + d.colspan - 1 >= gcol && d.oldIndex + d.colspan - 1 < gcol + group.colspan) {
+ span = i - fromIx + 1;
+ }
+ if (d.newIndex >= gcol && d.newIndex < gcol + group.colspan) {
+ toIx = i;
+ }
+ gcol += group.colspan;
+ }
+ var groups = r.splice(fromIx, span);
+ rows[row] = r.splice(0, toIx - (right ? span : 0)).concat(groups).concat(r);
+ }
+ for (var c = 0; c < d.colspan; c++) {
+ var oldIx = d.oldIndex + (right ? 0 : c), newIx = d.newIndex + (right ? -1 : c);
+ cm.moveColumn(oldIx, newIx);
+ this.grid.fireEvent("columnmove", oldIx, newIx);
+ }
+ return true;
+ }
+ return false;
+ }
+ },
+
+ getGroupStyle: function(group, gcol) {
+ var width = 0, hidden = true;
+ for (var i = gcol, len = gcol + group.colspan; i < len; i++) {
+ if (!this.cm.isHidden(i)) {
+ var cw = this.cm.getColumnWidth(i);
+ if (typeof cw == 'number') {
+ width += cw;
+ }
+ hidden = false;
+ }
+ }
+ return {
+ width: (Ext.isBorderBox || (Ext.isWebKit && !Ext.isSafari2) ? width : Math.max(width - this.borderWidth, 0)) + 'px',
+ hidden: hidden
+ };
+ },
+
+ updateGroupStyles: function(col) {
+ var tables = this.mainHd.query('.x-grid3-header-offset > table'), tw = this.getTotalWidth(), rows = this.cm.rows;
+ for (var row = 0; row < tables.length; row++) {
+ tables[row].style.width = tw;
+ if (row < rows.length) {
+ var cells = tables[row].firstChild.firstChild.childNodes;
+ for (var i = 0, gcol = 0; i < cells.length; i++) {
+ var group = rows[row][i];
+ if ((typeof col != 'number') || (col >= gcol && col < gcol + group.colspan)) {
+ var gs = Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupStyle.call(this, group, gcol);
+ cells[i].style.width = gs.width;
+ cells[i].style.display = gs.hidden ? 'none' : '';
+ }
+ gcol += group.colspan;
+ }
+ }
+ }
+ },
+
+ getGroupRowIndex: function(el) {
+ if (el) {
+ var m = el.className.match(this.hrowRe);
+ if (m && m[1]) {
+ return parseInt(m[1], 10);
+ }
+ }
+ return this.cm.rows.length;
+ },
+
+ getGroupSpan: function(row, col) {
+ if (row < 0) {
+ return {
+ col: 0,
+ colspan: this.cm.getColumnCount()
+ };
+ }
+ var r = this.cm.rows[row];
+ if (r) {
+ for (var i = 0, gcol = 0, len = r.length; i < len; i++) {
+ var group = r[i];
+ if (col >= gcol && col < gcol + group.colspan) {
+ return {
+ col: gcol,
+ colspan: group.colspan
+ };
+ }
+ gcol += group.colspan;
+ }
+ return {
+ col: gcol,
+ colspan: 0
+ };
+ }
+ return {
+ col: col,
+ colspan: 1
+ };
+ },
+
+ getDragDropData: function(h, n, e) {
+ if (h.parentNode != n.parentNode) {
+ return false;
+ }
+ var cm = this.grid.colModel, x = Ext.lib.Event.getPageX(e), r = Ext.lib.Dom.getRegion(n.firstChild), px, pt;
+ if ((r.right - x) <= (r.right - r.left) / 2) {
+ px = r.right + this.view.borderWidth;
+ pt = "after";
+ } else {
+ px = r.left;
+ pt = "before";
+ }
+ var oldIndex = this.view.getCellIndex(h), newIndex = this.view.getCellIndex(n);
+ if (cm.isFixed(newIndex)) {
+ return false;
+ }
+ var row = Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupRowIndex.call(this.view, h),
+ oldGroup = Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view, row, oldIndex),
+ newGroup = Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view, row, newIndex),
+ oldIndex = oldGroup.col;
+ newIndex = newGroup.col + (pt == "after" ? newGroup.colspan : 0);
+ if (newIndex >= oldGroup.col && newIndex <= oldGroup.col + oldGroup.colspan) {
+ return false;
+ }
+ var parentGroup = Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view, row - 1, oldIndex);
+ if (newIndex < parentGroup.col || newIndex > parentGroup.col + parentGroup.colspan) {
+ return false;
+ }
+ return {
+ r: r,
+ px: px,
+ pt: pt,
+ row: row,
+ oldIndex: oldIndex,
+ newIndex: newIndex,
+ colspan: oldGroup.colspan
+ };
+ }
+});
\ No newline at end of file
Ext.ns('eliot.absences.commons');
eliot.absences.commons.LovComboViewConstantes = {
- eventId : {
- actionValeurChange : 'actionValeurChange'
+ eventId:{
+ actionValeurChange:'actionValeurChange'
}
};
eliot.absences.commons.LovComboViewModele = {
- libelle : {
- tous : undefined
+ libelle:{
+ tous:undefined
}
};
eliot.absences.commons.LovComboView = Ext.extend(Ext.util.Observable, {
- constructor: function(config) {
+ constructor:function (config) {
var Constantes = eliot.absences.commons.LovComboViewConstantes;
// Définition de la configuration par défaut
var defaultConfig = {
- store : undefined,
- fieldLabel : '',
- champsObligatoire : false,
- width : 100,
- valeurInitiale : '-1',
- listWidth : undefined,
- valueField : 'id'
+ store:undefined,
+ fieldLabel:'',
+ champsObligatoire:false,
+ width:100,
+ valeurInitiale:'-1',
+ listWidth:undefined,
+ valueField:'id'
};
// Charge la config passée en paramètre
Ext.applyIf(config, defaultConfig);
- if(!config.listWidth){
+ if (!config.listWidth) {
config.listWidth = config.width;
}
* @param newValue l'ensemble des identifiants des éléments choisis
*/
this.addEvents(
- Constantes.eventId.actionValeurChange
- );
+ Constantes.eventId.actionValeurChange
+ );
var baliseZoneObligatoire = '<span class="red"> * </span>';
var labelSeparateur = ' : ';
if (config.champsObligatoire) {
labelSeparateur += baliseZoneObligatoire;
}
-
+
this.lovCombo = new Ext.ux.form.LovCombo({
- listWidth : config.listWidth,
- store: config.store,
- fieldLabel: config.fieldLabel,
- labelSeparator : labelSeparateur,
+ listWidth:config.listWidth,
+ store:config.store,
+ fieldLabel:config.fieldLabel,
+ labelSeparator:labelSeparateur,
hideOnSelect:false,
valueField:config.valueField,
displayField:'libelle',
mode:'local',
- value : config.valeurInitiale,
- width: config.width,
- editable: false
+ value:config.valeurInitiale,
+ width:config.width,
+ editable:false
});
this.valeur = config.valeurInitiale;
this.observeLovCombo();
},
- observeLovCombo : function () {
+ observeLovCombo:function () {
this.lovCombo.addListener({
- change : {
- fn : function(combo, newValue, oldValue) {
+ change:{
+ fn:function (combo, newValue, oldValue) {
var nouvellesValeur = newValue;
if (!newValue) {
nouvellesValeur = '-1';
combo.selectAll();
}
this.fireEvent(
- eliot.absences.commons.LovComboViewConstantes.eventId.
- actionValeurChange,
- nouvellesValeur
- )
+ eliot.absences.commons.LovComboViewConstantes.eventId.
+ actionValeurChange,
+ nouvellesValeur
+ )
},
- scope: this
+ scope:this
},
- beforeselect : {
- fn : function(combo, record, index) {
+ beforeselect:{
+ fn:function (combo, record, index) {
if (index !== 0) {
var tous = combo.store.getAt(0);
tous.set(combo.checkField, false);
}
},
- scope : this
+ scope:this
},
- select : {
- fn : function(combo, record, index) {
+ select:{
+ fn:function (combo, record, index) {
if (index == 0) {
if (record.data.checked) {
combo.selectAll();
tous.set(combo.checkField, false);
}
},
- scope : this
+ scope:this
},
- afterrender : {
- fn : function(combo) {
+ afterrender:{
+ fn:function (combo) {
if (combo.store.getCount() != 0 && this.valeur === '-1') {
combo.selectAll();
}
},
- scope : this
+ scope:this
}
});
this.lovCombo.store.addListener({
- load : {
- fn :function() {
+ load:{
+ fn:function () {
// On ajoute l'élément : 'Tous' seulement si il n'existe pas
var record = this.lovCombo.store.getById(-1);
if (!record) {
this.lovCombo.store.insert(
- 0,
- new this.lovCombo.store.recordType(
+ 0,
+ new this.lovCombo.store.recordType(
{
- id: -1,
- libelle : eliot.absences.commons.LovComboViewModele.libelle.tous
+ id:-1,
+ libelle:eliot.absences.commons.LovComboViewModele.libelle.tous
}
- ));
+ ));
+ }
+
+ var idsSelectionParDefaut = this.lovCombo.store.reader.jsonData.selectionParDefautIds;
+
+ if (idsSelectionParDefaut) {
+ this.lovCombo.setValue(idsSelectionParDefaut);
+ } else {
+ this.lovCombo.selectAll();
}
- this.lovCombo.selectAll();
},
- scope: this
+ scope:this
}
});
}
leInput[0].setAttribute('maxLength', nbCarMax);
},
- /**
- * Affiche une fenetre pour la creation ou modification d'un groupe de motif
- *
- */
- afficherMsgBoxGrpMotif: function(fnSiOui, fnSiNon, modifier) {
- var NameSpace = eliot.absences.parametrage.motifs;
- var initValLibelle = modifier ? this.getMotifSelectionne().attributes.nom : '';
- initValLibelle = this.decodeHtml(initValLibelle);
- var titreBox = modifier ? NameSpace.Modele.libelle.titreModifierGrpMotif :
- NameSpace.Modele.libelle.titreCreerGrpMotif;
-
- // Afin d'avoir le focus sur la fenêtre
- Ext.override(Ext.Window, {
- toFront : function(e) {
- if (this.manager.bringToFront(this)) {
- if (e && !e.getTarget().focus) {
- this.focus();
- }
- }
- return this;
- }
- });
-
- var MsgBox = new Ext.Window({
- modal : true,
- layout : 'form',
- id : NameSpace.Constantes.composantId.idMsgBox,
- labelAlign : 'left',
- labelWidth : 80,
- bodyStyle:'padding:5px 5px 5px',
- closeAction:'close',
- defaults: {
- labelSeparator : ' : '
- },
- width:420,
- height : 110,
- resizable : false,
- title:titreBox,
- items:[
- {
- xtype: 'textfield',
- fieldLabel: NameSpace.Modele.libelle.titreLibelleGrpMotif,
- id : NameSpace.Constantes.composantId.idLibelleGrpMotif,
- value:initValLibelle,
- width:250,
- allowBlank : false
- }
- ],
- buttons: [
- {
- text : NameSpace.Modele.libelle.btnOk,
- handler: function() {
- MsgBox.fireEvent('submit');
- }
- },
- {
- text: NameSpace.Modele.libelle.btnCancel,
- handler: function() {
- MsgBox.close();
- }
- }
- ],
- keys: [
- {
- key: [Ext.EventObject.ENTER],
- handler: function() {
- MsgBox.fireEvent('submit');
- }
- }
- ]
- ,listeners: {
- show: function(win) {
- var field = win.findById(
- NameSpace.Constantes.composantId.idLibelleGrpMotif
- );
- field.focus.defer(50, field);
-
- },
- close: function(panel) {
- NameSpace.Application.toolbarMotifs.activerToolbar(true);
- },
- submit: function() {
- var libelle = Ext.getCmp(
- NameSpace.Constantes.composantId.idLibelleGrpMotif
- ).getValue();
- var idEtab = Ext.get(
- NameSpace.Constantes.composantId.idEtab
- ).getValue();
- var nodeSel = NameSpace.Application.
- arbreMotifs.noeudMotifSelectionne();
- var nodeSelId = nodeSel ? nodeSel.id.substring(
- 1, nodeSel.id.length
- ) : undefined;
-
- libelle = libelle.trim();
- if (libelle != '') {
- fnSiOui(idEtab, libelle, nodeSelId);
- }
- if (libelle == '') {
- eliot.absences.Message.showErreur(
- NameSpace.Modele.message.groupeMotifEchecCreerLibelleVide
- );
- }
-
- MsgBox.close();
- }
- }
- });
-
- MsgBox.show();
- },
- /**
- * Affiche une fenetre pour la creation ou modification d'un motif
- *
- */
- afficherMsgBoxMotif: function(fnSiOui, fnSiNon, modifier) {
- var NameSpace = eliot.absences.parametrage.motifs;
- var initValLibelle = modifier ? this.getMotifSelectionne().attributes.nom : '';
- initValLibelle = this.decodeHtml(initValLibelle);
- var titreBox = modifier ? NameSpace.Modele.libelle.titreModifierMotif :
- NameSpace.Modele.libelle.titreCreerMotif;
- var nodeClr = null;
- if (modifier) nodeClr = NameSpace.Application.arbreMotifs.
- noeudMotifSelectionne().attributes['codeCouleur'];
- var couleurSel = nodeClr ? nodeClr : '#FFFFFF';
-
- var cp = new Ext.ColorPalette();
- cp.colors[31] = "CCCCCC";
- var lesCouleursDefauts = cp.colors;
-
- // Afin d'avoir le focus sur la fenêtre
- Ext.override(Ext.Window, {
- toFront : function(e) {
- if (this.manager.bringToFront(this)) {
- if (e && !e.getTarget().focus) {
- this.focus();
- }
- }
- return this;
- }
- });
-
- var MsgBox = new Ext.Window({
- modal:true,
- layout: 'form',
- labelAlign : 'left',
- labelWidth : 80,
- bodyStyle:'padding:10px 5px 5px',
- defaults: {
- labelSeparator : ' : '
- },
- width:400,
- autoHeight : true,
- resizable : false,
- title:titreBox,
- items:[
- {
- xtype : 'textfield',
- fieldLabel: NameSpace.Modele.libelle.titreLibelleGrpMotif,
- id : NameSpace.Constantes.composantId.idLibelleMotif,
- value:initValLibelle,
- width:280,
- allowBlank : false
- },
- {
- fieldLabel : NameSpace.Modele.libelle.titreLibelleCouleur,
- bodyStyle :'background-color:transparent',
- border : false
- },
- {
- xtype : 'panel',
- bodyStyle :'background-color:transparent',
- style:{ marginLeft : '90px', marginTop:'-10px'},
- border : false,
- items : {
- xtype:'colorpalette',
- id : NameSpace.Constantes.composantId.idColorPalMotif,
- colors :lesCouleursDefauts,
- value:couleurSel,
- width : 350
- }
- }
- ],
- buttons: [
- {
- text: NameSpace.Modele.libelle.btnOk,
- handler: function() {
- MsgBox.fireEvent('submit');
- }
- },
- {
- text: NameSpace.Modele.libelle.btnCancel,
- handler: function() {
- MsgBox.close();
-
- }
- }
- ],
- keys: [
- {
- key: [Ext.EventObject.ENTER],
- handler: function() {
- MsgBox.fireEvent('submit');
- }
- }
- ],
- listeners: {
- show: function(win) {
- var field = win.findById(
- NameSpace.Constantes.composantId.idLibelleMotif
- );
- field.focus.defer(50, field);
-
- },
- close: function(panel) {
- NameSpace.Application.toolbarMotifs.activerToolbar(true);
- },
- submit: function() {
- var libelle = Ext.getCmp(
- NameSpace.Constantes.composantId.idLibelleMotif
- ).getValue();
- var nodeSel = NameSpace.Application.arbreMotifs.
- noeudMotifSelectionne();
- var nodeGroupe = NameSpace.Application.arbreMotifs.
- groupeMotifCourant();
- var nodeGrpId = nodeGroupe.id.substring(
- 1, nodeGroupe.id.length
- );
- var nodeSelId = nodeSel.id.substring(1, nodeSel.id.length);
-
- libelle = libelle.trim();
- if (libelle != '') {
- fnSiOui(nodeGrpId, libelle, couleurSel, nodeSelId);
- }
- if (libelle == '') {
- eliot.absences.Message.showErreur(
- NameSpace.Modele.message.motifEchecCreerLibelleVide
- );
- }
-
- MsgBox.close();
- }
- }
-
- });
- Ext.getCmp(
- NameSpace.Constantes.composantId.idColorPalMotif
- ).addListener({
- select: {
- fn: function(colorPalette, color) {
- couleurSel = '#' + color;
- },
- scope: this
- }
- });
-
- MsgBox.show();
-
- },
-
getMotifSelectionne : function() {
return eliot.absences.parametrage.motifs.Application.arbreMotifs.
noeudMotifSelectionne();
activerComboEleve : 'activerComboEleve',
desActiverComboEleve : 'desActiverComboEleve',
donneesPretesAExporter : 'eliot.absences.commons.exportdonnees.BoutonExportControllerConstantes.donneesPretesAExporter',
- aucuneDonneesAExporter : 'eliot.absences.commons.exportdonnees.BoutonExportControllerConstantes.aucuneDonneesAExporter'
+ aucuneDonneesAExporter : 'eliot.absences.commons.exportdonnees.BoutonExportControllerConstantes.aucuneDonneesAExporter',
+ actionSelectionMotifsChange: 'eliot.absences.consultation.Constantes.eventId.actionSelectionMotifsChange',
+ actionCocheSelectionParDefaut: 'eliot.absences.consultation.Constantes.eventId.actionCocheSelectionParDefaut',
+ actionReloadMotifs: 'eliot.absences.consultation.Constantes.eventId.actionReloadMotifs'
},
identifiant : {
* la recherche dés l'éntrée dans la page
* @param config.criteresType lite des critères par défauts de type
*/
- constructor: function(config) {
+ constructor:function (config) {
var defaultConfig = {
- dateDebutIsNotToday : false,
- dateFin :new Date().format('d/m/Y')
+ dateDebutIsNotToday:false,
+ dateFin:new Date().format('d/m/Y')
};
Ext.applyIf(config, defaultConfig);
this.addEvents(
this.BoutonExportEventsId.donneesPretesAExporter,
- this.BoutonExportEventsId.aucuneDonneesAExporter
- );
+ this.BoutonExportEventsId.aucuneDonneesAExporter,
+ NameSpace.Constantes.eventId.actionSelectionMotifsChange
+ );
if (config.criteresType) {
this.critereType = String(config.criteresType);
// Objet qui contient les paramètres de recherche
this.params = {
- dateDebut : Date.parseDate(dateDebut, 'd/m/Y'),
- dateFin: Date.parseDate(config.dateFin, 'd/m/Y'),
- division: -1,
- motif: -1,
- groupeMotifs : -1,
- elevesId : -1,
- regimeIds : -1
+ dateDebut:Date.parseDate(dateDebut, 'd/m/Y'),
+ dateFin:Date.parseDate(config.dateFin, 'd/m/Y'),
+ division:-1,
+ motif:NameSpace.Modele.data.motifIdsDefaut,
+ groupeMotifs:-1,
+ elevesId:-1,
+ regimeIds:-1
};
if (config.criteresType) {
this.params.type = this.critereType;
// Création du proxy utilisé par le store pour communiquer avec le backoffice
var proxy = new Ext.data.HttpProxy({
- api: {
- read : NameSpace.Modele.url.getBilan
+ api:{
+ read:NameSpace.Modele.url.getBilan
}
});
var paramStore = {
- params : Ext.encode(this.params)
+ params:Ext.encode(this.params)
};
// Description du store des absences/retard/départ
this.store = new Ext.data.Store({
- proxy : proxy,
- autoLoad : config.autoLoad,
- autoDestroy: true,
- baseParams : paramStore,
- remoteSort: true,
- reader: new Ext.data.JsonReader({
- fields: [
+ proxy:proxy,
+ autoLoad:config.autoLoad,
+ autoDestroy:true,
+ baseParams:paramStore,
+ remoteSort:true,
+ reader:new Ext.data.JsonReader({
+ fields:[
{
name:'id'
},
{
- name: NameSpace.Modele.dataIndex.bilanLibelleColDate,
- type : 'date',
- convert: dateEU
+ name:NameSpace.Modele.dataIndex.bilanLibelleColDate,
+ type:'date',
+ convert:dateEU
},
{
- name: NameSpace.Modele.dataIndex.bilanLibelleColHeure
+ name:NameSpace.Modele.dataIndex.bilanLibelleColHeure
},
{
- name: NameSpace.Modele.dataIndex.bilanNomColNomPrenom
+ name:NameSpace.Modele.dataIndex.bilanNomColNomPrenom
},
{
- name: NameSpace.Modele.dataIndex.bilanEleveId
+ name:NameSpace.Modele.dataIndex.bilanEleveId
},
{
name:NameSpace.Modele.dataIndex.bilanNomColDivision
},
{
- name: NameSpace.Modele.dataIndex.bilanNomColType
+ name:NameSpace.Modele.dataIndex.bilanNomColType
},
{
- name: NameSpace.Modele.dataIndex.bilanLibelleColGrpMotif
+ name:NameSpace.Modele.dataIndex.bilanLibelleColGrpMotif
},
{
- name: NameSpace.Modele.dataIndex.bilanNomColMotif
+ name:NameSpace.Modele.dataIndex.bilanNomColMotif
},
- {name: 'regime'}
+ {name:'regime'}
],
root:'lignes',
totalProperty:'nbLignes',
- successProperty: 'success',
- messageProperty :'message',
- id: 'id'
+ successProperty:'success',
+ messageProperty:'message',
+ id:'id'
}),
- writer: new Ext.data.JsonWriter({
- encode: true
+ writer:new Ext.data.JsonWriter({
+ encode:true
})
});
* Observe le proxy du store absences/retard/départ
* @param proxy
*/
- observeProxy: function(proxy) {
+ observeProxy:function (proxy) {
proxy.addListener(
'exception',
- function(proxy, type, action, options, res, args) {
+ function (proxy, type, action, options, res, args) {
var message = res.message;
- if(!message){
- if(res.responseText){
+ if (!message) {
+ if (res.responseText) {
message = Ext.decode(res.responseText).message
}
}
eliot.absences.Message.showErreur(message);
},
this
- );
+ );
},
- observeStore : function() {
+ observeStore:function () {
this.store.addListener({
- load : {
- fn : function() {
+ load:{
+ fn:function () {
if (this.store.getTotalCount() > 0) {
this.fireEvent(
this.BoutonExportEventsId.donneesPretesAExporter,
this.params
- );
+ );
} else {
this.fireEvent(
this.BoutonExportEventsId.aucuneDonneesAExporter
- )
+ )
}
},
- scope : this
+ scope:this
}
})
},
* Observe le composant graphique du menu de la consultation
* @param toolBarView
*/
- observerToolBarView : function (toolBarView) {
+ observerToolBarView:function (toolBarView) {
toolBarView.addListener(
eliot.absences.consultation.Constantes.eventId.actionRechercher,
- function() {
+ function () {
eliot.absences.Message.resetMessages();
if (this.verifieLogiqueDeDate(
this.params.dateDebut,
this.params.dateFin
- )) {
+ )) {
this.executeRecherche();
} else {
var message = eliot.absences.consultation.Modele.message.
}
},
this
- );
+ );
+ toolBarView.addListener(
+ eliot.absences.consultation.Constantes.eventId.actionCocheSelectionParDefaut,
+ function (listeMotifIds) {
+ this.params.motif = listeMotifIds;
+ },
+ this
+ )
},
/**
* Permet de mettre à jour la liste de type choisie
* @param typeView
*/
- observeTypeView : function (typeView) {
+ observeTypeView:function (typeView) {
typeView.addListener(
eliot.absences.consultation.Constantes.
eventId.actionValeurChange,
- function(listeTypes) {
+ function (listeTypes) {
if (listeTypes[0] === '-' || !listeTypes) {
this.params.type = this.critereType;
} else {
}
},
this
- );
+ );
},
- observeRegimeView : function (view) {
+ observeRegimeView:function (view) {
view.addListener(
eliot.absences.consultation.Constantes.eventId.actionValeurChange,
- function(listeRegimes) {
+ function (listeRegimes) {
if (listeRegimes[0] === '-' || !listeRegimes) {
this.params.regimeIds = -1;
} else {
}
},
this
- );
+ );
},
/**
* Permet de mettre à jour la liste de division choisie
* @param divisionView
*/
- observeDivisionView : function (divisionView) {
+ observeDivisionView:function (divisionView) {
divisionView.addListener(
eliot.absences.consultation.Constantes.
eventId.actionValeurChange,
- function(listeDivision) {
+ function (listeDivision) {
if (listeDivision[0] === '-' || !listeDivision) {
this.params.division = -1;
} else {
}
},
this
- );
+ );
},
/**
* Permet de mettre à jour la liste de groupe de motif choisie
* @param groupeMotifsView
*/
- observeGroupeMotifsView : function (groupeMotifsView) {
+ observeGroupeMotifsView:function (groupeMotifsView) {
groupeMotifsView.addListener(
eliot.absences.consultation.Constantes.
eventId.actionValeurChange,
- function(listeGroupeMotif) {
+ function (listeGroupeMotif) {
if (listeGroupeMotif[0] === '-' || !listeGroupeMotif) {
this.params.groupeMotifs = -1;
} else {
this.params.motif = -1;
},
this
- );
+ );
},
/**
* Permet de mettre à jour la liste de groupe de motif choisie
* @param eleveView
*/
- observeEleveView : function (eleveView) {
+ observeEleveView:function (eleveView) {
eleveView.addListener(
eliot.absences.consultation.Constantes.eventId.actionValeurChange,
- function(listeEleve) {
+ function (listeEleve) {
if (listeEleve[0] === '-' || !listeEleve) {
this.params.elevesId = -1;
} else {
}
},
this
- );
+ );
},
/**
* Permet de mettre à jour la liste de motif choisie
* @param motifView
*/
- observeMotifView : function (motifView) {
+ observeMotifView:function (motifView) {
motifView.addListener(
- eliot.absences.consultation.Constantes.
- eventId.actionValeurChange,
- function(listeMotif) {
+ eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function (listeMotif) {
+ var newValue = undefined;
if (listeMotif[0] === '-' || !listeMotif) {
- this.params.motif = -1;
+ newValue = -1;
} else {
- this.params.motif = listeMotif;
+ newValue = listeMotif;
}
+
+ this.params.motif = newValue;
+ this.fireEvent(
+ eliot.absences.consultation.Constantes.eventId.actionSelectionMotifsChange,
+ newValue
+ );
},
this
- );
+ );
},
/**
* Permet de mettre la date de début de la période choisie
* @param dateDebut
*/
- observerDateDebut : function (dateDebut) {
+ observerDateDebut:function (dateDebut) {
dateDebut.addListener(
eliot.absences.consultation.Constantes.
eventId.actionDateChange,
- function(newValeur) {
+ function (newValeur) {
this.params.dateDebut = Date.parseDate(newValeur, 'd/m/Y');
},
this
- );
+ );
},
/**
* Permet de mettre la date de fin de la période choisie
* @param dateFin
*/
- observerDateFin : function (dateFin) {
+ observerDateFin:function (dateFin) {
dateFin.addListener(
eliot.absences.consultation.Constantes.
eventId.actionDateChange,
- function(newValeur) {
+ function (newValeur) {
this.params.dateFin = Date.parseDate(newValeur, 'd/m/Y');
},
this
- );
+ );
},
- verifieLogiqueDeDate : function(dateDebut, dateFin) {
+ verifieLogiqueDeDate:function (dateDebut, dateFin) {
return (dateFin >= dateDebut);
},
/**
* Permet d'exécuter la rechreche d'absences
*/
- executeRecherche : function () {
+ executeRecherche:function () {
this.store.setBaseParam('params', Ext.encode(this.params));
var lastOptions = this.store.lastOptions;
if (lastOptions) {
Ext.apply(lastOptions.params, {
- params: Ext.encode(this.params)
+ params:Ext.encode(this.params)
});
this.store.reload(lastOptions);
} else {
Ext.ns('eliot.absences.consultation');
eliot.absences.consultation.LovComboView = Ext.extend(Ext.util.Observable, {
- constructor: function(config) {
+ constructor:function (config) {
this.NameSpace = eliot.absences.consultation;
this.addEvents(
- /**
- * @event déclenché lors de la seléction
- * de nouvelles valeurs dans la liste
- * @param newValue l'ensemble des identifiants des éléments choisis
- */
- this.NameSpace.Constantes.eventId.actionValeurChange,
- /**
- * @event actionMAJIdSelectionne est déclenché pour mettre à jours
- * les éléments sélectionnés dans lovCombo
- * @param nbData nombre d'éléments chargés
- */
- this.NameSpace.Constantes.eventId.actionMAJIdSelectionne
- );
+ /**
+ * @event déclenché lors de la seléction
+ * de nouvelles valeurs dans la liste
+ * @param newValue l'ensemble des identifiants des éléments choisis
+ */
+ this.NameSpace.Constantes.eventId.actionValeurChange,
+ /**
+ * @event actionMAJIdSelectionne est déclenché pour mettre à jours
+ * les éléments sélectionnés dans lovCombo
+ * @param nbData nombre d'éléments chargés
+ */
+ this.NameSpace.Constantes.eventId.actionMAJIdSelectionne
+ );
// Définition de la configuration par défaut
var defaultConfig = {
- width : 280,
- label : '',
- valeurInitiale : '-1',
- disabled : false
+ width:280,
+ label:'',
+ valeurInitiale:'-1',
+ disabled:false
};
Ext.applyIf(config, defaultConfig);
this.lovCombo = new Ext.ux.form.LovCombo({
- id: config.id,
- store: config.store,
- fieldLabel: config.label,
- labelSeparator : ' : ',
+ id:config.id,
+ store:config.store,
+ fieldLabel:config.label,
+ labelSeparator:' : ',
valueField:'id',
displayField:'libelle',
triggerAction:'all',
mode:'local',
- value : config.valeurInitiale,
- width: config.width,
- editable: false,
- disabled : config.disabled
+ value:config.valeurInitiale,
+ width:config.width,
+ editable:false,
+ disabled:config.disabled
});
this.valeur = config.valeurInitiale;
this.observeLovCombo();
},
- observeLovCombo : function () {
+ observeLovCombo:function () {
this.lovCombo.addListener({
- change : {
- fn : function(combo, newValue, oldValue) {
+ change:{
+ fn:function (combo, newValue, oldValue) {
var nouvellesValeur = newValue;
if (!newValue) {
nouvellesValeur = '-1';
combo.selectAll();
}
-
this.fireEvent(
- eliot.absences.consultation.Constantes.
- eventId.actionValeurChange,
- nouvellesValeur
- )
+ eliot.absences.consultation.Constantes.
+ eventId.actionValeurChange,
+ nouvellesValeur
+ )
},
- scope: this
+ scope:this
},
- beforeselect : {
- fn : function(combo, record, index) {
+ beforeselect:{
+ fn:function (combo, record, index) {
if (index !== 0) {
var tous = combo.store.getAt(0);
tous.set(combo.checkField, false);
}
},
- scope : this
+ scope:this
},
- select : {
- fn : function(combo, record, index) {
+ select:{
+ fn:function (combo, record, index) {
if (index == 0) {
if (record.data.checked) {
combo.selectAll();
tous.set(combo.checkField, false);
}
},
- scope : this
+ scope:this
},
- afterrender : {
- fn : function(combo) {
+ afterrender:{
+ fn:function (combo) {
if (combo.store.getCount() != 0 && this.valeur === '-1') {
combo.selectAll();
}
},
- scope : this
+ scope:this
}
});
this.lovCombo.store.addListener({
- load : {
- fn :function() {
+ load:{
+ fn:function () {
+ var idsSelectionParDefaut = this.lovCombo.store.reader.jsonData.selectionParDefautIds;
var record = this.lovCombo.store.getById(-1);
var nbData = this.lovCombo.store.getCount();
if (!record && nbData) {
this.lovCombo.store.insert(
- 0,
- new this.lovCombo.store.recordType(
+ 0,
+ new this.lovCombo.store.recordType(
{
- id: -1,
- libelle : this.NameSpace.Modele.libelle.tous
+ id:-1,
+ libelle:this.NameSpace.Modele.libelle.tous
}
- ));
+ ));
+ }
+
+ if (idsSelectionParDefaut) {
+ this.lovCombo.setValue(idsSelectionParDefaut);
+ } else {
+ this.lovCombo.selectAll();
}
- this.lovCombo.selectAll();
+
this.fireEvent(
- this.NameSpace.Constantes.eventId.actionMAJIdSelectionne,
- nbData
- );
+ this.NameSpace.Constantes.eventId.actionMAJIdSelectionne,
+ nbData
+ );
},
- scope: this
+ scope:this
}
});
},
- observeClasseController : function(classeController) {
+ observeClasseController:function (classeController) {
var Constantes = eliot.absences.commons.ComboEnseignantViewConstantes;
classeController.addListener(
- this.NameSpace.Constantes.eventId.actionConstruirLibelleStructureEns,
- function(idEnseignant) {
- var label;
- if (idEnseignant && idEnseignant !== Constantes.enseignantsTousId) {
- label = this.NameSpace.Modele.libelle.comboClasseGroup;
- }
- else {
- label = this.NameSpace.Modele.libelle.comboClasse;
- }
- this.changeLabelDuComposant(
- this.lovCombo,
- label
- );
- this.lovCombo.clearValue();
- },
- this
- );
+ this.NameSpace.Constantes.eventId.actionConstruirLibelleStructureEns,
+ function (idEnseignant) {
+ var label;
+ if (idEnseignant && idEnseignant !== Constantes.enseignantsTousId) {
+ label = this.NameSpace.Modele.libelle.comboClasseGroup;
+ }
+ else {
+ label = this.NameSpace.Modele.libelle.comboClasse;
+ }
+ this.changeLabelDuComposant(
+ this.lovCombo,
+ label
+ );
+ this.lovCombo.clearValue();
+ },
+ this
+ );
},
/**
* La méthode permet de récupérer label du composant
* @param composant
*/
- getLabelDuComposant : function(composant) {
+ getLabelDuComposant:function (composant) {
var labelComboStructureEnseignement = composant.
- getEl().up('div.x-form-item').query('label[for=' +
- composant.id + ']')[0];
+ getEl().up('div.x-form-item').query('label[for=' +
+ composant.id + ']')[0];
return labelComboStructureEnseignement;
},
* @param composant : composant qui a un label
* @param nouveauLabel : nouveau label à changer
*/
- changeLabelDuComposant : function(composant, nouveauLabel) {
+ changeLabelDuComposant:function (composant, nouveauLabel) {
Ext.get(this.getLabelDuComposant(composant)).update(nouveauLabel + ' :');
}
});
\ No newline at end of file
salle: undefined,
structureEnseignement: undefined,
regimes: undefined,
- nombreElevesAuTotal: undefined
+ nombreElevesAuTotal: undefined,
+ selectionDefaut: undefined
},
url : {
listeStructure : undefined,
nombreLignesParPage : undefined,
isAgendaScolaireExiste : undefined,
- bilanLignesParPage:undefined
+ bilanLignesParPage:undefined,
+ motifIdsDefaut: undefined
},
message : {
* @param config.ajouterTypesRetardDepart flag permet
* d'ajouter les types de retards et départs
*/
- constructor: function(config) {
- var NameSpace = eliot.absences.consultation;
+ constructor:function (config) {
+ this.NameSpace = eliot.absences.consultation;
this.addEvents(
- /**
- * @event activerComboEleve déclenché quand une seule classes est sélectionnée
- */
- NameSpace.Constantes.eventId.activerComboEleve,
- /**
- * @event desActiverComboEleve déclenché quand plusieurs classes sont sélectionnées
- */
- NameSpace.Constantes.eventId.desActiverComboEleve
- );
+ /**
+ * @event activerComboEleve déclenché quand une seule classes est sélectionnée
+ */
+ this.NameSpace.Constantes.eventId.activerComboEleve,
+ /**
+ * @event desActiverComboEleve déclenché quand plusieurs classes sont sélectionnées
+ */
+ this.NameSpace.Constantes.eventId.desActiverComboEleve,
+
+ /**
+ * @event le store des motifs a été rechargé
+ */
+ this.NameSpace.Constantes.eventId.actionReloadMotifs
+ );
// Définition du store de type des absences
// Ce store est construit seulement pour
// la page multicritères et Absences du jour
if (config.construitStoreTypes) {
this.storeType = new Ext.data.SimpleStore({
- fields: [
+ fields:[
{
name:'id',
type:'int'
type:'string'
}
],
- data : this.getListeTypesPourPage(config.ajouterTypesRetardDepart)
+ data:this.getListeTypesPourPage(config.ajouterTypesRetardDepart)
});
}
// Définition du store des classes/groupes
this.storeDivision = new Ext.data.JsonStore({
- autoLoad : true,
- url: NameSpace.Modele.url.getDivisions,
+ autoLoad:true,
+ url:this.NameSpace.Modele.url.getDivisions,
id:'storedivision',
fields:[
{
// Définition du store des groupes de motif
this.storeGrpMotif = new Ext.data.JsonStore({
- autoLoad : true,
- url: NameSpace.Modele.url.getGroupesMotifs,
+ autoLoad:true,
+ url:this.NameSpace.Modele.url.getGroupesMotifs,
fields:[
{
name:'libelle'
// Définition du store des élèves
this.storeEleve = new Ext.data.JsonStore({
- autoLoad : false,
- url: NameSpace.Modele.url.getEleve,
+ autoLoad:false,
+ url:this.NameSpace.Modele.url.getEleve,
fields:[
{
name:'libelle'
// Définition du store des motifs
this.storeMotif = new Ext.data.JsonStore({
- url: NameSpace.Modele.url.getMotifs,
- baseParams : {
- groupeMotifIds : -1
+ url:this.NameSpace.Modele.url.getMotifs,
+ autoLoad:true,
+ baseParams:{
+ groupeMotifIds:-1
},
- autoLoad : true,
- fields: [
+ root:'data',
+ fields:[
{
name:'id',
type:'string'
]
});
- this.creeStoreRegime(NameSpace);
+ this.creeStoreRegime(this.NameSpace);
},
- creeStoreRegime: function(NameSpace) {
+ creeStoreRegime:function (NameSpace) {
this.storeRegime = new Ext.data.JsonStore({
- url: NameSpace.Modele.url.getRegimes,
- autoLoad : true,
- fields: [
+ url:NameSpace.Modele.url.getRegimes,
+ autoLoad:true,
+ fields:[
{name:'id', type:'string'},
{name:'libelle', type:'string'}
]
});
},
- observeGroupeMotifView : function (groupeMotifView) {
+ observeGroupeMotifView:function (groupeMotifView) {
groupeMotifView.addListener(
- eliot.absences.consultation.Constantes.
- eventId.actionValeurChange,
- function(listeIdGrpMotif) {
- this.executeGetMotifs(listeIdGrpMotif);
- },
- this
- );
+ eliot.absences.consultation.Constantes.
+ eventId.actionValeurChange,
+ function (listeIdGrpMotif) {
+ this.executeGetMotifs(listeIdGrpMotif);
+ },
+ this
+ );
},
- observeDivisionView : function (divisionView) {
+ observeDivisionView:function (divisionView) {
divisionView.addListener(
- eliot.absences.consultation.Constantes.
- eventId.actionValeurChange,
- function(divisionsId) {
- if (divisionsId.indexOf(',') === -1) {
- this.executeGetEleve(divisionsId);
- this.fireEvent(
- eliot.absences.consultation.Constantes.
- eventId.activerComboEleve
- );
- } else {
- this.fireEvent(
- eliot.absences.consultation.Constantes.
- eventId.desActiverComboEleve
- );
- }
- },
- this
+ eliot.absences.consultation.Constantes.
+ eventId.actionValeurChange,
+ function (divisionsId) {
+ if (divisionsId.indexOf(',') === -1) {
+ this.executeGetEleve(divisionsId);
+ this.fireEvent(
+ eliot.absences.consultation.Constantes.
+ eventId.activerComboEleve
+ );
+ } else {
+ this.fireEvent(
+ eliot.absences.consultation.Constantes.
+ eventId.desActiverComboEleve
);
+ }
+ },
+ this
+ );
},
- executeGetEleve : function(divisionId) {
+ executeGetEleve:function (divisionId) {
this.storeEleve.baseParams = {
- idStructureEnseignement : divisionId
+ idStructureEnseignement:divisionId
};
this.storeEleve.reload();
},
groupeMotifIds : ids
};
this.storeMotif.reload();
+ this.fireEvent(this.NameSpace.Constantes.eventId.actionReloadMotifs);
},
/**
* Permet de construire les datas du store des types d'absences
* @param ajouterTypesRetardDepart
*/
- getListeTypesPourPage : function (ajouterTypesRetardDepart) {
+ getListeTypesPourPage:function (ajouterTypesRetardDepart) {
var Modele = eliot.absences.consultation.Modele;
var Constantes = eliot.absences.consultation.Constantes;
var data = [
* le champs lovCombo Type
*/
constructor:function (config) {
- var NameSpace = eliot.absences.consultation;
+ this.NameSpace = eliot.absences.consultation;
+ this.Constantes = this.NameSpace.Constantes;
+ this.Modele = this.NameSpace.Modele;
this.addEvents(
/**
* @event déclenché sur la demande utilisateur de recherche d'absences
*/
- NameSpace.Constantes.eventId.actionRechercher
+ this.Constantes.eventId.actionRechercher,
+ /**
+ * @event déclenché qd l'utilisateur coche la case "Sélection par défaut"
+ */
+ this.Constantes.eventId.actionCocheSelectionParDefaut
);
this.height = 30;
}
this.toolBar = new Ext.FormPanel(this.getConfigToolBar(config));
+
+ this.motifView = config.motifView;
+
+ if (config.chkBoxSelectionDefaut) {
+ this.chkBoxSelectionDefaut = config.chkBoxSelectionDefaut;
+ this.observeChkBoxSelectionDefaut();
+ }
+ },
+
+ observeChkBoxSelectionDefaut:function () {
+ this.chkBoxSelectionDefaut.addListener({
+ check:{
+ fn:function (checkbox, checked) {
+ if (checked) {
+ this.motifView.setValue(this.Modele.data.motifIdsDefaut);
+ this.fireEvent(
+ this.Constantes.eventId.actionCocheSelectionParDefaut,
+ this.Modele.data.motifIdsDefaut
+ )
+ }
+ }},
+ scope:this
+ });
},
// Configuration de la toolBar
},
getConfigBoutons:function (config) {
- var NameSpace = eliot.absences.consultation;
-
var boutonExportCsv = {};
if (config.boutonExportCsv) {
config.boutonExportCsv.setWidth(76);
xtype:'button',
width:76,
style:"paddingLeft : 20px",
- id:NameSpace.Constantes.idBtnLister,
- text:NameSpace.Modele.libelle.chercher,
- icon:NameSpace.Modele.url.urlImageRechercher,
+ id:this.Constantes.idBtnLister,
+ text:this.Modele.libelle.chercher,
+ icon:this.Modele.url.urlImageRechercher,
handler:function () {
this.fireEvent(
- NameSpace.Constantes.eventId.actionRechercher
+ this.Constantes.eventId.actionRechercher
);
},
scope:this
* @param config
*/
getConfigPlusDeCriteres:function (config) {
- var NameSpace = eliot.absences.consultation;
-
var itemsPremiereColonne = [];
itemsPremiereColonne.push(config.divisionView);
if (config.ajouteEleve) {
if (config.regimeView != null) {
itemsPremiereColonne.push(config.regimeView);
}
-
return {
xtype:'fieldset',
- title:NameSpace.Modele.libelle.plusDeCriteres,
+ title:this.Modele.libelle.plusDeCriteres,
collapsible:true,
collapsed:true,
bodyStyle:'padding:5x 5px 0;',
listeners:{
collapse:function (cmp) {
// Force le panel central à se redimensionner
- var panel = Ext.getCmp(
- eliot.absences.consultation.Constantes.
- regionId.center
- );
+ var panel = Ext.getCmp(eliot.absences.consultation.Constantes.
+ regionId.center);
panel.doLayout();
},
expand:function (cmp) {
labelWidth:130,
items:[
config.groupeMotifView,
- config.motifView
+ config.motifView,
+ config.chkBoxSelectionDefaut
]
}
]
actionSelectionGrpMotifChange:function (listeIdGrpMotif) {
this.fireEvent(
- eliot.absences.consultation.Constantes.
- eventId.actionSelectionGrpMotifChange,
+ this.Constantes.eventId.actionSelectionGrpMotifChange,
listeIdGrpMotif
)
+ },
+
+ observeConsultationController:function (consultationController) {
+ consultationController.addListener(
+ this.Constantes.eventId.actionSelectionMotifsChange,
+ this.actionSelectionMotifsChange,
+ this
+ )
+ },
+
+ actionSelectionMotifsChange:function (value) {
+ this.chkBoxSelectionDefaut.setValue(
+ value == this.motifView.getStore().reader.jsonData.selectionParDefautIds
+ );
+ },
+
+ observeToolBarController:function (controller) {
+ controller.addListener(
+ this.Constantes.eventId.actionReloadMotifs,
+ function () {
+ this.affecteMotifsParDefaut();
+ },
+ this
+ )
+ },
+
+ affecteMotifsParDefaut:function () {
+ this.chkBoxSelectionDefaut.setValue(true);
+ this.motifView.setValue(
+ this.motifView.getStore().reader.jsonData.selectionParDefautIds
+ );
}
+
});
\ No newline at end of file
label : Modele.libelle.regimes
});
+ var chkBoxSelectionDefaut = new Ext.form.Checkbox({
+ boxLabel:Modele.libelle.selectionDefaut,
+ checked:true
+ });
+
var toolBarView = new eliot.absences.consultation.ToolBarView({
boutonExportCsv : boutonExporterView.bouton,
ajouteDateDeFin : false,
groupeMotifView : groupeMotifsView.lovCombo,
motifView : motifView.lovCombo,
regimeView: regimeView.lovCombo,
- debutPeriode : debutPeriodeView.date
+ debutPeriode : debutPeriodeView.date,
+ chkBoxSelectionDefaut: chkBoxSelectionDefaut
});
autoLoad : true
});
+ toolBarView.observeConsultationController(consultationController);
+
var consultationView = new eliot.absences.consultation.ConsultationView({
store : consultationController.store,
ajouterColDate : false,
Ext.ns('eliot.absences.consultation.demipensioninternat');
-eliot.absences.consultation.demipensioninternat.Application = function() {
+eliot.absences.consultation.demipensioninternat.Application = function () {
var Clazz = Ext.extend(Ext.util.Observable, {
- constructor: function() {
+ constructor:function () {
// supprime le loadMask après un temps maximal
eliot.absences.commons.Utils.supprimeLoadMask(
eliot.absences.commons.Constantes.maskTimeOut
- );
+ );
var NameSpace = eliot.absences.consultation.demipensioninternat;
var Modele = NameSpace.Modele;
var NameSpaceCommon = eliot.absences.consultation;
var boutonExporterView = new eliot.exportdonnees.BoutonExportView({});
var boutonExportController = new eliot.exportdonnees.
BoutonExportController({
- url : eliot.absences.consultation.Modele.url.exporteDonnees
- });
+ url:eliot.absences.consultation.Modele.url.exporteDonnees
+ });
boutonExportController.observeBoutonExportView(boutonExporterView);
boutonExporterView.observeBoutonExportController(boutonExportController);
// Toolbar controller
var toolBarController = new NameSpaceCommon.ToolBarController({
- ajouterTypesRetardDepart : false,
- construitStoreTypes : false
+ ajouterTypesRetardDepart:false,
+ construitStoreTypes:false
});
var dateFinPeriode = new Date();
var dateDebutAnneeScolaire = Date.parseDate(
ModeleCommon.data.anneeScolaire.debutAnneeScolaire,
'd/m/Y'
- );
+ );
var dateFinAnneeScolaire = Date.parseDate(
ModeleCommon.data.anneeScolaire.finAnneeScolaire,
'd/m/Y'
- );
+ );
if (dateFinPeriode < dateDebutAnneeScolaire ||
dateFinPeriode > dateFinAnneeScolaire
// Dates début
var debutPeriodeView = new NameSpaceCommon.DateView({
- date : ModeleCommon.data.anneeScolaire.debutAnneeScolaire,
- id :Constantes.composantId.idPeriodeDebut,
- anneeScolaire : ModeleCommon.data.anneeScolaire,
- label : ModeleCommon.libelle.periodeDebut
+ date:ModeleCommon.data.anneeScolaire.debutAnneeScolaire,
+ id:Constantes.composantId.idPeriodeDebut,
+ anneeScolaire:ModeleCommon.data.anneeScolaire,
+ label:ModeleCommon.libelle.periodeDebut
});
// Dates fin
var finPeriodeView = new NameSpaceCommon.DateView({
- date : dateFinPeriode,
- id :Constantes.composantId.idPeriodeFin,
- anneeScolaire : ModeleCommon.data.anneeScolaire,
- label : ModeleCommon.libelle.periodeFin
+ date:dateFinPeriode,
+ id:Constantes.composantId.idPeriodeFin,
+ anneeScolaire:ModeleCommon.data.anneeScolaire,
+ label:ModeleCommon.libelle.periodeFin
});
// Classes
var divisionView = new NameSpaceCommon.LovComboView({
- id : Constantes.composantId.idChkcomboDivision,
- store : toolBarController.storeDivision,
- label : ModeleCommon.libelle.divisions
+ id:Constantes.composantId.idChkcomboDivision,
+ store:toolBarController.storeDivision,
+ label:ModeleCommon.libelle.divisions
});
// Groupe motifs
var groupeMotifsView = new NameSpaceCommon.LovComboView({
- id : Constantes.composantId.idChkcomboGrpMotif,
- store : toolBarController.storeGrpMotif,
- label : ModeleCommon.libelle.groupeMotifs
+ id:Constantes.composantId.idChkcomboGrpMotif,
+ store:toolBarController.storeGrpMotif,
+ label:ModeleCommon.libelle.groupeMotifs
});
// Motifs
var motifView = new eliot.absences.consultation.LovComboView({
- id : Constantes.composantId.idChkcomboMotif,
- store : toolBarController.storeMotif,
- label : ModeleCommon.libelle.motifs
+ id:Constantes.composantId.idChkcomboMotif,
+ store:toolBarController.storeMotif,
+ label:ModeleCommon.libelle.motifs
+ });
+
+ var chkBoxSelectionDefaut = new Ext.form.Checkbox({
+ boxLabel:ModeleCommon.libelle.selectionDefaut,
+ checked:true
});
// Toolbar
var toolbarView = new NameSpaceCommon.ToolBarView({
- pasPlusDeCriteres : false,
- hasComboEleve : false,
- ajouteDateDeFin : true,
- ajouteTypes : false,
- debutPeriode : debutPeriodeView.date,
- finPeriode : finPeriodeView.date,
- divisionView : divisionView.lovCombo,
- groupeMotifView : groupeMotifsView.lovCombo,
- motifView : motifView.lovCombo,
- boutonExportCsv :boutonExporterView.bouton
+ pasPlusDeCriteres:false,
+ hasComboEleve:false,
+ ajouteDateDeFin:true,
+ ajouteTypes:false,
+ debutPeriode:debutPeriodeView.date,
+ finPeriode:finPeriodeView.date,
+ divisionView:divisionView.lovCombo,
+ groupeMotifView:groupeMotifsView.lovCombo,
+ motifView:motifView.lovCombo,
+ boutonExportCsv:boutonExporterView.bouton,
+ chkBoxSelectionDefaut:chkBoxSelectionDefaut
});
toolBarController.observeGroupeMotifView(groupeMotifsView);
/*************************** Grille *******************************/
var grilleController = new NameSpaceCommon.ConsultationController({
- sortInfoField : Constantes.sortInfoField,
- dateDebutIsNotToday : true,
- dateFin : dateFinPeriode.format('d/m/Y')
+ sortInfoField:Constantes.sortInfoField,
+ dateDebutIsNotToday:true,
+ dateFin:dateFinPeriode.format('d/m/Y')
});
+ toolbarView.observeConsultationController(grilleController);
+
var grilleView = new NameSpaceCommon.ConsultationView({
- store : grilleController.store,
- ajouterColDate : true,
- ajouterColTypes : false,
- ajouterColHeure : false
+ store:grilleController.store,
+ ajouterColDate:true,
+ ajouterColTypes:false,
+ ajouterColHeure:false
});
grilleController.observerToolBarView(toolbarView);
// Structure de la page
var centerRegionItems = [
{
- id: Constantes.regionId.center,
+ id:Constantes.regionId.center,
xtype:'panel',
layout:'border',
- border: false,
- autoScroll: true,
- autoShow : true,
+ border:false,
+ autoScroll:true,
+ autoShow:true,
items:[
{
- region : 'north',
- autoHeight : true,
- border: false,
- frame : false,
- items :[
+ region:'north',
+ autoHeight:true,
+ border:false,
+ frame:false,
+ items:[
toolbarView.toolBar
]
},
{
- region : 'center',
- xtype : 'panel',
- border: false,
- frame : false,
- layout: 'fit',
- items : grilleView.grilleConsultation
+ region:'center',
+ xtype:'panel',
+ border:false,
+ frame:false,
+ layout:'fit',
+ items:grilleView.grilleConsultation
}
]
];
// Rendu du viewport
- Ext.onReady(function() {
+ Ext.onReady(function () {
eliot.layout.doLayout(
Constantes.regionId.viewPort,
Constantes.regionId.northPanel,
Constantes.regionId.centerPanel,
centerRegionItems
- )
+ )
});
// Supprime la progresse barre
label : Modele.libelle.motifs
});
+ var chkBoxSelectionDefaut = new Ext.form.Checkbox({
+ boxLabel:Modele.libelle.selectionDefaut,
+ checked:true
+ });
+
// On ajoute pas le champs date de fin,on consulte les départs d'un jour
// On ajoute pas la liste des types, le type égale toujours à Départ anticipé
var toolBarView = new eliot.absences.consultation.ToolBarView({
divisionView : divisionView.lovCombo,
groupeMotifView : groupeMotifsView.lovCombo,
motifView : motifView.lovCombo,
- debutPeriode : debutPeriodeView.date
+ debutPeriode : debutPeriodeView.date,
+ chkBoxSelectionDefaut: chkBoxSelectionDefaut
});
autoLoad : true
});
+ toolBarView.observeConsultationController(consultationController);
+
// On ajoute pas la colonne de Date ni la colonne de type d'absence
var consultationView = new eliot.absences.consultation.
ConsultationView({
label : Modele.libelle.motifs
});
+ var chkBoxSelectionDefaut = new Ext.form.Checkbox({
+ boxLabel:Modele.libelle.selectionDefaut,
+ checked:true
+ });
+
+
var toolBarView = new eliot.absences.consultation.ToolBarView({
boutonExportCsv : boutonExporterView.bouton,
ajouteDateDeFin : true,
eleveView : eleveView.lovCombo,
motifView : motifView.lovCombo,
debutPeriode : debutPeriodeView.date,
- finPeriode : finPeriodeView.date
+ finPeriode : finPeriodeView.date,
+ chkBoxSelectionDefaut: chkBoxSelectionDefaut
});
this.observeToolBarController(toolBarController, eleveView);
dateFin :dateFinPeriode.format('d/m/Y')
});
+ toolBarView.observeConsultationController(consultationController);
+ toolBarView.observeToolBarController(toolBarController);
+
var consultationView = new eliot.absences.consultation.ConsultationView({
store : consultationController.store,
ajouterColDate : true,
label : Modele.libelle.motifs
});
+ var chkBoxSelectionDefaut = new Ext.form.Checkbox({
+ boxLabel:Modele.libelle.selectionDefaut,
+ checked:true
+ });
+
// On ajoute pas le champs date de fin,on consulte les retards d'un jour
// On ajoute pas la liste des types, le type égale toujours à Retard
var toolBarView = new eliot.absences.consultation.ToolBarView({
groupeMotifView : groupeMotifsView.lovCombo,
motifView : motifView.lovCombo,
debutPeriode : debutPeriodeView.date,
- boutonExportCsv : boutonExporterView.bouton
+ boutonExportCsv : boutonExporterView.bouton,
+ chkBoxSelectionDefaut: chkBoxSelectionDefaut
});
toolBarController.observeGroupeMotifView(groupeMotifsView);
autoLoad : true
});
+ toolBarView.observeConsultationController(consultationController);
+
// On ajoute pas la colonne de Date ni la colonne de type d'absence
var consultationView = new eliot.absences.consultation.
ConsultationView({
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ * @author jtra, onic
+ */
+
+Ext.ns('eliot.absences.parametrage.motif');
+
+eliot.absences.parametrage.motif.Application = function() {
+
+ var Clazz = Ext.extend(Ext.util.Observable, {
+
+ constructor: function() {
+ this.init(eliot.absences.parametrage.motif);
+ this.creeItems();
+ this.onReady();
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ },
+
+ onReady: function() {
+ var centerRegionItems = this.creeCenterRegionItems();
+ Ext.onReady(function() {
+ eliot.layout.doLayout('idViewport', 'idNorthPanel', 'idCenterPanel', centerRegionItems);
+ eliot.absences.commons.Utils.supprimeLoadMask(250);
+ });
+ },
+
+ creeItems: function() {
+ eliot.absences.commons.Utils.supprimeLoadMask(eliot.absences.commons.Constantes.maskTimeOut);
+
+ var model = this.creeModel();
+ var controller = this.creeController(model);
+ this.toolbarView = this.creeToolbar(controller, model);
+ this.view = this.creeView(controller, model);
+
+ controller.observeViews({
+ view: this.view,
+ toolbarView: this.toolbarView
+ });
+
+ },
+
+ creeModel: function() {
+ return new this.ns.ParametrageMotifModel();
+ },
+
+ creeController: function(model) {
+ return new this.ns.ParametrageMotifController({
+ model: model
+ }).getInterface();
+ },
+
+ creeToolbar: function(controller, model) {
+ return new this.ns.ToolbarView({
+ controller: controller,
+ model: model
+ }).getInterface();
+ },
+
+ creeView: function(controller, model) {
+ return new this.ns.ParametrageMotifView({
+ controller: controller,
+ model: model
+ }).getInterface();
+ },
+
+ creeCenterRegionItems: function() {
+ return [
+ {
+ id: this.Constantes.regionId.center,
+ xtype:'panel',
+ layout:'border',
+ border: false,
+ autoScroll: true,
+ autoShow: true,
+ items:[
+ {
+ region: 'north',
+ height: 33,
+ border: false,
+ frame: false,
+ items: this.toolbarView.getItems()
+ },
+ {
+ region: 'center',
+ xtype: 'panel',
+ border: false,
+ frame: false,
+ layout: 'fit',
+// autoScroll: true,
+ items: this.view.getItems()
+ }
+ ]
+ }
+ ];
+
+ }
+ });
+
+ return new Clazz('eliot-absences-parametrage-motif-app');
+}();
\ No newline at end of file
* Configuration de l'arbre des motifs et groupes de motifs
* @author jcas
*/
-Ext.ns('eliot.absences.parametrage.motifs');
+Ext.ns('eliot.absences.parametrage.motif');
-eliot.absences.parametrage.motifs.ArbreMotifs = Ext.extend(Ext.util.Observable, {
+eliot.absences.parametrage.motif.ArbreMotifs = Ext.extend(Ext.util.Observable, {
constructor: function(config) {
this.treePanel = new Ext.tree.TreePanel({ //Ext.ux.tree.ColumnTree({
if (obj.codeCouleur) {
var id = '';
if (obj.codeCouleur == eliot.absences.parametrage.
- motifs.Constantes.couleurSansMotif
+ motif.Constantes.couleurSansMotif
) {
id = 'id="sansMotif"';
}
}
],
loader: new Ext.tree.TreeLoader({
- dataUrl: eliot.absences.parametrage.motifs.Modele.urlMotifsLister,
+ dataUrl: eliot.absences.parametrage.motif.ConfigServeur.urlMotifsLister,
baseParams: {
listerTousMotifs: config.listerTousMotifs
},
}
})
-
});
var sort = '';
if (node.isLeaf()) {
sort += '0';
+ sort += node.attributes.nom;
}
else {
sort += '1';
+ var ordre = node.attributes.ordre;
+ if (ordre < 10) { // on presume que l'ordre ne va pas depasser 99
+ ordre = '0'+ordre;
+ }
+ sort += ordre;
}
- sort += node.attributes.nom;
-
return sort;
}
});
* Evénement déclenché à la sélection d'un motif dans l'arbre des
* motifs
*/
- eliot.absences.parametrage.motifs.Constantes.eventId.motifSelectionne
+ eliot.absences.parametrage.motif.Constantes.eventId.motifSelectionne
);
this.observeTree(config);
clickAction:function(node) {
eliot.absences.Message.resetMessages();
this.fireEvent(
- eliot.absences.parametrage.motifs.Constantes.eventId.motifSelectionne,
+ eliot.absences.parametrage.motif.Constantes.eventId.motifSelectionne,
node
);
},
this.treePanel.resumeEvents();
// Note (jtra) : Patch pour désactiver les menus (il faudrait le gérer proprement par des événements)
- eliot.absences.parametrage.motifs.Application.toolbarMotifs.activerToolbar(false);
+ eliot.absences.parametrage.motif.Application.toolbarMotifs.activerToolbar(false);
},
ajouterMotif: function(nodeParent, nodeId, nom, codeCouleur) {
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+/**
+ * @author jtra
+ */
+
+Ext.ns('eliot.absences.parametrage.motif');
+
+eliot.absences.parametrage.motif.ConfigServeur = {
+ url:{
+ urlImageAdd16:undefined,
+ urlImageEdit:undefined,
+ urlImageSupprimer:undefined,
+ urlImageFlecheHaut:undefined,
+ urlImageFlecheBas:undefined,
+
+ urlMotifsLister:undefined,
+ urlCreerMotif:undefined,
+ urlCreerGrpMotif:undefined,
+ urlModifierMotif:undefined,
+ urlModifierGrpMotif:undefined,
+ urlSupprimerMotif:undefined,
+ urlSupprimerGrpMotif:undefined,
+ urlModifierDispoMotif: undefined,
+ urlMonterGrpMotif: undefined,
+ urlDescendreGrpMotif: undefined
+ },
+
+ libelle:{
+ motifDialogSuppressionTitre:undefined,
+ motifDialogSuppressionTexte:undefined,
+ groupeMotifDialogSuppressionTitre:undefined,
+ groupeMotifDialogSuppressionTexte: undefined,
+
+ titreCreerGrpMotif:undefined,
+ titreModifierGrpMotif:undefined,
+ titreLibelleGrpMotif:undefined,
+ titreModifierMotif:undefined,
+
+ titreCreerMotif:undefined,
+ titreLibelleCouleur:undefined,
+
+ btnOk:undefined,
+ btnCancel:undefined,
+ btnYes:undefined,
+ btnNo:undefined,
+
+ creer:undefined,
+ modifier:undefined,
+ supprimer:undefined,
+
+ monter: undefined,
+ descendre: undefined,
+
+ creerGroupMotif:undefined,
+ creerMotif:undefined,
+
+ ordre: undefined,
+ motif: undefined,
+ bulletin: undefined,
+ stat: undefined,
+ selection: undefined,
+ },
+
+ message:{
+ motifCreerSucces:undefined,
+ motifCreerEchec:undefined,
+ motifEchecCreerLibelleVide:undefined,
+ motifModifierSucces:undefined,
+ motifModifierEchec:undefined,
+ motifSupprimerSucces:undefined,
+ motifSupprimerEchec:undefined,
+ groupeMotifsCreerSucces:undefined,
+ groupeMotifsCreerEchec:undefined,
+ groupeMotifsModifierSucces:undefined,
+ groupeMotifsModifierEchec:undefined,
+ groupeMotifsSupprimerSucces:undefined,
+ groupeMotifsSupprimerEchec:undefined,
+ groupeMotifEchecCreerLibelleVide:undefined,
+ motifDispoModifierSucces:undefined,
+ motifDispoModifierEchec:undefined,
+ grpMotifMonterSucces: undefined,
+ grpMotifMonterEchec: undefined,
+ grpMotifDescendreSucces: undefined,
+ grpMotifDescendreEchec: undefined
+ },
+
+ data:{
+ arbreMotif:undefined
+ }
+
+};
* @author jtra
*/
-Ext.ns('eliot.absences.parametrage.motifs');
+Ext.ns('eliot.absences.parametrage.motif');
-eliot.absences.parametrage.motifs.Constantes = {
+eliot.absences.parametrage.motif.Constantes = {
eventId: {
- motifSelectionne: 'motifSelectionne'
+ motifSelectionne: 'motifSelectionne',
+ change: 'change'
},
composantId:{
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+Ext.ns('eliot.absences.parametrage.motif');
+
+eliot.absences.parametrage.motif.ParametrageMotifController = Ext.extend(Ext.util.Observable, {
+
+ constructor:function (config) {
+ this.init(eliot.absences.parametrage.motif, config);
+ },
+
+ init:function (ns, config) {
+ this.ns = ns;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.config = Ext.apply(this.creeConfig(), config);
+ },
+
+ creeConfig:function () {
+ this.config = {
+ model: undefined
+ };
+ return this.config;
+ },
+
+ getInterface:function () {
+ return {
+ observeViews: this.observeViews.createDelegate(this),
+ creeMotif: this.creeMotif.createDelegate(this),
+ creeGroupe: this.creeGroupe.createDelegate(this),
+ modifie: this.modifie.createDelegate(this),
+ supprime: this.supprime.createDelegate(this),
+ monte: this.monte.createDelegate(this),
+ descend: this.descend.createDelegate(this),
+ modifieDispoMotif: this.modifieDispoMotif.createDelegate(this),
+ isGroupe: this.isGroupe.createDelegate(this),
+ isMotif: this.isMotif.createDelegate(this)
+ }
+ },
+
+ observeViews: function(views) {
+ this.view = views.view;
+ this.toolbarView = views.toolbarView;
+ },
+
+ isGroupe: function(node) {
+ if (node == null) {
+ return false;
+ }
+ if (node.leaf == true) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ },
+
+ isMotif: function(node) {
+ if (node == null) {
+ return false;
+ }
+ if (node.leaf == true) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ },
+
+ creeMotif: function() {
+ eliot.absences.Message.resetMessages();
+
+ var node = this.config.model.getValue();
+
+ this.view.openPopup({
+ title: this.ConfigServeur.libelle.titreCreerMotif,
+ libelleTitle: this.ConfigServeur.libelle.titreLibelleGrpMotif,
+ libelle: '',
+ couleurSel: '#FFFFFF',
+ displayColors: true,
+ scope: this,
+
+ onClose: function() {
+
+ },
+
+ onSuccess: function(libelle, couleur) {
+
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlCreerMotif,
+ params:{
+ idGroupe: node.attributes.id,
+ libelle: libelle,
+ couleur: couleur
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.motifCreerSucces);
+ }
+
+ this.view.creeNode(node, reponse.id, libelle, couleur);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.motifCreerEchec);
+ }
+ },
+
+ scope:this
+ });
+
+ }
+ });
+ },
+
+ creeGroupe: function() {
+ eliot.absences.Message.resetMessages();
+
+ var node = this.config.model.getValue();
+
+ this.view.openPopup({
+ title: this.ConfigServeur.libelle.titreCreerGrpMotif,
+ libelleTitle: this.ConfigServeur.libelle.titreLibelleGrpMotif,
+ libelle: '',
+ displayColors: false,
+ scope: this,
+
+ onClose: function() {
+
+ },
+
+ onSuccess: function(libelle) {
+
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlCreerGrpMotif,
+ params:{
+ libelle: libelle
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.groupeMotifsCreerSucces);
+ }
+
+ this.view.creeNode(null, reponse.id, libelle, null, reponse.ordre);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.groupeMotifsCreerEchec);
+ }
+ },
+
+ scope:this
+ });
+
+ }
+ });
+
+ },
+
+ modifie: function() {
+ eliot.absences.Message.resetMessages();
+
+ var node = this.config.model.getValue();
+
+ if (this.isMotif(node)) {
+ this.modifieMotif(node);
+ }
+ else if (this.isGroupe(node)) {
+ this.modifieGroupe(node);
+ }
+
+ },
+
+ modifieMotif: function(node) {
+
+ this.view.openPopup({
+ title: this.ConfigServeur.libelle.titreModifierMotif,
+ libelleTitle: this.ConfigServeur.libelle.titreLibelleGrpMotif,
+ libelle: Encoder.htmlDecode(node.attributes.nom),
+ couleurSel: node.attributes.couleur,
+ displayColors: true,
+ scope: this,
+
+ onClose: function() {
+
+ },
+
+ onSuccess: function(libelle, couleur) {
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlModifierMotif,
+ params:{
+ idMotif: node.attributes.id,
+ idGroupe: node.parentNode.id,
+ libelle: libelle,
+ couleur: couleur
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.motifModifierSucces);
+ }
+
+ this.view.modifieNode(node, libelle, couleur);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.motifModifierEchec);
+ }
+ },
+
+ scope:this
+ });
+
+ }
+ });
+ },
+
+ modifieGroupe: function(node) {
+
+ this.view.openPopup({
+ title: this.ConfigServeur.libelle.titreModifierGrpMotif,
+ libelleTitle: this.ConfigServeur.libelle.titreLibelleGrpMotif,
+ libelle: Encoder.htmlDecode(node.text),
+ displayColors: false,
+ scope: this,
+
+ onClose: function() {
+
+ },
+
+ onSuccess: function(libelle) {
+
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlModifierGrpMotif,
+ params:{
+ idGrpMotif: node.attributes.id,
+ ordre: node.attributes.ordre,
+ libelle: libelle
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.groupeMotifsModifierSucces);
+ }
+
+ this.view.modifieNode(node, libelle, null);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.groupeMotifsModifierEchec);
+ }
+ },
+
+ scope:this
+ });
+
+ }
+ });
+
+
+ },
+
+ supprime: function() {
+ eliot.absences.Message.resetMessages();
+
+ var node = this.config.model.getValue();
+ var nom = '"' + node.attributes['nom'] + '"';
+
+ if (this.isMotif(node)) {
+ var messageConfirmation = this.ConfigServeur.libelle.motifDialogSuppressionTexte + " " + nom + ' ?';
+ eliot.absences.Message.afficherDialogConfirmation(
+ eliot.absences.parametrage.motif.ConfigServeur.libelle.motifDialogSuppressionTitre,
+ messageConfirmation,
+ this.supprimeMotif.createDelegate(this),
+ null,
+ node
+ );
+ }
+
+ else if (this.isGroupe(node)) {
+ var messageConfirmation = this.ConfigServeur.libelle.groupeMotifDialogSuppressionTexte + " " + nom + ' ?';
+ eliot.absences.Message.afficherDialogConfirmation(
+ eliot.absences.parametrage.motif.ConfigServeur.libelle.groupeMotifDialogSuppressionTitre,
+ messageConfirmation,
+ this.supprimeGroupe.createDelegate(this),
+ null,
+ node
+ )
+ }
+ },
+
+ supprimeMotif: function(node) {
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlSupprimerMotif,
+ params:{
+ idMotif: node.attributes.id
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.motifSupprimerSucces);
+ }
+
+ node.remove(true);
+ this.config.model.setValue(null);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.motifSupprimerEchec);
+ }
+ },
+
+ scope:this
+ });
+ },
+
+ supprimeGroupe: function(node) {
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlSupprimerGrpMotif,
+ params:{
+ idGrpMotif: node.attributes.id
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.groupeMotifsSupprimerSucces);
+ }
+
+ node.remove(true);
+ this.config.model.setValue(null);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.groupeMotifsSupprimerEchec);
+ }
+ },
+
+ scope:this
+ });
+ },
+
+ monte: function() {
+ eliot.absences.Message.resetMessages();
+
+ var node = this.config.model.getValue();
+
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlMonterGrpMotif,
+ params:{
+ id: node.attributes.id
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.grpMotifMonterSucces);
+ }
+ this.view.monte(node, reponse.groupe1.ordre, reponse.groupe2.ordre);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.grpMotifMonterEchec);
+ }
+ },
+
+ scope:this
+ });
+
+ },
+
+ descend: function() {
+ eliot.absences.Message.resetMessages();
+
+ var node = this.config.model.getValue();
+
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlDescendreGrpMotif,
+ params:{
+ id: node.attributes.id
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.grpMotifDescendreSucces);
+ }
+
+ this.view.descend(node, reponse.groupe1.ordre, reponse.groupe2.ordre);
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.grpMotifDescendreEchec);
+ }
+ },
+
+ scope:this
+ });
+ },
+
+ modifieDispoMotif: function(changes) {
+ eliot.absences.Message.resetMessages();
+
+ if ((changes != null) && (changes.length > 0)) {
+
+ var motifs = [];
+
+ for (var i = 0; i < changes.length; i++) {
+ motifs.push(changes[i].attributes);
+ }
+
+ eliot.helper.AjaxHelper.request({
+ url:this.ConfigServeur.url.urlModifierDispoMotif,
+ params:{
+ motifs:Ext.encode(motifs)
+ },
+
+ success:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showConfirmation(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showConfirmation(this.ConfigServeur.message.motifDispoModifierSucces);
+ }
+ },
+
+ failure:function (reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.absences.Message.showErreur(reponse.message);
+ }
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.motifDispoModifierEchec);
+ }
+ this.view.annuleDispoMotif(changes);
+ },
+
+ scope:this
+ });
+ }
+ }
+
+});
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ * @author onic
+ */
+Ext.ns('eliot.absences.parametrage.motif');
+
+eliot.absences.parametrage.motif.ParametrageMotifModel = Ext.extend(Ext.util.Observable, {
+
+ constructor: function() {
+
+ this.ns = eliot.absences.parametrage.motif;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.Constantes = this.ns.Constantes;
+
+ this.value = undefined;
+
+ this.addEvents(this.Constantes.eventId.change);
+ },
+
+ setValue: function(value) {
+ this.value = value;
+ this.fireEvent(this.Constantes.eventId.change, value);
+ },
+
+ getValue: function() {
+ return this.value;
+ }
+
+});
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ * @author: onic
+ */
+
+Ext.ns('eliot.absences.parametrage.motif');
+
+eliot.absences.parametrage.motif.ParametrageMotifView = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.absences.parametrage.motif, config);
+ this.createParametrageMotifGrid();
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.config = Ext.apply(this.creeConfig(), config);
+ },
+
+ creeConfig:function () {
+ this.config = {
+ controller: undefined,
+ model: undefined
+ };
+ return this.config;
+ },
+
+ getInterface:function () {
+ return {
+ getItems: this.getItems.createDelegate(this),
+ annuleDispoMotif: this.annuleDispoMotif.createDelegate(this),
+ monte: this.monte.createDelegate(this),
+ descend: this.descend.createDelegate(this),
+ openPopup: this.openPopup.createDelegate(this),
+ creeNode: this.creeNode.createDelegate(this),
+ modifieNode: this.modifieNode.createDelegate(this)
+ }
+ },
+
+ getItems: function() {
+ return [
+ this.parametrageMotifGrid
+ ];
+ },
+
+ createParametrageMotifGrid: function() {
+ this.gridPlugins = [];
+
+ this.parametrageMotifGrid = new Ext.ux.tree.ColumnTree({
+ autoScroll: true,
+ autoWidth:false,
+ rootVisible: false,
+ border: false,
+ useArrows: true,
+ animate: true,
+ colonneRedim: 0,
+ root: this.createRootNode(),
+ columns: this.creeColumns(),
+ plugins:this.gridPlugins,
+ loader: new Ext.tree.TreeLoader({
+ uiProviders:{
+ col: Ext.ux.tree.ColumnNodeUI
+ }
+ }),
+ listeners: {
+ afterrender: function() {
+ this.parametrageMotifGrid.expandAll();
+ this.checkColumnsAfterRender();
+ },
+ click: function(node) {
+ this.config.model.setValue(node);
+ },
+ scope: this
+ }
+ });
+
+ this.createTreeSorter();
+ },
+
+ createTreeSorter: function() {
+ return new Ext.tree.TreeSorter(this.parametrageMotifGrid, {
+ folderSort: false,
+ dir: "asc",
+ sortType: this.sortNode.createDelegate(this)
+ });
+ },
+
+ sortNode: function(node) {
+ if (this.config.controller.isMotif(node)) {
+ return node.attributes.nom;
+ }
+ else if (this.config.controller.isGroupe(node)) {
+ return node.attributes.ordre;
+ }
+ },
+
+ createRootNode: function() {
+ this.rootNode = new Ext.tree.AsyncTreeNode({
+ draggable:false,
+ text: 'activites',
+ id:'aroot',
+ children: this.ConfigServeur.data.arbreMotif
+ });
+ return this.rootNode;
+ },
+
+ creeColumns: function() {
+
+ this.checkColumns = [];
+
+ var columns = [
+ {
+ header: this.ConfigServeur.libelle.motif,
+ dataIndex: 'nom',
+ width:200,
+ renderer: function(nom, node, obj) {
+ nom = Encoder.htmlEncode(nom);
+ var retour = nom;
+ if (obj.couleur) {
+ var id = '';
+ if (obj.couleur == eliot.absences.parametrage.motif.Constantes.couleurSansMotif) {
+ id = 'id="sansMotif"';
+ }
+ retour = "<span class='motif' " + id + "' style='font-size:9px;background-color:" +
+ obj.couleur + "'> </span>" + nom
+
+ }
+ return retour;
+ }
+ },
+ this.createCheckColumn({
+ header: this.ConfigServeur.libelle.bulletin,
+ dataIndex: 'dispoBulletin',
+ width: 150,
+ align: 'center'
+ }),
+ this.createCheckColumn({
+ header: this.ConfigServeur.libelle.stat,
+ dataIndex: 'dispoStats',
+ width: 150,
+ align: 'center'
+ })
+ ];
+
+ return columns;
+ },
+
+ createCheckColumn: function(config) {
+
+ var checkColumn = {
+ config: config
+ };
+
+ this.checkColumns.push(checkColumn);
+
+ var id = this.getCheckColumnHeaderId(checkColumn);
+ config.header = config.header + ' <input type="checkbox" id="' + id + '" name="' + id
+ + '" style="vertical-align: bottom; margin-right: 4px; margin-left: 8px;"/>';
+
+ config.renderer = function(value, node) {
+ return '<input type="checkbox" id="checkbox-' + config.dataIndex + '-' + node.id
+ + '" style="vertical-align: bottom; margin-right: 4px; margin-left: 8px;"'
+ + (value == true ? 'checked="true"' : '') + '/>';
+ };
+
+ return config;
+ },
+
+ getCheckColumnHeaderId: function(checkColumn) {
+ return 'checkboxHeader-' + checkColumn.config.dataIndex;
+ },
+
+ getCheckColumnId: function(checkColumn, node) {
+ return 'checkbox-' + checkColumn.config.dataIndex + '-' + node.id;
+ },
+
+ checkColumnsAfterRender: function() {
+
+ for (var i = 0; i < this.rootNode.childNodes.length; i++) {
+ var typeNode = this.rootNode.childNodes[i];
+
+ for (var j = 0; j < typeNode.childNodes.length; j++) {
+ var motifNode = typeNode.childNodes[j];
+
+ for (var k = 0; k < this.checkColumns.length; k++) {
+ var checkColumn = this.checkColumns[k];
+
+ var element = document.getElementById(this.getCheckColumnId(checkColumn, motifNode));
+
+ element.node = motifNode;
+ element.checkColumn = checkColumn;
+
+ element.onclick = this.checkColumnOnClick.createDelegate(this);
+ }
+ }
+ }
+
+ for (var i = 0; i < this.checkColumns.length; i++) {
+ var checkColumn = this.checkColumns[i];
+ checkColumn.element = document.getElementById(this.getCheckColumnHeaderId(checkColumn));
+ checkColumn.element.onclick = this.checkColumnHeaderOnClick.createDelegate(this);
+ this.updateHeaderCheckbox(checkColumn);
+ }
+ },
+
+ checkColumnHeaderOnClick: function(event) {
+ var element = (event.target || event.srcElement);
+
+ for (var i = 0; i < this.checkColumns.length; i++) {
+ var checkColumn = this.checkColumns[i];
+
+ if (checkColumn.element.id == element.id) {
+ checkColumn.checked = element.checked;
+ this.checkColumnCheckAll(checkColumn);
+ }
+ }
+ event.stopPropagation();
+ },
+
+ checkColumnOnClick: function(event) {
+ var element = (event.target || event.srcElement);
+ var checkColumn = element.checkColumn;
+ var node = element.node;
+
+ if (node.attributes[checkColumn.config.dataIndex] != element.checked) {
+ node.attributes[checkColumn.config.dataIndex] = element.checked;
+
+ var change = this.getCheckColumnChange(element);
+ this.config.controller.modifieDispoMotif([change]);
+
+ this.updateHeaderCheckbox(checkColumn);
+ }
+ event.stopPropagation();
+ },
+
+ getCheckColumnChange: function(element) {
+ var change = {
+ attributes: {
+ id: element.node.attributes.id
+ },
+ element: element
+ };
+
+ change.attributes[element.checkColumn.config.dataIndex] = element.node.attributes[element.checkColumn.config.dataIndex];
+
+ return change;
+ },
+
+ checkColumnCheckAll: function(checkColumn) {
+
+ var changes = [];
+
+ for (var i = 0; i < this.rootNode.childNodes.length; i++) {
+ var typeNode = this.rootNode.childNodes[i];
+
+ for (var j = 0; j < typeNode.childNodes.length; j++) {
+ var motifNode = typeNode.childNodes[j];
+ var element = document.getElementById(this.getCheckColumnId(checkColumn, motifNode));
+
+ if (motifNode.attributes[checkColumn.config.dataIndex] != checkColumn.checked) {
+
+ motifNode.attributes[checkColumn.config.dataIndex] = checkColumn.checked;
+ element.checked = checkColumn.checked;
+
+ changes.push(this.getCheckColumnChange(element));
+ }
+ }
+ }
+
+ if (changes.length > 0) {
+ this.config.controller.modifieDispoMotif(changes);
+ }
+ },
+
+ updateHeaderCheckbox: function () {
+
+ for (var i = 0; i < this.checkColumns.length; i++) {
+ var checkColumn = this.checkColumns[i];
+ checkColumn.checked = true;
+ }
+
+ for (var i = 0; i < this.rootNode.childNodes.length; i++) {
+ var typeNode = this.rootNode.childNodes[i];
+
+ for (var j = 0; j < typeNode.childNodes.length; j++) {
+ var motifNode = typeNode.childNodes[j];
+
+ for (var k = 0; k < this.checkColumns.length; k++) {
+ var checkColumn = this.checkColumns[k];
+
+ var element = document.getElementById(this.getCheckColumnId(checkColumn, motifNode));
+
+ if (!element.checked) {
+ checkColumn.checked = false;
+ }
+ }
+ }
+ }
+
+ for (var i = 0; i < this.checkColumns.length; i++) {
+ var checkColumn = this.checkColumns[i];
+ checkColumn.element.checked = checkColumn.checked;
+ }
+
+ },
+
+ updateHeaderCheckbox: function (checkColumn) {
+ checkColumn.checked = true;
+
+ for (var i = 0; i < this.rootNode.childNodes.length; i++) {
+ var typeNode = this.rootNode.childNodes[i];
+
+ for (var j = 0; j < typeNode.childNodes.length; j++) {
+ var motifNode = typeNode.childNodes[j];
+ var element = document.getElementById(this.getCheckColumnId(checkColumn, motifNode));
+
+ if (!element.checked) {
+ checkColumn.checked = false;
+ }
+ }
+ }
+
+ checkColumn.element.checked = checkColumn.checked;
+
+ },
+
+ annuleDispoMotif: function(changes) {
+ var checkColumns = [];
+ for (var i = 0; i < changes.length; i++) {
+ var change = changes[i];
+
+ var checked = !change.element.node.attributes[change.element.checkColumn.config.dataIndex];
+
+ change.element.checked = checked;
+ change.element.node.attributes[change.element.checkColumn.config.dataIndex] = checked;
+
+ var newCheckColumn = true;
+ for (var j = 0; j < checkColumns.length; j++) {
+ if (checkColumns[j] == change.element.checkColumn) {
+ newCheckColumn = false;
+ break;
+ }
+ }
+
+ if (newCheckColumn) {
+ checkColumns.push(change.element.checkColumn);
+ }
+
+ }
+ for (var i = 0; i < checkColumns.length; i++) {
+ this.updateHeaderCheckbox(checkColumns[i] );
+ }
+ },
+
+ monte: function(node, ordre1, ordre2) {
+ node.previousSibling.attributes.ordre = ordre1;
+ node.attributes.ordre = ordre2;
+ node.setText(node.text);
+ this.config.model.setValue.defer(1, this.config.model, [node]);
+ },
+
+ descend: function(node, ordre1, ordre2) {
+ node.nextSibling.attributes.ordre = ordre1;
+ node.attributes.ordre = ordre2;
+ node.setText(node.text);
+ this.config.model.setValue.defer(1, this.config.model, [node]);
+ },
+
+ openPopup: function(config) {
+
+ var couleurSel = config.couleurSel;
+
+ Ext.override(Ext.Window, {
+ toFront : function(e) {
+ if (this.manager.bringToFront(this)) {
+ if (e && !e.getTarget().focus) {
+ this.focus();
+ }
+ }
+ return this;
+ }
+ });
+
+ var items = [
+ {
+ xtype: 'textfield',
+ fieldLabel: config.libelleTitle,
+ id: this.Constantes.composantId.idLibelleMotif,
+ value: config.libelle,
+ width:280,
+ allowBlank : false
+ }
+ ];
+
+ if (config.displayColors) {
+ items.push({
+ fieldLabel : this.ConfigServeur.libelle.titreLibelleCouleur,
+ bodyStyle :'background-color:transparent',
+ border : false
+ });
+
+ items.push({
+ xtype : 'panel',
+ bodyStyle :'background-color:transparent',
+ style:{ marginLeft : '90px', marginTop:'-10px'},
+ border : false,
+ items : {
+ xtype:'colorpalette',
+ id: this.Constantes.composantId.idColorPalMotif,
+ colors: this.getCouleursParDefaut(),
+ value: config.couleurSel,
+ width : 350
+ }
+ });
+ }
+
+ var MsgBox = new Ext.Window({
+ modal: true,
+ layout: 'form',
+ id: this.Constantes.composantId.idMsgBox,
+ labelAlign: 'left',
+ labelWidth: 80,
+ bodyStyle: 'padding:10px 5px 5px',
+ closeAction:'close',
+ defaults: {
+ labelSeparator : ' : '
+ },
+ width:420,
+ autoHeight: true,
+ resizable: false,
+ title: config.title,
+ items: items,
+ buttons: [
+ {
+ text : this.ConfigServeur.libelle.btnOk,
+ handler: function() {
+ MsgBox.fireEvent('submit');
+ }
+ },
+ {
+ text: this.ConfigServeur.libelle.btnCancel,
+ handler: function() {
+ MsgBox.close();
+ }
+ }
+ ],
+ keys: [
+ {
+ key: [Ext.EventObject.ENTER],
+ handler: function() {
+ MsgBox.fireEvent('submit');
+ }
+ }
+ ]
+ ,
+ listeners: {
+ scope: this,
+
+ show: function() {
+ var field = Ext.getCmp(this.Constantes.composantId.idLibelleMotif);
+ field.focus.defer(50, field);
+ },
+
+ close: function(panel) {
+ if (config.onClose != null) {
+ var close = config.onClose.createDelegate(config.scope);
+ close();
+ }
+ },
+ submit: function() {
+ var libelle = Ext.getCmp(this.Constantes.composantId.idLibelleMotif).getValue();
+ libelle = libelle.trim();
+
+ if (libelle != '') {
+ if (config.onSuccess != null) {
+ var success = config.onSuccess.createDelegate(config.scope);
+
+ if (config.displayColors) {
+ success(libelle, couleurSel);
+ }
+ else {
+ success(libelle);
+ }
+ }
+ }
+
+ else {
+ eliot.absences.Message.showErreur(this.ConfigServeur.message.motifEchecCreerLibelleVide);
+ }
+
+ MsgBox.close();
+ }
+ }
+
+ });
+
+ if (config.displayColors) {
+ Ext.getCmp(this.Constantes.composantId.idColorPalMotif).addListener({
+ select: {
+ fn: function(colorPalette, color) {
+ couleurSel = '#' + color;
+ },
+ scope: this
+ }
+ });
+ }
+
+ MsgBox.show();
+ },
+
+ getCouleursParDefaut: function() {
+ var cp = new Ext.ColorPalette();
+ cp.colors[31] = "CCCCCC";
+ return cp.colors;
+ },
+
+ creeNode: function(parentNode, id, libelle, couleur, ordre) {
+
+ var encodedLibelle = Encoder.htmlEncode(libelle);
+
+ if (parentNode == null) {
+
+ var newNode = new Ext.tree.AsyncTreeNode({
+ nom: encodedLibelle,
+ text: encodedLibelle,
+ ordre: ordre,
+ leaf:false,
+ allowDrag:false,
+ id : id,
+ children: []
+ });
+
+ var insertedNode = this.rootNode.appendChild(newNode);
+ insertedNode.select();
+ this.config.model.setValue(insertedNode);
+
+ }
+ else {
+
+ var text = this.getMotifTexte(encodedLibelle, couleur);
+
+ var newNode = new Ext.tree.AsyncTreeNode({
+ nom: encodedLibelle,
+ text: text,
+ leaf: true,
+ allowDrag: false,
+ id: id,
+ couleur: couleur,
+ dispoBulletin: true,
+ dispoStats: true,
+ iconCls: 'no-icon',
+ uiProvider: Ext.ux.tree.ColumnNodeUI
+ });
+
+ parentNode.expand();
+
+ var insertedNode = parentNode.appendChild(newNode);
+ insertedNode.select();
+ this.config.model.setValue(insertedNode);
+
+ this.checkColumnsAfterRender();
+ }
+
+ },
+
+ getMotifTexte: function(encodedLibelle, couleur) {
+ var text = encodedLibelle;
+ if (couleur) {
+ var text = "<span class='motif' style='background-color:" + couleur
+ + "'> </span>" + encodedLibelle;
+ }
+ return text;
+ },
+
+ modifieNode: function(node, libelle, couleur) {
+
+ var encodedLibelle = Encoder.htmlEncode(libelle);
+
+ node.attributes.nom = encodedLibelle;
+
+ if (this.config.controller.isMotif(node)) {
+ node.attributes.couleur = couleur;
+ node.setText(this.getMotifTexte(encodedLibelle, couleur));
+ }
+ else if (this.config.controller.isGroupe(node)) {
+ node.setText(encodedLibelle);
+ }
+ }
+
+});
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ * @author jcas, onic
+ */
+Ext.ns('eliot.absences.parametrage.motif');
+
+eliot.absences.parametrage.motif.ToolbarView = Ext.extend(Ext.util.Observable, {
+
+ constructor:function (config) {
+ this.init(eliot.absences.parametrage.motif, config);
+ this.creeToolbar();
+ this.observeToolbar();
+ this.observeModel();
+ },
+
+ init:function (ns, config) {
+ this.ns = ns;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.config = Ext.apply(this.creeConfig(), config);
+ this.addConstantes();
+ },
+
+ addConstantes: function() {
+ this.Constantes.MotifToolbar = {
+ idMotifToolBar: 'toolBarMotif',
+ idBoutonCreerMotif: 'creationMotif',
+ idBoutonModifierMotif: 'modifierMotif',
+ idBoutonSupprimerMotif: 'supprimerDossier',
+ idMenuCreerMotif: 'creerMotif',
+ idMenuCreerGroupeMotif: 'creerGroupeMotif',
+ idMenuParam: 'motifParam',
+ idMenuPasDeDecompte: 'motifParamPasDeDecompte',
+ idMenuMotifs: 'motifParamMotif',
+ idMenuCourriersType: 'motifParamCourriersType',
+ idMenuCalendrier: 'motifParamCalendrier',
+ idBoutonMonterMotif: 'idBoutonMonterMotif',
+ idBoutonDescendreMotif: 'idBoutonDescendreMotif'
+ };
+ },
+
+ creeConfig:function () {
+ this.config = {
+ model: undefined,
+ controller: undefined
+ };
+ return this.config;
+ },
+
+ getInterface:function () {
+ return {
+ getItems: this.getItems.createDelegate(this),
+ updateDisplay: this.updateDisplay.createDelegate(this)
+ }
+ },
+
+ getItems: function() {
+ return [
+ this.toolbar
+ ];
+ },
+
+ creeToolbar: function() {
+ this.toolbar = new Ext.Toolbar({
+ border: false,
+ autoWidth:true,
+ height: 36,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idMotifToolBar,
+
+ items: [
+ {
+ xtype: 'tbbutton',
+ text: this.ConfigServeur.libelle.creer,
+ cls: 'add16',
+ icon: eliot.absences.parametrage.motif.ConfigServeur.url.urlImageAdd16,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idBoutonCreerMotif,
+ menu: [
+ {
+ text: this.ConfigServeur.libelle.creerGroupMotif,
+ icon: eliot.absences.parametrage.motif.ConfigServeur.url.urlImageAdd16,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idMenuCreerGroupeMotif
+ },
+ {
+ text: this.ConfigServeur.libelle.creerMotif,
+ icon: eliot.absences.parametrage.motif.ConfigServeur.url.urlImageAdd16,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idMenuCreerMotif,
+ disabled: true
+ }
+ ]
+ },
+ {
+ xtype: 'tbbutton',
+ text: this.ConfigServeur.libelle.modifier,
+ cls: 'add16',
+ icon: eliot.absences.parametrage.motif.ConfigServeur.url.urlImageEdit,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idBoutonModifierMotif,
+ disabled:true
+ },
+ {
+ xtype: 'tbbutton',
+ text : this.ConfigServeur.libelle.supprimer,
+ cls: 'add16',
+ icon: eliot.absences.parametrage.motif.ConfigServeur.url.urlImageSupprimer,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idBoutonSupprimerMotif,
+ disabled:true
+ },
+ {
+ xtype: 'tbbutton',
+ text : this.ConfigServeur.libelle.monter,
+ cls: 'add16',
+ icon: eliot.absences.parametrage.motif.ConfigServeur.url.urlImageFlecheHaut,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idBoutonMonterMotif,
+ disabled:true
+ },
+ {
+ xtype: 'tbbutton',
+ text : this.ConfigServeur.libelle.descendre,
+ cls: 'add16',
+ icon: eliot.absences.parametrage.motif.ConfigServeur.url.urlImageFlecheBas,
+ id: eliot.absences.parametrage.motif.Constantes.MotifToolbar.idBoutonDescendreMotif,
+ disabled:true
+ }
+ ]
+ });
+ },
+
+ observeToolbar: function() {
+
+ Ext.getCmp(this.Constantes.MotifToolbar.idMenuCreerMotif).addListener({
+ click: {
+ fn: function() {
+ this.config.controller.creeMotif();
+ },
+ scope: this
+ }
+ });
+
+ Ext.getCmp(this.Constantes.MotifToolbar.idMenuCreerGroupeMotif).addListener({
+ click: {
+ fn: function() {
+ this.config.controller.creeGroupe();
+ },
+ scope: this
+ }
+ });
+
+ Ext.getCmp(this.Constantes.MotifToolbar.idBoutonModifierMotif).addListener({
+ click: {
+ fn: function() {
+ this.config.controller.modifie();
+ },
+ scope: this
+ }
+ });
+
+ Ext.getCmp(this.Constantes.MotifToolbar.idBoutonSupprimerMotif).addListener({
+ click: {
+ fn: function() {
+ this.config.controller.supprime();
+ },
+ scope: this
+ }
+ });
+
+ Ext.getCmp(this.Constantes.MotifToolbar.idBoutonMonterMotif).addListener({
+ click: {
+ fn: function() {
+ this.config.controller.monte();
+ },
+ scope: this
+ }
+ });
+
+ Ext.getCmp(this.Constantes.MotifToolbar.idBoutonDescendreMotif).addListener({
+ click: {
+ fn: function() {
+ this.config.controller.descend();
+ },
+ scope: this
+ }
+ });
+ },
+
+ observeModel: function() {
+ this.config.model.addListener(
+ this.Constantes.eventId.change,
+ function (node) {
+ this.updateDisplay(node);
+ },
+ this);
+ },
+
+ updateDisplay: function(node) {
+
+ var creeMotifButton = Ext.getCmp(this.Constantes.MotifToolbar.idMenuCreerMotif);
+ var modifieButton = Ext.getCmp(this.Constantes.MotifToolbar.idBoutonModifierMotif);
+ var supprimeButton = Ext.getCmp(this.Constantes.MotifToolbar.idBoutonSupprimerMotif);
+ var monteButton = Ext.getCmp(this.Constantes.MotifToolbar.idBoutonMonterMotif);
+ var descendButton = Ext.getCmp(this.Constantes.MotifToolbar.idBoutonDescendreMotif);
+
+ if (this.config.controller.isMotif(node)) {
+ creeMotifButton.disable();
+ modifieButton.enable();
+ supprimeButton.enable();
+ monteButton.disable();
+ descendButton.disable();
+ }
+ else if (this.config.controller.isGroupe(node)) {
+ creeMotifButton.enable();
+ modifieButton.enable();
+ supprimeButton.enable();
+
+ if (!node.isFirst()){
+ monteButton.enable();
+ }
+ else {
+ monteButton.disable();
+ }
+
+ if (!node.isLast()) {
+ descendButton.enable();
+ }
+ else {
+ descendButton.disable();
+ }
+ }
+ else {
+ creeMotifButton.disable();
+ modifieButton.disable();
+ supprimeButton.disable();
+ monteButton.disable();
+ descendButton.disable();
+ }
+
+ }
+
+});
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
- * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
- *
- * Lilie is free software. You can redistribute it and/or modify since
- * you respect the terms of either (at least one of the both license) :
- * - under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- * - the CeCILL-C as published by CeCILL-C; either version 1 of the
- * License, or any later version
- *
- * There are special exceptions to the terms and conditions of the
- * licenses as they are applied to this software. View the full text of
- * the exception in file LICENSE.txt in the directory of this software
- * distribution.
- *
- * Lilie 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
- * Licenses for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the CeCILL-C along with Lilie. If not, see :
- * <http://www.gnu.org/licenses/> and
- * <http://www.cecill.info/licences.fr.html>.
- */
-
-/**
- * Classe Application de la page 'paramétrage des motifs'
- * @author jtra
- */
-
-Ext.ns('eliot.absences.parametrage.motifs');
-
-eliot.absences.parametrage.motifs.Application = function() {
-
- var Clazz = Ext.extend(Ext.util.Observable, {
- constructor: function() {
- // supprime le loadMask après un temps maximal
- eliot.absences.commons.Utils.supprimeLoadMask(
- eliot.absences.commons.Constantes.maskTimeOut
- );
-
- this.toolbarMotifs =
- new eliot.absences.parametrage.motifs.MotifsToolbar({});
-
- this.arbreMotifs = new eliot.absences.parametrage.motifs.ArbreMotifs({
- listerTousMotifs : false
- });
-
- this.arbreMotifs.addListener(
- eliot.absences.parametrage.motifs.Constantes.eventId.motifSelectionne,
- function() {
- this.toolbarMotifs.activerToolbar(true);
- },
- this
- );
-
- // Mise en forme de la page
- var centerRegionItems = [
- {
- id: eliot.absences.parametrage.motifs.Constantes.regionId.center,
- xtype:'panel',
- layout:'border',
- border: false,
- autoScroll: true,
- autoShow : true,
- items:[
- {
- region : 'north',
- height : 33,
- border: false,
- frame : false,
- items :[
- this.toolbarMotifs.toolbar
- ]
- },
- {
- region : 'center',
- xtype : 'panel',
- border: false,
- frame : false,
- layout: 'fit',
- title: 'Motifs',
- autoScroll: true,
- items : [
- this.arbreMotifs.treePanel
- ]
- }
- ]
- }
- ];
-
- // Rendu du viewport
- Ext.onReady(function() {
- eliot.layout.doLayout(
- eliot.absences.parametrage.motifs.Constantes.
- regionId.viewPort,
- eliot.absences.parametrage.motifs.Constantes.
- regionId.northPanel,
- eliot.absences.parametrage.motifs.Constantes.
- regionId.centerPanel,
- centerRegionItems
- );
-
- // Supprime la progress bar
- eliot.absences.commons.Utils.supprimeLoadMask(250);
-
- });
- }
- });
-
- // Construit l'instance singleton
- return new Clazz();
-}();
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
- * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
- *
- * Lilie is free software. You can redistribute it and/or modify since
- * you respect the terms of either (at least one of the both license) :
- * - under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- * - the CeCILL-C as published by CeCILL-C; either version 1 of the
- * License, or any later version
- *
- * There are special exceptions to the terms and conditions of the
- * licenses as they are applied to this software. View the full text of
- * the exception in file LICENSE.txt in the directory of this software
- * distribution.
- *
- * Lilie 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
- * Licenses for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the CeCILL-C along with Lilie. If not, see :
- * <http://www.gnu.org/licenses/> and
- * <http://www.cecill.info/licences.fr.html>.
- */
-
-/**
- * @author jtra
- */
-
-Ext.ns('eliot.absences.parametrage.motifs');
-
-eliot.absences.parametrage.motifs.Modele = {
- url: {
- urlImageAdd16: undefined,
- urlImageEdit: undefined,
- urlImageSupprimer: undefined,
-
- urlMotifsLister: undefined,
- urlCreerMotif: undefined,
- urlCreerGrpMotif: undefined,
- urlModifierMotif: undefined,
- urlModifierGrpMotif: undefined,
- urlSupprimerMotif: undefined,
- urlSupprimerGrpMotif: undefined
- },
-
- libelle : {
- motifDialogSuppressionTitre: undefined,
- motifDialogSuppressionTexte: undefined,
- groupeMotifDialogSuppressionTitre: undefined,
-
- titreCreerGrpMotif: undefined,
- titreModifierGrpMotif: undefined,
- titreLibelleGrpMotif: undefined,
- titreModifierMotif: undefined,
- titreCreerMotif: undefined,
- titreLibelleCouleur: undefined,
-
- btnOk: undefined,
- btnCancel: undefined,
- btnYes: undefined,
- btnNo: undefined,
-
- creer : undefined,
- modifier : undefined,
- supprimer : undefined,
-
- creerGroupMotif : undefined,
- creerMotif : undefined
- },
-
- message : {
- motifCreerSucces: undefined,
- motifCreerEchec: undefined,
- motifEchecCreerLibelleVide: undefined,
- motifModifierSucces: undefined,
- motifModifierEchec: undefined,
- motifSupprimerSucces: undefined,
- motifSupprimerEchec: undefined,
- groupeMotifsCreerSucces: undefined,
- groupeMotifsCreerEchec: undefined,
- groupeMotifsModifierSucces: undefined,
- groupeMotifsModifierEchec: undefined,
- groupeMotifsSupprimerSucces: undefined,
- groupeMotifsSupprimerEchec: undefined,
- groupeMotifEchecCreerLibelleVide: undefined
- }
-
-};
+++ /dev/null
-/*
- * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
- * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
- *
- * Lilie is free software. You can redistribute it and/or modify since
- * you respect the terms of either (at least one of the both license) :
- * - under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- * - the CeCILL-C as published by CeCILL-C; either version 1 of the
- * License, or any later version
- *
- * There are special exceptions to the terms and conditions of the
- * licenses as they are applied to this software. View the full text of
- * the exception in file LICENSE.txt in the directory of this software
- * distribution.
- *
- * Lilie 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
- * Licenses for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the CeCILL-C along with Lilie. If not, see :
- * <http://www.gnu.org/licenses/> and
- * <http://www.cecill.info/licences.fr.html>.
- */
-
-/**
- * Configuration de la toolbar des Motifs
- * @author jcas
- */
-Ext.ns('eliot.absences.parametrage.motifs');
-
-// Ajoute les constantes propres à la toolbar ---------------------------------
-eliot.absences.parametrage.motifs.Constantes.MotifsToolbar = {
- idMotifsToolBar: 'toolBarMotifs',
- idBoutonCreerMotif: 'creationMotif',
- idBoutonModifierMotif: 'modifierMotif',
- idBoutonSupprimerMotif: 'supprimerDossier',
- idMenuCreerMotif: 'creerMotif',
- idMenuCreerGroupeMotif: 'creerGroupeMotif',
- idMenuParam: 'motifParam',
- idMenuPasDeDecompte: 'motifParamPasDeDecompte',
- idMenuMotifs: 'motifParamMotif',
- idMenuCourriersType: 'motifParamCourriersType',
- idMenuCalendrier: 'motifParamCalendrier'
-};
-
-eliot.absences.parametrage.motifs.MotifsToolbar = Ext.extend(Ext.util.Observable, {
-
- constructor: function(config) {
- this.Modele = eliot.absences.parametrage.motifs.Modele;
-
- this.toolbar = new Ext.Toolbar({
- border: false,
- autoWidth:true,
- height: 36,
- id: eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idMotifsToolBar,
-
- items: [
- {
- xtype: 'tbbutton',
- text: this.Modele.libelle.creer,
- cls: 'add16',
- icon: eliot.absences.parametrage.motifs.Modele.urlImageAdd16,
- id: eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idBoutonCreerMotif,
- menu: [
- {
- text: this.Modele.libelle.creerGroupMotif,
- icon: eliot.absences.parametrage.motifs.Modele.urlImageAdd16,
- id: eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idMenuCreerGroupeMotif
- },
- {
- text: this.Modele.libelle.creerMotif,
- icon: eliot.absences.parametrage.motifs.Modele.urlImageAdd16,
- id: eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idMenuCreerMotif
- }
- ]
- },
- {
- xtype: 'tbbutton',
- text: this.Modele.libelle.modifier,
- cls: 'add16',
- icon: eliot.absences.parametrage.motifs.Modele.urlImageEdit,
- id: eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idBoutonModifierMotif,
- disabled:true
- },
- {
- xtype: 'tbbutton',
- text : this.Modele.libelle.supprimer,
- cls: 'add16',
- icon: eliot.absences.parametrage.motifs.Modele.urlImageSupprimer,
- id: eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idBoutonSupprimerMotif,
- disabled:true
- }
- ]
- });
-
- // Ajout des évènements persos
- this.listeners = config.listeners;
- this.observeToolbar();
-
- // Ajout des évènements perso
- this.selectionActionsEvent = 'selectionActionsEvent';
- this.addEvents(this.selectionActionsEvent);
- this.listeners = config.listeners;
- },
-
- /*
- * Associe les événements
- * */
- observeToolbar: function() {
- // Observe le menu des motifs
- Ext.getCmp(eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idMenuCreerMotif).addListener({
- click: {
- fn: function() {
- this.creerMotif();
- },
- scope: this
- }
- });
- Ext.getCmp(eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idMenuCreerGroupeMotif).addListener({
- click: {
- fn: function() {
- this.creerGroupeMotif();
- },
- scope: this
- }
- });
-
- Ext.getCmp(eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idBoutonModifierMotif).addListener({
- click: {
- fn: function() {
- this.modifier();
- },
- scope: this
- }
- });
- Ext.getCmp(eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idBoutonSupprimerMotif).addListener({
- click: {
- fn: function() {
- this.supprimer();
- },
- scope: this
- }
- });
-
- Ext.getCmp(eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idBoutonCreerMotif).addListener({
- click: {
- fn: function() {
- this.creer();
- },
- scope: this
- }
- });
- },
-
- activerToolbar:function(etat) {
- var itemBtnCreerMotif = Ext.getCmp(eliot.absences.parametrage.motifs.
- Constantes.MotifsToolbar.idBoutonCreerMotif);
- var itemBtnModifierMotif = Ext.getCmp(eliot.absences.parametrage.motifs.
- Constantes.MotifsToolbar.idBoutonModifierMotif);
- var itemBtnSupprimerMotif = Ext.getCmp(eliot.absences.parametrage.motifs.
- Constantes.MotifsToolbar.idBoutonSupprimerMotif);
-
- if (etat) {
- itemBtnCreerMotif.enable();
- itemBtnModifierMotif.enable();
- itemBtnSupprimerMotif.enable();
- } else {
- //itemBtnCreerMotif.disable();
- itemBtnModifierMotif.disable();
- itemBtnSupprimerMotif.disable();
- }
-
- },
- enableToolbar:function() {
- this.activerToolbar(true);
- },
- /*
- * Actions des boutons
- * */
- creer:function() {
- eliot.absences.Message.resetMessages();
- var itemMenuCreerMotif = Ext.getCmp(eliot.absences.parametrage.motifs.Constantes.MotifsToolbar.idMenuCreerMotif);
- if (!this.getNoeudMotifSelectionne()) {
- itemMenuCreerMotif.disable();
- } else {
- itemMenuCreerMotif.enable();
- }
- },
-
- creerMotif: function () {
- eliot.absences.Message.resetMessages();
-
- var node = this.getNoeudMotifSelectionne();
- if (node != null) {
- // this.activerToolbar(false);
- eliot.absences.Message.afficherMsgBoxMotif(
- this.executerCreerMotif.createDelegate(this),
- undefined,
- false
- );
- }
-
- },
-
- creerGroupeMotif: function () {
- eliot.absences.Message.resetMessages();
-
- this.activerToolbar(false);
- eliot.absences.Message.afficherMsgBoxGrpMotif(
- this.executerCreerGroupeMotif.createDelegate(this),
- undefined,
- false
- );
- },
-
- modifier: function () {
- eliot.absences.Message.resetMessages();
-
- var node = this.getNoeudMotifSelectionne();
-
-
- if (node != null && node.id.charAt(0) == 'm') {
- this.activerToolbar(false);
- eliot.absences.Message.afficherMsgBoxMotif(
- this.executerModifierMotif.createDelegate(this),
- undefined,
- true
- );
- }
- if (node != null && node.id.charAt(0) == 'g') {
- this.activerToolbar(false);
- eliot.absences.Message.afficherMsgBoxGrpMotif(this.executerModifierGrpMotif.createDelegate(this), undefined, true);
- }
- },
- supprimer: function () {
- eliot.absences.Message.resetMessages();
-
- var node = this.getNoeudMotifSelectionne();
- var messageConfirmation = '';
- var nom = '"' + node.attributes['nom'] + '"';
-
- if (node == null) return;
- var nodeId = node.id.substring(1, node.id.length);
-
- if (node.id.charAt(0) == 'm') {
- this.activerToolbar(false);
- messageConfirmation = eliot.absences.parametrage.motifs.Modele.
- libelle.motifDialogSuppressionTexte + " " + nom + ' ?';
- eliot.absences.Message.afficherDialogConfirmation(
- eliot.absences.parametrage.motifs.Modele.libelle.motifDialogSuppressionTitre,
- messageConfirmation,
- this.executerSupprimerMotif.createDelegate(this),
- this.enableToolbar.createDelegate(this),
- nodeId
- );
-
- }
- if (node.id.charAt(0) == 'g') {
- this.activerToolbar(false);
- messageConfirmation = eliot.absences.parametrage.motifs.Modele.
- libelle.groupeMotifDialogSuppressionTexte + " " + nom + ' ?';
- eliot.absences.Message.afficherDialogConfirmation(
- eliot.absences.parametrage.motifs.Modele.libelle.groupeMotifDialogSuppressionTitre,
- messageConfirmation,
- this.executerSupprimerGrpMotif.createDelegate(this),
- this.enableToolbar.createDelegate(this),
- nodeId
- )
- }
-
- },
- /**
- * Executions des actions
- */
- executerCreerMotif: function (idGroupe, libelle, couleur, nodeId) {
- Ext.Ajax.request({
- url: eliot.absences.parametrage.motifs.Modele.urlCreerMotif,
- params: { idGroupe : idGroupe, libelle : libelle, couleur : couleur },
- scope:this,
- success:function(response, request) {
- var reponse = Ext.decode(response.responseText);
- if (reponse.success != true) {
- if (reponse.errorMsg) {
- eliot.absences.Message.showErreur(reponse.errorMsg);
- }
- else {
- request.failure();
- }
- } else {
- eliot.absences.Message.showConfirmation(
- eliot.absences.parametrage.motifs.Modele.message.motifCreerSucces
- );
- this.ajouterMotif(this.getGrpMotifCourant(), 'm' + reponse.id, reponse.nom, reponse.codeCouleur);
- this.activerToolbar(true);
- }
- },
- failure:function() {
- eliot.absences.Message.showErreur(
- eliot.absences.parametrage.motifs.Modele.message.motifCreerEchec
- );
-
- }
- });
- },
- executerCreerGroupeMotif: function (idEtab, libelle, nodeId) {
- Ext.Ajax.request({
- url: eliot.absences.parametrage.motifs.Modele.urlCreerGrpMotif,
- params: { idEtab : idEtab, libelle : libelle},
- scope:this,
- success:function(response, request) {
- var reponse = Ext.decode(response.responseText);
- if (reponse.success != true) {
- if (reponse.errorMsg) {
- eliot.absences.Message.showErreur(reponse.errorMsg);
- }
- else {
- request.failure();
- }
- } else {
- eliot.absences.Message.showConfirmation(
- eliot.absences.parametrage.motifs.Modele.message.groupeMotifsCreerSucces
- );
- this.ajouterGrpMotif('g' + reponse.id, reponse.nom);
- this.activerToolbar(true);
- }
- },
- failure:function() {
- eliot.absences.Message.showErreur(
- eliot.absences.parametrage.motifs.Modele.message.groupeMotifsCreerEchec
- );
- }
- });
- },
- executerModifierMotif: function (idGroupe, libelle, clr, nodeId) {
- Ext.Ajax.request({
- url: eliot.absences.parametrage.motifs.Modele.urlModifierMotif,
- params: { idGroupe : idGroupe, idMotif : nodeId, libelle : libelle, couleur: clr},
- scope:this,
- success:function(response, request) {
- var reponse = Ext.decode(response.responseText);
- if (reponse.success != true) {
- if (reponse.errorMsg) {
- eliot.absences.Message.showErreur(reponse.errorMsg);
- }
- else {
- request.failure();
- }
- } else {
- eliot.absences.Message.showConfirmation(
- eliot.absences.parametrage.motifs.Modele.message.motifModifierSucces
- );
- this.modifierNoeudCourant(reponse.nom, reponse.codeCouleur);
- }
- },
- failure:function() {
- eliot.absences.Message.showErreur(
- eliot.absences.parametrage.motifs.Modele.message.motifModifierEchec
- );
- }
- });
- },
- executerModifierGrpMotif: function (idEtab, libelle, nodeId) {
- Ext.Ajax.request({
- url: eliot.absences.parametrage.motifs.Modele.urlModifierGrpMotif,
- params: { idGrpMotif : nodeId, libelle : libelle},
- scope:this,
- success:function(response, request) {
- var reponse = Ext.decode(response.responseText);
- if (reponse.success != true) {
- if (reponse.errorMsg) {
- eliot.absences.Message.showErreur(reponse.errorMsg);
- }
- else {
- request.failure();
- }
- } else {
- eliot.absences.Message.showConfirmation(
- eliot.absences.parametrage.motifs.Modele.message.groupeMotifsModifierSucces
- );
- this.modifierNoeudCourant(reponse.nom, null);
-
- }
- },
- failure:function() {
- eliot.absences.Message.showErreur(
- eliot.absences.parametrage.motifs.Modele.message.groupeMotifsModifierEchec
- );
- }
- });
- },
-
- executerSupprimerMotif: function(nodeId) {
- Ext.Ajax.request({
- url: eliot.absences.parametrage.motifs.Modele.urlSupprimerMotif,
- params: { idMotif : nodeId},
- scope:this,
- success:function(response, request) {
- var reponse = Ext.decode(response.responseText);
- if (reponse.success != true) {
- eliot.absences.Message.showErreur(reponse.message);
- } else {
- eliot.absences.Message.showConfirmation(
- eliot.absences.parametrage.motifs.Modele.message.motifSupprimerSucces
- );
-
- this.supprimerNoeud(this.getNoeudMotifSelectionne());
- }
- }
- });
-
- },
- executerSupprimerGrpMotif: function(nodeId) {
- Ext.Ajax.request({
- url: eliot.absences.parametrage.motifs.Modele.urlSupprimerGrpMotif,
- params: { idGrpMotif : nodeId},
- scope:this,
- success:function(response, request) {
- var reponse = Ext.decode(response.responseText);
- if (reponse.success != true) {
- eliot.absences.Message.showErreur(reponse.message);
- } else {
- eliot.absences.Message.showConfirmation(
- eliot.absences.parametrage.motifs.Modele.message.groupeMotifsSupprimerSucces
- );
-
- this.supprimerNoeud(this.getNoeudMotifSelectionne());
- }
- }
- });
-
- },
- getNoeudMotifSelectionne : function() {
- return eliot.absences.parametrage.motifs.Application.arbreMotifs.noeudMotifSelectionne();
- },
-
- getRootMotif : function() {
-
- return eliot.absences.parametrage.motifs.Application.arbreMotifs.racineMotif();
- },
-
- ajouterMotif : function(nodeParent, nodeId, text, codeCouleur) {
- eliot.absences.parametrage.motifs.Application.arbreMotifs.ajouterMotif(nodeParent, nodeId, text, codeCouleur);
- },
-
- ajouterGrpMotif : function(nodeId, text) {
- eliot.absences.parametrage.motifs.Application.arbreMotifs.ajouterGrpMotif(nodeId, text);
- },
-
- modifierNoeudCourant: function(nom, codeCouleur) {
- eliot.absences.parametrage.motifs.Application.arbreMotifs.modifierNoeudCourant(nom, codeCouleur);
- },
-
- getGrpMotifCourant:function() {
- return eliot.absences.parametrage.motifs.Application.arbreMotifs.groupeMotifCourant();
- },
-
- supprimerNoeud:function(node) {
- eliot.absences.parametrage.motifs.Application.arbreMotifs.supprimerNoeud(node);
- }
-
-});
\ No newline at end of file
observeMotifs:function (arbreMotifs) {
arbreMotifs.addListener(
- eliot.absences.parametrage.motifs.Constantes.
+ eliot.absences.parametrage.motif.Constantes.
eventId.motifSelectionne,
this.actionMotifChange,
this
var NameSpace = eliot.absences.saisie.saisie;
// Arbre des motifs
- var motifView = new eliot.absences.parametrage.motifs.ArbreMotifs({
+ var motifView = new eliot.absences.parametrage.motif.ArbreMotifs({
listerTousMotifs : true,
id : 'idArbreMotifs',
selection : true
/****************************** Bouton exporter **********************************/
- var boutonExporterView = new eliot.exportdonnees.BoutonExportView({});
+ var boutonExporterView = new eliot.exportdonnees.BoutonExportView({
+ width:90
+ });
var boutonExportController = new eliot.exportdonnees.BoutonExportController({
url : Modele.url.exporteDonnees
});
defaultGroupesMotifController = Modele.data.paramsTempsReel.groupesMotif;
defaultMotifsController = Modele.data.paramsTempsReel.motifs;
defaultTypesDisciplineController = Modele.data.paramsTempsReel.typesDiscipline;
+ } else {
+ defaultMotifsView = Modele.data.motifIdsDefaut
}
// La configuration du composant date : début
tempsReelController.observeCritereTempsReelView(criteresTempsReelView);
+ criteresTempsReelView.observeCritereTempsReelController(tempsReelController);
/************** Panel de la représentations de temps réel ***************/
actionTypeChange : 'actionTypeChange',
actionGroupesMotifChange : 'actionGroupesMotifChange',
actionMotifsChange : 'actionMotifsChange',
- actionTypesDisciplineChange : 'actionTypesDisciplineChange'
+ actionTypesDisciplineChange : 'actionTypesDisciplineChange',
+ actionSelectionMotifsChange : 'actionSelectionMotifsChange',
+ actionReloadMotifs: 'actionReloadMotifs'
},
defaults : {
* config.dataClasses : les classes sous la forme [id : libelle]
* config.dataModesCalcul : les modes de calculs sous la forme [id : libelle]
*/
- constructor: function(config) {
+ constructor:function (config) {
this.Constantes = eliot.absences.statistique.tempsreel.Constantes;
this.Modele = eliot.absences.statistique.tempsreel.Modele;
var defaultConfig = {
- dateDebut : new Date(),
- dateFin : new Date(),
- dataClasses : [],
- structuresEnseignement : this.Constantes.defaults.lovComboParDefaut,
- groupesMotif : this.Constantes.defaults.lovComboParDefaut,
- motifs : this.Constantes.defaults.lovComboParDefaut,
- modeCalcul : 1,
- dataModesCalcul : [],
- type : 1,
- typesDiscipline : undefined,
- dataTypes : []
+ dateDebut:new Date(),
+ dateFin:new Date(),
+ dataClasses:[],
+ structuresEnseignement:this.Constantes.defaults.lovComboParDefaut,
+ groupesMotif:this.Constantes.defaults.lovComboParDefaut,
+ motifs:this.Constantes.defaults.lovComboParDefaut,
+ modeCalcul:1,
+ dataModesCalcul:[],
+ type:1,
+ typesDiscipline:undefined,
+ dataTypes:[]
};
Ext.applyIf(config, defaultConfig);
+ this.addEvents(
+ /**
+ * Déclenché lorsque la sélection des motifs a changé.
+ * @param true si la sélection correspond à la sélection par défaut
+ */
+ this.Constantes.eventId.actionSelectionMotifsChange,
+
+ /**
+ * Déclenché lorsque la combo des motifs est rechargée
+ */
+ this.Constantes.eventId.actionReloadMotifs
+ );
+
this.dateDebut = config.dateDebut;
this.dateFin = config.dateFin;
this.structuresEnseignement = config.structuresEnseignement;
{name:'id', type:'int'},
{name:'libelle', type:'string'}
],
- data : []
+ data:[]
});
this.typeStore.loadData(config.dataTypes);
{name:'id', type:'int'},
{name:'libelle', type:'string'}
],
- data : []
+ data:[]
});
// Ajout de l'item 'Tous'
- config.dataGroupesMotif.unshift({id : -1, libelle : this.Modele.libelle.tous});
+ config.dataGroupesMotif.unshift({id:-1, libelle:this.Modele.libelle.tous});
this.groupesMotifStore.loadData(config.dataGroupesMotif);
// définition du store des motifs
this.motifStore = new Ext.data.JsonStore({
- url: this.Modele.url.getDataMotifsForGroupe,
- params : {
- idsGroupesMotif : Ext.encode(this.groupesMotif)
+ url:this.Modele.url.getDataMotifsForGroupe,
+ params:{
+ idsGroupesMotif:Ext.encode(this.groupesMotif)
},
- autoLoad : false,
+ autoLoad:false,
+ root:'data',
fields:[
{name:'id', type:'int'},
{name:'libelle', type:'string'}
- ],
- data : []
+ ]
});
// Ajout de l'item 'Tous'
- config.dataMotifs.unshift({id : -1, libelle : this.Modele.libelle.tous});
- this.motifStore.loadData(config.dataMotifs);
+ config.dataMotifs.unshift({id:-1, libelle:this.Modele.libelle.tous});
+ this.motifStore.loadData({'data':config.dataMotifs});
// définition du store des types de discipline
{name:'id', type:'int'},
{name:'libelle', type:'string'}
],
- data : []
+ data:[]
});
if (this.Constantes.types.avecChoixTypeDiscipline.indexOf(this.type) !== -1) {
this.loadTypesDisciplineStore(this.type);
{name:'id', type:'int'},
{name:'libelle', type:'string'}
],
- data : []
+ data:[]
});
// Ajout de l'item 'Tous'
- config.dataClasses.unshift({id : -1, libelle : this.Modele.libelle.tous});
+ config.dataClasses.unshift({id:-1, libelle:this.Modele.libelle.tous});
this.classeStore.loadData(config.dataClasses);
{name:'id', type:'int'},
{name:'libelle', type:'string'}
],
- data : []
+ data:[]
});
this.modeCalculStore.loadData(config.dataModesCalcul);
* Observe les modifications de chacun des composants de critère de recherche
* @param critereTempsReelView
*/
- observeCritereTempsReelView : function(critereTempsReelView) {
+ observeCritereTempsReelView:function (critereTempsReelView) {
critereTempsReelView.addListener(
- this.Constantes.eventId.actionDateDebutChange,
- this.setDateDebut,
- this
- );
+ this.Constantes.eventId.actionDateDebutChange,
+ this.setDateDebut,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionDateFinChange,
- this.setDateFin,
- this
- );
+ this.Constantes.eventId.actionDateFinChange,
+ this.setDateFin,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionRechercher,
- this.actionRechercher,
- this
- );
+ this.Constantes.eventId.actionRechercher,
+ this.actionRechercher,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionStructuresChange,
- this.setStructuresEnseignements,
- this
- );
+ this.Constantes.eventId.actionStructuresChange,
+ this.setStructuresEnseignements,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionModeCalculChange,
- this.setModeCalcul,
- this
- );
+ this.Constantes.eventId.actionModeCalculChange,
+ this.setModeCalcul,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionTypeChange,
- this.actionTypeChange,
- this
- );
+ this.Constantes.eventId.actionTypeChange,
+ this.actionTypeChange,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionGroupesMotifChange,
- this.actionGroupesMotifChange,
- this
- );
+ this.Constantes.eventId.actionGroupesMotifChange,
+ this.actionGroupesMotifChange,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionMotifsChange,
- this.setMotifs,
- this
- );
+ this.Constantes.eventId.actionMotifsChange,
+ this.setMotifs,
+ this
+ );
critereTempsReelView.addListener(
- this.Constantes.eventId.actionTypesDisciplineChange,
- this.setTypesDiscipline,
- this
- );
+ this.Constantes.eventId.actionTypesDisciplineChange,
+ this.setTypesDiscipline,
+ this
+ );
},
- setTypesDiscipline : function(typesDiscipline) {
+ setTypesDiscipline:function (typesDiscipline) {
this.typesDiscipline = typesDiscipline;
},
- actionGroupesMotifChange : function(groupesMotif) {
+ actionGroupesMotifChange:function (groupesMotif) {
if (groupesMotif !== this.groupesMotif) {
this.setGroupesMotif(groupesMotif);
this.executeGroupesMotifChange(groupesMotif);
}
},
- setGroupesMotif : function(groupesMotif) {
+ setGroupesMotif:function (groupesMotif) {
this.groupesMotif = groupesMotif;
},
- executeGroupesMotifChange : function(groupesMotif) {
+ executeGroupesMotifChange:function (groupesMotif) {
this.motifStore.setBaseParam(
- 'idsGroupesMotif', Ext.encode(this.groupesMotif)
- );
+ 'idsGroupesMotif', Ext.encode(this.groupesMotif)
+ );
this.motifStore.reload();
+ this.fireEvent(this.Constantes.eventId.actionReloadMotifs);
},
- setMotifs : function(motifs) {
- this.motifs = motifs;
+ setMotifs:function (motifs) {
+ var liste = motifs.split(',');
+ if (liste[0] == "-1") {
+ liste.shift();
+ }
+ motifs = liste.join(',');
+ if (this.motifs != motifs) {
+ this.motifs = motifs;
+ var defautList = this.motifStore.reader.jsonData.selectionParDefautIds.split(',');
+ var motifList = motifs.split(',');
+ this.fireEvent(
+ this.Constantes.eventId.actionSelectionMotifsChange,
+ (motifList.sort().toString() === defautList.sort().toString())
+ )
+ }
},
- actionTypeChange : function(type) {
+ actionTypeChange:function (type) {
this.setType(type);
this.loadTypesDisciplineStore(type);
},
- setType : function(type) {
+ setType:function (type) {
this.type = type;
var typesConstantes = eliot.absences.statistique.tempsreel.Constantes.types;
var isTypeAvecChoixMotif =
- typesConstantes.avecChoixMotifs.indexOf(type) !== -1;
+ typesConstantes.avecChoixMotifs.indexOf(type) !== -1;
// Initilaisation des donnés avec choix de motifs
if (isTypeAvecChoixMotif) {
this.groupesMotif = this.Constantes.defaults.lovComboParDefaut;
* Charge le store des types avec les données qui conviennent
* @param type
*/
- loadTypesDisciplineStore : function(type) {
+ loadTypesDisciplineStore:function (type) {
var datas = [];
var loadStore = false;
switch (type) {
}
if (loadStore) {
- datas.unshift({id : -1, libelle : this.Modele.libelle.tous});
+ datas.unshift({id:-1, libelle:this.Modele.libelle.tous});
this.typesDisciplineStore.loadData(datas);
}
},
- setModeCalcul : function(identifiantModeCalcul) {
+ setModeCalcul:function (identifiantModeCalcul) {
this.modeCalcul = identifiantModeCalcul;
},
- setStructuresEnseignements : function(structuresEnseignement) {
+ setStructuresEnseignements:function (structuresEnseignement) {
this.structuresEnseignement = structuresEnseignement;
},
- setDateDebut : function(dateDebut) {
+ setDateDebut:function (dateDebut) {
this.dateDebut = dateDebut;
},
- setDateFin : function(dateFin) {
+ setDateFin:function (dateFin) {
this.dateFin = dateFin;
},
- actionRechercher : function() {
+ actionRechercher:function () {
if (this.dateDebut > this.dateFin) {
eliot.absences.Message.showErreur(this.Modele.message.datesPasLogiques);
* Exécute la recherche avec les paramètres
* La page est rechargée
*/
- executeRechercher : function() {
+ executeRechercher:function () {
var params = {
- dateDebut : this.dateDebut,
- dateFin: this.dateFin,
- type : this.type,
- groupesMotif : this.groupesMotif,
- motifs : this.motifs,
- typesDiscipline : this.typesDiscipline,
- structuresEnseignement : this.structuresEnseignement,
- modeCalcul : this.modeCalcul
+ dateDebut:this.dateDebut,
+ dateFin:this.dateFin,
+ type:this.type,
+ groupesMotif:this.groupesMotif,
+ motifs:this.motifs,
+ typesDiscipline:this.typesDiscipline,
+ structuresEnseignement:this.structuresEnseignement,
+ modeCalcul:this.modeCalcul
};
var href = this.Modele.url.indexTempsReel +
- '?params=' + Ext.encode(params);
+ '?params=' + Ext.encode(params);
document.location.href = href;
}
* la construction du composant de mode de calcul
*
*/
- constructor: function(config) {
+ constructor:function (config) {
this.Modele = eliot.absences.statistique.tempsreel.Modele;
this.Constantes = eliot.absences.statistique.tempsreel.Constantes;
var NameSpaceCommun = eliot.absences.commons;
this.addEvents(
- /**
- * @event 'actionDateDebutChange' : déclanché sur changement de la valeur
- * de début de la période de recherche
- * @param date la nouvelle date (non formaté)
- */
+ /**
+ * @event 'actionDateDebutChange' : déclanché sur changement de la valeur
+ * de début de la période de recherche
+ * @param date la nouvelle date (non formaté)
+ */
this.Constantes.eventId.actionDateDebutChange,
- /**
- * @event 'actionDateFinChange' : déclanché sur changement de la valeur
- * de la fin de la période de recherche
- * @param date la nouvelle date (non formaté)
- */
+ /**
+ * @event 'actionDateFinChange' : déclanché sur changement de la valeur
+ * de la fin de la période de recherche
+ * @param date la nouvelle date (non formaté)
+ */
this.Constantes.eventId.actionDateFinChange,
- /**
- * @event 'actionStructuresChange' : déclanché sur changement de la valeur
- * de la structure d'enseignement
- * @param valeurSelectionnes la liste des identifiants
- * des classes sélectionnés
- */
+ /**
+ * @event 'actionStructuresChange' : déclanché sur changement de la valeur
+ * de la structure d'enseignement
+ * @param valeurSelectionnes la liste des identifiants
+ * des classes sélectionnés
+ */
this.Constantes.eventId.actionStructuresChange,
- /**
- * @event 'actionModeCalculChange' : déclanché sur changement
- * du mode de calcul
- * @param identifiantModeCalcul l'identifiant du nouveau mode de calcul
- */
+ /**
+ * @event 'actionModeCalculChange' : déclanché sur changement
+ * du mode de calcul
+ * @param identifiantModeCalcul l'identifiant du nouveau mode de calcul
+ */
this.Constantes.eventId.actionModeCalculChange,
- /**
- * @event 'actionTypeChange' : déclanché sur changement du type
- * @param identifiantType l'identifiant du nouveau type
- */
+ /**
+ * @event 'actionTypeChange' : déclanché sur changement du type
+ * @param identifiantType l'identifiant du nouveau type
+ */
this.Constantes.eventId.actionTypeChange,
- /**
- * @event 'actionGroupesMotifChange' : déclanché sur changement
- * des groupes de motifs
- * @param valeurSelectionnes la liste des identifiants
- * des groupes de motifs sélectionnés
- */
+ /**
+ * @event 'actionGroupesMotifChange' : déclanché sur changement
+ * des groupes de motifs
+ * @param valeurSelectionnes la liste des identifiants
+ * des groupes de motifs sélectionnés
+ */
this.Constantes.eventId.actionGroupesMotifChange,
- /**
- * @event 'actionMotifsChange' : déclanché sur changement de motifs
- * @param valeurSelectionnes la liste des identifiants
- * des motifs sélectionnés
- */
+ /**
+ * @event 'actionMotifsChange' : déclanché sur changement de motifs
+ * @param valeurSelectionnes la liste des identifiants
+ * des motifs sélectionnés
+ */
this.Constantes.eventId.actionMotifsChange,
- /**
- * @event 'actionTypesDisciplineChange' : déclanché sur changement
- * du type de discipline
- * @param valeurSelectionne l'identifiant du type de la discipline choisie
- */
+ /**
+ * @event 'actionTypesDisciplineChange' : déclanché sur changement
+ * du type de discipline
+ * @param valeurSelectionne l'identifiant du type de la discipline choisie
+ */
this.Constantes.eventId.actionTypesDisciplineChange
- );
+ );
this.typeSelectionne = config.type;
var avecChoixMotif = true;
// Combo de choix de type de recherche (absence, retard, dépard, ...)
var comboType = new NameSpaceCommun.ComboBoxView(
config.configComboType
- );
+ );
// Liste à choix multiples pour les groupes de motifs
this.lovComboGroupesMotif = new NameSpaceCommun.LovComboView(
config.configLovComboGroupesMotif
- );
+ );
// Liste à choix multiples pour les motifs
this.lovComboMotifs = new NameSpaceCommun.LovComboView(
config.configLovComboMotifs
- );
+ );
if (!avecChoixMotif) {
config.configLovComboTypeDisciplines.fieldLabel =
}
this.lovComboDiscipline = new NameSpaceCommun.LovComboView(
config.configLovComboTypeDisciplines
- );
+ );
// Liste de sélection multiple de classe
var lovComboClasses = new NameSpaceCommun.LovComboView(
config.configLovComboClasse
- );
+ );
var comboModeCalcul = new NameSpaceCommun.ComboBoxView(
config.configComboModeCalcul
- );
+ );
var boutonChercher = new Ext.Button({
- width : 100,
- text: this.Modele.libelle.chercher,
- icon: this.Modele.icon.urlImageRechercher,
- handler : function () {
+ width:90,
+ text:this.Modele.libelle.chercher,
+ icon:this.Modele.icon.urlImageRechercher,
+ handler:function () {
this.fireEvent(
this.Constantes.eventId.actionRechercher
- );
+ );
},
- scope : this
+ scope:this
});
/******** Card layout pour le changement de type et en ce qui coule *******/
defaultActiveItem = 1;
}
+ this.chkBoxSelectionDefaut = new Ext.form.Checkbox({
+ boxLabel:this.Modele.libelle.selectionDefaut,
+ checked:this.Modele.data.selectionMotifsDefautCoche
+ });
+
+
this.panel1 = new Ext.Panel({
- layout : 'card',
- activeItem : defaultActiveItem,
- height : 26,
- items : [
+ layout:'card',
+ activeItem:defaultActiveItem,
+ height:26,
+ items:[
{
- layout : 'form',
- items :this.lovComboGroupesMotif.lovCombo
+ layout:'form',
+ items:this.lovComboGroupesMotif.lovCombo
},
{
- layout : 'form',
- items : this.lovComboDiscipline.lovCombo
+ layout:'form',
+ items:this.lovComboDiscipline.lovCombo
}
]
});
this.panel2 = new Ext.Panel({
- layout : 'card',
- height : 26,
- activeItem : defaultActiveItem,
- items : [
+ layout:'card',
+ height:52,
+ activeItem:defaultActiveItem,
+ items:[
{
- layout : 'form',
- items : this.lovComboMotifs.lovCombo
+ layout:'form',
+ items:[
+ this.lovComboMotifs.lovCombo,
+ this.chkBoxSelectionDefaut
+ ]
},
{}
]
});
-
-
/*** Construction du panel et organisation des composant à l'intérieur ***/
this.view = new Ext.FormPanel({
- frame : true,
- defaults : {
- layout : 'form',
- labelAlign : 'right',
+ frame:true,
+ defaults:{
+ layout:'form',
+ labelAlign:'right',
bodyStyle:'padding:5px 0 5px 0'
},
- layout : 'column',
- items : [
+ layout:'column',
+ items:[
{
- width: 300,
- labelWidth: 100,
- items : [
+ width:300,
+ labelWidth:100,
+ items:[
dateDebutView.dateField,
comboType.comboBox,
lovComboClasses.lovCombo
{
width:350,
- labelWidth: 130,
- items: [
+ labelWidth:130,
+ items:[
dateFinView.dateField,
this.panel1,
comboModeCalcul.comboBox
},
{
- width : 265,
- labelWidth: 50,
- items : [
+ width:265,
+ labelWidth:50,
+ items:[
{
- bodyStyle:'paddingBottom :5px;',
- layout : 'column',
- items : [
+ bodyStyle:'paddingBottom :5px;paddingLeft:55px;',
+ layout:'column',
+ items:[
boutonChercher,
{
- bodyStyle : 'paddingLeft:30px;',
- items : config.boutonExportCsv
+ bodyStyle:'paddingLeft:10px;',
+ items:config.boutonExportCsv
}
]
},
-
this.panel2
]
}
this.observeChangementGroupesMotif();
this.observeChangementMotifs();
this.observeChangementTypesDiscipline();
+ this.observeSelectionDefaut();
+
+ },
+
+ observeSelectionDefaut:function () {
+ this.chkBoxSelectionDefaut.addListener({
+ check:{
+ fn:function (checkbox, checked) {
+ if (checked) {
+ this.affecteMotifsParDefaut();
+ }
+ },
+ scope:this
+ }
+ })
+ },
+ affecteMotifsParDefaut:function () {
+ this.chkBoxSelectionDefaut.setValue(true);
+ this.lovComboMotifs.lovCombo.setValue(this.Modele.data.motifIdsDefaut);
},
- observeChangementTypesDiscipline : function() {
+ observeChangementTypesDiscipline:function () {
var eventsId = eliot.absences.commons.LovComboViewConstantes.eventId;
this.lovComboDiscipline.addListener(
eventsId.actionValeurChange,
- function(valeurSelectionne) {
+ function (valeurSelectionne) {
this.fireEvent(
this.Constantes.eventId.actionTypesDisciplineChange,
valeurSelectionne
- )
+ )
},
this
- )
+ )
},
- observeChangementGroupesMotif : function() {
+ observeChangementGroupesMotif:function () {
var eventsId = eliot.absences.commons.LovComboViewConstantes.eventId;
this.lovComboGroupesMotif.addListener(
eventsId.actionValeurChange,
- function(valeurSelectionnes) {
+ function (valeurSelectionnes) {
this.fireEvent(
this.Constantes.eventId.actionGroupesMotifChange,
valeurSelectionnes
- )
+ )
},
this
- )
+ )
},
- observeChangementMotifs : function() {
+ observeChangementMotifs:function () {
var eventsId = eliot.absences.commons.LovComboViewConstantes.eventId;
this.lovComboMotifs.addListener(
eventsId.actionValeurChange,
- function(valeurSelectionnes) {
+ function (valeurSelectionnes) {
this.fireEvent(
this.Constantes.eventId.actionMotifsChange,
valeurSelectionnes
- )
+ )
},
this
- )
+ )
},
- observeChangementType : function(comboType) {
+ observeChangementType:function (comboType) {
var eventsId = eliot.absences.commons.ComboBoxViewConstantes.eventId;
comboType.addListener(
eventsId.actionSelectionChange,
this.actionTypeChange,
this
- )
+ )
},
- observeChangementModeCalcul : function(comboModeCalcul) {
+ observeChangementModeCalcul:function (comboModeCalcul) {
var eventsId = eliot.absences.commons.ComboBoxViewConstantes.eventId;
comboModeCalcul.addListener(
eventsId.actionSelectionChange,
- function(identifiantModeCalcul) {
+ function (identifiantModeCalcul) {
this.fireEvent(
this.Constantes.eventId.actionModeCalculChange,
identifiantModeCalcul
- )
+ )
},
this
- )
+ )
},
- observeChangementClasses : function(lovComboClasses) {
+ observeChangementClasses:function (lovComboClasses) {
var eventsId = eliot.absences.commons.LovComboViewConstantes.eventId;
lovComboClasses.addListener(
eventsId.actionValeurChange,
- function(valeurSelectionnes) {
+ function (valeurSelectionnes) {
this.fireEvent(
this.Constantes.eventId.actionStructuresChange,
valeurSelectionnes
- )
+ )
},
this
- )
+ )
},
- observeChangementDate : function(dateDebutView, dateFinView) {
+ observeChangementDate:function (dateDebutView, dateFinView) {
var eventsIds = eliot.absences.commons.DateViewConstantes.eventId;
dateDebutView.addListener(
eventsIds.actionSelectionnerDate,
- function(dateDebut) {
+ function (dateDebut) {
this.fireEvent(
this.Constantes.eventId.actionDateDebutChange,
dateDebut
- )
+ )
},
this
- );
+ );
dateFinView.addListener(
eventsIds.actionSelectionnerDate,
- function(dateFin) {
+ function (dateFin) {
this.fireEvent(
this.Constantes.eventId.actionDateFinChange,
dateFin
- )
+ )
},
this
- )
+ )
+ },
+
+ observeCriteresTempsReelController:function (controller) {
+ controller.addListener(
+ this.Constantes.eventId.actionReloadMotifs,
+ function () {
+ this.affecteMotifsParDefaut();
+ },
+ this
+ )
},
/**
*
* @param identifiantType
*/
- actionTypeChange : function(identifiantType) {
+ actionTypeChange:function (identifiantType) {
var typesConstantes = this.Constantes.types;
if (this.typeSelectionne != identifiantType) {
this.fireEvent(
this.Constantes.eventId.actionGroupesMotifChange,
this.Constantes.defaults.lovComboParDefaut
- );
+ );
this.typeSelectionne = identifiantType;
this.fireEvent(
this.Constantes.eventId.actionTypeChange,
identifiantType
- );
+ );
}
},
* Sanctions/Punitions/Incidents seulent l'identifiant du type
* @param identifiantType
*/
- misAjourLibelleTypeDiscipline : function(identifiantType) {
+ misAjourLibelleTypeDiscipline:function (identifiantType) {
var libelle = this.getLibelleForTypeDiscipline(identifiantType);
var labelElement = this.lovComboDiscipline.lovCombo.getEl().up('div.x-form-item').query('label[for=' +
Ext.get(labelElement).update(libelle + ' :');
},
- getLibelleForTypeDiscipline : function(identifiantType) {
+ getLibelleForTypeDiscipline:function (identifiantType) {
var libelle;
switch (identifiantType) {
case 4:
break;
}
return libelle
+ },
+
+ observeCritereTempsReelController:function (tempsReelController) {
+ tempsReelController.addListener(
+ this.Constantes.eventId.actionSelectionMotifsChange,
+ this.actionSelectionMotifsChange,
+ this
+ );
+
+ tempsReelController.addListener(
+ this.Constantes.eventId.actionReloadMotifs,
+ function () {
+ this.affecteMotifsParDefaut();
+ },
+ this
+ );
+ },
+
+ actionSelectionMotifsChange:function (defaut) {
+ this.chkBoxSelectionDefaut.setValue(defaut);
}
});
\ No newline at end of file
typeSanction : undefined,
typePunitions : undefined,
reprsentationParGrille : undefined,
- reprsentationParGraphe : undefined
+ reprsentationParGraphe : undefined,
+ selectionDefaut: undefined
},
dataTypeIncidents : undefined,
dataTypePunitions : undefined,
paramsTempsReel : undefined,
- datasTempsReel : undefined
+ datasTempsReel : undefined,
+ motifIdsDefaut: undefined,
+ selectionMotifsDefautCoche: undefined
},
message : {
import org.lilie.services.eliot.impression.donnees.eleve.SelectionAdresseResponsableEnum
import org.lilie.services.eliot.scolarite.Periode
import org.lilie.services.eliot.securite.impl.DefaultSecuriteSessionFactory
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
/**
* Service de requetage de notes pour le publipostage - bulletins et releves
eleves,
typePeriode,
eleveImpressionInfos,
- impressionRequetageSelection.infoDetailRetards
+ impressionRequetageSelection.infoDetailRetards,
+ PriseEnCompteMotif.BULLETIN
)
}
eleves,
typePeriode,
eleveImpressionInfos,
- impressionRequetageSelection.infoDetailAbsences
+ impressionRequetageSelection.infoDetailAbsences,
+ PriseEnCompteMotif.BULLETIN
)
}
import org.lilie.services.eliot.notes.TypeAvis
import org.lilie.services.eliot.notes.AvisElevePeriode
+import org.lilie.services.eliot.applications.absences.PriseEnCompteMotif
/**
* @author bper
eleve.autorite,
dateDebut,
dateFin,
- classe)
+ classe,
+ PriseEnCompteMotif.BULLETIN
+ )
}
}