diff --git a/Readme.md b/Readme.md index edaffb5..456653d 100644 --- a/Readme.md +++ b/Readme.md @@ -1,8 +1,6 @@ # analyseWriter L'application analyse et note les fichiers de traitement de texte au format ODF des étudiants. Le format natif des suites de bureautique, LibreOffice, OpenOffice, Trio Office). -Tutoriels : https://www.youtube.com/channel/UCBSfItcCVnbRJdQbVE9ppjQ - Cette application permet d’évaluer un très grand nombre de fichiers réalisés par des étudiants en suivant les consignes du fichier d’analyse. Elle permet de facilité l'importation des notes et des feedbacks des étudiants sur Moodle. C’est une application console (sans interface) écrite en java. @@ -16,3 +14,8 @@ C’est une application console (sans interface) écrite en java. • De générer des archives au format ZIP contenant tous les feedbacks (comptes-rendus) des étudiants. Ces archives peuvent être utilisées sur Moodle. Elles permettent d’importer tous les feedbacks (comptes-rendus) des étudiants. • d’importer les notes des étudiants et diverses informations dans un fichier au format CSV. Les notes peuvent être alors importer dans le carnet de note du CMS Moodle. • de générer des fichiers d’analyses pour créer ses propres évaluations. + +### Tutoriels : +https://artoistv.univ-artois.fr/video/4334-presentation-analysewriter/ + +https://www.youtube.com/channel/UCBSfItcCVnbRJdQbVE9ppjQ \ No newline at end of file diff --git a/analyseWriter.jar b/analyseWriter.jar index 6402e07..d104a03 100644 Binary files a/analyseWriter.jar and b/analyseWriter.jar differ diff --git a/bin/MEPTL/meptl.class b/bin/MEPTL/meptl.class index a1dab93..f9d088b 100644 Binary files a/bin/MEPTL/meptl.class and b/bin/MEPTL/meptl.class differ diff --git a/bin/MEPTL/verificationFichierAnalyse.class b/bin/MEPTL/verificationFichierAnalyse.class index 5a37487..27649be 100644 Binary files a/bin/MEPTL/verificationFichierAnalyse.class and b/bin/MEPTL/verificationFichierAnalyse.class differ diff --git a/src/MEPTL/feedbacks.java b/src/MEPTL/feedbacks.java new file mode 100644 index 0000000..551e4e7 --- /dev/null +++ b/src/MEPTL/feedbacks.java @@ -0,0 +1,556 @@ +package MEPTL; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.DateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.FormatStyle; +import java.util.ArrayList; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import cXML.node; + +public class feedbacks { + + public feedbacks() { + + } + /** + * Ecriture du fichier feedback.
+ * Si zip = true alors pour archive.
+ * Si zip = false alors pour fichier html.
+ *
+ * @param nodana : node de l'analyse de l'étudiant. + * @param verif : node de vérification (ensemble des vérifications des historiques) + * @parame zip : Pour créer un fichier html ou une archive zip. + * @return + * @throws IOException + */ + public static StringBuilder feedback(node nodana, node verif, Boolean zip) throws IOException { + + System.getProperty("file.encoding","UTF-8"); + Date aujourdhui = new Date(); + + int number_match = 2; + int mini_modification = 0; + boolean plagiat = false; + boolean copiercoller = false; + boolean pasAssezDeModification =false; + boolean baremeABC = false; + boolean producteur =false; + String SuiteBureautique=""; + String VersionLibreOffice=""; + String SystemeStudent=""; + node verifStudent = null; + if((commandes.verifHisto||commandes.verifHisto2)) { //&&commandes.ecritNoteCSV&&commandes.fourniCSV + if(verif.getAttributs().get("number_match") != null) number_match = Integer.valueOf(verif.getAttributs().get("number_match")); + if(verif.getAttributs().get("mini_number_modification") != null) mini_modification = Integer.valueOf(verif.getAttributs().get("mini_number_modification")); + + //verification du plagiat + verifStudent = verif.retourneFirstNodeByNameAndAttributValue("fichier", "dossier", nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier")); + if(verifStudent != null) { + if(verifStudent.getAttributs().get("filename").equals(nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("filename"))) { + if(Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>number_match) plagiat=true; + if(!verifStudent.getAttributs().get("first_modification_identique").equals("null") && Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>=number_match) plagiat=true; + if(verifStudent.getAttributs().get("copier_coller")!=null) copiercoller=true; + if(Integer.valueOf(verifStudent.getAttributs().get("nombre_modification"))<=mini_modification) pasAssezDeModification=true; + } + } + } + if(nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("baremeABC")!=null) { + try { + baremeABC= Boolean.valueOf(nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("baremeABC")); + }catch (Exception e) { + System.out.println("Problème avec la valeur binaire de l'attribut baremeABC."); + } + } + + + StringBuilder fichier = new StringBuilder(); + + //ajoute le chemin vers le feedback dans le node d'analyse + //nodana.retourneFirstEnfantsByName("ouverture").getAttributs().put("feedback", patch + "/" + cheminFeedBack); + + // auteur du sujet + String auteurSujet = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("auteur"); + if(auteurSujet==null) auteurSujet=""; + + + //création du feedback + fichier.append("\r" + + "\r" + + "\r" + + "\r" + + "Analyse LibreOffice Calc\r"); + + fichier.append("" + + "" + + ""); + + + fichier.append(""); + + fichier.append("\r"); + fichier.append("\r"); + + fichier.append("
"); + if(!commandes.noLogo) { + if(!commandes.newLogo) { + fichier.append("

\r\n" + + "Feedback - AnalyseWriter - format ODF 1.2
"+HTML.imgLogos()+"

\r"); + }else { + + fichier.append("

\r\n" + + "Feedback - AnalyseWriter - format ODF 1.2
"+commandes.contenuFichierSVG+"

\r"); + } + }else { + fichier.append("

\r\n" + + "Feedback - AnalyseWriter - format ODF 1.2

\r"); + } + + //Note + node ouvre = nodana.retourneFirstEnfantsByName("ouverture"); + String noteFrom = ouvre.getAttributs().get("notefrom"); + node notation = nodana.retourneFirstEnfantsByName("bodyetnotation"); + if(!baremeABC) { + if(noteFrom ==null) noteFrom="20"; + if(!commandes.noNote) if(!plagiat&&!copiercoller&&!pasAssezDeModification) fichier.append("

" + notation.getAttributs().get("note") + " / " + noteFrom +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); + if(plagiat || copiercoller || pasAssezDeModification) { + notation.getAttributs().put("note","0"); + String AffichageNote = ""; + if(plagiat) AffichageNote = " Plagiat "; + if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; + if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; + if(!commandes.noNote) fichier.append("

" + AffichageNote + " / " + noteFrom +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); + } + }else { + String imageNote = ""; + switch (notation.getAttributs().get("noteABC")) { + case "A": + imageNote = HTML.NoteA(); + break; + case "B": + imageNote = HTML.NoteB(); + break; + case "C": + imageNote = HTML.NoteC(); + break; + case "D": + imageNote = HTML.NoteD(); + break; + case "E": + imageNote = HTML.NoteE(); + break; + default: + imageNote = ""; + break; + } + if(!commandes.noNote) if(!plagiat&& !copiercoller &&!pasAssezDeModification) fichier.append("

" + imageNote +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); + if(plagiat || copiercoller || pasAssezDeModification) { + notation.getAttributs().put("note","0"); + notation.getAttributs().put("noteABC","E"); + String AffichageNote = ""; + if(plagiat) AffichageNote = " Plagiat "; + if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; + if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; + if(!commandes.noNote) fichier.append("

" + AffichageNote + " / " + "
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); + } + } + + + //producteur + if(ouvre.getAttributs().get("producteur")!=null) { + try { + producteur= true; + String[] decompose = ouvre.getAttributs().get("producteur").split("/"); + SuiteBureautique=decompose[0]; + VersionLibreOffice=decompose[1].substring(0, decompose[1].lastIndexOf("$")); + SystemeStudent=decompose[1].substring(decompose[1].lastIndexOf("$")+1, decompose[1].lastIndexOf(" ")); + }catch (Exception e) { + System.out.println("Problème avec l'attribut producteur."); + + }finally { + + } + } + + //********************** + //** Les informations ** + //********************** + // date d'analyse, dossier étudiant, auteur sujet, date de la dernière modificatio, lien, algorithme + DateFormat mediumDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM); + LocalDateTime dateTimeModif = null; + String dateModif=""; + if(!ouvre.getAttributs().get("dateModification").isEmpty()) { + try { + dateTimeModif = LocalDateTime.parse(ouvre.getAttributs().get("dateModification")); + dateModif = dateTimeModif.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)); + }catch (Exception e) { + System.out.println(e.toString()); + } + } + + fichier.append("

