MAJ V4.5.0

This commit is contained in:
pablo rodriguez 2024-04-30 10:02:44 +02:00
parent 27df011b47
commit 80440c6035
9 changed files with 93 additions and 384 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2043,6 +2043,12 @@ public class meptl {
if(commandes.nodeCSV!=null) {
csv = commandes.nodeCSV;
separator = commandes.nodeCSV.getAttributs().get("separator");
encoding = commandes.nodeCSV.getAttributs().get("encoding");
nameid = commandes.nodeCSV.getAttributs().get("id");
nameemail = commandes.nodeCSV.getAttributs().get("email");
nameStudent = commandes.nodeCSV.getAttributs().get("name");
firstnameStudent = commandes.nodeCSV.getAttributs().get("firstname");
}else {
csv = commandes.sujet.retourneFirstEnfantsByName("csv");
csv.getAttributs().put("nameListStudent", nameListStudent);
@ -2087,7 +2093,13 @@ public class meptl {
if(!target[0].contains(separator)||!target[0].contains(nameid)
||!target[0].contains(nameemail)||!target[0].contains(nameStudent)
||!target[0].contains(firstnameStudent)) {
JOptionPane.showMessageDialog(null, "Le fichier CSV ne correspond pas\nà la définition des paramètres d'importation", "Erreur CSV", JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, "<html><p>Le fichier CSV ne correspond pas à la définition des paramètres d'importation.</p>"
+ "<p>Les paramètres d'importation sont :</p>"
+ "<ol><li>Séparateur : "+separator +"</li>"
+ "<li>Champ nom de l'étudiant : "+nameStudent+"</li>"
+ "<li>Champ prénom de l'étudiant : "+firstnameStudent+"</li>"
+ "<li>Champ identifiant de l'étudiant : " +nameid +"</li>"
+ "<li>Champ email de l'étudiant : "+nameemail +"</li></ol></html>", "Erreur CSV", JOptionPane.INFORMATION_MESSAGE);
return false;
}

View File

@ -0,0 +1,16 @@
package baseListesEtudiants;
import MEPTL.commandes;
public class chargeListeEtudiants {
public static void chargeDansleNodeCSVListeEtudiants(Integer index) {
if(commandes.listesEtudiants!=null) {
if(commandes.listesEtudiants.getNodes().size()>0) {
commandes.nodeCSV = commandes.listesEtudiants.getNodes().get(index);
commandes.fourniCSV=true;
}
}
}
}

View File

@ -42,8 +42,8 @@ public class recupeNodeBaseListesEtudiants {
targetString.append(line);
}
String codeTexte = "<!-- A -->" + targetString.toString().replace("\t","").replace("\r", "").replace("\n", "");
node nodRetourne = new node(codeTexte.replaceAll(">/{1,}<", "><")); //Le node A est nécessaire.
codeTexte = codeTexte.replaceAll(">/{1,}<", "><");
node nodRetourne = new node(codeTexte);
if(nodRetourne.getNomElt().equals("fichier")) {
nodRetourne.setNomElt("ListesEtudiants");

View File

@ -489,7 +489,6 @@ private void ListenerAction() {
* Chargement d'une évaluation par double click.
*/
table.addMouseListener( new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
@ -661,371 +660,4 @@ private void ListenerAction() {
}
///**
// * charge en mémoire l'évaluation sélectionnée.<br>
// * @param evaluation
// */
//private void chargeEvaluationSelected(node evaluation) {
//
// //* Charge le node sujet provisoirement
// commandes.NameEvaluationCharger= evaluation.getAttributs().get("name");
// commandes.path = evaluation.getAttributs().get("path"); //Dossier des fichiers des étudiants
// node sujetLoad = new node(Run.ecritureXMLDansStringBuilder(evaluation.retourneFirstEnfantsByName("fichier"), Run.TypeFile.Sujet).replace("\t","").replace("\r", "").replace("\n", ""));
// commandes.sujet = sujetLoad;
//
//// Chargement provisoire du node sujet depuis la base
//
// commandes.nameSujet = evaluation.getAttributs().get("analysis_filename");
// commandes.PathFilenameAnalysis = evaluation.getAttributs().get("PathFilenameAnalysis");
//
// //** Les paramètres
// commandes.version = evaluation.getAttributs().get("version");
// commandes.fichierStudentMoodle = Boolean.valueOf(evaluation.getAttributs().get("fichierStudentMoodle"));
// commandes.sansFeeback = Boolean.valueOf(evaluation.getAttributs().get("sansFeeback"));
// commandes.noDetail = Boolean.valueOf(evaluation.getAttributs().get("noDetail"));
// commandes.noNote = Boolean.valueOf(evaluation.getAttributs().get("noNote"));
// commandes.zipfeedback = Boolean.valueOf(evaluation.getAttributs().get("zipfeedback"));
// commandes.verifHisto2 = Boolean.valueOf(evaluation.getAttributs().get("verifHisto2"));
// commandes.ecritNoteCSV = Boolean.valueOf(evaluation.getAttributs().get("ecritNoteCSV"));
// commandes.newLogo = Boolean.valueOf(evaluation.getAttributs().get("newLogo"));
// commandes.noLogo = Boolean.valueOf(evaluation.getAttributs().get("noLogo"));
// commandes.fourniCSV = Boolean.valueOf(evaluation.getAttributs().get("fourniCSV"));
// commandes.nameCSV = evaluation.getAttributs().get("nameCSV");
//
// if(evaluation.getAttributs().get("analyse_nombres_modifications_simultané_maxi")!=null) {
// commandes.analyse_nombres_modifications_simultané_maxi = Integer.valueOf(evaluation.getAttributs().get("analyse_nombres_modifications_simultané_maxi"));
// }
//
// commandes.fourniCSV = Boolean.valueOf(evaluation.getAttributs().get("fourniCSV"));
// commandes.nameSVG = evaluation.getAttributs().get("nameSVG");
//
//
// commandes.nodeCSV = evaluation.retourneFirstEnfantsByName("fileCSV");
//
// commandes.contenuFichierSVG = evaluation.retourneFirstEnfantsByName("nodSVG").retourneLesContenusEnfants("");
//
// commandes.fichierAnalyseValide = true;
//
//
//
// //* Rechercher la source
// String CheminVersFileXML = "";
// if(commandes.os.contains("Win")) {
// commandes.PathFilenameAnalysis.replaceAll("/", "\\"); // Sur Windows
// CheminVersFileXML = commandes.PathFilenameAnalysis + "\\" + commandes.nameSujet;
//
// }else {
// commandes.PathFilenameAnalysis.replaceAll("\\", "/"); // Sur Windows // Sur mac & Linux
// CheminVersFileXML = commandes.PathFilenameAnalysis + "/" + commandes.nameSujet;
// }
//
// File file = new File(CheminVersFileXML);
// if(file.exists()) {
//
// if (recupereDateFichierAnalyseSource(file)!=null) {
//
// Date DateFichierSource = recupereDateFichierAnalyseSource(file);
// Date DateFichierAnalyseBase = calcul.formatDateWriter.dateNodeSujet();
//
// if(DateFichierAnalyseBase.before(DateFichierSource)) {
// JFrame frame = new JFrame();
// JLabel text = new JLabel();
// text.setText("<html><p>Le fichier d'analyse est déjà chargé depuis la base de données.</p><br>"
// + "<p>Cependant, vous avez le fichier d'analyse qui se trouve dans le dossier :</p>"
// + "<p>"+CheminVersFileXML+"</p>"
// + "<p>Et dont la date est plus récente que le fichier d'analyse qui se trouve dans la base.</p><br><hr>"
// + "<p>Voulez-vous le charger depuis ce dossier ?</p></html>");
// if (JOptionPane.showConfirmDialog(frame, text, "WARNING",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
// chargeLeNodeSujet(file);
// commandes.path = evaluation.getAttributs().get("path"); //Recharge le chemin vers le dossier contenant les fichiers des étudiants
//
// }
// }
//
//
// }
//
//
// }
//
//
// commandes.initialiseParametresSettingProprietes();
// try {
// commandes.sujetSauvegarde = commandes.sujet.clone();
// } catch (CloneNotSupportedException e) {
// e.printStackTrace();
// }
//
// //Chargement des paramètres du fichier d'analyse
// meptl.chargementParametresFichierAnalyse();
//
//
//
// //** Remise à zéro de la base dans la mémoire de l'application
// commandes.evaluationsBase = null;
//
// //** Affichage de la fenêtre
// if(!evaluate.isDispose) {
// evaluate.getInstance();
// };
// if(!create.isDispose) {
// create.getInstance();
// };
//
// isDispose=true;
//
//}
///**
// * Charge le fichier d'analyse de l'évaluation.<br>
// * @param file
// */
//private void chargeLeNodeSujet(File file) {
//
// BufferedReader br;
// try {
// br = new BufferedReader(
// new InputStreamReader(
// new FileInputStream(file.getAbsoluteFile()), "UTF-8"));
// String line;
// StringBuilder targetString = new StringBuilder();
// while ((line = br.readLine()) != null) {
// targetString.append(line);
// }
//
// //node.node2(targetString);
// node sujetLoad = new node(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
//
// // Vérification de la conformité du fichier d'analyse
// if(!ChargeFichierXML.fichierSujetValide(sujetLoad)) {
// JOptionPane.showMessageDialog(null, "Le fichier d'analyse n'est pas valide.");
// }else {
// commandes.initialiseParametresSettingProprietes();
// commandes.sujet = sujetLoad;
// commandes.sujetSauvegarde = commandes.sujet.clone();
//
// //Chargement des paramètres du fichier d'analyse
// System.out.println( "Chargement des paramètres du fichier d'analyse");
// meptl.chargementParametresFichierAnalyse();
//
// // Rechercher des erreurs dans le fichier d'analyse
// System.out.println( "Vérification du fichier d'analyse" );
// new verificationFichierAnalyse();
// }
//
// } catch (UnsupportedEncodingException e1) {
// e1.printStackTrace();
// } catch (FileNotFoundException e1) {
// e1.printStackTrace();
// } catch (Exception e) {
// }
//
// }
//private Date recupereDateFichierAnalyseSource(File file) {
// BufferedReader br;
// try {
// br = new BufferedReader(
// new InputStreamReader(
// new FileInputStream(file.getAbsoluteFile()), "UTF-8"));
// String line;
// StringBuilder targetString = new StringBuilder();
// while ((line = br.readLine()) != null) {
// targetString.append(line);
// }
//
// //node.node2(targetString);
// node sujetLoad = new node(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
//
// // Vérification de la conformité du fichier d'analyse
// if(!ChargeFichierXML.fichierSujetValide(sujetLoad)) {
// JOptionPane.showMessageDialog(null, "Le fichier d'analyse n'est pas valide.");
// }else {
// if(sujetLoad.getAttributs().get("date")!=null) {
// String dateString = sujetLoad.getAttributs().get("date");
// return calcul.formatDateWriter.DateLibreOffice(dateString);
// }
//
// }
//
// } catch (UnsupportedEncodingException e1) {
// e1.printStackTrace();
// } catch (FileNotFoundException e1) {
// e1.printStackTrace();
// } catch (Exception e) {
// }
// return null;
//
//}
//private void ecritureBaseEvaluation(node evaluations) throws IOException {
//// File directory = new File(FileSystemView.getFileSystemView().getDefaultDirectory().getPath());
//// Run.ecritureNodeEnXML(evaluations, "base_evaluations_analyseWriter.xml", directory.getAbsolutePath(), Run.TypeFile.Evaluation);
//
// String directoryName = "";
// if(commandes.PathBaseEvaluationDefaut) {
// directoryName = Paths.get("").toAbsolutePath().toString();
// }else {
// directoryName = commandes.PathBaseEvaluations;
// }
// Run.ecritureNodeEnXML(evaluations, commandes.NameBaseEvaluations, directoryName, Run.TypeFile.Evaluation);
//
//}
//private boolean isEvaluationExist(String nameEvaluation) {
// if(commandes.evaluationsBase.retourneFirstNodeByNameAndAttributValueExactStrict("evaluation", "name", nameEvaluation)!=null) return true;
// return false;
//}
//private node creationNodeEvaluation(node evaluation, String name) {
// evaluation.setNomElt("evaluation");
// Date aujourdhui = new Date();
// evaluation.getAttributs().put("version", commandes.version);
// evaluation.getAttributs().put("name", name);
// evaluation.getAttributs().put("PathFilenameAnalysis", commandes.PathFilenameAnalysis);
// evaluation.getAttributs().put("path", commandes.path);
// evaluation.getAttributs().put("fichierStudentMoodle", String.valueOf(commandes.fichierStudentMoodle));
// evaluation.getAttributs().put("sansFeeback", String.valueOf(commandes.sansFeeback) );
// evaluation.getAttributs().put("noDetail", String.valueOf(commandes.noDetail) );
// evaluation.getAttributs().put("noNote", String.valueOf(commandes.noNote) );
// evaluation.getAttributs().put("zipfeedback", String.valueOf(commandes.zipfeedback) );
// evaluation.getAttributs().put("verifHisto2", String.valueOf(commandes.verifHisto2) );
// evaluation.getAttributs().put("ecritNoteCSV", String.valueOf(commandes.ecritNoteCSV) );
// evaluation.getAttributs().put("newLogo", String.valueOf(commandes.newLogo) );
// evaluation.getAttributs().put("noLogo", String.valueOf(commandes.noLogo) );
// evaluation.getAttributs().put("analyse_nombres_modifications_simultané_maxi", String.valueOf(commandes.analyse_nombres_modifications_simultané_maxi) );
//
// //Supprime le node fichier s'il existe.
// node nodremove = evaluation.retourneFirstEnfantsByName("fichier");
// if(!nodremove.isVide()) evaluation.getNodes().remove(nodremove);
//
// evaluation.getNodes().add(commandes.sujet);
//
// if(commandes.sujet.getAttributs().get("analysis_filename").contains(".xml")) {
// evaluation.getAttributs().put("analysis_filename",commandes.sujet.getAttributs().get("analysis_filename"));
// }else {
// evaluation.getAttributs().put("analysis_filename",commandes.nameSujet);
// }
//
//
// evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
// if(commandes.nameCSV!=null) {
// evaluation.getAttributs().put("nameCSV", commandes.nameCSV );
// }else {
// evaluation.getAttributs().put("nameCSV", "");
// }
//
// evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
// if(commandes.nameSVG!=null) {
// evaluation.getAttributs().put("nameSVG", commandes.nameSVG );
// }else {
// evaluation.getAttributs().put("nameSVG", "" );
// }
//
//
// //Supprime le node fichier s'il existe.
// nodremove = evaluation.retourneFirstEnfantsByName("fileCSV");
// if(!nodremove.isVide()) evaluation.getNodes().remove(nodremove);
//
// evaluation.getNodes().add(commandes.nodeCSV);
//
// try {
// evaluation.getAttributs().put("date", calcul.formatDateWriter.DateLibreOffice(aujourdhui));
// } catch (ParseException e) {
// e.printStackTrace();
// }
//
// if(commandes.nameSVG!=null) {
// if(!commandes.nameSVG.isBlank() && !commandes.contenuFichierSVG.isBlank()) {
// node SVG = new node();
// SVG.setNomElt("nodSVG");
// SVG.setContenu(commandes.contenuFichierSVG);
// evaluation.getNodes().add(SVG);
// }
// }
//
// return evaluation;
//
//}
//private void recupeNodeBaseEvaluations() {
//
//// File directory = new File(FileSystemView.getFileSystemView().getDefaultDirectory().getPath());
//
// String directoryName = "";
// File file = null;
// if(commandes.PathBaseEvaluationDefaut) {
// directoryName = Paths.get("").toAbsolutePath().toString();
// }else {
// directoryName = commandes.PathBaseEvaluations;
// }
//
// if(commandes.os.contains("Win")) {
// file = new File(directoryName + "\\" + commandes.NameBaseEvaluations);
// }else {
// file = new File(directoryName + "/" + commandes.NameBaseEvaluations);
// }
//
// if(file!=null) {
// BufferedReader br;
// try {
// br = new BufferedReader(
// new InputStreamReader(
// new FileInputStream(file.getAbsoluteFile()), "UTF-8"));
// String line;
// StringBuilder targetString = new StringBuilder();
// while ((line = br.readLine()) != null) {
// targetString.append(line);
// }
// node evaluations = new node(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
// if(evaluations!=null) {
// if(evaluations.getNodes().size()>0) {
// if(evaluations.getNomElt().equals("evaluations")) {
// commandes.evaluationsBase = evaluations;
// }
// }
// }
// }catch (Exception e) {
// JFrame frame = new JFrame();
// JLabel texte = new JLabel("<html><p>La base de données ne se trouve pas dans le même dossier<br>que celui de l'application.</p><br>"
// +"<p>Vous pouvez charger la base de données depuis la fenêtre \"<b>base de données d'évaluation</b>\" de l'application.</p>"
// + "<p>Sinon, une nouvelle base de données sera créé dans le dossier de l'application.</p></html>");
// JOptionPane.showMessageDialog(frame, texte);
// }
// }
//
//}
//private void afficheInformationEvaluation() {
// node evaluation = commandes.evaluationsBase.getNodes().get(indexSelect);
// node fichieranalyse = evaluation.retourneFirstEnfantsByName("fichier");
// String version = evaluation.getAttributs().get("version");
// String auteur = fichieranalyse.getAttributs().get("auteur");
// String path = evaluation.getAttributs().get("path");
// String modesuivi = fichieranalyse.getAttributs().get("historiquePresent");
// String baremeAlpha = fichieranalyse.getAttributs().get("baremeABC");
// String dossierNominatif = evaluation.getAttributs().get("fichierStudentMoodle");
// String bareme = "";
// if(!Boolean.valueOf(fichieranalyse.getAttributs().get("baremeABC"))) {
// bareme = fichieranalyse.getAttributs().get("notefrom");
// }
// String progression = fichieranalyse.getAttributs().get("progression");
//
// textPane.setText("Version analyseWriter : " + version+
// "\nAuteur : " + auteur +
// "\nLes fichiers des étudiants sont dans des dossiers nominatifs : " + dossierNominatif+
// "\nBarème alphabétique : " + baremeAlpha +
// "\nMode de suivi activé : " + modesuivi);
//
// textPane_1.setText("Path des étudiants : " + path +
// "\nBarème : " + bareme +
// "\nCoef. de progression : " + progression);
//}
}

View File

@ -4,6 +4,8 @@ import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@ -19,7 +21,7 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableColumnModel;
import MEPTL.commandes;
import action.actAddStudentBaseListesEtudiants;
import baseListesEtudiants.chargeListeEtudiants;
import baseListesEtudiants.myTableBaseListesEtudiants;
import net.miginfocom.swing.MigLayout;
@ -158,6 +160,48 @@ public class baseDonneesListesEtudiants extends JFrame{
});
table.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
System.out.println("un click ou deux click");
if(lsm!=null)if (!lsm.isSelectionEmpty()) {
indexSelect = lsm.getMinSelectionIndex();
chargeListeEtudiants.chargeDansleNodeCSVListeEtudiants(indexSelect);
evaluate.getInstance();
baseDonneesListesEtudiants.getInstance();
}
}
}
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
});
}
}

