Nouvelle version 3.6.0

Ajout du hash (hashcode) du fichier d'analyse.
This commit is contained in:
pablo rodriguez 2022-05-03 16:02:02 +02:00
parent 36531d658e
commit 2a8749e7a9
21 changed files with 859 additions and 626 deletions

View File

@ -1,12 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1 +0,0 @@
pablo rodriguez,LAPTOP-G5TBC6N3/pabr6,LAPTOP-G5TBC6N3,29.04.2022 19:17,file:///C:/Users/pabr6/AppData/Roaming/LibreOffice/4;

View File

@ -1,2 +0,0 @@
[.ShellClassInfo]
IconResource=C:\Program Files (x86)\ownCloud\owncloud.exe,0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -228,7 +228,7 @@ public class HTML {
}
//ajoute le commentaire
if(!nod.getContenu().isEmpty()) if(nod.getNodes().size()==1) code = code + HTML.Paragraph_classp6(nod.getContenu()) + HTML.SautLigne();
if(!nod.getContenu().isEmpty()) if(nod.getNodes().size()==1) code = code + HTML.Paragraph_classp6(nod.getContenu().get(0)) + HTML.SautLigne();
code = code + HTML.TableEntete(); //ajoute l'entête
@ -260,7 +260,7 @@ public class HTML {
code = code + HTML.SautLigne();
}
if(!nod.getContenu().isEmpty()) code = code + HTML.Paragraph_classp6(nod.getContenu()) + HTML.SautLigne();
if(!nod.getContenu().isEmpty()) code = code + HTML.Paragraph_classp6(nod.getContenu().get(0)) + HTML.SautLigne();
for(int l = 0 ; l < nod.getNodes().get(k).getNodes().size() ; l++) {
if(!nod.getNodes().get(k).getNodes().get(l).getNomElt().equals("saut")){

View File

@ -0,0 +1,132 @@
package MEPTL;
import cXML.node;
import cXML.Run;
public class analyseLesNodesEnants {
/**
* Cette méthode récursive permet d'analyser et d'évaluer les nodes enfants.</br>
*
* @param PourAnalyse : Le node pour écrire le node d'analyse contenant tous les résultats
* @param nomDuNodePourAnalyse : Le nom du node de l'analyse pour cette partie (exemple ana:page)
* @param nod2Student : Le node de l'étudiant le plus bas niveau (le dernier node trouvé)
* @param nod1Student : Le node de l'étudaint de niveau intermédiaire contenant le node nod2Student
* @param nodStudent : Le node de l'étudiant le plus haut niveau contenant les nodes nod1Student & nod2Student
* @param nodSujet : le node sujet.
* @param nodSujetParagraphs : node contenant l'ensemble des nodes styles de paragraphes du sujet.
* @param nodStudentParagraphes : node contenant l'ensemble des nodes styles de paragarphes de l'étudiants.
* @param a : Objet de cXML.Run
* @return le node pour analyse PourAnalyse
*/
static public node nodeNext(node PourAnalyse, String nomDuNodePourAnalyse, node nod2Student, node nod1Student, node nodStudent, node nodSujet, node nodSujetParagraphs, node nodStudentParagraphes, Run a) {
node nodEnfantSujet = null;
node nodStudentCorrespondantAuNodSujet = null;
for(int j = 0 ; j < nodSujet.getNodes().size();j++ ) {
nodEnfantSujet = nodSujet.getNodes().get(j);
String nameNode = nodEnfantSujet.getNomElt();
//********************************
//** Ajoute des sauts et titres **
//********************************
PourAnalyse = meptl.addNodeSautTitre(nodEnfantSujet, PourAnalyse); // ajoute des saut de page s'il y a des sauts avec des titres
//***************************************************
//** Recherche le node correspondant de l'étudiant **
//***************************************************
if(nod2Student!=null) {
if(nod2Student.containElementByName(nameNode)) {
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
}
}
if(nodStudentCorrespondantAuNodSujet==null && nod1Student!=null) {
if(nod1Student.containElementByName(nameNode)) {
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
}
}
if(nodStudentCorrespondantAuNodSujet==null && nodStudent!=null) {
if(nodStudent.containElementByName(nameNode)) {
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
}
}
//**************************************************************
//** Analyse attribut et contenu du node enfant de l'étudiant **
//**************************************************************
PourAnalyse = meptl.analyseLesAttributEtContenuDuNode(nodStudentCorrespondantAuNodSujet, nodEnfantSujet, PourAnalyse, nomDuNodePourAnalyse,nameNode);
//*******************************
//** méthode analyseStyle=true **
//*******************************
if(nameNode.contains("text:") && nodEnfantSujet.getAttributs().get("analyseStyle")!=null && nodSujetParagraphs!=null) {
if(nodEnfantSujet.getAttributs().get("analyseStyle").equalsIgnoreCase("true")) {
PourAnalyse = analyseStyle(PourAnalyse, nomDuNodePourAnalyse, nodEnfantSujet,nodStudentCorrespondantAuNodSujet, nodSujetParagraphs,nodStudentParagraphes);
}
}
//**********************************************
//** Analyse les nodes enfants du node enfant **
//**********************************************
if(nodEnfantSujet!=null) {
PourAnalyse = nodeNext(PourAnalyse, nomDuNodePourAnalyse, nodStudentCorrespondantAuNodSujet, nod2Student, nod1Student, nodEnfantSujet, nodSujetParagraphs, nodStudentParagraphes, a);
}
}
return PourAnalyse;
}
/**
* Permet d'analyser les styles depuis l'attribut analyseStyle.</br>
* @param PourAnalyse : node pour le node analyse
* @param : Le nom du node de l'analyse pour cette partie (exemple ana:page)
* @param nodSujet
* @param nodStudent
* @param nodSujetParagraphs
* @param nodStudentParagraphs
* @return
*/
public static node analyseStyle(node PourAnalyse, String nomDuNodePourAnalyse, node nodSujet, node nodStudent, node nodSujetParagraphs, node nodStudentParagraphs ) {
node StyleParagraphSujet = null;
node StyleParagraphStudent = null;
if(nodSujet.getAttributs().get("analyseStyle")!=null) {
if(nodSujet.getAttributs().get("analyseStyle").equalsIgnoreCase("true") && nodSujet.getAttributs().get("text:style-name")!=null) {
String NameStyleParagrapheSujet = nodSujet.getAttributs().get("text:style-name");
StyleParagraphSujet = nodSujetParagraphs.retourneFirstNodeStyleByValueAttribut("style:style", "style:name", NameStyleParagrapheSujet);
}
if(nodStudent!=null && StyleParagraphSujet!=null) {
if(nodStudent.getAttributs().get("text:style-name")!=null && StyleParagraphSujet!=null) {
String NameStyleParagrapheStudent = nodStudent.getAttributs().get("text:style-name");
StyleParagraphStudent = nodStudentParagraphs.retourneFirstNodeStyleByValueAttribut("style:style", "style:name",NameStyleParagrapheStudent);
}
}
// ajoute les valeurs par héritage.
if(StyleParagraphSujet!=null) {
if(StyleParagraphStudent!=null) StyleParagraphStudent = meptl.ajouteValeurLesValeursDuStyleParagraphParent(nodStudentParagraphs , StyleParagraphStudent);
//ajoute les valeurs par défaut.
if(StyleParagraphStudent!=null) StyleParagraphStudent = meptl.ajouteValeurParDefautAuStyleParagraph(nodStudentParagraphs , StyleParagraphStudent);
//**************************************************************
//** Analyse attribut et contenu du node enfant de l'étudiant **
//**************************************************************
PourAnalyse = meptl.analyseLesAttributAnalyseStyle(StyleParagraphStudent, StyleParagraphSujet, PourAnalyse, nomDuNodePourAnalyse,"style:style");
}
}
return PourAnalyse;
}
}

View File

@ -25,6 +25,8 @@ public class commandes {
public static boolean ecritCode = false; // -write : ecriture du code du sujet
public static boolean ecritSujet = false; // -sujet : ecriture 2 du code du sujet, uniquement les nodes évalués
public static boolean ecritNoteCSV = false; // ecriture note.csv
public static boolean writefiles = false; // -writefiles permet d'écrire tous les fichiers XML après la lecture en node
public static boolean calculLeHashDuFichier = false; // -hash retourne le hash du fichier d'analyse
public static boolean sansFeeback = false; // pas de feedback étudiant
public static boolean verifHisto = false; // vérification des historiques correspond à la commande -verif
public static boolean verifHisto2 = false; // vérification des historiques lorsqu'il y a aussi analyse
@ -43,7 +45,7 @@ public class commandes {
public static String contenuFichierSVG =""; // Le nouveau logo
public static String path ="";
public static String pathDestination ="";
public static String version ="3.5.1"; // La version
public static String version ="3.6.0"; // La version
public static String Command ="";
//** setting valeur par défaut
@ -57,7 +59,10 @@ public class commandes {
public static int tolerance_vert = 30;
public static int tolerance_bleu = 30;
//** Variable de mise à jour du fichier d'analyse
public static boolean MAJnameAnalysisFile =false;
public static boolean MAJFichierAnalyse = false;
public static String hash ="0";
/**
*
@ -74,81 +79,94 @@ public class commandes {
}
try {
if(args.length==0) {badCommand=true; System.out.println("There must be at least one command.");System.out.println("You can type the -help command to get help.");}
if(args.length==0) {badCommand=true; System.out.println("Il doit y avoir une commande.");System.out.println("Vous pouvez saisir les commandes -aide ou -help pour obtenir la liste des commandes.");}
for(int i = 0 ; i < args.length ; i++) {
if(args[i].equals("-use")) if((i+1)<args.length) { if(!args[i+1].contains(".xml")) {badCommand=true; System.out.println("The -use command must be followed by the name of analyze file.");}}else {badCommand=true; System.out.println("The -use command must be followed by the name of analyze file.");}
if(args[i].equals("-use")) if((i+1)<args.length) { if(!args[i+1].contains(".xml")) {badCommand=true; System.out.println("La commande -use doit être suivi du nom du fichier.");}}else {badCommand=true; System.out.println("La commande -use doit être suivi du nom du fichier.");}
if(args[i].contains(".xml")) {
Matcher m = Pattern.compile("{1,}.xml$").matcher(args[i]);
if(m.find()) {nameSujet = args[i];}else {badCommand=true;System.out.println("There is a problem with the extension of the analyze file. The extension must be \".xml\".");};
if(i-1>=0) {if(args[i-1].equals("-use")) analyse=true;}else {badCommand=true; System.out.println("The -use command must be before the name of the analyze file.");}
if(i-1>=0) {if(!args[i-1].equals("-use")) {badCommand=true; System.out.println("The -use command is missing in front of the name of the scan file.");}}else {badCommand=true; System.out.println("The -use command must be before the name of the analyze file.");}
if(m.find()) {nameSujet = args[i];}else {badCommand=true;System.out.println("Il y a un problème avec l'extension du fichier d'analyse.\nL'extension doit être \".xml\".");};
if(i-1>=0){
if(args[i-1].equals("-use")) analyse=true;
if(args[i-1].equals("-hash")) calculLeHashDuFichier=true;
if(!analyse&&!calculLeHashDuFichier) {
badCommand=true;
System.out.println("Les commandes -use ou -hash doit être suivi du nom du fichier d'analyse.");
}
}
}
if(args[i].contains(".csv")) {
Matcher m = Pattern.compile("{1,}.csv$").matcher(args[i]);
if(m.find()) {fourniCSV=true; nameCSV = args[i];}else {badCommand=true;System.out.println("There is a problem with the extension of the CSV file. The extension must be \".csv\".");}
if(!args[i-1].equals("-csv") && !args[i-1].equals("-verifcsv")) {badCommand=true; System.out.println("The -csv or -verifcsv command is missing in front of the name of the file containing the list of students with their identifiers.");}
if(m.find()) {fourniCSV=true; nameCSV = args[i];}else {badCommand=true;System.out.println("Il y a un problème avec l'extension du fichier CSV.\nL'extension doit être \".csv\".");}
if(!args[i-1].equals("-csv") && !args[i-1].equals("-verifcsv")) {badCommand=true; System.out.println("Les commandes -csv ou -verifcsv doivent être suivies par le fichier CSV contenant les identifiants des étudiants.");}
}
if(args[i].equals("-csv")) {
if(!analyse) {badCommand=true;System.out.println("You must type the -use analyzefileName.xml command then after the command -csv.");}
if(!analyse) {badCommand=true;System.out.println("Vous devez saisir la commande -use suivi du nom du fichier d'analyse et après la commande -csv.");}
ecritNoteCSV=true;
}
if(args[i].contains(".svg")) {
Matcher m = Pattern.compile("{1,}.svg$").matcher(args[i]);
if(m.find()) {newLogo=true; nameSVG = args[i];}else {badCommand=true;System.out.println("There is a problem with the extension of the SVG file. The extension must be \".svg\".");}
if(!args[i-1].equals("-newLogo")) {badCommand=true; System.out.println("The -newLogo command is missing in front of the name of the SVG file.");}
if(m.find()) {newLogo=true; nameSVG = args[i];}else {badCommand=true;System.out.println("Il y a un problème avec l'extension du fichier SVG.\nL'extension doit être \".svg\".");}
if(!args[i-1].equals("-newLogo")) {badCommand=true; System.out.println("La commande -newLogo doit être suivi du nom du fichier SVG.");}
}
if(args[i].equals("-newLogo")) {
if(!analyse) {badCommand=true;System.out.println("You must type the -use analyzefileName.xml command then after the command -newLogo.");}
if(noLogo) {badCommand=true;System.out.println("The -newLogo and -noLogo commands cannot be executed together.");}
if(!analyse) {badCommand=true;System.out.println("Vous devez saisir la commade -use puis le nom du fichier d'analyse et après la commande -newLogo.");}
if(noLogo) {badCommand=true;System.out.println("la commande -newLogo et -nologo ne peuvent pas être executées ensemble.");}
newLogo=true;
}
if(args[i].equals("-verifcsv")) {
if(verifHisto) {badCommand=true;System.out.println("The -verifcsv and -verif commands cannot be executed together.");}
if(verifHisto) {badCommand=true;System.out.println("Les commandes -verifcsv et -verif ne peuvent pas être executées ensemble.");}
ecritNoteCSV=true;
verifHisto=false;
verifHisto2=true;
if(!analyse) {badCommand=true;System.out.println("You must type the command -use analyzeFileName.xml then after the command -verifcsv.");}
if(!analyse) {badCommand=true;System.out.println("Vous devez saisir la commade -use puis le nom du fichier d'analyse et après la commande -verifcsv.");}
}
if(args[i].equals("-nofeedback")) {
if(zipfeedback) {badCommand=true;System.out.println("It is not possible to run the -nofeedback and -zipfeedback commands at the same time. ");}
if(zipfeedback) {badCommand=true;System.out.println("Ce n'est pas possible d'executer les commandes -nofeedback et -zipfeedback en même temps.");}
sansFeeback=true;
}
if(args[i].equals("-verif")) {
if(verifHisto2) {badCommand=true;System.out.println("The -verifcsv and -verif commands cannot be executed together.");}
if(verifHisto2) {badCommand=true;System.out.println("Les commandes -verifcsv et -verif ne peuvent pas être executées ensemble.");}
verifHisto=true;
verifHisto2=false;
}
if(args[i].equals("-help")) {
if(args.length>1) {System.out.println("\n\n***\nThe -help command should be the only command.\n***");clotureWithError();}
if(args.length>1) {System.out.println("\n\n***\nLa commande -help doit être la seule commande.\n***");clotureWithError();}
helpEN();
clotureWithHelp();
}
if(args[i].equals("-aide")) {
if(args.length>1) {System.out.println("\n\n***\nThe -aide command should be the only command.\n***");clotureWithError();}
if(args.length>1) {System.out.println("\n\n***\nLa commande -aide doit être la seule commande.\n***");clotureWithError();}
helpFR();
clotureWithHelp();
}
if(args[i].equals("-licence")) {
if(args.length>1) {System.out.println("\n\n***\nThe -licence command should be the only command.\n***");clotureWithError();}
if(args.length>1) {System.out.println("\n\n***\nla commande -licence doite être la seule commande..\n***");clotureWithError();}
licence();
}
if(args[i].equals("-write")) {
if(args.length>1) {System.out.println("\n\n***\nThe -write command should be the only command.\n***");clotureWithError();}
if(args.length>1) {System.out.println("\n\n***\nLa commande -write doit être la seule commande.\n***");clotureWithError();}
ecritCode=true;
Profil = UserStatus.STUDENT;
}
if(args[i].equals("-writefiles")) {
if(!(args.length==1 && Command.contains("-writefiles") || args.length==2 && Command.contains("-writefiles")&&Command.contains("-f")) ) {System.out.println("\n\n***\nLa commande -writefiles doit être la seule commande.\nElle peut être suivi de la commande -f uniquement.\n***");clotureWithError();}
writefiles=true;
}
if(args[i].equals("-hash")) {
if(args.length>2) {System.out.println("\n\n***\nLa commande -hash suivi du nom du fichier d'analyse doit être la seule commande.\n***");clotureWithError();}
calculLeHashDuFichier=true;
}
if(args[i].equals("-sujet")) {
if(!analyse) {badCommand=true;System.out.println("You must type the command -use, then the name of analysis file, then the command -sujet.");}
if(args.length>3) {badCommand=true; System.out.println("If you use the command -sujet, you can't use other commands except -use and the filename.");}
if(!(analyse&&args.length==3&&Command.contains("-use"))) {badCommand=true; System.out.println("Vous devez saisir la commande -use suivi du fichier d'analyse et après vous pouvez saisir la commande -sujet.");}
ecritSujet=true;
}
if(args[i].equals("-nologo")) {
if(!analyse) {badCommand=true;System.out.println("You must type the command -use , then the filename and after then the command -sujet.");}
if(newLogo) {badCommand=true;System.out.println("The -newLogo and -noLogo commands cannot be executed together.");}
if(!analyse) {badCommand=true;System.out.println("Vous devez saisir la commande -use suivi du fichier d'analyse et après vous pouvez saisir la commande -nologo.");}
if(newLogo) {badCommand=true;System.out.println("Les commandes -newlogo et -nologo ne peuvent pas être executées en même temps.");}
noLogo=true;
}
if(args[i].equals("-about")) {
if(args.length>1) {System.out.println("\n\n***\nThe -about command should be the only command.\n***");clotureWithError();}
if(args.length>1) {System.out.println("\n\n***\nLa commande -about doit être la seule commande.\n***");clotureWithError();}
about();
clotureApplication();
}
@ -156,12 +174,12 @@ public class commandes {
noNote=true;
}
if(args[i].equals("-zipfeedback")) {
if(!analyse) {badCommand=true;System.out.println("You must type the command -use, then the name of analysis file, then the command -zipfeedback.");}
if(sansFeeback) {badCommand=true;System.out.println("It is not possible to run the -nofeedback and -zipfeedback commands at the same time.");}
if(!analyse) {badCommand=true;System.out.println("Vous devez saisir la commande -use suivi du fichier d'analyse et après vous pouvez saisir la commande -zipfeedback.");}
if(sansFeeback) {badCommand=true;System.out.println("Ce n'est pas possible d'executer les commandes -nofeedback et -zipfeedback en même temps.");}
zipfeedback=true;
}
if(args[i].equals("-f")) {
if(Command.contains(" -d ")) {badCommand=true;System.out.println("The -f and -d commands cannot be executed together.");}
if(Command.contains(" -d ")) {badCommand=true;System.out.println("Les commandes -f et -d ne peuvent pas être executées ensemble.");}
fichierStudentMoodle=true;
}
if(args[i].equals("-dest")) if((i+1)<args.length) {
@ -173,16 +191,16 @@ public class commandes {
File file = new File(path+"/"+ pathDestination);
if (!file.exists()) {
if (file.mkdir()) {
System.out.println("The directory \"" + pathDestination + "\" has been created.");
System.out.println("Le dossier \"" + pathDestination + "\" a été créé.");
} else {
System.out.println("Cannot create the directory " + pathDestination);
System.out.println("Impossible de créer le dossier " + pathDestination);
}
}else {
System.out.println("The directory \"" + pathDestination + "\" has not been created.");
System.out.println("Le dossier \"" + pathDestination + "\" n'a pas été créé.");
}
}else {
System.out.println(args[i+1]);
System.out.println("After the -dest command, there must be the path to the destination folder.\nThe path to the destination folder is not correct.");
System.out.println("Après la commande -dest, il doit y avoir le chemin de destination vers le dossier.\nLe chemin de destination n'est pas correct.");
badCommand =true;
}
}
@ -190,8 +208,9 @@ public class commandes {
if(!args[i].equals("-use")&&!args[i].equals("-write")&&!args[i].equals("-csv")&&!args[i].equals("-verif")&&!args[i].equals("-verifcsv")
&&!args[i].contains(".csv")&&!args[i].contains(".svg")&&!args[i].contains(".xml")&&!args[i].contains("-nofeedback")&&!args[i].contains("-help")&&!args[i].equals("-aide")
&&!args[i].equals("-about")&&!args[i].equals("-nonote") &&!args[i].equals("-dest")&&!args[i].equals("-sujet")&&!args[i].equals("-nologo")
&&!args[i].equals("-licence")&&!args[i].equals("-zipfeedback")&&!args[i].equals("-newLogo")&&!args[i].equals("-f")&&!m.find()) {
badCommand=true; System.out.println("the command " + args[i] + " is unknown.");System.out.println("You can type the -help command to get help.");
&&!args[i].equals("-licence")&&!args[i].equals("-zipfeedback")&&!args[i].equals("-newLogo")&&!args[i].equals("-f")&&!m.find()&&!args[i].equals("-writefiles")
&&!args[i].equals("-hash")&&!m.find()) {
badCommand=true; System.out.println("La commande " + args[i] + " est inconnu.");System.out.println("Vous pouvez taper \"java -jar analyseWriter.jar -aide\" pour obtenir la liste des commandes.");
}
}
}catch (ArrayIndexOutOfBoundsException e){
@ -220,6 +239,8 @@ public class commandes {
System.out.println("No student grade = " + noNote);
System.out.println("Writing an analysis file = "+ ecritCode);
System.out.println("Write the subject file \"sujet.xml\" = "+ ecritSujet);
System.out.println("Write all student's files to XML = "+ writefiles);
System.out.println("Hash = "+ calculLeHashDuFichier);
System.out.println("Check historics (-verif) = " + verifHisto);
System.out.println("Check historics and write CSV file (-verifcsv) = " + verifHisto2);
System.out.println("Export in CSV format = " + ecritNoteCSV);
@ -308,6 +329,11 @@ public class commandes {
System.out.println(" : \t Vous devez l'adapter en modifiant le code XML pour réaliser vos propres analyses.");
System.out.println();
System.out.println(" -writefiles : \t Permet d'écrire tous les fichiers en XML.");
System.out.println(" : \t Les fichiers générés se trouvent dans le dossier courant*.");
System.out.println(" : \t Les fichiers générés sont au format XML.");
System.out.println();
System.out.println(" -zipfeedback : \t Permet de générer une archive ZIP contenant les feedbacks des étudiant.");
System.out.println(" : \t L'archive se nomme moodleFeedback.zip.");
System.out.println(" : \t L'archive respecte le format pour l'importation des feedbacks dans Moodle.");
@ -347,6 +373,10 @@ public class commandes {
System.out.println(" : \t Le fichier \"sujet.xml\" se trouve dans le dossier courant de l'application.");
System.out.println();
System.out.println(" -hash : \t Permet calculer le hash d'un fichier.");
System.out.println(" : \t Permet de vérifier qu'un fichier d'analyse n'a pas été mofidié.");
System.out.println();
System.out.println(" -about : \t Affiche la version, l'auteur et la licence.");
System.out.println();
@ -432,6 +462,11 @@ public class commandes {
System.out.println(" : \t You must adapt it by modifying the XML code to perform your own analyzes.");
System.out.println();
System.out.println(" -writefiles : \t Allows you to write all files in XML.");
System.out.println(" : \t The generated files are located in the current folder*.");
System.out.println(" : \t The generated files are in XML format.");
System.out.println();
System.out.println(" -zipfeedback : \t Allows you to generate a ZIP archive containing student feedback. ");
System.out.println(" : \t The archive is named \"moodleFeedback.zip\".");
System.out.println(" : \t The archive respects the format for importing feedback into Moodle.");
@ -459,6 +494,10 @@ public class commandes {
System.out.println(" : \t The \"subject.xml\" file is located in the current application folder. ");
System.out.println();
System.out.println(" -hash : \t Allows you to calculate the hash of a file.");
System.out.println(" : \t Allows you to verify that an analysis file has not been mofidized.");
System.out.println();
System.out.println(" -about : \t Displays the version, author and license. ");
System.out.println();
@ -485,17 +524,22 @@ public class commandes {
*/
private static void about() throws InterruptedException, IOException {
CLS();
int nbespace = 58-version.length();
if (nbespace<0) nbespace=1;
System.out.println();
System.out.println("*******************************************************************");
System.out.println("application: analyseWriter");
System.out.println();
System.out.println("version : " + version);
System.out.println("Mise à jour : https://github.com/1-pablo-rodriguez/analyseWriter\n");
System.out.println("enseignant : pablo Rodriguez");
System.out.println("Université d'Artois - 10 rue du temple 62000 Arras\n");
System.out.println("LICENCE");
System.out.println("GNU GENERAL PUBLIC LICENSE\r\nVersion 3, 29 June 2007");
System.out.println("*******************************************************************");
System.out.println("\t\t┌─────────────────────────────────────────────────────────────────────┐");
System.out.println("\t\t│ ANALYSEWRITER (Origin ) │");
System.out.println("\t\t│ Version : " + version+ new String(new char[nbespace]).replace("\0", " ") +"" );
System.out.println("\t\t│ │");
System.out.println("\t\t│ Mise à jour : https://github.com/1-pablo-rodriguez/analyseWriter │");
System.out.println("\t\t│ Mise à jour : https://forge.chapril.org/pablo/analyseWriter/releases│");
System.out.println("\t\t│ │");
System.out.println("\t\t│ Développeur : pablo Rodriguez │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ LICENCE GNU GENERAL PUBLIC LICENSE │");
System.out.println("\t\t│ Version 3, 29 June 2007 │");
System.out.println("\t\t└─────────────────────────────────────────────────────────────────────┘");
System.out.println();
}
@ -519,11 +563,11 @@ public class commandes {
System.out.println();
System.out.println("\t\t┌─────────────────────────────────────────────┐");
System.out.println("\t\t│ Above, you have the app license. │");
System.out.println("\t\t│ Au-dessus, vous avez la licence. │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ (')_(') │");
System.out.println("\t\t│ ( `.° ) │");
System.out.println("\t\t│ (\")__(\") .. see you soon, analyseWriter.");
System.out.println("\t\t│ (\")__(\") .. à bientôt, analyseWriter. ");
System.out.println("\t\t└─────────────────────────────────────────────┘");
System.out.println();
System.exit(0);
@ -536,14 +580,15 @@ public class commandes {
public static void clotureWithError() {
System.out.println();
System.out.println("\t\t┌─────────────────────────────────────────────┐");
System.out.println("\t\t│ You made a mistake in your command. │");
System.out.println("\t\t│ Vous avez commis une erreur dans votre │");
System.out.println("\t\t│ commande. │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ You need to read the above information and");
System.out.println("\t\t│ start over. ");
System.out.println("\t\t│ Lisez les informations ci-dessus et ");
System.out.println("\t\t│ recommencez.");
System.out.println("\t\t│ │");
System.out.println("\t\t│ (')_(') │");
System.out.println("\t\t│ ( `.° ) │");
System.out.println("\t\t│ (\")__(\") .. see you soon, analyseWriter.");
System.out.println("\t\t│ (\")__(\") .. à bientôt, analyseWriter. ");
System.out.println("\t\t└─────────────────────────────────────────────┘");
System.out.println();
System.exit(0);
@ -557,7 +602,7 @@ public class commandes {
System.out.println();
System.out.println("\t\t┌────────────────────────────────────────────────────┐");
System.out.println("\t\t│ (')_(') │");
System.out.println("\t\t│ ( `.° ) Well done, you've worked very hard! ");
System.out.println("\t\t│ ( `.° ) Bravo, vous avez travaillé très dur!");
System.out.println("\t\t│ (\")__(\") .. Bye Bye analyseWriter. │");
System.out.println("\t\t└────────────────────────────────────────────────────┘");
System.out.println();
@ -567,13 +612,13 @@ public class commandes {
public static void clotureWithHelp() {
System.out.println();
System.out.println("\t\t┌─────────────────────────────────────────────────────┐");
System.out.println("\t\t│ Above you have the help of the app. ");
System.out.println("\t\t│ But don't forget, you also have the documentation");
System.out.println("\t\t│ on the github website. And soon in english.");
System.out.println("\t\t│ Au-dessus, vous avez la liste des commandes.");
System.out.println("\t\t│ Mais vous avez aussi la documentation sur le ");
System.out.println("\t\t│ le serveur de github ou chapril. ");
System.out.println("\t\t│ │");
System.out.println("\t\t│ (')_(') │");
System.out.println("\t\t│ ( `.° ) │");
System.out.println("\t\t│ (\")__(\") .. see you soon, analyseWriter.");
System.out.println("\t\t│ (\")__(\") .. à bientôt, analyseWriter. ");
System.out.println("\t\t└─────────────────────────────────────────────────────┘");
System.out.println();
System.exit(0);

View File

@ -20,8 +20,9 @@ public class ecritureSujet {
* @param a
* @param i
* @return
* @throws CloneNotSupportedException
*/
public static node nodePourEcritureSujet(node nod, Run a, Integer i) {
public static node nodePourEcritureSujet(node nod, Run a, Integer i) throws CloneNotSupportedException {
LocalDateTime aujourdhui = LocalDateTime.now();
// fichier
@ -39,17 +40,17 @@ public class ecritureSujet {
nod.getAttributs().put("controle_Initial_Creator", "false");
nod.getAttributs().put("presenceMetaSujet", "false");
node b = a.retourneName(nod.retourneFirstEnfantsByName("office:meta"),"meta:user-defined","meta:name","Sujet");
if(b!=null) { nod.getAttributs().put("metaSujet", b.getContenu());}else {nod.getAttributs().put("metaSujet", "?");}
if(b!=null) { nod.getAttributs().put("metaSujet", b.getContenu().get(0));}else {nod.getAttributs().put("metaSujet", "?");}
b = nod.retourneFirstEnfantsByName("office:meta").retourneFirstEnfantsByName("meta:creation-date");
if(b!=null) {
if(b.getContenu().contains(".")) {
nod.getAttributs().put("creationDate", b.getContenu().substring(0, b.getContenu().lastIndexOf(".")));
if(b!=null) if(b.getContenu().size()>0) {
if(b.getContenu().get(0).contains(".")) {
nod.getAttributs().put("creationDate", b.getContenu().get(0).substring(0, b.getContenu().get(0).lastIndexOf(".")));
}else {
nod.getAttributs().put("creationDate", b.getContenu());
nod.getAttributs().put("creationDate", b.getContenu().get(0));
}
}
b = nod.retourneFirstEnfantsByName("office:meta").retourneFirstEnfantsByName("meta:initial-creator");
if(b!=null) nod.getAttributs().put("Initial_Creator", b.getContenu());
if(b!=null) if(b.getContenu().size()>0) { nod.getAttributs().put("Initial_Creator", b.getContenu().get(0));}else {nod.getAttributs().put("Initial_Creator", "");}
nod.getAttributs().put("auteur", "votre nom et prénom");
nod.setContenu("Commentaire sur cet exercice.-NewLine-Seconde ligne de commentaire.");
nod.getAttributs().remove("dossier");
@ -258,6 +259,10 @@ public class ecritureSujet {
// ajoute le node setting et translation
nod = addSetting(nod);
// ajoute le hash du code
String hash = String.valueOf(Run.HashNode(Run.NodesAyantAttributEvaluerTRUEavecComplement(nod),0));
nod.getAttributs().put("hash", hash);
return nod;
}
@ -312,7 +317,7 @@ public class ecritureSujet {
if(listeDesNodesSautEtTitre(no4.get(n).getNomElt())) {no4.get(n).getAttributs().put("saut", "false"); no4.get(n).getAttributs().put("titre", "");no4.get(n).getAttributs().put("styletitre", "nostyle");}
if(listeDesNodesRechercheIndex(no4.get(n).getNomElt())) {no4.get(n).getAttributs().put("recherche_index", "false"); no4.get(n).getAttributs().put("recherche_contenu_exact", "false");}
if(listeDesNodesAnalyseStyle(no4.get(n).getNomElt())) no4.get(n).getAttributs().put("analyseStyle", "false");
if(listeDesNodesAllContent(no4.get(n).getNomElt())) no4.get(n).getAttributs().put("allContent", "0");
if(listeDesNodesAllContent(no4.get(n).getNomElt())) no4.get(n).getAttributs().put("allContent", "strict0");
}
}
@ -365,8 +370,7 @@ public class ecritureSujet {
* @return
*/
private static boolean listeDesNodesAnalyseStyle(String nameNode) {
if(nameNode.equals("text:p")) return true;
if(nameNode.equals("text:span")) return true;
if(nameNode.contains("text:")) return true;
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ public class outils {
boolean T = false;
if(translation.getNodes().get(i).getAttributs().get("translate")!=null) if(!translation.getNodes().get(i).getAttributs().get("translate").isEmpty()) translate=translation.getNodes().get(i).getAttributs().get("translate");
if(!translation.getNodes().get(i).getContenu().isEmpty()) contenu = translation.getNodes().get(i).getContenu().replace("-!", "<").replace("!-", ">");
if(!translation.getNodes().get(i).getContenu().isEmpty()) contenu = translation.getNodes().get(i).getContenu().get(0).replace("-!", "<").replace("!-", ">");
if(translation.getNodes().get(i).getAttributs().get("link")!=null) if(!translation.getNodes().get(i).getAttributs().get("link").isEmpty()) link="<p><a href=\"" + translation.getNodes().get(i).getAttributs().get("link") + "\" target=\"_blank\">Lien</a></p>";
if(translation.getNodes().get(i).getAttributs().get("color")!=null) if(!translation.getNodes().get(i).getAttributs().get("color").isEmpty()) color="<span style=\"color:" + translation.getNodes().get(i).getAttributs().get("color") + "\">";
if(translation.getNodes().get(i).getAttributs().get("image")!=null) if(!translation.getNodes().get(i).getAttributs().get("image").isEmpty()) if(translation.getNodes().get(i).getAttributs().get("image").equals("true")) T=true;

View File

@ -1,5 +1,6 @@
package MEPTL;
import cXML.Run;
import cXML.node;
@ -25,37 +26,37 @@ public class rechercherUnNodeStudent {
public static node rechercheLeNodeEnCascade(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a ) {
node nodStudent =null;
// recherche le node uniquement par son contenu et pas celui de ses enfants
// recherche le node uniquement par son contenu exact et par celui de ses enfants
if(nodSujet.getAttributs().get("recherche_contenu_exact")!=null){
if(nodSujet.getAttributs().get("recherche_index")!=null) {
if(nodSujet.getAttributs().get("recherche_contenu_exact").equals("true") && nodSujet.getAttributs().get("recherche_index").equals("false") ) {
String valueAttribut = outils.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getContenu());
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut);
String valueAttribut = outils.withoutCodeAndPointPourRechercheContenuExact(nodSujet.retourneLesContenusEnfants(""));
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nodStudent!=null) {return nodStudent;}else {return null;}
}
if(nodSujet.getAttributs().get("recherche_contenu_exact").equals("true") && nodSujet.getAttributs().get("recherche_index").equals("true") && nodSujet.getAttributs().get("index")!=null ) {
String valueAttribut = outils.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getContenu());
String valueAttribut = outils.withoutCodeAndPointPourRechercheContenuExact(nodSujet.retourneLesContenusEnfants(""));
String indexSujet = nodSujet.getAttributs().get("index");
if(!valueAttribut.isEmpty()&&!indexSujet.isEmpty()) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut);
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut,nodSujet.getNomElt());
if(nodStudent!=null) if(nodStudent.getAttributs().get("index").equals(indexSujet)) {return nodStudent;}else {nodStudent=null;}
if(nod1Student!=null) if(nodStudent==null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut);
if(nod1Student!=null) if(nodStudent==null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nodStudent!=null) if(nodStudent.getAttributs().get("index").equals(indexSujet)) {return nodStudent;}else {nodStudent=null;}
if(nod0Student!=null) if(nodStudent==null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut);
if(nod0Student!=null) if(nodStudent==null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nodStudent!=null) if(nodStudent.getAttributs().get("index").equals(indexSujet)) {return nodStudent;}else {nodStudent=null;}
}
}
}else {
if(nodSujet.getAttributs().get("recherche_contenu_exact").equals("true")) {
String valueAttribut = outils.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getContenu());
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut);
String valueAttribut = outils.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getContenu().get(0));
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nodStudent!=null) {return nodStudent;}else {return null;}
}
}
@ -72,7 +73,7 @@ public class rechercherUnNodeStudent {
return nodStudent;
}else {
return null;
}
}
}
}
@ -136,9 +137,10 @@ public class rechercherUnNodeStudent {
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "index", outils.withoutCodeAndPoint(nodSujet.getAttributs().get("index")));
}
}else {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
String contenuSujet = nodSujet.retourneLesContenusEnfants("");
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(),contenuSujet ,commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
}
}
}
@ -170,11 +172,12 @@ public class rechercherUnNodeStudent {
}
//recherche par le contenu enfant du node
//recherche par le contenu enfant du node les titres par défaut
if(nameNode.equals("text:h")) {
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
String contenuSujet = nodSujet.retourneLesContenusEnfants("");
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
}
//recherche par text:name
@ -233,9 +236,9 @@ public class rechercherUnNodeStudent {
//recherche par le nom de l'objet
if(nameNode.equals("style:graphic-properties")) {
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameContent(nod2Student, nameNode, nodSujet.getContenu());
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameContent(nod1Student, nameNode, nodSujet.getContenu());
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameContent(nod0Student, nameNode, nodSujet.getContenu());
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameContent(nod2Student, nameNode, nodSujet.getContenu().get(0));
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameContent(nod1Student, nameNode, nodSujet.getContenu().get(0));
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameContent(nod0Student, nameNode, nodSujet.getContenu().get(0));
}
@ -280,18 +283,19 @@ public class rechercherUnNodeStudent {
//recherche par contenu
if(nameNode.equals("text:span")) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
String contenuSujet = nodSujet.retourneLesContenusEnfants("");
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
}
//recherche par contenu
if(nameNode.equals("text:tab")) {
if(!nodSujet.retourneLesContenusEnfants("").isEmpty()) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), nodSujet.retourneLesContenusEnfants(""),commandes.tolerance_characters,commandes.tolerance_text);
String contenuSujet = nodSujet.retourneLesContenusEnfants("");
if(!contenuSujet.trim().isEmpty()) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
}
}

View File

@ -1,16 +1,26 @@
package MEPTL;
import java.io.IOException;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cXML.Run;
import cXML.node;
/**
*
* @author pablo rodriguez
*
* Vérification du fichier d'analyse.
*
*/
public class verificationFichierAnalyse {
public static boolean erreur = false;
public verificationFichierAnalyse(node Sujet) throws CloneNotSupportedException{
if(Sujet==null) {
System.out.println();
System.out.println("**-** Erreur, le fichier d'analyse est null.");
@ -29,6 +39,25 @@ public class verificationFichierAnalyse {
}
//** Verification du hash et du nom du fichier d'analyse
commandes.hash = String.valueOf(Run.HashNode(Sujet,0));
if(Sujet.getAttributs().get("analysis_filename")!=null) {
if(!Sujet.getAttributs().get("analysis_filename").equals(commandes.nameSujet)) {
commandes.MAJnameAnalysisFile=true;
}
}
if(Sujet.getAttributs().get("hash")==null) {
commandes.MAJFichierAnalyse =true;
}else {
if(!Sujet.getAttributs().get("hash").equals(commandes.hash)) {
commandes.MAJFichierAnalyse=true;
}
}
if(commandes.MAJFichierAnalyse||commandes.MAJnameAnalysisFile) {
messagMiseAJourFichierAnalyse(commandes.hash);
}
//** Vérification des attributs du node style:paragraph et vérification style de paragraphe par défaut
if(Sujet.retourneEnfantsByNameExist("style:paragraph")) {
verificationNodeEvaluate(Sujet.retourneFirstEnfantsByName("style:paragraph").getAttributs(),"style:paragraph");
@ -201,7 +230,12 @@ public class verificationFichierAnalyse {
}
}
/**
* Vérification des nodes autorisé dans la structure.
* @param structure
* @throws CloneNotSupportedException
*/
private static void verifNodeAutoriserDansStructure(node structure) throws CloneNotSupportedException {
String nom = structure.getNomElt();
@ -441,7 +475,11 @@ public class verificationFichierAnalyse {
/**
* Avertissement sur le style de paragraphe par défaut.</br>
* Ne doit pas contenir lattribut evaleur=true.
* @param styleParagraphDefault
*/
private static void verifcationStyleParagraphDefaut(node styleParagraphDefault) {
if(styleParagraphDefault.getAttributs().get("evaluer")!=null) {
if(styleParagraphDefault.getAttributs().get("evaluer").equals("true")) {
@ -464,7 +502,7 @@ public class verificationFichierAnalyse {
if( nod.getContenu().contains("") ) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equalsIgnoreCase("true")) {
if( outils.NetTexte(nod.getContenu()).length() <=3 ) {
if( outils.NetTexte(nod.getContenu().get(0)).length() <=3 ) {
System.out.println();
System.out.println("**-** ERREUR dans le fichier d'analyse, le node \"" + nod.getNomElt() + "\".");
System.out.println("Le contenu du node est : " + nod.getContenu());
@ -482,7 +520,7 @@ public class verificationFichierAnalyse {
Pattern pt = Pattern.compile("[1-9]$|[1-9][0-9]$");
Matcher match= pt.matcher(A);
if(match.find()) {
if(nod.retourneLesContenusEnfants(nod, "").contains("")){
if(nod.retourneLesContenusEnfants("").contains("")){
System.out.println();
System.out.println("**-** ERREUR dans le fichier d'analyse, le node \"" + nod.getNomElt() + "\".");
System.out.println("Le node possède l'attribut allContent=\"" + nod.getAttributs().get("allContent")+"\"");
@ -500,21 +538,118 @@ public class verificationFichierAnalyse {
}
/**
* Mise à jour du hash et du nom du fichier d'analyse.</br>
* @throws CloneNotSupportedException
* @throws IOException
*/
public static void MiseAJourDuHash() throws CloneNotSupportedException, IOException {
node nodeCalculHash = meptl.chargementsujet(commandes.nameSujet, false);
commandes.hash = String.valueOf(Run.HashNode(nodeCalculHash,0));
boolean maj =false;
if(nodeCalculHash.getAttributs().get("hash")==null) {
maj=true;
}else {
if(!nodeCalculHash.getAttributs().get("hash").equals(commandes.hash)) {
maj=true;
}
}
if(nodeCalculHash.getAttributs().get("analysis_filename")==null) {
maj=true;
}else {
if(!nodeCalculHash.getAttributs().get("analysis_filename").equals(commandes.nameSujet)) {
maj=true;
}
}
if(maj) {
int nbespace = "───────────────────────────┐".length()-commandes.hash.length();
if (nbespace<0) nbespace=1;
int nbespace2 = "────────────────────────────────┐".length()-commandes.hash.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 │");
System.out.println("\t\t│ a été mise à jour dans le fichier d'analyse. │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ Le hash du code de l'évaluation est : " + commandes.hash + new String(new char[nbespace]).replace("\0", " ") +"" );
System.out.println("\t\t│ Le nom du fichier d'analyse est : " + commandes.nameSujet + new String(new char[nbespace2]).replace("\0", " ") +"" );
System.out.println("\t\t│ │");
System.out.println("\t\t└────────────────────────────────────────────────────────────────────┘");
System.out.println();
nodeCalculHash.getAttributs().put("hash", commandes.hash);
nodeCalculHash.getAttributs().put("analysis_filename", commandes.nameSujet);
Run.ecritureNodeEnXML(nodeCalculHash,commandes.nameSujet.substring(0, commandes.nameSujet.lastIndexOf(".")),commandes.pathDestination,false,"Sujet");
}else {
System.out.println("\t\t┌─────────────────────────────────────────────────────┐");
System.out.println("\t\t│ Vérification du hash et du nom du fichier correct. │");
System.out.println("\t\t└─────────────────────────────────────────────────────┘");
System.out.println();
}
//** bye bye analyseWriter
commandes.clotureApplication();
}
static public void ecrisLeFichierSujetXML() throws CloneNotSupportedException, IOException {
node nodeSujet = meptl.chargementsujet(commandes.nameSujet, true);
nodeSujet.getAttributs().put("hash", String.valueOf(Run.HashNode(nodeSujet, 0)));
nodeSujet.getAttributs().put("analysis_filename", "sujet.xml");
Run.ecritureNodeEnXML(nodeSujet, "sujet","",false, "Sujet"); // ecriture du node sujet. Uniquement les nodes évalués.
System.out.println("\t\t┌─────────────────────────────────────────────────────────────────────┐");
System.out.println("\t\t│ Un nouveau fichier \"sujet.xml\" a été créé dans le dossier courant. │");
System.out.println("\t\t└─────────────────────────────────────────────────────────────────────┘");
System.out.println();
//** bye bye analyseWriter
commandes.clotureApplication();
}
static private void messagMiseAJourFichierAnalyse(String hash) {
int nbespace = "───────────────────────────┐".length()-hash.length();
if (nbespace<0) nbespace=1;
int nbespace2 = "──────────────────────────────┐".length()-hash.length();
if (nbespace2<0) nbespace2=1;
System.out.println("\t\t┌────────────────────────────────────────────────────────────────────┐");
System.out.println("\t\t│ A la fin de l'évaluation. │");
System.out.println("\t\t│ Il y aura une mise à jour du fichier d'analyse. │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ Le hash du code de l'évaluation est : " + hash + new String(new char[nbespace]).replace("\0", " ") +"" );
System.out.println("\t\t│ Le nom du fichier d'analyse est : " + commandes.nameSujet + new String(new char[nbespace2]).replace("\0", " ") +"" );
System.out.println("\t\t│ │");
System.out.println("\t\t└────────────────────────────────────────────────────────────────────┘");
System.out.println();
}
static public void messagMiseAJourFichierAnalyseAprèsAnalyse() {
int nbespace = "───────────────────────────┐".length()-commandes.hash.length();
if (nbespace<0) nbespace=1;
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 │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ Le hash du code de l'évaluation est : " + commandes.hash + new String(new char[nbespace]).replace("\0", " ") +"" );
System.out.println("\t\t│ Le nom du fichier d'analyse est : " + commandes.nameSujet + new String(new char[nbespace2]).replace("\0", " ") +"" );
System.out.println("\t\t│ │");
System.out.println("\t\t└────────────────────────────────────────────────────────────────────┘");
System.out.println();
}
/**
* Clôture lorsqu'il y a une erreur dans le fichier d'analyse
*/
public static void clotureWithErrorInanalyzeFile() {
System.out.println();
System.out.println("\t\t┌─────────────────────────────────────────────┐");
System.out.println("\t\t│ You made a mistake in your analyze file. │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ You need to look for your error in the │");
System.out.println("\t\t│ analyze file. Read the information above. │");
System.out.println("\t\t│ │");
System.out.println("\t\t│ (')_(') │");
System.out.println("\t\t│ ( `.° ) │");
System.out.println("\t\t│ (\")__(\") .. see you soon, analyseWriter. │");
System.out.println("\t\t└─────────────────────────────────────────────┘");
System.out.println("\t\t┌───────────────────────────────────────────────────────────");
System.out.println("\t\t│ Vous avez commis une erreur dans le fichier d'analyse. │");
System.out.println("\t\t│ ");
System.out.println("\t\t│ Vous devez rechercher l'erreur dans le fichier ");
System.out.println("\t\t│ d'analyse. Lisez les informations au-dessus. ");
System.out.println("\t\t│ ");
System.out.println("\t\t│ (')_(') ");
System.out.println("\t\t│ ( `.° ) ");
System.out.println("\t\t│ (\")__(\") .. à bientôt, analyseWriter. ");
System.out.println("\t\t└───────────────────────────────────────────────────────────");
System.out.println();
System.exit(0);
}