Date d'analyse : "+ mediumDateFormat.format(aujourdhui) + "
"); + fichier.append("Dossier étudiant : "+ ouvre.getAttributs().get("dossier") + "
"); + fichier.append("Nom du fichier : "+ ouvre.getAttributs().get("filename") + "
"); + fichier.append("Date de la dernière modification du fichier analysé : "+ dateModif + "
"); + fichier.append("Durée d'édition du fichier analysé : "+ meptl.traitementDureeEdition(ouvre.getAttributs().get("dureeEdition") + "
")); + if(producteur) { + fichier.append("Suite de bureautique de l'étudiant : "+ SuiteBureautique + ""); + fichier.append(" - Version : "+ VersionLibreOffice + ""); + fichier.append(" - Système : "+ SystemeStudent + "
"); + } + fichier.append("
"); + if(!auteurSujet.isEmpty()) {fichier.append("Sujet créé par : "+ auteurSujet + "
");} + fichier.append("Hash du fichier analyse : "+ ouvre.getAttributs().get("hash") + "
"); + fichier.append("Nom du fichier analyse : "+ commandes.nameSujet + "
"); + fichier.append("Titre de l'exercice : "+ ouvre.getAttributs().get("titre") + "
"); + + if(!commandes.noNote) { + if(!plagiat&&!copiercoller&&!pasAssezDeModification) fichier.append("Méthode :
Progression " + ouvre.getAttributs().get("progression") + "Explication
"+ HTML.imgProgression() +"
- Pourcentage correcte : " + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("proportioncorrect") +"
"); + if(plagiat || copiercoller || pasAssezDeModification) { + String AffichageNote = ""; + if(plagiat) AffichageNote = " Plagiat "; + if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; + if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; + fichier.append("Méthode :
Progression " + ouvre.getAttributs().get("progression") + "Explication
"+ HTML.imgProgression() +"
- Pourcentage correcte : "+ AffichageNote +"
"); + } + if(baremeABC) { + fichier.append("Barème :
0% → E → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneE"))*100) + "% → D → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneD"))*100) + "% → C → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneC"))*100) + "% → B → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneB"))*100) + "% → A → 100%Prendre en compte le coefficient de progression.
"); + } + } + + + + + if(ouvre.getAttributs().get("link_sujet")!=null) { + String linkSujet= ouvre.getAttributs().get("link_sujet"); + Matcher m = Pattern.compile("^https://.{1,}|^http://.{1,}").matcher(linkSujet); + if(m.find()) {fichier.append("
Lien vers le sujet
");} + } + if(ouvre.getAttributs().get("link_help")!=null) { + String linkSujet= ouvre.getAttributs().get("link_help"); + Matcher m = Pattern.compile("^https://.{1,}|^http://.{1,}").matcher(linkSujet); + if(m.find()) {fichier.append("
Lien vers le support
");} + } + + fichier.append("
Analysé avec la version : " + commandes.version + "

