--- /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.notes.domaine
+
+import grails.converters.JSON
+import org.lilie.services.eliot.notes.AbstractNotesController
+
+class AvisController extends AbstractNotesController {
+
+ def loadAsArbre = {
+
+ // Bouchon
+
+ List arbre = [
+ [
+ id: '1',
+ libelle: "Avis conseil de classe",
+ type: "TYPE_AVIS",
+ children: [
+ [
+ id: '1',
+ libelle: "Félicitations",
+ type: "AVIS",
+ ],
+ [
+ id: '2',
+ libelle: "Encouragements",
+ type: "AVIS",
+ ]
+ ]
+ ],
+ [
+ id: '2',
+ libelle: "Avis d'orientation",
+ type: "TYPE_AVIS",
+ children: [
+ [
+ id: '3',
+ libelle: "Admis en classe supperieure",
+ type: "AVIS",
+ ],
+ [
+ id: '4',
+ libelle: "Redoublement",
+ type: "AVIS",
+ ]
+ ]
+ ],
+ [
+ id: '3',
+ libelle: "Avis sans enfants",
+ type: "TYPE_AVIS",
+ children: []
+ ]
+ ]
+
+ render arbre as JSON
+ }
+
+ def supprime = {
+ Map result = tryCatch {
+
+ if (params.id.toLong() % 2 == 0) {
+ throw new IllegalStateException("Suppresion echoué")
+ }
+
+ }
+ render result as JSON
+ }
+
+ def cree = {
+ Map result = tryCatch {
+
+ // Bouchon
+ if (params.typeAvisId.toLong() % 2 == 0) {
+ throw new IllegalStateException("Création echoué")
+ }
+
+ [
+ avis: [
+ id: (new Random()).nextInt(),
+ libelle: params.libelle,
+ type: "AVIS",
+ ]
+ ]
+
+ }
+ render result as JSON
+ }
+
+ def modifie = {
+ Map result = tryCatch {
+
+ // Bouchon
+
+ if (params.id.toLong() % 2 == 0) {
+ throw new IllegalStateException("Modification echoué")
+ }
+
+ }
+
+ render result as JSON
+ }
+
+}
--- /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.notes.domaine
+
+import grails.converters.JSON
+import org.lilie.services.eliot.notes.AbstractNotesController
+
+class TypeAvisController extends AbstractNotesController {
+
+
+ def modifie = {
+
+ // Bouchon
+ Map result = tryCatch {
+
+ if (params.id.toLong() % 2 == 0) {
+ throw new IllegalStateException("Modification echoué")
+ }
+
+ }
+
+ render result as JSON
+ }
+}
eliot.notes.saisie.nonEnregistrees=Vous devez enregistrer ou annuler votre saisie avant de poursuivre.
# Parametrage généraux
+eliot.notes.libelle.annotations=Annotations
+eliot.notes.libelle.code=Code
+eliot.notes.libelle.libelle=Libellé
+eliot.notes.libelle.avis=Avis
+
+# Parametrage généraux - Précisions
eliot.notes.parametrages.generaux.libelle.precisionNotes=Précision notes
eliot.notes.parametrages.generaux.libelle.precisionDesNotes=Précision des notes
eliot.notes.parametrages.generaux.libelle.precision1=à 1 près
eliot.notes.parametrages.generaux.messages.enregistrePrecisionSucces=La précision a été enregistrée avec succès.
eliot.notes.parametrages.generaux.messages.enregistrePrecisionEchec=La modification de la précision a échoué.
-# Annotations
-eliot.notes.libelle.annotations=Annotations
-eliot.notes.libelle.code=Code
-eliot.notes.libelle.libelle=Libellé
+# Parametrage généraux - Annotations
eliot.notes.message.annotationNonValide=L'annotation n'existe pas
eliot.notes.parametrages.generaux.messages.succesCreeAnnotation=L'annotation a été créée avec succès.
eliot.notes.parametrages.generaux.messages.succesEnregistreAnnotation=L'annotation a été modifiée avec succès.
eliot.notes.parametrages.generaux.messages.confirmeSupprimeAnnotationTitre=Suppression d'une annotation
eliot.notes.parametrages.generaux.messages.confirmeSupprimeAnnotation=Confirmez-vous la suppression de l'annotation
eliot.notes.parametrages.generaux.messages.noteTextuelleExisteDeja=Le code et/ou le libellé de l'annotation existe déjà.
-eliot.notes.parametrages.generaux.messages.codeFaux=Le code de l''annotation ne doit pas être numérique.
\ No newline at end of file
+eliot.notes.parametrages.generaux.messages.codeFaux=Le code de l''annotation ne doit pas être numérique.
+
+# Parametrage généraux - Avis
+eliot.notes.parametrages.generaux.messages.succesModifieTypeAvis=Le type d'avis a été modifié avec succès.
+eliot.notes.parametrages.generaux.messages.erreurModifieTypeAvis=La modification du type d'avis a échoué.
+eliot.notes.parametrages.generaux.messages.succesModifieAvis=L'avis a été modifié avec succès.
+eliot.notes.parametrages.generaux.messages.erreurModifieAvis=La modification de l'avis a échoué.
+eliot.notes.parametrages.generaux.messages.succesCreeAvis=L'avis a été créé avec succès.
+eliot.notes.parametrages.generaux.messages.erreurCreeAvis=La création de l'avis a échoué.
+eliot.notes.parametrages.generaux.messages.succesSupprimeAvis=L'avis a été supprimé avec succès.
+eliot.notes.parametrages.generaux.messages.erreurSupprimeAvis=La suppression de l'avis a échoué.
+eliot.notes.parametrages.generaux.messages.creerAvis=Créer un avis
+eliot.notes.parametrages.generaux.messages.modifierAvis=Modifier l'avis
+eliot.notes.parametrages.generaux.messages.modifierTypeAvis=Modifier le type d'avis
+eliot.notes.parametrages.generaux.messages.supprimerAvis=Supprimer l'avis
+eliot.notes.parametrages.generaux.messages.confirmeSupprimeAvis=Confirmez-vous la suppression de l'avis
+
<g:setJsValueMessage name="erreurSupprimeAnnotation" code="eliot.notes.parametrages.generaux.messages.erreurSupprimeAnnotation"/>
<g:setJsValueMessage name="confirmeSupprimeAnnotationTitre" code="eliot.notes.parametrages.generaux.messages.confirmeSupprimeAnnotationTitre"/>
<g:setJsValueMessage name="confirmeSupprimeAnnotation" code="eliot.notes.parametrages.generaux.messages.confirmeSupprimeAnnotation"/>
+ <g:setJsValueMessage name="succesModifieTypeAvis" code="eliot.notes.parametrages.generaux.messages.succesModifieTypeAvis"/>
+ <g:setJsValueMessage name="erreurModifieTypeAvis" code="eliot.notes.parametrages.generaux.messages.erreurModifieTypeAvis"/>
+ <g:setJsValueMessage name="succesModifieAvis" code="eliot.notes.parametrages.generaux.messages.succesModifieAvis"/>
+ <g:setJsValueMessage name="erreurModifieAvis" code="eliot.notes.parametrages.generaux.messages.erreurModifieAvis"/>
+ <g:setJsValueMessage name="succesCreeAvis" code="eliot.notes.parametrages.generaux.messages.succesCreeAvis"/>
+ <g:setJsValueMessage name="erreurCreeAvis" code="eliot.notes.parametrages.generaux.messages.erreurCreeAvis"/>
+ <g:setJsValueMessage name="succesSupprimeAvis" code="eliot.notes.parametrages.generaux.messages.succesSupprimeAvis"/>
+ <g:setJsValueMessage name="erreurSupprimeAvis" code="eliot.notes.parametrages.generaux.messages.erreurSupprimeAvis"/>
+ <g:setJsValueMessage name="creerAvis" code="eliot.notes.parametrages.generaux.messages.creerAvis"/>
+ <g:setJsValueMessage name="modifierAvis" code="eliot.notes.parametrages.generaux.messages.modifierAvis"/>
+ <g:setJsValueMessage name="modifierTypeAvis" code="eliot.notes.parametrages.generaux.messages.modifierTypeAvis"/>
+ <g:setJsValueMessage name="supprimerAvis" code="eliot.notes.parametrages.generaux.messages.supprimerAvis"/>
+ <g:setJsValueMessage name="confirmeSupprimeAvis" code="eliot.notes.parametrages.generaux.messages.confirmeSupprimeAvis"/>
// Url
<g:setJsVar value="ConfigServeur.url"/>
<g:setJsValueLink name="enregistreAnnotation" controller="noteTextuelle" action="enregistreNoteTextuelle"/>
<g:setJsValueLink name="supprimeAnnotation" controller="noteTextuelle" action="supprimeNoteTextuelle"/>
+ <g:setJsValueLink name="modifieTypeAvis" controller="typeAvis" action="modifie"/>
+ <g:setJsValueLink name="loadArbreAvis" controller="avis" action="loadAsArbre"/>
+ <g:setJsValueLink name="creeAvis" controller="avis" action="cree"/>
+ <g:setJsValueLink name="modifieAvis" controller="avis" action="modifie"/>
+ <g:setJsValueLink name="supprimeAvis" controller="avis" action="supprime"/>
+
// Libellés
<g:setJsVar value="ConfigServeur.libelle"/>
<g:setJsValueMessage name="precisionNotes" code="eliot.notes.parametrages.generaux.libelle.precisionNotes"/>
<g:setJsValueMessage name="supprimer" code="eliot.notes.libelle.supprimer"/>
<g:setJsValueMessage name="code" code="eliot.notes.libelle.code"/>
<g:setJsValueMessage name="libelle" code="eliot.notes.libelle.libelle"/>
+ <g:setJsValueMessage name="avis" code="eliot.notes.libelle.avis"/>
// Icônes
<g:setJsVar value="ConfigServeur.icon"/>
<g:javascript library="src/views/commun/AjaxHelper"/>
<g:javascript library="src/views/commun/Ext.ux.grid.RowEditor"/>
<g:javascript library="src/views/commun/Ext.ux.grid.RowEditor.fix"/>
+ <g:javascript library="src/views/commun/Ext.ux.tree.ColumnNodeUI"/>
<g:javascript library="src/views/parametrages/generaux/ParametragesGenerauxView"/>
<g:javascript library="src/views/parametrages/generaux/AnnotationController"/>
<g:javascript library="src/views/parametrages/generaux/AnnotationModel"/>
+ <g:javascript library="src/views/parametrages/generaux/AvisView"/>
+ <g:javascript library="src/views/parametrages/generaux/AvisController"/>
+ <g:javascript library="src/views/parametrages/generaux/AvisModel"/>
+
<g:javascript library="src/views/parametrages/generaux/Application"/>
</head>
.ux-lovcombo-item-text.disabled {
color: #808080;
-}
\ No newline at end of file
+}
+
+.no-icon {
+ display: none;
+}
* le bouton 'annuler'
* @param value (option) la valeur déjà présente dans le champ texte
*/
- ,afficherDialogSaisie: function(titre, texte, fnSiOui, fnSiNon, value) {
+ ,afficherDialogSaisie: function(titre, texte, fnSiOui, fnSiNon, value, maxLength) {
var box = Ext.MessageBox.show({
title:Ext.util.Format.htmlEncode(titre),
msg: Ext.util.Format.htmlEncode(texte),
}
}
});
- this.limiterSaisieMsgBox(255);
+ this.limiterSaisieMsgBox(maxLength ? maxLength : 255);
this.positionnerExtMessageBox();
},
--- /dev/null
+/*!\r
+ * Ext JS Library 3.0+\r
+ * Copyright(c) 2006-2009 Ext JS, LLC\r
+ * licensing@extjs.com\r
+ * http://www.extjs.com/license\r
+ */\r
+Ext.ns('Ext.ux.tree');\r
+\r
+/**\r
+ * @class Ext.ux.tree.ColumnTree\r
+ * @extends Ext.tree.TreePanel\r
+ *\r
+ * @xtype columntree\r
+ */\r
+Ext.ux.tree.ColumnTree = Ext.extend(Ext.tree.TreePanel, {\r
+ lines : false,\r
+ borderWidth : Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell\r
+ cls : 'x-column-tree',\r
+\r
+ onRender : function() {\r
+\r
+ /*\r
+ Ext.tree.ColumnTree.superclass.onRender.apply(this, arguments);\r
+\r
+ this.headers = this.header.createChild({cls:'x-tree-headers'});\r
+\r
+ var cols = this.columns, c;\r
+ var totalWidth = 0;\r
+ var scrollOffset = 19; // similar to Ext.grid.GridView default\r
+\r
+ for(var i = 0, len = cols.length; i < len; i++){\r
+ c = cols[i];\r
+ totalWidth += c.width;\r
+ this.headers.createChild({\r
+ cls:'x-tree-hd ' + (c.cls?c.cls+'-hd':''),\r
+ cn: {\r
+ cls:'x-tree-hd-text',\r
+ html: c.header\r
+ },\r
+ style:'width:'+(c.width-this.borderWidth)+'px;'\r
+ });\r
+ }\r
+ this.headers.createChild({cls:'x-clear'});\r
+ // prevent floats from wrapping when clipped\r
+ // atua : on laisse la taille auto\r
+ //this.headers.setWidth(totalWidth+scrollOffset);\r
+ this.innerCt.setWidth(totalWidth);\r
+ */\r
+\r
+ // call parent\r
+ Ext.tree.ColumnTree.superclass.onRender.apply(this, arguments);\r
+\r
+ // after parent code, e.g. install event handlers on rendered components\r
+ this.headers = this.body.createChild({\r
+ cls : 'x-tree-headers'}, this.innerCt.dom);\r
+ // this.headers = this.getEl().createChild( //will make the header stick but takes away horizontal scroll\r
+ // {cls:'x-tree-headers'},this.body);\r
+\r
+ var cols = this.columns, c;\r
+ var totalWidth = 0;\r
+\r
+ for (var i = 0, len = cols.length; i < len; i++) {\r
+ c = cols[i];\r
+\r
+ // check if this column should be hidden *** La premiere colonne s'etire suivant la largeur totale\r
+ if (c.hidden === true)\r
+ continue;\r
+ var containerSize = this.getSize();\r
+ if ((containerSize.width >= 901) && (containerSize.width <= 1000)) {\r
+ cols[this.colonneRedim].width = 450;\r
+ } else if ((containerSize.width >= 1001) && (containerSize.width <= 1100)) {\r
+ cols[this.colonneRedim].width = 520;\r
+ } else if ((containerSize.width >= 1101) && (containerSize.width <= 1200)) {\r
+ cols[this.colonneRedim].width = 610;\r
+ } else if ((containerSize.width >= 1201) && (containerSize.width <= 1300)) {\r
+ cols[this.colonneRedim].width = 710;\r
+ } else if ((containerSize.width >= 1301) && (containerSize.width <= 1400)) {\r
+ cols[this.colonneRedim].width = 810;\r
+ } else if (containerSize.width >= 1401) {\r
+ cols[this.colonneRedim].width = 910;\r
+ }\r
+\r
+\r
+ totalWidth += c.width;\r
+ this.headers.createChild({\r
+ cls : 'x-tree-hd ' + (c.cls ? c.cls + '-hd' : ''),\r
+ cn : {\r
+ cls : 'x-tree-hd-text',\r
+ html : c.header\r
+ },\r
+ style : 'width:' + (c.width - this.borderWidth) + 'px;'\r
+ ,onclick:'trierColonne('+i+',"'+c.dataIndex+'");'\r
+ });\r
+ }\r
+ this.headers.createChild({\r
+ cls : 'x-clear'\r
+ });\r
+ // prevent floats from wrapping when clipped\r
+ this.headers.setWidth(totalWidth);\r
+ this.innerCt.setWidth(totalWidth);\r
+\r
+ }\r
+});\r
+\r
+Ext.reg('columntree', Ext.ux.tree.ColumnTree);\r
+\r
+//backwards compat\r
+Ext.tree.ColumnTree = Ext.ux.tree.ColumnTree;\r
+\r
+\r
+/**\r
+ * @class Ext.ux.tree.ColumnNodeUI\r
+ * @extends Ext.tree.TreeNodeUI\r
+ */\r
+Ext.ux.tree.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {\r
+ focus: Ext.emptyFn, // prevent odd scrolling behavior\r
+\r
+ renderElements : function(n, a, targetNode, bulkRender) {\r
+ this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';\r
+\r
+ var t = n.getOwnerTree();\r
+ var cols = t.columns;\r
+ var bw = t.borderWidth;\r
+ var c = cols[0];\r
+ var cb = typeof a.checked == 'boolean';\r
+ \r
+\r
+ var buf = [\r
+ '<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf ', a.cls,'">',\r
+ '<div class="x-tree-col" style="width:',c.width - bw,'px;">',\r
+ '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",\r
+ '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow">',\r
+ cb ? ('<input class="x-tree-node-cb" type="checkbox" unselectable="on" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',\r
+ '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " " + a.iconCls : ""),'" unselectable="on">',\r
+ '<a hidefocus="on" class="x-tree-node-anchor" href="',a.href ? a.href : "#",'" tabIndex="1" ',\r
+ a.hrefTarget ? ' target="' + a.hrefTarget + '"' : "", '>',\r
+ '<span unselectable="on" colnum="0">', n.text || (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</span></a>",\r
+ "</div>"];\r
+ for (var i = 1, len = cols.length; i < len; i++) {\r
+ c = cols[i];\r
+\r
+ buf.push('<div class="x-tree-col ', (c.cls ? c.cls : ''), '" style="width:', c.width - bw, 'px;">',\r
+ '<div class="x-tree-col-text" colnum="', i, '">', (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]), "</div>",\r
+ "</div>");\r
+ }\r
+ buf.push(\r
+ '<div class="x-clear"></div></div>',\r
+ '<ul class="x-tree-node-ct" style="display:none;"></ul>',\r
+ "</li>");\r
+\r
+ if (bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()) {\r
+ this.wrap = Ext.DomHelper.insertHtml("beforeBegin",\r
+ n.nextSibling.ui.getEl(), buf.join(""));\r
+ } else {\r
+ this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));\r
+ }\r
+\r
+ this.elNode = this.wrap.childNodes[0];\r
+ this.ctNode = this.wrap.childNodes[1];\r
+ var cs = this.elNode.firstChild.childNodes;\r
+ this.indentNode = cs[0];\r
+ this.ecNode = cs[1];\r
+\r
+ var index = 2;\r
+ if(cb){\r
+ this.checkbox = cs[2];\r
+ // fix for IE6\r
+ this.checkbox.defaultChecked = this.checkbox.checked;\r
+ index++;\r
+ }\r
+ \r
+ this.iconNode = cs[index];\r
+ this.anchor = cs[index+1];\r
+ this.textNode = cs[index+1].firstChild;\r
+ }\r
+});\r
+\r
+//backwards compat\r
+Ext.tree.ColumnNodeUI = Ext.ux.tree.ColumnNodeUI;\r
+\r
+\r
+Ext.tree.ColumnTreeEditor = function(tree, config) {\r
+ config = config || {};\r
+ this.noEditColumns = config.noEditColumns || [];\r
+ var field = config.events ? config : new Ext.form.TextField(config);\r
+ Ext.tree.TreeEditor.superclass.constructor.call(this, field);\r
+\r
+ this.tree = tree;\r
+\r
+ if (!tree.rendered) {\r
+ tree.on('render', this.initEditor, this);\r
+ } else {\r
+ this.initEditor(tree);\r
+ }\r
+};\r
+\r
+\r
+Ext.extend(Ext.tree.ColumnTreeEditor, Ext.Editor, {\r
+\r
+ alignment: "l-l",\r
+ autoSize: false,\r
+\r
+ hideEl : false,\r
+\r
+ cls: "x-small-editor x-tree-editor",\r
+\r
+ shim:false,\r
+ shadow:"frame",\r
+\r
+ maxWidth: 250,\r
+\r
+ editDelay: 0,\r
+\r
+\r
+\r
+ initEditor : function(tree) {\r
+ tree.on('beforeclick', this.beforeNodeClick, this);\r
+ this.on('complete', this.updateNode, this);\r
+ this.on('beforestartedit', this.fitToTree, this);\r
+ this.on('startedit', this.bindScroll, this, {delay:10});\r
+ this.on('specialkey', this.onSpecialKey, this);\r
+ },\r
+\r
+ fitToTree : function(ed, el) {\r
+ var td = this.tree.getTreeEl().dom, nd = el.dom;\r
+ if (td.scrollLeft > nd.offsetLeft) {\r
+ td.scrollLeft = nd.offsetLeft;\r
+ }\r
+ var w = Math.min(\r
+ this.maxWidth,\r
+ (td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft - td.scrollLeft) - 5);\r
+ this.setSize(w, '');\r
+ },\r
+\r
+ triggerEdit : function(node, e) {\r
+ var obj = e.target;\r
+\r
+ if (Ext.select(".x-tree-node-anchor", false, obj).getCount() == 1) {\r
+ obj = Ext.select(".x-tree-node-anchor", false, obj).elements[0].firstChild;\r
+ } else if (obj.nodeName == 'SPAN' || obj.nodeName == 'DIV') {\r
+ obj = e.target;\r
+ } else {\r
+ return false;\r
+ }\r
+\r
+ var colIndex = 0;\r
+ for (var i in node.cols) {\r
+\r
+ if (node.cols[i] == obj.innerHTML) {\r
+ colIndex = i;\r
+ }\r
+ }\r
+\r
+ // Si le numéro de colonne est dans la variable noEditColumns: return (la colonne n'est pas éditable)\r
+\r
+ if (!node.attributes.editable) return;\r
+ var colnum = obj.getAttribute('colnum');\r
+ for (var i in this.noEditColumns)\r
+ {\r
+ if (colnum == i) return;\r
+ }\r
+\r
+\r
+ this.completeEdit();\r
+ this.editNode = node;\r
+ this.editCol = obj;\r
+ this.editColIndex = colIndex;\r
+ this.startEdit(obj);\r
+ if (obj.nodeName == 'DIV') {\r
+ var width = obj.offsetWidth;\r
+ this.setSize(width);\r
+ }\r
+ },\r
+\r
+ bindScroll : function() {\r
+ this.tree.getTreeEl().on('scroll', this.cancelEdit, this);\r
+ },\r
+\r
+ beforeNodeClick : function(node, e) {\r
+\r
+ var sinceLast = (this.lastClick ? this.lastClick.getElapsed() : 0);\r
+ this.lastClick = new Date();\r
+ if (sinceLast > this.editDelay && this.tree.getSelectionModel().isSelected(node)) {\r
+ e.stopEvent();\r
+ this.triggerEdit(node, e);\r
+ return false;\r
+ } else {\r
+ this.completeEdit();\r
+ }\r
+ },\r
+\r
+ updateNode : function(ed, value) {\r
+ this.tree.getTreeEl().un('scroll', this.cancelEdit, this);\r
+ //this.editNode.cols[this.editColIndex] = value; //for internal use only\r
+ this.editNode.attributes[this.editColIndex] = value;//duplicate into array of node attributes\r
+ this.editCol.innerHTML = value;\r
+ },\r
+\r
+ onHide : function() {\r
+ Ext.tree.TreeEditor.superclass.onHide.call(this);\r
+ if (this.editNode) {\r
+ this.editNode.ui.focus();\r
+ }\r
+ },\r
+\r
+ onSpecialKey : function(field, e) {\r
+ var k = e.getKey();\r
+ if (k == e.ESC) {\r
+ e.stopEvent();\r
+ this.cancelEdit();\r
+ } else if (k == e.ENTER && !e.hasModifier()) {\r
+ e.stopEvent();\r
+ this.completeEdit();\r
+ }\r
+ }\r
+});
\ No newline at end of file
creeItems: function() {
this.creePrecisionNotes();
this.creeAnnotation();
+ this.creeAvis();
this.creeParametragesGeneraux();
},
creeParametragesGeneraux: function() {
this.parametragesGenerauxView = new this.ns.ParametragesGenerauxView({
precisionNotesItem: this.precisionNotesView.getItem(),
- annotationsItem: this.annotationView.item
+ annotationsItem: this.annotationView.item,
+ avisItem: this.avisView.item
}).getInterface();
},
controller: this.annotationController,
model: this.annotationModel
}).getInterface();
+ },
+
+ creeAvis: function() {
+ this.avisModel = new this.ns.AvisModel().getInterface();
+
+ this.avisController = new this.ns.AvisController({
+ model: this.avisModel
+ }).getInterface();
+
+ this.avisView = new this.ns.AvisView({
+ controller: this.avisController,
+ model: this.avisModel
+ }).getInterface();
}
});
--- /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.notes.parametrages.generaux');
+
+/**
+ * @author bper
+ */
+eliot.notes.parametrages.generaux.AvisController = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.notes.parametrages.generaux, config);
+ this.creeItems();
+ },
+
+ 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.addAllEvents();
+ },
+
+ addAllEvents: function() {
+ //this.addEvents();
+ },
+
+ creeConfig: function() {
+ this.config = {
+ model: undefined
+ };
+ return this.config;
+ },
+
+ getInterface: function() {
+ return {
+ loader: this.loader,
+ modifie: this.modifie.createDelegate(this),
+ cree: this.cree.createDelegate(this),
+ supprime: this.supprime.createDelegate(this)
+ }
+ },
+
+ creeItems: function() {
+ this.loader = new Ext.tree.TreeLoader({
+ dataUrl: this.ConfigServeur.url.loadArbreAvis,
+ baseParams: {},
+ uiProviders: {
+ 'col': Ext.ux.tree.ColumnNodeUI
+ },
+ baseAttrs: {
+ iconCls: "no-icon",
+ uiProvider: "col"
+ },
+ createNode: function(attr) {
+ attr.leaf = attr.type == 'AVIS';
+ attr.id = attr.type + '_' + attr.id
+ return Ext.tree.TreeLoader.prototype.createNode.call(this, attr);
+ }
+ });
+ },
+
+ modifie: function(libelle) {
+ var node = this.config.model.getValue();
+
+ var url = undefined;
+ var messsageSucces = undefined;
+ var messsageErreur = undefined;
+
+ switch(node.attributes.type) {
+ case 'TYPE_AVIS':
+ url = this.ConfigServeur.url.modifieTypeAvis;
+ messsageSucces = this.ConfigServeur.messages.succesModifieTypeAvis;
+ messsageErreur = this.ConfigServeur.messages.erreurModifieTypeAvis;
+ break;
+ case 'AVIS':
+ url = this.ConfigServeur.url.modifieAvis;
+ messsageSucces = this.ConfigServeur.messages.succesModifieAvis;
+ messsageErreur = this.ConfigServeur.messages.erreurModifieAvis;
+ break;
+ }
+
+ eliot.commun.AjaxHelper.request({
+
+ url: url,
+
+ params: {
+ id: node.id.match(/\d+/),
+ libelle: libelle
+ },
+
+ success: function(reponse) {
+ eliot.notes.Messages.showConfirmation(messsageSucces);
+ node.attributes.libelle = libelle;
+ node.setText(libelle);
+ },
+
+ failure: function(reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.notes.Messages.showErreur(reponse.message);
+ }
+ else {
+ eliot.notes.Messages.showErreur(messsageErreur);
+ }
+ },
+ scope: this
+ });
+ },
+
+ cree: function(libelle) {
+ var parentNode = this.config.model.getValue();
+
+ eliot.commun.AjaxHelper.request({
+
+ url: this.ConfigServeur.url.creeAvis,
+
+ params: {
+ typeAvisId: parentNode.id.match(/\d+/),
+ libelle: libelle
+ },
+
+ success: function(reponse) {
+ eliot.notes.Messages.showConfirmation(this.ConfigServeur.messages.succesCreeAvis);
+ var newNode = this.loader.createNode(reponse.avis);
+ parentNode.appendChild(newNode);
+ },
+
+ failure: function(reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.notes.Messages.showErreur(reponse.message);
+ }
+ else {
+ eliot.notes.Messages.showErreur(this.ConfigServeur.messages.erreurCreeAvis);
+ }
+ },
+ scope: this
+ });
+ },
+
+ supprime: function() {
+ var node = this.config.model.getValue();
+
+ eliot.commun.AjaxHelper.request({
+
+ url: this.ConfigServeur.url.supprimeAvis,
+
+ params: {
+ id: node.id.match(/\d+/)
+ },
+
+ success: function(reponse) {
+ eliot.notes.Messages.showConfirmation(this.ConfigServeur.messages.succesSupprimeAvis);
+ var node = this.config.model.getValue();
+ this.config.model.setValue(null);
+ node.remove();
+ },
+
+ failure: function(reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.notes.Messages.showErreur(reponse.message);
+ }
+ else {
+ eliot.notes.Messages.showErreur(this.ConfigServeur.messages.erreurSupprimeAvis);
+ }
+ },
+ 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>.
+ */
+
+Ext.ns('eliot.notes.parametrages.generaux');
+
+/**
+ * @author bper
+ */
+eliot.notes.parametrages.generaux.AvisModel = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.notes.parametrages.generaux, config);
+ this.creeItems();
+ },
+
+ 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.addAllEvents();
+ },
+
+ addAllEvents: function() {
+ this.addEvents(this.Constantes.eventId.actionChange);
+ },
+
+ creeConfig: function() {
+ this.config = {};
+ return this.config;
+ },
+
+ creeItems: function() {
+ this.value = undefined;
+ },
+
+ getInterface: function() {
+ return {
+ getValue: this.getValue.createDelegate(this),
+ setValue: this.setValue.createDelegate(this),
+ addListener: this.addListener.createDelegate(this)
+ };
+ },
+
+ setValue: function(value) {
+ this.value = value;
+ this.fireEvent(this.Constantes.eventId.actionChange, 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>.
+ */
+
+Ext.ns('eliot.notes.parametrages.generaux');
+
+/**
+ * @author bper
+ */
+eliot.notes.parametrages.generaux.AvisView = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.notes.parametrages.generaux, config);
+ this.creeItems();
+ },
+
+ 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.addAllEvents();
+ },
+
+ addAllEvents: function() {
+ //this.addEvents();
+ },
+
+ creeConfig: function() {
+ this.config = {
+ controller: undefined,
+ model: undefined
+ };
+ return this.config;
+ },
+
+ getInterface: function() {
+ return {
+ item: this.item
+ }
+ },
+
+ creeItems: function() {
+ this.item = new Ext.Panel({
+ layout: 'border',
+ autoScroll: true,
+ items: [
+ this.creeToolbar(),
+ this.creeCenterItem()
+ ]
+ });
+
+ this.observeModel();
+ },
+
+ creeToolbar: function() {
+ return {
+ id: this.Constantes.composantId.idToolbarAvisPanel,
+ xtype: 'toolbar',
+ region: 'north',
+ height: 35,
+ defaults: {
+ style: 'margin-top: 3px;margin-right: 25px'
+ },
+ items: [
+ this.creeCreerButton(),
+ this.creeModifierButton(),
+ this.creeSupprimerButton()
+ ]
+ };
+ },
+
+ creeCreerButton: function() {
+ this.creerButton = new Ext.Button({
+ text: this.ConfigServeur.libelle.creer,
+ icon: this.ConfigServeur.icon.creer,
+ handler: this.actionCreer,
+ disabled: true,
+ scope: this
+ });
+ return this.creerButton;
+ },
+
+ creeModifierButton: function() {
+ this.modifierButton = new Ext.Button({
+ text: this.ConfigServeur.libelle.modifier,
+ icon: this.ConfigServeur.icon.modifier,
+ handler: this.actionModifier,
+ disabled: true,
+ scope: this
+ });
+ return this.modifierButton;
+ },
+
+ creeSupprimerButton: function() {
+ this.supprimerButton = new Ext.Button({
+ text: this.ConfigServeur.libelle.supprimer,
+ icon: this.ConfigServeur.icon.supprimer,
+ handler: this.actionSupprimer,
+ disabled: true,
+ scope: this
+ });
+ return this.supprimerButton;
+ },
+
+ creeCenterItem: function() {
+
+ var colums = [
+ {
+ dataIndex: 'libelle',
+ renderer: function(libelle, node, obj) {
+ return this.nodeRenderer(node);
+ }.createDelegate(this)
+ }
+ ];
+
+ var root = new Ext.tree.AsyncTreeNode({
+ draggable: false,
+ id: 'root'
+ });
+
+ this.treePanel = new Ext.tree.TreePanel({
+ region: 'center',
+ border: false,
+ frame: false,
+ rootVisible: false,
+ autoHeight: false,
+ useArrows: true,
+ containerScroll: true,
+ autoScroll: true,
+ animate: true,
+ enableDD:false,
+ root: root,
+ columns: colums,
+ loader: this.config.controller.loader
+ });
+
+ this.observeTree();
+
+ return this.treePanel;
+ },
+
+ nodeRenderer: function(node) {
+ var result = Encoder.htmlEncode(node.attributes.libelle);
+ if (!node.isLeaf()) {
+ result = '<span style="font-weight:bold;">' + result + '</span>'
+ }
+ return result;
+ },
+
+ observeModel: function() {
+ this.config.model.addListener(
+ this.Constantes.eventId.actionChange,
+ function(node) {
+ this.gereButtons(node);
+ },
+ this);
+ },
+
+ gereButtons: function(node) {
+ if (!node) {
+ this.creerButton.disable();
+ this.modifierButton.disable();
+ this.supprimerButton.disable();
+ } else {
+ if (node.isLeaf()) {
+ this.creerButton.disable();
+ this.modifierButton.enable();
+ this.supprimerButton.enable();
+ } else {
+ this.creerButton.enable();
+ this.modifierButton.enable();
+ this.supprimerButton.disable();
+ }
+ }
+ },
+
+ observeTree: function() {
+ this.treePanel.getSelectionModel().addListener({
+ selectionchange: {
+ fn: function(treePanel, node) {
+ this.config.model.setValue(node);
+ if (node) {
+ this.observeNode(node);
+ }
+ },
+ scope: this
+ }
+ });
+
+ this.treePanel.addListener({
+ load: {
+ fn: function() {
+ this.treePanel.expandAll();
+ },
+ scope: this
+ }
+ });
+ },
+
+ observeNode: function(node) {
+ node.addListener(
+ 'textchange',
+ function(node, text, oldText) {
+ node.suspendEvents()
+ node.setText(this.nodeRenderer(node));
+ node.resumeEvents()
+ },
+ this);
+ },
+
+ actionCreer: function() {
+ eliot.notes.Messages.resetMessages();
+ eliot.notes.Messages.afficherDialogSaisie(
+ this.ConfigServeur.messages.creerAvis,
+ this.ConfigServeur.libelle.libelle + ' :',
+ this.config.controller.cree,
+ undefined,
+ "",
+ 30
+ );
+ },
+
+ actionModifier: function() {
+ eliot.notes.Messages.resetMessages();
+
+ var node = this.config.model.getValue();
+ var titre = undefined;
+
+ if (node.attributes.type == 'AVIS') {
+ titre = this.ConfigServeur.messages.modifierAvis;
+ } else if (node.attributes.type == 'TYPE_AVIS') {
+ titre = this.ConfigServeur.messages.modifierTypeAvis;
+ }
+
+ eliot.notes.Messages.afficherDialogSaisie(
+ titre,
+ this.ConfigServeur.libelle.libelle + ' :',
+ this.config.controller.modifie,
+ undefined,
+ node.attributes.libelle,
+ 30
+ );
+ },
+
+ actionSupprimer: function() {
+ eliot.notes.Messages.resetMessages();
+ var libelle = this.config.model.getValue().attributes.libelle
+ eliot.notes.Messages.afficherDialogConfirmation(
+ this.ConfigServeur.messages.supprimerAvis,
+ this.ConfigServeur.messages.confirmeSupprimeAvis + ' "' + libelle + '" ?',
+ this.config.controller.supprime
+ );
+ }
+});
\ No newline at end of file
/**
* @author onic
+ * @author bper
*/
eliot.notes.parametrages.generaux.ConfigServeur = {
messages:{
enregistrePrecisionSucces: undefined,
enregistrePrecisionEchec: undefined,
+
succesCreeAnnotation: undefined,
succesEnregistreAnnotation: undefined,
erreurCreeAnnotation: undefined,
succesSupprimeAnnotation: undefined,
erreurSupprimeAnnotation: undefined,
confirmeSupprimeAnnotationTitre: undefined,
- confirmeSupprimeAnnotation: undefined
+ confirmeSupprimeAnnotation: undefined,
+
+ modifierTypeAvis: undefined,
+ modifierAvis: undefined,
+ creerAvis: undefined,
+ supprimerAvis: undefined,
+ confirmeSupprimeAvis: undefined,
+ succesModifieTypeAvis: undefined,
+ erreurModifieTypeAvis: undefined,
+ succesModifieAvis: undefined,
+ erreurModifieAvis: undefined,
+ succesCreeAvis: undefined,
+ erreurCreeAvis: undefined,
+ succesSupprimeAvis: undefined,
+ erreurSupprimeAvis: undefined
},
url:{
enregistrePrecision: undefined,
+
enregistreAnnotation: undefined,
- supprimeAnnotation: undefined
+ supprimeAnnotation: undefined,
+
+ loadArbreAvis: undefined,
+ modifieTypeAvis: undefined,
+ creeAvis: undefined,
+ modifieAvis: undefined,
+ supprimeAvis: undefined
},
libelle: {
modifier: undefined,
supprimer: undefined,
code: undefined,
- libelle: undefined
+ libelle: undefined,
+ avis: undefined
},
icon: {
},
composantId: {
- idToolbarAnnotationPanel: 'idToolbarAnnotationPanel'
+ idToolbarAnnotationPanel: 'idToolbarAnnotationPanel',
+ idToolbarAvisPanel: 'idToolbarAvisPanel'
},
storeId: {
creeConfig: function() {
this.config = {
precisionNotesItem: undefined,
- annotationsItem: undefined
+ annotationsItem: undefined,
+ avisItem: undefined
};
return this.config;
},
border: false,
layout: 'fit',
items:[this.config.annotationsItem]
+ },
+ {
+ title: this.ConfigServeur.libelle.avis,
+ xtype: 'panel',
+ frame: false,
+ border: false,
+ layout: 'fit',
+ items:[this.config.avisItem]
}
]
});