View File

@ -419,12 +419,14 @@ public class evaluate extends JFrame {
if(commandes.fourniCSV) {
lblChargementFichierCSV.setBackground(new Color(40,180,40));
lblChargementFichierCSV.setText("Liste des étudiants");
if(commandes.nodeCSV.getAttributs().get("nameListStudent")==null) {
commandes.nodeCSV.getAttributs().put("nameListStudent","?");
commandes.nodeCSV.getAttributs().put("year", "?");
}
lblChargementFichierCSV.setText("Liste des étudiants : " + commandes.nodeCSV.getAttributs().get("nameListStudent"));
lblChargementFichierCSV.setOpaque(true);
// lblFichierCSV.setText("<HTML><B><U>Fichier CSV</U></B> : " + commandes.nameCSV + "</HTML>");
}else {
lblChargementFichierCSV.setOpaque(false);
// lblFichierCSV.setText("<HTML><B><U>Fichier CSV</U></B></HTML>");
}
@ -579,10 +581,6 @@ public class evaluate extends JFrame {
toolBar.add(btnSaveEvaluation);
// JButton btnSaveEvluation = toolBar.add( new actSaveHistoriqueEvaluation() );
// btnSaveEvluation.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// }
// });
// btnSaveEvluation.setIcon(new ImageIcon(create.class.getResource("/resources/sauvegardehistoriqueevaluation.png")));
// btnSaveEvluation.setHideActionText(true);
// toolBar.add(btnSaveEvluation);
@ -746,12 +744,15 @@ public class evaluate extends JFrame {
chckPasDeProgression.setEnabled(true);
if(commandes.fourniCSV) {
if(commandes.nodeCSV.getAttributs().get("nameListStudent")==null) {
commandes.nodeCSV.getAttributs().put("nameListStudent","?");
commandes.nodeCSV.getAttributs().put("year", "?");
}
lblChargementFichierCSV.setBackground(new Color(40,180,40));
lblChargementFichierCSV.setText("Liste des étudiants");
lblChargementFichierCSV.setText("Liste des étudiants : " + commandes.nodeCSV.getAttributs().get("nameListStudent"));
lblChargementFichierCSV.setOpaque(true);
}else {
lblChargementFichierCSV.setOpaque(false);
// lblFichierCSV.setText("<HTML><B><U>Fichier CSV</U></B></HTML>");
}
@ -1192,8 +1193,12 @@ public class evaluate extends JFrame {
if(commandes.fourniCSV) {
if(commandes.nodeCSV.getAttributs().get("nameListStudent")==null) {
commandes.nodeCSV.getAttributs().put("nameListStudent","?");
commandes.nodeCSV.getAttributs().put("year", "?");
}
lblChargementFichierCSV.setBackground(new Color(40,180,40));
lblChargementFichierCSV.setText("Liste des étudiants");
lblChargementFichierCSV.setText("Liste des étudiants : " + commandes.nodeCSV.getAttributs().get("nameListStudent"));
lblChargementFichierCSV.setOpaque(true);
}else {
lblChargementFichierCSV.setOpaque(false);