"); + + + fichier.append(HTML.SautLigne()); + + fichier.append("
"); + + //ajoute le menu + fichier.append(HTML.getHTMLmenu(nodana.retourneFirstEnfantsByName("menu").getNodes())); + + + //Les erreurs + node errors = nodana.retourneFirstEnfantsByName("erreurs"); + if(Boolean.valueOf(errors.getAttributs().get("oneError"))) { + fichier.append(HTML.SautLigne()); + if(Boolean.valueOf(errors.getAttributs().get("manqueHistorique"))) fichier.append(HTML.Paragraph_classp5("ERREUR : Il n'y a pas d'historique des modifications dans ce fichier. Le fichier n'a pas été modifié ou il a été réïnitialisé.
L'analyse de l'historique n'a pas pu se faire.")); + if(Boolean.valueOf(errors.getAttributs().get("manqueCreationDate"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La date de création du fichier a été supprimée. Le fichier a été réïnitialisé ou ce n'est pas le fichier du sujet.")); + if(Boolean.valueOf(errors.getAttributs().get("manqueValeurCreationDate"))) fichier.append(HTML.Paragraph_classp5("ERREUR : Ce n'est pas la bonne date de création du fichier. Le fichier a été réïnitialisé ou ce n'est pas le fichier du sujet.")); + if(Boolean.valueOf(errors.getAttributs().get("manqueMetaSujet"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La méta donnée \"Sujet\" dans les propriétés du fichier a été supprimée ou renommée.")); + if(Boolean.valueOf(errors.getAttributs().get("manqueValeurMetaSujet"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La valeur de la méta donnée \"Sujet\" dans les propriétés du fichier n'est pas \"" + nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("metaSujet"))+".\""); + if(Boolean.valueOf(errors.getAttributs().get("manqueInitialCreator"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La valeur de la méta donnée \"initial-creator\" dans les propriétés du fichier n'est pas \"" + nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("Initial_Creator"))+".\""); + } + + //plagiat + if(plagiat) if(verifStudent!=null){ + fichier.append(HTML.SautLigne()); + ArrayList correspondance = verifStudent.retourneEnfantsByName("correspondance", new ArrayList()); + for(int j = 0 ; j < correspondance.size();j++) { + fichier.append(HTML.Paragraph_classp5("Correspondance à la date=" + correspondance.get(j).getAttributs().get("date") + " avec l'étudiant " + correspondance.get(j).getAttributs().get("Avec_etudiant"))); + } + } + + + fichier.append(HTML.SautLigne()); + + if(!plagiat && !copiercoller && !pasAssezDeModification) { + + //Ajoute de commentaire de l'exercice + fichier.append(HTML.H3(nodana.getContenu().get(0)).replace("-NewLine-", "
")); + + fichier.append(HTML.SautLigne()); + + + fichier.append(HTML.H2("Synthèse")); + + fichier.append(HTML.TableEnteteTableurSynthese()); + String IdError = ""; // permet de récupérer les id des menu ou la proportioncorrect est NaN. (à cause de l'attribut analyseStyle=true) + for(int k = 0 ; k < nodana.getNodes().size();k++) { + if(nodana.getNodes().get(k).getAttributs().get("addmenu")!=null) if(nodana.getNodes().get(k).getAttributs().get("addmenu").equals("true")) { + if(!nodana.getNodes().get(k).getAttributs().get("proportioncorrect").equals("NaN")) { + fichier.append(HTML.TablePointsSyntheseStyle(nodana.getNodes().get(k).getAttributs().get("titre"),Double.valueOf(nodana.getNodes().get(k).getAttributs().get("proportioncorrect")),nodana.getNodes().get(k).getAttributs().get("pointtotal") + " pt",nodana.getNodes().get(k).getAttributs().get("pointgagner") + " pt", nodana.getNodes().get(k).getAttributs().get("poids"),nodana.getNodes().get(k).getAttributs().get("id"))); + }else { + IdError = IdError + nodana.getNodes().get(k).getAttributs().get("id"); + } + } + } + + + //Metadonnées + if(nodana.retourneFirstEnfantsByName("meta")!=null) if(nodana.retourneFirstEnfantsByName("meta").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("meta"))); + } + + //style de paragraphe + if(nodana.retourneFirstEnfantsByName("paragraphs")!=null) if(nodana.retourneFirstEnfantsByName("paragraphs").isClose()) { + //il est possible qu'il n'y ai aucun point car passé par analyseStyle dans le node structurepage + if(!IdError.contains(nodana.retourneFirstEnfantsByName("paragraphs").getAttributs().get("id"))){ + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("paragraphs"))); + } + } + + //pages + if(nodana.retourneFirstEnfantsByName("pages")!=null) if(nodana.retourneFirstEnfantsByName("pages").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("pages"))); + } + + //sequences + if(nodana.retourneFirstEnfantsByName("sequences")!=null) if(nodana.retourneFirstEnfantsByName("sequences").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("sequences"))); + } + + //numerotationchapitre + if(nodana.retourneFirstEnfantsByName("numerotationchapitre")!=null) if(nodana.retourneFirstEnfantsByName("numerotationchapitre").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("numerotationchapitre"))); + } + + //frames + if(nodana.retourneFirstEnfantsByName("frames")!=null) if(nodana.retourneFirstEnfantsByName("frames").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("frames"))); + } + + //section + if(nodana.retourneFirstEnfantsByName("sections")!=null) if(nodana.retourneFirstEnfantsByName("sections").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("sections"))); + } + + //tableau + if(nodana.retourneFirstEnfantsByName("tableaux")!=null) if(nodana.retourneFirstEnfantsByName("tableaux").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("tableaux"))); + } + + //bibliographies + if(nodana.retourneFirstEnfantsByName("bibliographies")!=null) if(nodana.retourneFirstEnfantsByName("bibliographies").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("bibliographies"))); + } + + //tablematieres + if(nodana.retourneFirstEnfantsByName("tablematieres")!=null) if(nodana.retourneFirstEnfantsByName("tablematieres").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("tablematieres"))); + } + + //tableillustrations + if(nodana.retourneFirstEnfantsByName("tableillustrations")!=null) if(nodana.retourneFirstEnfantsByName("tableillustrations").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("tableillustrations"))); + } + + //structurepage + if(nodana.retourneFirstEnfantsByName("structurepage")!=null) if(nodana.retourneFirstEnfantsByName("structurepage").isClose()) { + fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("structurepage"))); + } + + fichier.append("



"); + } + + + + + //footer + fichier.append("
"); + fichier.append("analyseWriter - P. Rodriguez (université d'Artois) - Licence GPL v3.0 - analysé avec la version : " + commandes.version + " - "); + fichier.append("Fichier d'analyse créé avec la version : " + ouvre.getAttributs().get("version") + ""); + fichier.append("
"); + + fichier.append(""); + + fichier.append("\r"); + fichier.append(""); + + + if(!zip) { + + //nom du fichier feedback + String metaS = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("metaSujet"); + if(metaS.equals("?")) metaS = "metaSujet-inconnu"; + if(metaS.isEmpty()) metaS = "metaSujet-inconnu"; + String cheminFeedBack = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier") + "-DateLong" + aujourdhui.getTime()+"-"+metaS; + if(!commandes.noNote&&!baremeABC) { + if(!plagiat&&!copiercoller)cheminFeedBack = cheminFeedBack + "-" + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("note") + ".html"; + if(plagiat) cheminFeedBack = cheminFeedBack + "- plagiat.html"; + if(copiercoller) cheminFeedBack = cheminFeedBack + "- copier-coller.html"; + if(pasAssezDeModification) cheminFeedBack = cheminFeedBack + "- pas assez de modification.html"; + } + if(!commandes.noNote&&baremeABC) { + if(!plagiat)cheminFeedBack = cheminFeedBack + "-" + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("noteABC") + ".html"; + if(copiercoller) cheminFeedBack = cheminFeedBack + "- copier-coller.html"; + if(plagiat) cheminFeedBack = cheminFeedBack + "- plagiat.html"; + if(pasAssezDeModification) cheminFeedBack = cheminFeedBack + "- pas assez de modification.html"; + } + if(commandes.noNote) { + cheminFeedBack = cheminFeedBack + ".html"; + } + + // Chemin vers le dossier de destination + Path outputFilePath = Paths.get(commandes.path + "/" + cheminFeedBack); + if(commandes.fourniDossierDestination) outputFilePath = Paths.get(commandes.path + "/" + commandes.pathDestination+ "/" + cheminFeedBack); + + + BufferedWriter fichier1 = Files.newBufferedWriter(outputFilePath, StandardCharsets.UTF_8); + + //ajoute le chemin vers le feedback dans le node d'analyse + nodana.retourneFirstEnfantsByName("ouverture").getAttributs().put("feedback", commandes.path + "/" + cheminFeedBack); + + fichier1.append(fichier.toString()); + + fichier1.close(); + + //affichage dans la console + if(!commandes.fourniDossierDestination) System.out.println("\n\t The feedback file has been written.\n\t " + commandes.path + "\\" + cheminFeedBack); + if(commandes.fourniDossierDestination) System.out.println("\n\t The feedback file has been written.\n\t " + commandes.path + "\\" + commandes.pathDestination + "\\" + cheminFeedBack); + + + } + + + return fichier; + } + + + +} diff --git a/src/MEPTL/meptl.java b/src/MEPTL/meptl.java index 28d2dff..ea73345 100644 --- a/src/MEPTL/meptl.java +++ b/src/MEPTL/meptl.java @@ -10,19 +10,19 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.DateFormat; +//import java.text.DateFormat; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; +//import java.time.LocalDateTime; +//import java.time.format.DateTimeFormatter; +//import java.time.format.FormatStyle; import java.util.ArrayList; import java.util.Date; import java.util.Dictionary; import java.util.Enumeration; import java.util.Hashtable; -import java.util.regex.Matcher; +//import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.parsers.ParserConfigurationException; @@ -44,7 +44,7 @@ import net.lingala.zip4j.exception.ZipException; public class meptl { static DecimalFormat df = new DecimalFormat("###.##"); - static String patch =""; + //static String patch =""; static double progression = 1.0; /** @@ -60,11 +60,11 @@ public class meptl { public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, CloneNotSupportedException, InterruptedException { System.getProperty("file.encoding","UTF-8"); - patch = System.getProperty("user.dir"); + commandes.path = System.getProperty("user.dir"); // patch = "C:/Users/pabr6/OneDrive/Desktop/Nouveau dossier"; //** les commandes - new commandes(args,patch); + new commandes(args,commandes.path); //** Node pour le chargement du node sujet (fichier d'analyse) node nodeSujet = new node(); @@ -81,7 +81,7 @@ public class meptl { //***************************************************** //** Lancement des lectures des dossiers ou fichiers ** //***************************************************** - a = new Run(patch,commandes.Profil, commandes.fichierStudentMoodle); + a = new Run(commandes.path,commandes.Profil, commandes.fichierStudentMoodle); //***************************************** @@ -102,7 +102,7 @@ public class meptl { //** Calcul le hash du fichier d'analyse et met à jour le fichier d'analyse ** //**************************************************************************** if(commandes.calculLeHashDuFichier) { - verificationFichierAnalyse.MiseAJourDuHash(); + verificationFichierAnalyse.MiseAJourFichierAnalyse(); } @@ -280,7 +280,8 @@ public class meptl { //**************************** if(!commandes.sansFeeback) { if(!commandes.zipfeedback) { - feedback(ana, verif); //classique directement dans le répertoire + //feedback(ana, verif); //classique directement dans le répertoire + feedbacks.feedback(ana,verif, false); } if(commandes.zipfeedback) { // Dans une archive pour Moodle try { @@ -291,7 +292,8 @@ public class meptl { if(zip.getAttributs().get("size")!=null)size = Long.valueOf(zip.getAttributs().get("size")); if(zip.getAttributs().get("name")!=null)nameZip = zip.getAttributs().get("name"); } - a.AddStreamToZip(feedbackForZip(ana, verif), retourneLeNomDuFeedback(a.getLectDossiers().getEC().getListeNomFichierFeedBack().get(i),ana, verif),size,nameZip); + //a.AddStreamToZip(feedbackForZip(ana, verif), retourneLeNomDuFeedback(a.getLectDossiers().getEC().getListeNomFichierFeedBack().get(i),ana, verif),size,nameZip); + a.AddStreamToZip(feedbacks.feedback(ana, verif, true), retourneLeNomDuFeedback(a.getLectDossiers().getEC().getListeNomFichierFeedBack().get(i),ana, verif),size,nameZip); } catch (ZipException e) { e.printStackTrace(); } catch (IOException e) { @@ -337,7 +339,7 @@ public class meptl { //** Mise à jour du fichier d'analyse ** //************************************** if(commandes.MAJFichierAnalyse||commandes.MAJnameAnalysisFile) { - Run.ecritureNodeEnXML(nodeSujet, commandes.nameSujet.substring(0, commandes.nameSujet.lastIndexOf(".")), commandes.pathDestination, false, "sujet"); + verificationFichierAnalyse.MiseAJourFichierAnalyse(); verificationFichierAnalyse.messagMiseAJourFichierAnalyseAprèsAnalyse(); } @@ -900,7 +902,7 @@ public class meptl { }catch (Exception e) { System.out.println(); System.out.println("** Le fichier \"" + nameSujet + "\" n'est pas dans le dossier courant."); - System.out.println("** Le dossier courant de l'application est : " + patch); + System.out.println("** Le dossier courant de l'application est : " + commandes.path); System.out.println(); } @@ -1589,15 +1591,22 @@ public class meptl { nodpages.setNomElt("pages"); nodpages.setAttributs(nodSujetPage.getAttributs()); - //ajoute l'identifiant pour le menu + //*************************************** + //** Ajoute l'identifiant pour le menu ** + //*************************************** if(a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "name", "style:page")!=null) { nodpages.getAttributs().put("id", a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "name", "style:page").getAttributs().get("id")); } - //initialise les points + //*************************** + //** initialise les points ** + //*************************** outils.initiliseLesPoints(); - for(int i = 0 ; i < nodSujetPage.getNodes().size(); i++) { //niveau 1 + //**************************************** + //** Analyse tous les style:master-page ** + //**************************************** + for(int i = 0 ; i < nodSujetPage.getNodes().size(); i++) { if(nodSujetPage.getNodes().get(i).getNomElt().equals("style:master-page")) { int pointDebut = outils.getPointsClass(); @@ -1614,105 +1623,19 @@ public class meptl { // analyse les attributs du node style:master-page page = analyseLesAttributEtContenuDuNode(pageStudent, pageSujet, page, "ana:page",pageSujet.getNomElt()); - // Les autres nodes enfants + //********************************************** + //** Analyse de tous les autres nodes enfants ** + //********************************************** page=analyseLesNodesEnants.nodeNext(page, "ana:page", pageStudent, null, null, pageSujet, nodSujetParagraphes, nodStudentParagraphes, a); - - - -// // les enfants du premier niveau du node -// for(int j = 0 ; j < pageSujet.getNodes().size();j++ ) { //niveau 2 -// -// node nodSujet = pageSujet.getNodes().get(j); -// String nameNode = nodSujet.getNomElt(); -// page = addNodeSautTitre(nodSujet, page); // ajoute des saut de page s'il y a des sauts avec des titres -// -// //recherche le node correspondant de l'étudiant -// node nodStudent = null; -// if(pageStudent!=null) if(pageStudent.retourneFirstEnfantsByName(nameNode).getNomElt().equals(nameNode)) { -// nodStudent = pageStudent.retourneFirstEnfantsByName(nameNode); -// } -// -// -// // analyse attribut et contenu des enfants du premier niveau -// page = analyseLesAttributEtContenuDuNode(nodStudent, nodSujet, page, "ana:page",pageSujet.getNodes().get(j).getNomElt()); -// -// -// for(int k = 0 ; k < nodSujet.getNodes().size();k++) { //niveau 3 -// // C'est à ce niveau que se trouve les nodes text:p dans les entêtes et les pieds de page -// -// node nod2Sujet = nodSujet.getNodes().get(k); -// String nameNode2 = nod2Sujet.getNomElt(); -// page = addNodeSautTitre(nod2Sujet, page); // ajoute des sauts s'il y a des sauts avec des titres -// -// -// //recherche le node correspondant de l'étudiant -// node nod2Student = null; -// if(nodStudent!=null) if(nodStudent.containElementByName(nameNode2)) { -// nod2Student = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode2,nod2Sujet,null,null,nodStudent,a); -// } -// -// -// //analyse style du paragraphe -// if(nod2Sujet.getAttributs().get("analyseStyle")!=null) { -// if(nod2Sujet.getAttributs().get("analyseStyle").equals("true") && nod2Sujet.getNomElt().equals("text:p")) { -// page = analyseStyle(page, nod2Sujet, nod2Student, nodSujetParagraphes, nodStudentParagraphes); -// } -// } -// -// -// // analyse attribut et contenu des enfants du second niveau -// page = analyseLesAttributEtContenuDuNode(nod2Student, nod2Sujet, page, "ana:page",nodSujet.getNodes().get(k).getNomElt() ); -// -// -// for(int l = 0 ; l < nod2Sujet.getNodes().size();l++) { //niveau 4 -// //C'est à ce niveau qi'il peut y avoir des nodes text:tab ou text:span -// -// node nod3Sujet = nod2Sujet.getNodes().get(l); -// String nameNode3 = nod3Sujet.getNomElt(); -// //page = addNodeSautTitre(nod3Sujet, page); -// -// //recherche du node correspondant de l'étudiant -// node nod3Student = null; -// -// if(nodStudent!=null) if(nodStudent.containElementByName(nameNode3)) { -// nod3Student = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode3,nod3Sujet,null,nodStudent,nod2Student,a); -// } -// -// // analyse attribut et contenu des enfants du troisième niveau -// page = analyseLesAttributEtContenuDuNode(nod3Student, nod3Sujet, page, "ana:page", nod2Sujet.getNodes().get(l).getNomElt()); -// -// -// for(int m = 0 ; m < nod3Sujet.getNodes().size();m++) { //niveau 5 -// node nod4Sujet = nod3Sujet.getNodes().get(m); -// String nameNode4 = nod4Sujet.getNomElt(); -// -// //recherche du node correspondant de l'étudiant -// node nod4Student = null; -// -// if(nodStudent!=null) if(nodStudent.containElementByName(nameNode4)) { -// nod4Student = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode4,nod4Sujet,nodStudent,nod2Student,nod3Student,a); -// } -// -// // analyse attribut et contenu des enfants du troisième niveau -// page = analyseLesAttributEtContenuDuNode(nod4Student, nod4Sujet, page, "ana:page", nod3Sujet.getNodes().get(m).getNomElt()); -// -// } // fin du niveau 5 -// -// } // fin du niveau 4 -// -// } // fin du niveau 3 -// -// } // fin du niveau 2 page.getAttributs().put("point", String.valueOf(outils.getPointsClass()-pointDebut)); page.getAttributs().put("pointTotal", String.valueOf(outils.getPointTotal()-pointTotalDebut)); nodpages.getNodes().add(page); - - } // fin du "style:master-page" + } - } // fin du niveau 1 + } nodpages.getAttributs().put("pointgagner",String.valueOf(outils.getPointsClass())); nodpages.getAttributs().put("pointtotal",String.valueOf(outils.getPointTotal())); @@ -2804,36 +2727,6 @@ public class meptl { return retour; } - - - -// /** -// * Analyse toutes les contenus des enfants et les compares.
-// * Utiliser pour les nodes
-// *
-// * @param Student -// * @param Sujet -// * @param retour -// * @param nameItem -// * @param nameElt -// * @param a -// * @return -// */ -// private static node analyseLesContenusDesArrayList(ArrayList Student, ArrayList Sujet, node retour, String nameItem, String nameElt, Run a) { -// -// for(int i = 0 ; i < Sujet.size();i++) { -// String sujetContent = Sujet.get(i).retourneLesContenusEnfants(""); -// node StudentNode = a.retourneFirstNodeByFindContent2(Student, outils.withoutCodeAndPoint(sujetContent),commandes.tolerance_characters,commandes.tolerance_text); -// String studentContent = "null"; -// if(StudentNode!=null) studentContent = outils.NetChiffreALaFin(StudentNode.retourneLesContenusEnfants("")); -// -// node item = retourneNoteAvecResultatsAnalyse(nameItem, "Contenu textuel", studentContent, sujetContent,nameElt); -// retour.getNodes().add(item); -// -// } -// -// return retour; -// } /** @@ -2861,7 +2754,8 @@ public class meptl { /** * Analyse tous les attributs des nodes .
- * Formatage direct des styles de paragraphe. Les attributs doivent contenir le code ‼.
+ * Formatage direct des styles de paragraphe.
+ * Les attributs doivent contenir le code ‼.
*
* @param nodeStudent : le node de l'étudiant. * @param sujet : le node du sujet @@ -2968,516 +2862,8 @@ public class meptl { return retour; } - - - /** - * Création du feedback (compte-rendu) au format HTML.
- *
- * @param nodana - * @throws IOException - */ - private static void feedback(node nodana, node verif) throws IOException { - - System.getProperty("file.encoding","UTF-8"); - Date aujourdhui = new Date(); - - int number_match = 2; - int mini_modification = 0; - boolean plagiat = false; - boolean copiercoller = false; - boolean pasAssezDeModification =false; - boolean baremeABC = false; - boolean producteur = false; - String SuiteBureautique = ""; - String VersionLibreOffice = ""; - String SystemeStudent = ""; - node verifStudent = null; - if((commandes.verifHisto||commandes.verifHisto2)&&commandes.ecritNoteCSV&&commandes.fourniCSV) { - if(verif.getAttributs().get("number_match") != null) number_match = Integer.valueOf(verif.getAttributs().get("number_match")); - if(verif.getAttributs().get("mini_number_modification") != null) mini_modification = Integer.valueOf(verif.getAttributs().get("mini_number_modification")); - - //verification du plagiat - verifStudent = verif.retourneFirstNodeByNameAndAttributValue("fichier", "dossier", nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier")); - if(verifStudent != null) { - if(verifStudent.getAttributs().get("filename").equals(nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("filename"))) { - if(Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>number_match) plagiat=true; - if(!verifStudent.getAttributs().get("first_modification_identique").equals("null") && Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>=number_match) plagiat=true; - if(verifStudent.getAttributs().get("copier_coller")!=null) copiercoller=true; - if(Integer.valueOf(verifStudent.getAttributs().get("nombre_modification"))<=mini_modification) pasAssezDeModification=true; - } - } - } - - //BaremeABC - if(nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("baremeABC")!=null) { - try { - baremeABC= Boolean.valueOf(nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("baremeABC")); - }catch (Exception e) { - System.out.println("Problème avec la valeur binaire de l'attribut baremeABC."); - } - } - - - - //nom du fichier feedback - String metaS = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("metaSujet"); - if(metaS.equals("?")) metaS = "metaSujet-inconnu"; - if(metaS.isEmpty()) metaS = "metaSujet-inconnu"; - String cheminFeedBack = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier") + "-DateLong" + aujourdhui.getTime()+"-"+metaS; - if(!commandes.noNote&&!baremeABC) { - if(!plagiat&&!copiercoller)cheminFeedBack = cheminFeedBack + "-" + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("note") + ".html"; - if(plagiat) cheminFeedBack = cheminFeedBack + "- plagiat.html"; - if(copiercoller) cheminFeedBack = cheminFeedBack + "- copier-coller.html"; - if(pasAssezDeModification) cheminFeedBack = cheminFeedBack + "- pas assez de modification.html"; - } - if(!commandes.noNote&&baremeABC) { - if(!plagiat)cheminFeedBack = cheminFeedBack + "-" + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("noteABC") + ".html"; - if(copiercoller) cheminFeedBack = cheminFeedBack + "- copier-coller.html"; - if(plagiat) cheminFeedBack = cheminFeedBack + "- plagiat.html"; - if(pasAssezDeModification) cheminFeedBack = cheminFeedBack + "- pas assez de modification.html"; - } - if(commandes.noNote) { - cheminFeedBack = cheminFeedBack + ".html"; - } - - // Chemin vers le dossier de destination - Path outputFilePath = Paths.get(patch + "/" + cheminFeedBack); - if(commandes.fourniDossierDestination) outputFilePath = Paths.get(patch + "/" + commandes.pathDestination+ "/" + cheminFeedBack); - - - BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, StandardCharsets.UTF_8); - - //ajoute le chemin vers le feedback dans le node d'analyse - nodana.retourneFirstEnfantsByName("ouverture").getAttributs().put("feedback", patch + "/" + cheminFeedBack); - - // auteur du sujet - String auteurSujet = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("auteur"); - if(auteurSujet==null) auteurSujet=""; - - - //création du feedback - fichier.write("\r" - + "\r" - + "\r" - + "\r" - + "Analyse LibreOffice Calc\r"); - - fichier.write("" - + "" - + ""); - - fichier.write(""); - - fichier.write("\r"); - fichier.write("\r"); - - fichier.write("
"); - if(!commandes.noLogo) { - if(!commandes.newLogo) { - fichier.write("

\r\n" + - "Feedback - AnalyseWriter - format ODF 1.2
"+HTML.imgLogos()+"

\r"); - }else { - - fichier.write("

\r\n" + - "Feedback - AnalyseWriter - format ODF 1.2
"+commandes.contenuFichierSVG+"

\r"); - } - }else { - fichier.write("

\r\n" + - "Feedback - AnalyseWriter - format ODF 1.2

\r"); - } - - - //Note - node ouvre = nodana.retourneFirstEnfantsByName("ouverture"); - String noteFrom = ouvre.getAttributs().get("notefrom"); - node notation = nodana.retourneFirstEnfantsByName("bodyetnotation"); - if(!baremeABC) { - if(noteFrom ==null) noteFrom="20"; - if(!commandes.noNote) if(!plagiat&&!copiercoller&&!pasAssezDeModification) fichier.write("

" + notation.getAttributs().get("note") + " / " + noteFrom +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - if(plagiat || copiercoller || pasAssezDeModification) { - notation.getAttributs().put("note","0"); - String AffichageNote = ""; - if(plagiat) AffichageNote = " Plagiat "; - if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; - if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; - if(!commandes.noNote) fichier.write("

" + AffichageNote + " / " + noteFrom +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - } - }else { - String imageNote = ""; - switch (notation.getAttributs().get("noteABC")) { - case "A": - imageNote = HTML.NoteA(); - break; - case "B": - imageNote = HTML.NoteB(); - break; - case "C": - imageNote = HTML.NoteC(); - break; - case "D": - imageNote = HTML.NoteD(); - break; - case "E": - imageNote = HTML.NoteE(); - break; - default: - imageNote = ""; - break; - } - if(!commandes.noNote) if(!plagiat&& !copiercoller &&!pasAssezDeModification) fichier.write("

" + imageNote +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - if(plagiat || copiercoller || pasAssezDeModification) { - notation.getAttributs().put("note","0"); - notation.getAttributs().put("noteABC","E"); - String AffichageNote = ""; - if(plagiat) AffichageNote = " Plagiat "; - if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; - if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; - if(!commandes.noNote) fichier.write("

" + AffichageNote + " / " + "
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - } - } - - //producteur - if(ouvre.getAttributs().get("producteur")!=null) { - try { - producteur= true; - String[] decompose = ouvre.getAttributs().get("producteur").split("/"); - SuiteBureautique=decompose[0]; - VersionLibreOffice=decompose[1].substring(0, decompose[1].lastIndexOf("$")); - SystemeStudent=decompose[1].substring(decompose[1].lastIndexOf("$")+1, decompose[1].lastIndexOf(" ")); - }catch (Exception e) { - System.out.println("Problème avec l'attribut producteur."); - }finally { - - } - } - - //informations - // date d'analyse, dossier étudiant, auteur sujet, date de la dernière modificatio, lien, algorithme - DateFormat mediumDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM); - LocalDateTime dateTimeModif = null; - String dateModif=""; - if(ouvre.getAttributs().get("dateModification")!=null) if(!ouvre.getAttributs().get("dateModification").isEmpty()) { - try { - dateTimeModif = LocalDateTime.parse(ouvre.getAttributs().get("dateModification")); - dateModif = dateTimeModif.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)); - }catch (Exception e) { - System.out.println(e.toString()); - } - } - - fichier.write("

Date d'analyse : "+ mediumDateFormat.format(aujourdhui) + "
"); - fichier.write("Dossier étudiant : "+ ouvre.getAttributs().get("dossier") + "
"); - fichier.write("Nom du fichier : "+ ouvre.getAttributs().get("filename") + "
"); - fichier.write("Hash du fichier analyse : "+ ouvre.getAttributs().get("hash") + "
"); - fichier.write("Nom du fichier analyse : "+ commandes.nameSujet + "
"); - fichier.write("Date de la dernière modification du fichier analysé : "+ dateModif + "
"); - fichier.write("Durée d'édition du fichier analysé : "+ traitementDureeEdition(ouvre.getAttributs().get("dureeEdition") + "
")); - if(producteur) { - fichier.write("Suite de bureautique : "+ SuiteBureautique + ""); - fichier.write(" - Version : "+ VersionLibreOffice + ""); - fichier.write(" - Système : "+ SystemeStudent + "
"); - } - if(!auteurSujet.isEmpty()) {fichier.write("Sujet créé par : "+ auteurSujet + "
");}else {fichier.write("
");} - - if(!commandes.noNote) { - if(!plagiat&&!copiercoller&&!pasAssezDeModification) fichier.write("Méthode :
Progression " + ouvre.getAttributs().get("progression") + "Explication
"+ HTML.imgProgression() +"
- Pourcentage correcte : " + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("proportioncorrect") +"
"); - if(plagiat || copiercoller || pasAssezDeModification) { - String AffichageNote = ""; - if(plagiat) AffichageNote = " Plagiat "; - if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; - if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; - fichier.write("Méthode :
Progression " + ouvre.getAttributs().get("progression") + "Explication
"+ HTML.imgProgression() +"
- Pourcentage correcte : "+ AffichageNote +"
"); - } - } - - if(baremeABC) { - fichier.append("Barème :
0% → E → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneE"))*100) + "% → D → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneD"))*100) + "% → C → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneC"))*100) + "% → B → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneB"))*100) + "% → A → 100%Prendre en compte le coefficient de progression.
"); - } - - if(ouvre.getAttributs().get("link_sujet")!=null) { - String linkSujet= ouvre.getAttributs().get("link_sujet"); - Matcher m = Pattern.compile("^https://.{1,}|^http://.{1,}").matcher(linkSujet); - if(m.find()) {fichier.write("
Lien vers le sujet
");} - } - if(ouvre.getAttributs().get("link_help")!=null) { - String linkSujet= ouvre.getAttributs().get("link_help"); - Matcher m = Pattern.compile("^https://.{1,}|^http://.{1,}").matcher(linkSujet); - if(m.find()) {fichier.write("
Lien vers le support
");} - } - - fichier.write("
Analysé avec la version : " + commandes.version + "

"); - - - fichier.write(HTML.SautLigne()); - - fichier.write("
"); - - //ajoute le menu - fichier.write(HTML.getHTMLmenu(nodana.retourneFirstEnfantsByName("menu").getNodes())); - - - //Les erreurs - node errors = nodana.retourneFirstEnfantsByName("erreurs"); - if(Boolean.valueOf(errors.getAttributs().get("oneError"))) { - fichier.write(HTML.SautLigne()); - if(Boolean.valueOf(errors.getAttributs().get("manqueHistorique"))) fichier.write(HTML.Paragraph_classp5("ERREUR : Il n'y a pas d'historique des modifications dans ce fichier. Le fichier n'a pas été modifié ou il a été réinitialisé.
L'analyse de l'historique n'a pas pu se faire.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueCreationDate"))) fichier.write(HTML.Paragraph_classp5("ERREUR : La date de création du fichier a été supprimée. Le fichier a été réïnitialisé ou ce n'est pas le fichier du sujet.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueValeurCreationDate"))) fichier.write(HTML.Paragraph_classp5("ERREUR : Ce n'est pas la bonne date de création du fichier. Le fichier a été réïnitialisé ou ce n'est pas fichier du sujet.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueMetaSujet"))) fichier.write(HTML.Paragraph_classp5("ERREUR : La méta donnée \"Sujet\" dans les propriétés du fichier a été supprimée ou renommée.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueValeurMetaSujet"))) fichier.write(HTML.Paragraph_classp5("ERREUR : La valeur de la méta donnée \"Sujet\" dans les propriétés du fichier n'est pas \"" + nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("metaSujet"))+".\""); - if(Boolean.valueOf(errors.getAttributs().get("manqueInitialCreator"))) fichier.write(HTML.Paragraph_classp5("ERREUR : La valeur de la méta donnée \"initial-creator\" dans les propriétés du fichier n'est pas \"" + nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("Initial_Creator"))+".\""); - } - - //plagiat - if(plagiat) if(verifStudent!=null){ - fichier.append(HTML.SautLigne()); - ArrayList correspondance = verifStudent.retourneEnfantsByName("correspondance", new ArrayList()); - for(int j = 0 ; j < correspondance.size();j++) { - fichier.write(HTML.Paragraph_classp5("Correspondance à la date=" + correspondance.get(j).getAttributs().get("date") + " avec l'étudiant " + correspondance.get(j).getAttributs().get("Avec_etudiant"))); - } - } - - - fichier.write(HTML.SautLigne()); - - - if(!plagiat && !copiercoller && !pasAssezDeModification) { - - //Ajoute de commentaire de l'exercice - fichier.write(HTML.H3(nodana.getContenu().get(0)).replace("-NewLine-", "
")); - - fichier.write(HTML.SautLigne()); - - - fichier.write(HTML.H2("Synthèse")); - - fichier.write(HTML.TableEnteteTableurSynthese()); - String IdError = ""; // permet de récupérer les id des menus ou la proportion correct est NaN. (à cause de l'attribut analyseStyle=true) - for(int k = 0 ; k < nodana.getNodes().size();k++) { - if(nodana.getNodes().get(k).getAttributs().get("addmenu")!=null) if(nodana.getNodes().get(k).getAttributs().get("addmenu").equals("true")) { - if(!nodana.getNodes().get(k).getAttributs().get("proportioncorrect").equals("NaN")) { - fichier.write(HTML.TablePointsSyntheseStyle(nodana.getNodes().get(k).getAttributs().get("titre"),Double.valueOf(nodana.getNodes().get(k).getAttributs().get("proportioncorrect")),nodana.getNodes().get(k).getAttributs().get("pointtotal") + " pt",nodana.getNodes().get(k).getAttributs().get("pointgagner") + " pt", nodana.getNodes().get(k).getAttributs().get("poids"),nodana.getNodes().get(k).getAttributs().get("id"))); - }else { - IdError = IdError + nodana.getNodes().get(k).getAttributs().get("id"); - } - } - } - - - //Metadonnées - if(nodana.retourneFirstEnfantsByName("meta")!=null) if(nodana.retourneFirstEnfantsByName("meta").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("meta"))); - } - - //style de paragraphe - if(nodana.retourneFirstEnfantsByName("paragraphs")!=null) if(nodana.retourneFirstEnfantsByName("paragraphs").isClose()) { - //il est possible qu'il n'y ai aucun point car passé par analyseStyle dans le node structurepage - if(!IdError.contains(nodana.retourneFirstEnfantsByName("paragraphs").getAttributs().get("id"))){ - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("paragraphs"))); - } - } - - //pages - if(nodana.retourneFirstEnfantsByName("pages")!=null) if(nodana.retourneFirstEnfantsByName("pages").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("pages"))); - } - - //sequences - if(nodana.retourneFirstEnfantsByName("sequences")!=null) if(nodana.retourneFirstEnfantsByName("sequences").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("sequences"))); - } - //numerotationchapitre - if(nodana.retourneFirstEnfantsByName("numerotationchapitre")!=null) if(nodana.retourneFirstEnfantsByName("numerotationchapitre").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("numerotationchapitre"))); - } - - //frames - if(nodana.retourneFirstEnfantsByName("frames")!=null) if(nodana.retourneFirstEnfantsByName("frames").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("frames"))); - } - - //section - if(nodana.retourneFirstEnfantsByName("sections")!=null) if(nodana.retourneFirstEnfantsByName("sections").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("sections"))); - } - - //tableau - if(nodana.retourneFirstEnfantsByName("tableaux")!=null) if(nodana.retourneFirstEnfantsByName("tableaux").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("tableaux"))); - } - - //bibliographies - if(nodana.retourneFirstEnfantsByName("bibliographies")!=null) if(nodana.retourneFirstEnfantsByName("bibliographies").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("bibliographies"))); - } - - //tablematieres - if(nodana.retourneFirstEnfantsByName("tablematieres")!=null) if(nodana.retourneFirstEnfantsByName("tablematieres").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("tablematieres"))); - } - - //tableillustrations - if(nodana.retourneFirstEnfantsByName("tableillustrations")!=null) if(nodana.retourneFirstEnfantsByName("tableillustrations").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("tableillustrations"))); - } - - //structurepage - if(nodana.retourneFirstEnfantsByName("structurepage")!=null) if(nodana.retourneFirstEnfantsByName("structurepage").isClose()) { - fichier.write(HTML.Table(nodana.retourneFirstEnfantsByName("structurepage"))); - } - - } - - - - fichier.write("



