package baseEvaluations; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.Date; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import MEPTL.commandes; import MEPTL.meptl; import MEPTL.verificationFichierAnalyse; import cXML.Run; import cXML.node; import fenetres.ChargeFichierXML; public class chargeEvaluationSelected { public chargeEvaluationSelected(node evaluation) { //* Charge le node sujet provisoirement commandes.evaluationChargeEnMemoire = evaluation; 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.versionEvaluation = 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("
Le fichier d'analyse est déjà chargé depuis la base de données.
Cependant, vous avez le fichier d'analyse qui se trouve dans le dossier :
" + ""+CheminVersFileXML+"
" + "Et dont la date est plus récente que le fichier d'analyse qui se trouve dans la base.
Voulez-vous le charger depuis ce dossier ?
"); 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; } /** * Charge le fichier d'analyse de l'évaluation.