"); - - //footer - fichier.write("
"); - fichier.write("analyseWriter - P. Rodriguez (université d'Artois) - Licence GPL v3.0 - analysé avec la version : " + commandes.version + " - "); - fichier.write("Fichier d'analyse créé avec la version : " + ouvre.getAttributs().get("version") + ""); - fichier.write("
"); - - fichier.write(""); - - fichier.write("\r"); - fichier.write(""); - - fichier.close(); - - //affichage dans la console - if(!commandes.fourniDossierDestination) System.out.println("\n\t The feedback file has been written.\n\t " + patch + "\\" + cheminFeedBack); - if(commandes.fourniDossierDestination) System.out.println("\n\t The feedback file has been written.\n\t " + patch + "\\" + commandes.pathDestination + "\\" + cheminFeedBack); - - - } - - /** * Retourne le nom du fichier de l'étudiant pour le Zip de Moodle.
*
@@ -3550,491 +2936,10 @@ public class meptl { return filename + cheminFeedBack; } - + /** - * Ecriture du fichier pour l'archive ZIP de moodle.
- *
- * @param nodana - * @return - * @throws IOException - */ - private static StringBuilder feedbackForZip(node nodana, node verif) throws IOException { - - System.getProperty("file.encoding","UTF-8"); - Date aujourdhui = new Date(); - - int number_match = 2; - int mini_modification = 0; - boolean plagiat = false; - boolean copiercoller = false; - boolean pasAssezDeModification =false; - boolean baremeABC = false; - boolean producteur =false; - String SuiteBureautique=""; - String VersionLibreOffice=""; - String SystemeStudent=""; - node verifStudent = null; - if((commandes.verifHisto||commandes.verifHisto2)) { //&&commandes.ecritNoteCSV&&commandes.fourniCSV - if(verif.getAttributs().get("number_match") != null) number_match = Integer.valueOf(verif.getAttributs().get("number_match")); - if(verif.getAttributs().get("mini_number_modification") != null) mini_modification = Integer.valueOf(verif.getAttributs().get("mini_number_modification")); - - //verification du plagiat - verifStudent = verif.retourneFirstNodeByNameAndAttributValue("fichier", "dossier", nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier")); - if(verifStudent != null) { - if(verifStudent.getAttributs().get("filename").equals(nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("filename"))) { - if(Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>number_match) plagiat=true; - if(!verifStudent.getAttributs().get("first_modification_identique").equals("null") && Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>=number_match) plagiat=true; - if(verifStudent.getAttributs().get("copier_coller")!=null) copiercoller=true; - if(Integer.valueOf(verifStudent.getAttributs().get("nombre_modification"))<=mini_modification) pasAssezDeModification=true; - } - } - } - if(nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("baremeABC")!=null) { - try { - baremeABC= Boolean.valueOf(nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("baremeABC")); - }catch (Exception e) { - System.out.println("Problème avec la valeur binaire de l'attribut baremeABC."); - } - } - - - StringBuilder fichier = new StringBuilder(); - - //ajoute le chemin vers le feedback dans le node d'analyse - //nodana.retourneFirstEnfantsByName("ouverture").getAttributs().put("feedback", patch + "/" + cheminFeedBack); - - // auteur du sujet - String auteurSujet = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("auteur"); - if(auteurSujet==null) auteurSujet=""; - - - //création du feedback - fichier.append("\r" - + "\r" - + "\r" - + "\r" - + "Analyse LibreOffice Calc\r"); - - fichier.append("" - + "" - + ""); - - - fichier.append(""); - - fichier.append("\r"); - fichier.append("\r"); - - fichier.append("
"); - if(!commandes.noLogo) { - if(!commandes.newLogo) { - fichier.append("

\r\n" + - "Feedback - AnalyseWriter - format ODF 1.2
"+HTML.imgLogos()+"

\r"); - }else { - - fichier.append("

\r\n" + - "Feedback - AnalyseWriter - format ODF 1.2
"+commandes.contenuFichierSVG+"

\r"); - } - }else { - fichier.append("

\r\n" + - "Feedback - AnalyseWriter - format ODF 1.2

\r"); - } - - //Note - node ouvre = nodana.retourneFirstEnfantsByName("ouverture"); - String noteFrom = ouvre.getAttributs().get("notefrom"); - node notation = nodana.retourneFirstEnfantsByName("bodyetnotation"); - if(!baremeABC) { - if(noteFrom ==null) noteFrom="20"; - if(!commandes.noNote) if(!plagiat&&!copiercoller&&!pasAssezDeModification) fichier.append("

" + notation.getAttributs().get("note") + " / " + noteFrom +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - if(plagiat || copiercoller || pasAssezDeModification) { - notation.getAttributs().put("note","0"); - String AffichageNote = ""; - if(plagiat) AffichageNote = " Plagiat "; - if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; - if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; - if(!commandes.noNote) fichier.append("

" + AffichageNote + " / " + noteFrom +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - } - }else { - String imageNote = ""; - switch (notation.getAttributs().get("noteABC")) { - case "A": - imageNote = HTML.NoteA(); - break; - case "B": - imageNote = HTML.NoteB(); - break; - case "C": - imageNote = HTML.NoteC(); - break; - case "D": - imageNote = HTML.NoteD(); - break; - case "E": - imageNote = HTML.NoteE(); - break; - default: - imageNote = ""; - break; - } - if(!commandes.noNote) if(!plagiat&& !copiercoller &&!pasAssezDeModification) fichier.append("

" + imageNote +"
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - if(plagiat || copiercoller || pasAssezDeModification) { - notation.getAttributs().put("note","0"); - notation.getAttributs().put("noteABC","E"); - String AffichageNote = ""; - if(plagiat) AffichageNote = " Plagiat "; - if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; - if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; - if(!commandes.noNote) fichier.append("

" + AffichageNote + " / " + "
"+ ouvre.getAttributs().get("metaSujet") +"

\r"); - } - } - - - //producteur - if(ouvre.getAttributs().get("producteur")!=null) { - try { - producteur= true; - String[] decompose = ouvre.getAttributs().get("producteur").split("/"); - SuiteBureautique=decompose[0]; - VersionLibreOffice=decompose[1].substring(0, decompose[1].lastIndexOf("$")); - SystemeStudent=decompose[1].substring(decompose[1].lastIndexOf("$")+1, decompose[1].lastIndexOf(" ")); - }catch (Exception e) { - System.out.println("Problème avec l'attribut producteur."); - - }finally { - - } - } - - //informations - // date d'analyse, dossier étudiant, auteur sujet, date de la dernière modificatio, lien, algorithme - DateFormat mediumDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM); - LocalDateTime dateTimeModif = null; - String dateModif=""; - if(!ouvre.getAttributs().get("dateModification").isEmpty()) { - try { - dateTimeModif = LocalDateTime.parse(ouvre.getAttributs().get("dateModification")); - dateModif = dateTimeModif.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)); - }catch (Exception e) { - System.out.println(e.toString()); - } - } - - fichier.append("

Date d'analyse : "+ mediumDateFormat.format(aujourdhui) + "
"); - fichier.append("Dossier étudiant : "+ ouvre.getAttributs().get("dossier") + "
"); - fichier.append("Nom du fichier : "+ ouvre.getAttributs().get("filename") + "
"); - fichier.append("Hash du fichier analyse : "+ ouvre.getAttributs().get("hash") + "
"); - fichier.append("Nom du fichier analyse : "+ commandes.nameSujet + "
"); - fichier.append("Date de la dernière modification du fichier analysé : "+ dateModif + "
"); - fichier.append("Durée d'édition du fichier analysé : "+ traitementDureeEdition(ouvre.getAttributs().get("dureeEdition") + "
")); - if(producteur) { - fichier.append("Suite de bureautique : "+ SuiteBureautique + ""); - fichier.append(" - Version : "+ VersionLibreOffice + ""); - fichier.append(" - Système : "+ SystemeStudent + "
"); - } - if(!auteurSujet.isEmpty()) {fichier.append("Sujet créé par : "+ auteurSujet + "
");}else {fichier.append("
");} - - if(!commandes.noNote) { - if(!plagiat&&!copiercoller&&!pasAssezDeModification) fichier.append("Méthode :
Progression " + ouvre.getAttributs().get("progression") + "Explication
"+ HTML.imgProgression() +"
- Pourcentage correcte : " + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("proportioncorrect") +"
"); - if(plagiat || copiercoller || pasAssezDeModification) { - String AffichageNote = ""; - if(plagiat) AffichageNote = " Plagiat "; - if(copiercoller) AffichageNote = AffichageNote + " Copier Coller "; - if(pasAssezDeModification) AffichageNote = AffichageNote + " Pas assez de modification "; - fichier.append("Méthode :
Progression " + ouvre.getAttributs().get("progression") + "Explication
"+ HTML.imgProgression() +"
- Pourcentage correcte : "+ AffichageNote +"
"); - } - } - - if(baremeABC) { - fichier.append("Barème :
0% → E → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneE"))*100) + "% → D → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneD"))*100) + "% → C → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneC"))*100) + "% → B → " + Math.round(Double.valueOf(notation.getAttributs().get("BorneB"))*100) + "% → A → 100%Prendre en compte le coefficient de progression.
"); - } - - - if(ouvre.getAttributs().get("link_sujet")!=null) { - String linkSujet= ouvre.getAttributs().get("link_sujet"); - Matcher m = Pattern.compile("^https://.{1,}|^http://.{1,}").matcher(linkSujet); - if(m.find()) {fichier.append("
Lien vers le sujet
");} - } - if(ouvre.getAttributs().get("link_help")!=null) { - String linkSujet= ouvre.getAttributs().get("link_help"); - Matcher m = Pattern.compile("^https://.{1,}|^http://.{1,}").matcher(linkSujet); - if(m.find()) {fichier.append("
Lien vers le support
");} - } - - fichier.append("
Analysé avec la version : " + commandes.version + "

"); - - - fichier.append(HTML.SautLigne()); - - fichier.append("
"); - - //ajoute le menu - fichier.append(HTML.getHTMLmenu(nodana.retourneFirstEnfantsByName("menu").getNodes())); - - - //Les erreurs - node errors = nodana.retourneFirstEnfantsByName("erreurs"); - if(Boolean.valueOf(errors.getAttributs().get("oneError"))) { - fichier.append(HTML.SautLigne()); - if(Boolean.valueOf(errors.getAttributs().get("manqueHistorique"))) fichier.append(HTML.Paragraph_classp5("ERREUR : Il n'y a pas d'historique des modifications dans ce fichier. Le fichier n'a pas été modifié ou il a été réïnitialisé.
L'analyse de l'historique n'a pas pu se faire.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueCreationDate"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La date de création du fichier a été supprimée. Le fichier a été réïnitialisé ou ce n'est pas le fichier du sujet.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueValeurCreationDate"))) fichier.append(HTML.Paragraph_classp5("ERREUR : Ce n'est pas la bonne date de création du fichier. Le fichier a été réïnitialisé ou ce n'est pas le fichier du sujet.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueMetaSujet"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La méta donnée \"Sujet\" dans les propriétés du fichier a été supprimée ou renommée.")); - if(Boolean.valueOf(errors.getAttributs().get("manqueValeurMetaSujet"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La valeur de la méta donnée \"Sujet\" dans les propriétés du fichier n'est pas \"" + nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("metaSujet"))+".\""); - if(Boolean.valueOf(errors.getAttributs().get("manqueInitialCreator"))) fichier.append(HTML.Paragraph_classp5("ERREUR : La valeur de la méta donnée \"initial-creator\" dans les propriétés du fichier n'est pas \"" + nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("Initial_Creator"))+".\""); - } - - //plagiat - if(plagiat) if(verifStudent!=null){ - fichier.append(HTML.SautLigne()); - ArrayList correspondance = verifStudent.retourneEnfantsByName("correspondance", new ArrayList()); - for(int j = 0 ; j < correspondance.size();j++) { - fichier.append(HTML.Paragraph_classp5("Correspondance à la date=" + correspondance.get(j).getAttributs().get("date") + " avec l'étudiant " + correspondance.get(j).getAttributs().get("Avec_etudiant"))); - } - } - - - fichier.append(HTML.SautLigne()); - - if(!plagiat && !copiercoller && !pasAssezDeModification) { - - //Ajoute de commentaire de l'exercice - fichier.append(HTML.H3(nodana.getContenu().get(0)).replace("-NewLine-", "
")); - - fichier.append(HTML.SautLigne()); - - - fichier.append(HTML.H2("Synthèse")); - - fichier.append(HTML.TableEnteteTableurSynthese()); - String IdError = ""; // permet de récupérer les id des menu ou la proportioncorrect est NaN. (à cause de l'attribut analyseStyle=true) - for(int k = 0 ; k < nodana.getNodes().size();k++) { - if(nodana.getNodes().get(k).getAttributs().get("addmenu")!=null) if(nodana.getNodes().get(k).getAttributs().get("addmenu").equals("true")) { - if(!nodana.getNodes().get(k).getAttributs().get("proportioncorrect").equals("NaN")) { - fichier.append(HTML.TablePointsSyntheseStyle(nodana.getNodes().get(k).getAttributs().get("titre"),Double.valueOf(nodana.getNodes().get(k).getAttributs().get("proportioncorrect")),nodana.getNodes().get(k).getAttributs().get("pointtotal") + " pt",nodana.getNodes().get(k).getAttributs().get("pointgagner") + " pt", nodana.getNodes().get(k).getAttributs().get("poids"),nodana.getNodes().get(k).getAttributs().get("id"))); - }else { - IdError = IdError + nodana.getNodes().get(k).getAttributs().get("id"); - } - } - } - - - //Metadonnées - if(nodana.retourneFirstEnfantsByName("meta")!=null) if(nodana.retourneFirstEnfantsByName("meta").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("meta"))); - } - - //style de paragraphe - if(nodana.retourneFirstEnfantsByName("paragraphs")!=null) if(nodana.retourneFirstEnfantsByName("paragraphs").isClose()) { - //il est possible qu'il n'y ai aucun point car passé par analyseStyle dans le node structurepage - if(!IdError.contains(nodana.retourneFirstEnfantsByName("paragraphs").getAttributs().get("id"))){ - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("paragraphs"))); - } - } - - //pages - if(nodana.retourneFirstEnfantsByName("pages")!=null) if(nodana.retourneFirstEnfantsByName("pages").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("pages"))); - } - - //sequences - if(nodana.retourneFirstEnfantsByName("sequences")!=null) if(nodana.retourneFirstEnfantsByName("sequences").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("sequences"))); - } - - //numerotationchapitre - if(nodana.retourneFirstEnfantsByName("numerotationchapitre")!=null) if(nodana.retourneFirstEnfantsByName("numerotationchapitre").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("numerotationchapitre"))); - } - - //frames - if(nodana.retourneFirstEnfantsByName("frames")!=null) if(nodana.retourneFirstEnfantsByName("frames").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("frames"))); - } - - //section - if(nodana.retourneFirstEnfantsByName("sections")!=null) if(nodana.retourneFirstEnfantsByName("sections").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("sections"))); - } - - //tableau - if(nodana.retourneFirstEnfantsByName("tableaux")!=null) if(nodana.retourneFirstEnfantsByName("tableaux").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("tableaux"))); - } - - //bibliographies - if(nodana.retourneFirstEnfantsByName("bibliographies")!=null) if(nodana.retourneFirstEnfantsByName("bibliographies").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("bibliographies"))); - } - - //tablematieres - if(nodana.retourneFirstEnfantsByName("tablematieres")!=null) if(nodana.retourneFirstEnfantsByName("tablematieres").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("tablematieres"))); - } - - //tableillustrations - if(nodana.retourneFirstEnfantsByName("tableillustrations")!=null) if(nodana.retourneFirstEnfantsByName("tableillustrations").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("tableillustrations"))); - } - - //structurepage - if(nodana.retourneFirstEnfantsByName("structurepage")!=null) if(nodana.retourneFirstEnfantsByName("structurepage").isClose()) { - fichier.append(HTML.Table(nodana.retourneFirstEnfantsByName("structurepage"))); - } - - fichier.append("



"); - } - - - - - //footer - fichier.append("
"); - fichier.append("analyseWriter - P. Rodriguez (université d'Artois) - Licence GPL v3.0 - analysé avec la version : " + commandes.version + " - "); - fichier.append("Fichier d'analyse créé avec la version : " + ouvre.getAttributs().get("version") + ""); - fichier.append("
"); - - fichier.append(""); - - fichier.append("\r"); - fichier.append(""); - - - //affichage dans la console -// if(!commandes.fourniDossierDestination) System.out.println("\n\t The feedback file has been written.\n\t " + patch + "\\" + cheminFeedBack); -// if(commandes.fourniDossierDestination) System.out.println("\n\t The feedback file has been written.\n\t " + patch + "\\" + commandes.pathDestination + "\\" + cheminFeedBack); - - return fichier; - } - - - - /** - * Affichage uniquement dans la console des erreurs + * Affichage uniquement dans la console Les erreurs. * @param nod */ private static void messageSystem(node nod) { @@ -4043,30 +2948,31 @@ public class meptl { node erreurs = nod.retourneFirstEnfantsByName("erreurs"); boolean flagError = Boolean.valueOf(erreurs.getAttributs().get("oneError")); - System.out.println("\t Folder analyzed : " + ouverture.getAttributs().get("dossier")); + if(!commandes.fichierStudentMoodle) {System.out.println("\t Dossier analysé : " + ouverture.getAttributs().get("dossier"));}else {System.out.println("\t Fichier analysé : " + ouverture.getAttributs().get("dossier"));} if(notation.getAttributs().get("baremeABC").equals("true")) { - System.out.println("\t Grade : " + notation.getAttributs().get("noteABC")); + System.out.println("\t Note : " + notation.getAttributs().get("noteABC")); }else { - System.out.println("\t Grade : " + notation.getAttributs().get("note") + "/" + ouverture.getAttributs().get("notefrom")); + System.out.println("\t Note : " + notation.getAttributs().get("note") + "/" + ouverture.getAttributs().get("notefrom")); } if(flagError) { - System.out.println("\t ERROR in student's file."); - if(Boolean.valueOf(erreurs.getAttributs().get("manqueHistorique"))) System.out.println("\t ERROR : There is no historic in the file. Perhaps, the file has not been modified or it has been reset by the student."); - if(Boolean.valueOf(erreurs.getAttributs().get("manqueCreationDate"))) System.out.println("\t ERROR : This is the wrong file creation date. The file has been reset or it is not the correct file."); - if(Boolean.valueOf(erreurs.getAttributs().get("manqueValeurCreationDate"))) System.out.println("\t ERROR : This is the wrong file creation date."); + System.out.println("\t ERREUR dans le fichier de l'étudiant."); + if(Boolean.valueOf(erreurs.getAttributs().get("manqueHistorique"))) System.out.println("\t Erreur : Il n'y a pas d'historique dans le fichier.Peut être que le fichier n'a pas été modifié ou il a été réïnitialisé par l'étudiant."); + if(Boolean.valueOf(erreurs.getAttributs().get("manqueCreationDate"))) System.out.println("\t Erreur : Ce n'est pas la bonne date de création du fichier. Le fichier a été réïnitialisé ou ce n'est pas le fichier de l'évaluation."); + if(Boolean.valueOf(erreurs.getAttributs().get("manqueValeurCreationDate"))) System.out.println("\t Erreur : Ce n'est pas la bonne date de création du fichier."); - if(Boolean.valueOf(erreurs.getAttributs().get("manqueMetaSujet"))) System.out.println("\t ERROR : The metadata \"Sujet\" has been deleted in the student's file. It is impossible to identify the exercise."); - if(Boolean.valueOf(erreurs.getAttributs().get("manqueValeurMetaSujet"))) System.out.println("\t ERROR : The metadata value of \"Sujet \" in the student's file is not. \"" + ouverture.getAttributs().get("metaSujet")+"\""); - if(Boolean.valueOf(erreurs.getAttributs().get("manqueInitialCreator"))) System.out.println("\t ERROR : The initial creator value in the student's file is wrong. \"" + ouverture.getAttributs().get("metaSujet")+"\""); + if(Boolean.valueOf(erreurs.getAttributs().get("manqueMetaSujet"))) System.out.println("\t Erreur : La propriété personnalisé \"Sujet\" a été supprimé dans le fichier de l'étudiant."); + if(Boolean.valueOf(erreurs.getAttributs().get("manqueValeurMetaSujet"))) System.out.println("\t Erreur : La propriété personnalisé \"Sujet \" a été modifié par l'étudiant.\nLa valeur de cette propriété personnalisé dans le fichier de l'étudiant est \"" + ouverture.getAttributs().get("metaSujet")+"\".\nCe n'est pas la valeur correct."); + if(Boolean.valueOf(erreurs.getAttributs().get("manqueInitialCreator"))) System.out.println("\t Erreur : La propriété personnalisé \"Sujet\" n'est pas correct."); } System.out.println(); } /** - * Place au node le contenu saut de ligne
- * Et place un titre1, ou titre2, ou titre3 + * Ajoute dans le node nodanalyse.
+ * Le node saut et son attribut titre
+ * Et place un titre1, ou titre2, ou titre3
*
* @param nod * @return @@ -4300,11 +3206,11 @@ public class meptl { */ private static void ecritureCSV(node ana) throws IOException{ Date aujourdhui = new Date(); - Path outputFilePath = Paths.get(patch + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(commandes.fourniDossierDestination) outputFilePath = Paths.get(patch +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + Path outputFilePath = Paths.get(commandes.path + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(commandes.fourniDossierDestination) outputFilePath = Paths.get(commandes.path +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(!commandes.fourniDossierDestination) System.out.println(patch +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(commandes.fourniDossierDestination) System.out.println(patch +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(!commandes.fourniDossierDestination) System.out.println(commandes.path +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(commandes.fourniDossierDestination) System.out.println(commandes.path +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, StandardCharsets.UTF_8); fichier.write("prénom nom;date modification;producteur;durée edition;sujet;note\n"); @@ -4346,11 +3252,11 @@ public class meptl { Date aujourdhui = new Date(); - Path outputFilePath = Paths.get(patch + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(commandes.fourniDossierDestination) outputFilePath = Paths.get(patch +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + Path outputFilePath = Paths.get(commandes.path + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(commandes.fourniDossierDestination) outputFilePath = Paths.get(commandes.path +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(!commandes.fourniDossierDestination) System.out.println(patch +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(commandes.fourniDossierDestination) System.out.println(patch +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(!commandes.fourniDossierDestination) System.out.println(commandes.path +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(commandes.fourniDossierDestination) System.out.println(commandes.path +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); @@ -4443,11 +3349,11 @@ public class meptl { Date aujourdhui = new Date(); - Path outputFilePath = Paths.get(patch + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(commandes.fourniDossierDestination) outputFilePath = Paths.get(patch +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + Path outputFilePath = Paths.get(commandes.path + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(commandes.fourniDossierDestination) outputFilePath = Paths.get(commandes.path +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(!commandes.fourniDossierDestination) System.out.println(patch +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); - if(commandes.fourniDossierDestination) System.out.println(patch +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(!commandes.fourniDossierDestination) System.out.println(commandes.path +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); + if(commandes.fourniDossierDestination) System.out.println(commandes.path +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv"); BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, encoding); fichier.write("prénom nom"+separator+"email"+separator+"identifiant"+separator+"date modification"+separator+"producteur"+separator+"durée edition"+separator+"sujet"+separator+"nbr modification" + separator + "nbr modifications date unique" + separator+ "nbr match consecutif" + separator +"note" + separator +"commentaire\n"); @@ -4598,7 +3504,7 @@ public class meptl { * @param dureeEdition * @return */ - private static String traitementDureeEdition(String dureeEdition) { + public static String traitementDureeEdition(String dureeEdition) { dureeEdition = dureeEdition.replace("P", ""); dureeEdition = dureeEdition.replace("D", " j "); dureeEdition = dureeEdition.replace("T", " "); diff --git a/src/MEPTL/verificationFichierAnalyse.java b/src/MEPTL/verificationFichierAnalyse.java index 78c7433..2ba3644 100644 --- a/src/MEPTL/verificationFichierAnalyse.java +++ b/src/MEPTL/verificationFichierAnalyse.java @@ -543,7 +543,7 @@ public class verificationFichierAnalyse { * @throws CloneNotSupportedException * @throws IOException */ - public static void MiseAJourDuHash() throws CloneNotSupportedException, IOException { + public static void MiseAJourFichierAnalyse() throws CloneNotSupportedException, IOException { node nodeCalculHash = meptl.chargementsujet(commandes.nameSujet, false); commandes.hash = String.valueOf(Run.HashNode(nodeCalculHash,0)); boolean maj =false; @@ -564,7 +564,7 @@ public class verificationFichierAnalyse { if(maj) { int nbespace = "───────────────────────────┐".length()-commandes.hash.length(); if (nbespace<0) nbespace=1; - int nbespace2 = "────────────────────────────────┐".length()-commandes.hash.length(); + int nbespace2 = "───────────────────────────────┐".length()-commandes.nameSujet.length(); if (nbespace2<0) nbespace2=1; System.out.println("\t\t┌────────────────────────────────────────────────────────────────────┐"); System.out.println("\t\t│ Le hash du code de l'évaluation ou le nom du fichier d'analyse │"); @@ -606,7 +606,7 @@ public class verificationFichierAnalyse { static private void messagMiseAJourFichierAnalyse(String hash) { int nbespace = "───────────────────────────┐".length()-hash.length(); if (nbespace<0) nbespace=1; - int nbespace2 = "──────────────────────────────┐".length()-hash.length(); + int nbespace2 = "───────────────────────────────┐".length()-commandes.nameSujet.length(); if (nbespace2<0) nbespace2=1; System.out.println("\t\t┌────────────────────────────────────────────────────────────────────┐"); System.out.println("\t\t│ A la fin de l'évaluation. │"); @@ -622,7 +622,7 @@ public class verificationFichierAnalyse { static public void messagMiseAJourFichierAnalyseAprèsAnalyse() { int nbespace = "───────────────────────────┐".length()-commandes.hash.length(); if (nbespace<0) nbespace=1; - int nbespace2 = "──────────────────────────────┐".length()-commandes.hash.length(); + int nbespace2 = "───────────────────────────────┐".length()-commandes.hash.length(); if (nbespace2<0) nbespace2=1; System.out.println("\t\t┌────────────────────────────────────────────────────────────────────┐"); System.out.println("\t\t│ Mise à jour du fichier d'analyse │");