Commit dfb0297f authored by Jérémie Passerat's avatar Jérémie Passerat

Debuts modification xml moodle

parent 4fa898dd
This diff is collapsed.
<template>
<div>
<Question_Vrai_Faux v-show="questionParsee.type_question === 'truefalse'" v-bind:questionParsee="questionParsee"></Question_Vrai_Faux>
<Question_Reponse_Courte v-show="questionParsee.type_question === 'shortanswer'" v-bind:questionParsee="questionParsee"></Question_Reponse_Courte>
<Question_Choix_Multiple v-show="questionParsee.type_question === 'multichoice'" v-bind:questionParsee="questionParsee"></Question_Choix_Multiple>
<Question_Numerique v-show="questionParsee.type_question === 'numerical'" v-bind:questionParsee="questionParsee"></Question_Numerique>
<Question_Calculee_Simple v-show="questionParsee.type_question === 'calculatedsimple'" v-bind:questionParsee="questionParsee" ></Question_Calculee_Simple>
</div>
</template>
<script>
import Service from '../src/service/Service'
import Question_Vrai_Faux from "./components/moodle/Question_Vrai_Faux";
import Question_Reponse_Courte from "./components/moodle/Question_Reponse_Courte";
import Question_Choix_Multiple from "./components/moodle/Question_Choix_Multiple";
import Question_Numerique from "./components/moodle/Question_Numerique";
import Question_Calculee_Simple from "./components/moodle/Question_Calculee_Simple";
export default {
//calculatedsimple
name: "Previsualiser_Moodle",
components: {
Question_Numerique,
Question_Choix_Multiple,
Question_Vrai_Faux,
Question_Reponse_Courte,
Question_Calculee_Simple
},
data: function () {
return {
questionParsee: ''
}
},
props: {
// texte du contenu survolé
id: {}
},
mounted() {
/**
* @vuese
* A chaque fois que prévisualiser_moodle est appelé on fait appel a parserTexte pour permettre d'appeler le bon composant d'affichage
*/
let that = this
Service.parserTexte(JSON.stringify(this.id)).then(function (response) {
that.questionParsee = response.data
})
},
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -87,9 +87,12 @@ export default {
* Permet de convertir le markdown d'un contenu en du html lisible
*/
formatterMarkdown: function () {
let showdown = require('showdown'),
converter = new showdown.Converter()
return converter.makeHtml(this.contenu)
if (this.sourceContenu !== 'moodle') {
let showdown = require('showdown'),
converter = new showdown.Converter()
return converter.makeHtml(this.contenu)
}
// return this.contenu
},
/**
* @vuese
......@@ -152,13 +155,13 @@ export default {
}
return -1
} else {
if (this.contenuClique.versionEnCours.note === 0){
if (this.contenuClique.versionEnCours.note === 0){
return 0
}
return (this.contenuClique.versionEnCours.note / this.contenuClique.versionEnCours.nbreNotes).toFixed(2)
}
/* return 0
}*/
/* return 0
}*/
} else {
return 0
}
......@@ -190,6 +193,9 @@ export default {
this.populariteContenu = this.contenuClique.popularite
this.tagsContenus = this.contenuClique.tags_fixes === undefined ? [] : this.contenuClique.tags_fixes.join(", ")
this.isContenuRefuse = false
this.typeContenu = this.contenuClique.type
this.sourceContenu = this.contenuClique.source
this.noteContenu = this.contenuClique.versionEnCours === undefined ? '' : this.calculerNoteDetailContenu()
......
......@@ -19,11 +19,13 @@
<div id="modifTitre">
<div id="changerTitre">
<label>Titre du contenu : </label><br>
<label v-if="sourceContenu !== 'moodle'">Titre du contenu : </label>
<label v-else>Nom de la question : </label>
<br>
<select v-show="contenuCliqueProvenance === 'perso' && versionMax > 1" v-model="versionChoisie" v-on:change="changerVersion" >
<option v-for="i in versionMax" v-bind:key="i"> {{i}}</option>
</select>
<input type="text" id="titreDuContenu" placeholder="titre du contenu" v-model="titreContenu">
<input type="text" id="titreDuContenu" placeholder="titre du contenu" style="width: 350px; outline: none; border: none" v-model="titreContenu">
</div>
<div id="voirNote">
<button v-show="contenuCliqueProvenance === 'tiers' && !notePresente" id="noterContenu">{{ messageNoter }}</button>
......@@ -53,13 +55,16 @@
</div>
</div>
<br>
<div class="mavonEditor" v-show="!isModeTag">
<div class="mavonEditor" v-show="!isModeTag && sourceContenu !== 'moodle'">
<mavon-editor :language="'fr'" style="position: static; height: 79vh; margin-top: -0.5%" v-model="texteDuContenu"/>
</div>
<TagsLibres v-show="isModeTag" v-bind:contenu="this.contenuClique" v-bind:auteur="auteur" @actionTagLibre="actionTagLibre"
style="position: static; height: 79vh; margin-top: -0.5%" v-bind:darktheme="darktheme" @chargerTagsLibres="chargerTagsLibres" v-bind:tagLibreAssocie="tagLibreAssocie"></TagsLibres>
<div class="markdown">
<Edit_Contenus @actionMoodle="actionMoodle" v-show="!isModeTag && sourceContenu === 'moodle'" v-bind:darktheme="darktheme" v-bind:idContenu="idContenu"></Edit_Contenus>
<div class="markdown" v-show="sourceContenu !== 'moodle'">
<br>
<button id="validerModif" v-on:click="action('valider')">modifier </button>
<button id="retourArriere" v-on:click="action('arriere')"> revenir en arrière</button>
......@@ -74,11 +79,13 @@
import Service from "../service/Service";
import StarRating from 'vue-star-rating'
import TagsLibres from "../TagsLibres";
import Edit_Contenus from "./moodle/Edit_Contenus";
export default {
name: "Modifier_Contenu",
components: {
Edit_Contenus,
TagsLibres,
StarRating
},
......@@ -113,7 +120,8 @@ export default {
isModeTag: false,
titreModifierTags: "modifier Tags",
typeContenu: '',
sourceContenu: ''
sourceContenu: '',
idContenu: ''
}
},
methods: {
......@@ -123,11 +131,17 @@ export default {
*/
action: function (actionChoisie) {
this.isModeTag = false
this.questionParsee = ''
if (actionChoisie === 'valider'){
// evenement de modification du texte d'un contenu
// @arg l'action choisie, ici 'valider'
// @arg le texte modifié
this.$emit("choixModif", {action: actionChoisie, nouveauTexte: this.texteDuContenu, titre: this.titreContenu})
if (this.sourceContenu === 'moodle'){
alert("Je modifie un moodle")
} else {
// evenement de modification du texte d'un contenu
// @arg l'action choisie, ici 'valider'
// @arg le texte modifié
this.$emit("choixModif", {action: actionChoisie, nouveauTexte: this.texteDuContenu, titre: this.titreContenu})
}
} else {
// evenement de retour en arrière vers Consulter_COntenu
// @arg l'action choisie, ici 'arriere'
......@@ -215,6 +229,12 @@ export default {
*/
chargerTagsLibres: function () {
this.$emit("chargerTagsLibres")
},
actionMoodle: function (event) {
if (event.action === 'arriere')
this.$emit("choixModif", {action: event.action})
else
this.$emit("choixModif", {action: event.action, questionParsee: event.questionParsee, titre: this.titreContenu})
}
......@@ -256,7 +276,7 @@ export default {
this.typeContenu = this.contenuClique.type
this.sourceContenu = this.contenuClique.source
this.populariteContenu = this.contenuClique.popularite
this.idContenu = this.contenuClique._id
this.isContenuRefuse = Object.prototype.hasOwnProperty.call(this.contenuClique, 'refuse');
......@@ -271,7 +291,7 @@ export default {
let that = this
Service.recupererNoteContenu(JSON.stringify(this.contenuClique._id), this.auteur, this.versionChoisie).then(function (result) {
let nombre = result.data
if (nombre !== '-1'){
if (nombre !== '-'){
nombre = JSON.parse(nombre)
that.rating = nombre.note
that.notePresente = true
......@@ -306,16 +326,13 @@ button {
}
#titreDuContenu {
margin-left: 5px;
}
#validerModif {
margin-right: 5px;
margin-bottom: 5px;
}
#titreContenu {
margin-left: 5px;
text-align: center;
align-content: center;
display: flex;
......
......@@ -70,9 +70,10 @@ isActif ? {'margin-left': '1vw', 'margin-right': '1vw'} : {'margin-left': '0.6vw
}">
<td :id="JSON.stringify(item._id)" v-on:click="chargerContenu(item, item.provenance)">{{item.titre}}<div style="display:none;">
{{ item._id }}</div></td>
<b-popover style="height: 700px; width: 700px" class="non" v-on:show="rechercherTexte(item._id, item.provenance, item.source)" :target="JSON.stringify(item._id)" triggers="hover" placement="bottom">
<b-popover style="height: 700px; width: 700px" class="non" v-on:show="rechercherTexte(item._id, item.provenance, item.source)" :target="JSON.stringify(item._id)"
triggers="hover" placement="bottom">
<p id="beautiful" v-html="texteDuContenu" v-if="!isMoodle"></p>
<Test v-else></Test>
<Previsualiser_Moodle v-bind:id="item._id" v-else></Previsualiser_Moodle>
</b-popover>
<!-- auteur -->
<td>{{item.auteur}}</td>
......@@ -104,7 +105,7 @@ isActif ? {'margin-left': '1vw', 'margin-right': '1vw'} : {'margin-left': '0.6vw
<td :id="'a' + JSON.stringify(item._id)" v-on:click="chargerContenu(item, 'banque')">{{ item.titre }}</td>
<b-popover :target="'a' + JSON.stringify(item._id)" v-on:show="rechercherTexte(item._id, 'banque', item.source)" triggers="hover" placement="bottom">
<p v-html="texteDuContenu" v-if="!isMoodle"></p>
<Test v-else></Test>
<Previsualiser_Moodle v-else></Previsualiser_Moodle>
</b-popover>
<td>{{ item.auteur }}</td>
<td>{{item.versionEnCours.numero}}</td>
......@@ -145,6 +146,7 @@ isActif ? {'margin-left': '1vw', 'margin-right': '1vw'} : {'margin-left': '0.6vw
<script>
//import axios from "axios";
import Previsualiser_Moodle from "@/Previsualiser_Moodle";
let $ = require("jquery");
window.$ = window.jQuery = $;
require("jquery-ui-bundle");
......@@ -153,12 +155,13 @@ import Volet_Contenu from "./Volet_Contenu";
import Service from '../../src/service/Service'
import Modifier_Contenu from "./Modifier_Contenu";
import Consulter_Contenu from "./Consulter_Contenu";
import Test from "../Test"
//import Test from "../Test"
export default {
name: "Volet_Base",
components: {
Test,
Previsualiser_Moodle,
//Test,
Modifier_Contenu,
Consulter_Contenu,
Volet_Menu,
......@@ -662,10 +665,12 @@ export default {
*/
rechercherTexte: function (id, provenance, source) {
if (id === undefined)
return
let that = this
if (source === "moodle"){
this.isMoodle = true
}
......@@ -673,7 +678,7 @@ export default {
this.isMoodle = false
if(provenance === 'en-cours'){
if (provenance === 'en-cours') {
Service.recupererTexteContenuEnCours(JSON.stringify(id)).then(
function (response) {
let showdown = require('showdown'),
......@@ -682,8 +687,7 @@ export default {
that.texteDuContenu = converter.makeHtml(response.data)
}
)
}
else if (provenance === 'banque'){
} else if (provenance === 'banque') {
Service.recupererTexteVersionContenu(JSON.stringify(id), 0).then(
function (response) {
let showdown = require('showdown'),
......@@ -692,8 +696,7 @@ export default {
that.texteDuContenu = converter.makeHtml(response.data)
}
)
}
else {
} else {
Service.recupererTexteContenu(JSON.stringify(id)).then(
function (response) {
let showdown = require('showdown'),
......@@ -701,6 +704,7 @@ export default {
that.texteDuContenu = converter.makeHtml(response.data)
}
)
// }
}
}
},
......@@ -741,6 +745,11 @@ export default {
}
}
}
} else if (event.action === "modifier"){
let questionParsee = event.questionParsee
questionParsee["nom_question"] = event.titre
let data = {id_contenu: JSON.stringify(this.contenuClique._id), elements_contenu: JSON.stringify(questionParsee)}
Service.modifierXML(data)
}
},
/**
......
<template>
<div id="full">
<div id="body" :class="darktheme ? 'editDark' : 'edit'">
<table style="width: 100%">
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Nom de la question</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="nomQuestion"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Texte de la question</td>
<td style="width: 70%">
<quill-editor toolbar="minimal" style="height: 100px; margin-top: -66px" v-model="texteQuestion"/>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Note par défaut</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="noteDefaut"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback général</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="generalFeedback"/>
</td>
</tr>
<template v-for="j in reponses.length">
<tr :key="j + 'reponse'">
<td style="width: 30%; text-align: left">Formule de la réponse {{j}}</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px; width: 250px; margin-right: 5px" v-model="reponses[j - 1]"/>
Note
<select style="margin-left: 5px" v-model="notes[j - 1]">
<option v-for="i in options.length" :key="i">{{ options[i-1] }}</option>
</select>
</td>
</tr>
<tr :key="j + 'tolerance'">
<td style="width: 30%; text-align: left">Tolérance +/-</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px; width: 75px; margin-right: 5px" v-model="tolerance[j - 1]"/>
Type
</td>
</tr>
<tr :key="j + 'precision'">
<td style="width: 30%; text-align: left">Affichage de la réponse</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px; width: 75px; margin-right: 5px" v-model="tolerance[j - 1]"/>
Format
</td>
</tr>
<tr :key="j + 'feedback'">
<td style="width: 30%; text-align: left">Feedback</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: 26px" v-model="feedback[j - 1]"/>
</td>
</tr>
</template>
</table>
</div>
</div>
</template>
<script>
export default {
name: "Edit_Calculee_Simple",
props: {
// mode sombre activé ou non
darktheme: {},
//la question Parsee
questionParsee: {}
},
data: function () {
return {
//questionParsee: '',
nomQuestion: '',
texteQuestion: '',
noteDefaut: 0,
generalFeedback: '',
options: ["Aucun", "100%", "90%", "83.33%", "80%", "75%", "70%", "66.66%", "60%", "50%", "40%", "33.33%", "30%", "25%", "20%", "16.6667%", "14.28571%",
"12.5%", "11.11%", "10%", "5%"],
reponses: [],
notes: [],
feedback: [],
tolerance: []
}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'calculatedsimple') {
this.nomQuestion = this.questionParsee.nom_question
this.texteQuestion = this.questionParsee.intitule_question
this.noteDefaut = this.questionParsee.note_defaut
this.generalFeedback = this.questionParsee.feedback_general
this.reponses = this.questionParsee.liste_reponse
this.notes = this.questionParsee.liste_note.map(note => note + "%")
this.notes = this.notes.map(note => {if (note === '0%') return 'Aucun'; else return note;})
this.feedback = this.questionParsee.liste_feedback
this.tolerance = this.questionParsee.liste_tolerance
}
}
}
}
</script>
<style scoped>
label {
margin-right: 5px;
margin-top: 10px;
}
.edit {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: whitesmoke;
}
.editDark {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: darkslategray;
color: whitesmoke;
}
#body {
overflow-y: auto;
}
#full {
height: 79.35vh;
width: 100%;
background: white;
margin-top: -1.75vh;
}
.column {
flex: 50%;
}
td > * {
vertical-align: middle;
}
</style>
\ No newline at end of file
<template>
<div id="full">
<div id="body" :class="darktheme ? 'editDark' : 'edit'">
<table style="width: 100%">
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Nom de la question</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="nomQuestion"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Texte de la question</td>
<td style="width: 70%">
<quill-editor toolbar="minimal" style="height: 100px; margin-top: -66px" v-model="texteQuestion"/>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Note par défaut</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="noteDefaut"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback général</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="generalFeedback"/>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Plusieurs réponses ou une seule?</td>
<td style="width: 70%; text-align: left">
<select v-model="multipleChoisie">
<option>Réponses multiples autorisées</option>
<option>Une seule réponse</option>
</select>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Numéroter les choix?</td>
<td style="width: 70%; text-align: left">
<select v-model="optionNumChoisie">
<option v-for="i in optionsNumerotation.length" :key="i">{{ optionsNumerotation[i-1] }}</option>
</select>
</td>
</tr>
<template v-for="j in reponses.length" style="background: brown">
<tr style="height: 225px" :key="j + 'reponse'">
<td style="width: 30%; text-align: left">Réponse {{ j }}</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="reponses[j - 1]"/>
</td>
</tr>
<tr style="height: 69px" :key="j + 'note'">
<td style="width: 30%; text-align: left">Note</td>
<td style="width: 70%; text-align: left">
<select v-model="notes[j - 1]">
<option v-for="i in options.length" :key="i">{{ options[i-1] }}</option>
</select>
</td>
</tr>
<tr style="height: 225px" :key="j + 'feedback'">
<td style="width: 30%; text-align: left">Feedback</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="feedbacks[j - 1]"/>
</td>
</tr>
</template>
</table>
</div>
</div>
</template>
<script>
export default {
name: "Edit_Choix_Multiple",
props: {
// mode sombre activé ou non
darktheme: {},
//la question Parsee
questionParsee: {}
},
data: function () {
return {
//questionParsee: '',
nomQuestion: '',
texteQuestion: '',
noteDefaut: 0,
generalFeedback: '',
options: ["Aucun", "100%", "90%", "83.33%", "80%", "75%", "70%", "66.66%", "60%", "50%", "40%", "33.33%", "30%", "25%", "20%", "16.6667%", "14.28571%",
"12.5%", "11.11%", "10%", "5%"],
optionsNumerotation: ["a. b. c. etc.", "A. B. C. etc.", "1. 2. 3. etc.", "i. ii. iii. etc.", "I. II. III. etc.", "Sans numérotation"],
reponses: [],
notes: [],
feedbacks: [],
prefixes: [],
optionNumChoisie: '',
multipleChoisie: ''
}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'multichoice') {
this.nomQuestion = this.questionParsee.nom_question
this.texteQuestion = this.questionParsee.intitule_question
this.noteDefaut = this.questionParsee.note_defaut
this.generalFeedback = this.questionParsee.feedback_general
this.feedbacks = this.questionParsee.liste_feedback
this.reponses = this.questionParsee.liste_reponse
this.notes = this.questionParsee.liste_note.map(note => note + "%")
this.notes = this.notes.map(note => {if (note === '0%') return 'Aucun'; else return note;})
switch (this.questionParsee.numerotation) {
case "abc":
this.optionNumChoisie = this.optionsNumerotation[0]
break
case "ABCD":
this.optionNumChoisie = this.optionsNumerotation[1]
break
case "123":
this.optionNumChoisie = this.optionsNumerotation[2]
break
case "iii" :
this.optionNumChoisie = this.optionsNumerotation[3]
break
case "IIII" :
this.optionNumChoisie = this.optionsNumerotation[4]
break
case "none":
this.optionNumChoisie = this.optionsNumerotation[5]
break
}
if (this.questionParsee.nb_reponse){
this.multipleChoisie = "Une seule réponse"
} else {
this.multipleChoisie = "Réponses multiples autorisées"
}
}
}
}
}
</script>
<style scoped>
label {
margin-right: 5px;
margin-top: 10px;
}
.edit {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: whitesmoke;
}
.editDark {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: darkslategray;
color: whitesmoke;
}
#body {
overflow-y: auto;
}
#full {
height: 79.35vh;
width: 100%;
background: white;
margin-top: -1.75vh;
}
.column {
flex: 50%;
}
td > * {
vertical-align: middle;
}
</style>
\ No newline at end of file
<template>
<div>
<Edit_Reponse_Courte @actionMoodle="passerMoodle" v-show="type_question === 'shortanswer'" v-bind:questionParsee="questionParsee"></Edit_Reponse_Courte>
<Edit_Vrai_Faux @actionMoodle="passerMoodle" v-show="type_question === 'truefalse'" v-bind:questionParsee="questionParsee"></Edit_Vrai_Faux>
<Edit_Choix_Multiple @actionMoodle="passerMoodle" v-show="type_question === 'multichoice'" v-bind:questionParsee="questionParsee"></Edit_Choix_Multiple>
<Edit_Numerique @actionMoodle="passerMoodle" v-show="type_question === 'numerical'" v-bind:questionParsee="questionParsee"></Edit_Numerique>
<Edit_Calculee_Simple @actionMoodle="passerMoodle" v-show="type_question === 'calculatedsimple'" v-bind:questionParsee="questionParsee"></Edit_Calculee_Simple>
</div>
</template>
<script>
import Service from "@/service/Service";
import Edit_Reponse_Courte from "@/components/moodle/Edit_Reponse_Courte";
import Edit_Vrai_Faux from "@/components/moodle/Edit_Vrai_Faux";
import Edit_Choix_Multiple from "@/components/moodle/Edit_Choix_Multiple";
import Edit_Numerique from "@/components/moodle/Edit_Numerique";
import Edit_Calculee_Simple from "@/components/moodle/Edit_Calculee_Simple";
export default {
name: "Edit_Contenus",
components: {Edit_Calculee_Simple, Edit_Numerique, Edit_Choix_Multiple, Edit_Vrai_Faux, Edit_Reponse_Courte},
props: {
// mode sombre activé ou non
darktheme: {},
//l'id du contenu clique
idContenu: {}
},
methods: {
passerMoodle: function (event) {
if (event.action === 'arriere')
this.$emit("actionMoodle", {action: event.action})
else
this.$emit("actionMoodle", {action: event.action, questionParsee: event.questionParsee})
}
},
data: function () {
return {
questionParsee: '',
type_question: ''
}
},
watch: {
idContenu: function () {
let that = this
Service.parserTexte(JSON.stringify(this.idContenu)).then(function (response) {
that.questionParsee = response.data
that.type_question = that.questionParsee.type_question
})
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<div id="full">
<div id="body" :class="darktheme ? 'editDark' : 'edit'">
<table style="width: 100%">
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Nom de la question</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="nomQuestion"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Texte de la question</td>
<td style="width: 70%">
<quill-editor toolbar="minimal" style="height: 100px; margin-top: -66px" v-model="texteQuestion"/>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Note par défaut</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="noteDefaut"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback général</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="generalFeedback"/>
</td>
</tr>
<!-- Contenu spécifique -->
<template v-for="j in reponses.length">
<tr :key="j + 'reponse'">
<td style="width: 30%; text-align: left">Reponse {{j}}</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px; width: 75px; margin-right: 5px" v-model="reponses[j - 1]"/>
Erreur
<input type="text" style="height: 25px; width: 75px; margin-left: 5px; margin-right: 5px" v-model="tolerance[j - 1]"/>
Note
<select style="margin-left: 5px" v-model="notes[j - 1]">
<option v-for="i in options.length" :key="i">{{ options[i-1] }}</option>
</select>
</td>
</tr>
<tr :key="j + 'feedback'">
<td style="width: 30%; text-align: left">Feedback</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: 26px" v-model="feedback[j - 1]"/>
</td>
</tr>
</template>
</table>
</div>
</div>
</template>
<script>
export default {
name: "Edit_Numerique",
props: {
// mode sombre activé ou non
darktheme: {},
//la question Parsee
questionParsee: {}
},
data: function () {
return {
//questionParsee: '',
nomQuestion: '',
texteQuestion: '',
noteDefaut: 0,
generalFeedback: '',
options: ["Aucun", "100%", "90%", "83.33%", "80%", "75%", "70%", "66.66%", "60%", "50%", "40%", "33.33%", "30%", "25%", "20%", "16.6667%", "14.28571%",
"12.5%", "11.11%", "10%", "5%"],
reponses: [],
notes: [],
feedback: [],
tolerance: []
}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'numerical') {
this.nomQuestion = this.questionParsee.nom_question
this.texteQuestion = this.questionParsee.intitule_question
this.noteDefaut = this.questionParsee.note_defaut
this.generalFeedback = this.questionParsee.feedback_general
this.reponses = this.questionParsee.liste_reponse
this.notes = this.questionParsee.liste_note.map(note => note + "%")
this.notes = this.notes.map(note => {if (note === '0%') return 'Aucun'; else return note;})
this.feedback = this.questionParsee.liste_feedback
this.tolerance = this.questionParsee.liste_tolerance
}
}
}
}
</script>
<style scoped>
label {
margin-right: 5px;
margin-top: 10px;
}
.edit {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: whitesmoke;
}
.editDark {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: darkslategray;
color: whitesmoke;
}
#body {
overflow-y: auto;
}
#full {
height: 79.35vh;
width: 100%;
background: white;
margin-top: -1.75vh;
}
.column {
flex: 50%;
}
td > * {
vertical-align: middle;
}
</style>
\ No newline at end of file
<template>
<div id="full">
<div id="body" :class="darktheme ? 'editDark' : 'edit'">
<table style="width: 100%">
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Nom de la question</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="nomQuestion"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Texte de la question</td>
<td style="width: 70%">
<quill-editor toolbar="minimal" style="height: 100px; margin-top: -66px" v-model="texteQuestion"/>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Note par défaut</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="noteDefaut"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback général</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="generalFeedback"/>
</td>
</tr>
<!-- Partie spécifique à réponse courte -->
<tr>
<td style="width: 30%; text-align: left">Sensible à la casse</td>
<td style="width: 70%; text-align: left">
<select v-model="choixCasse">
<option>Non, la casse n'est pas importante</option>
<option>Oui, la casse est importante</option>
</select>
</td>
</tr>
<tr>
<td style="width: 30%; text-align: left">Réponse 1</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px;" v-model="texteReponse[0]"/> <label id="note">Note</label>
<select style="width: 75px;" v-model="noteReponse[0]">
<option v-for="i in options.length" :key="i">{{ options[i-1] }}</option>
</select>
</td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="feedbackReponse[0]"/>
</td>
</tr>
<tr>
<td style="width: 30%; text-align: left">Réponse 2</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px;" v-model="texteReponse[1]"/> <label id="note">Note</label>
<select style="width: 75px;" v-model="noteReponse[1]">
<option v-for="i in options.length" :key="i">{{ options[i-1] }}</option>
</select>
</td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="feedbackReponse[1]"/>
</td>
</tr>
<tr>
<td style="width: 30%; text-align: left">Réponse 3</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px;" v-model="texteReponse[2]"/> <label id="note">Note</label>
<select style="width: 75px;" v-model="noteReponse[2]">
<option v-for="i in options.length" :key="i">{{ options[i-1] }}</option>
</select>
</td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="feedbackReponse[2]"/>
</td>
</tr>
</table>
</div>
</div>
</template>
<script>
export default {
name: "Edit_Reponse_Courte",
props: {
// mode sombre activé ou non
darktheme: {},
//la question Parsee
questionParsee: {}
},
data: function () {
return {
//questionParsee: '',
nomQuestion: 'chameau',
texteQuestion: 'chocolat',
noteDefaut: 0,
generalFeedback: '',
feedbackReponse: [],
texteReponse: [],
noteReponse: [],
choixCasse: '',
optionsCasse: ["Non, la casse n'est pas importante", "Oui, la casse est importante"],
options: ["Aucun", "100%", "90%", "83.33%", "80%", "75%", "70%", "66.66%", "60%", "50%", "40%", "33.33%", "30%", "25%", "20%", "16.6667%", "14.28571%",
"12.5%", "11.11%", "10%", "5%"]
}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'shortanswer') {
this.nomQuestion = this.questionParsee.nom_question
this.texteQuestion = this.questionParsee.intitule_question
this.noteDefaut = this.questionParsee.note_defaut
this.generalFeedback = this.questionParsee.feedback_general
this.texteReponse = this.questionParsee.liste_reponse.filter(reponse => reponse)
this.noteReponse = this.questionParsee.liste_note.map(note => note + "%")
this.feedbackReponse = this.questionParsee.liste_feedback
this.choixCasse = this.optionsCasse[this.questionParsee.majuscule]
}
}
}
}
</script>
<style scoped>
label {
margin-right: 5px;
margin-top: 10px;
}
.edit {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: whitesmoke;
}
.editDark {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: darkslategray;
color: whitesmoke;
}
#body {
overflow-y: auto;
}
#full {
height: 79.35vh;
width: 100%;
background: white;
margin-top: -1.75vh;
}
.column {
flex: 50%;
}
td > * {
vertical-align: middle;
}
#note {
margin-left: 5px;
margin-right: 5px;
margin-bottom: 7.5px;
}
</style>
\ No newline at end of file
<template>
<div id="full" >
<div id="body" :class="darktheme ? 'editDark' : 'edit'">
<table style="width: 100%">
<!-- <tr style="height: 69px">
<td style="width: 30%; text-align: left">Nom de la question</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="nomQuestion"/></td>
</tr>-->
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Texte de la question</td>
<td style="width: 70%">
<quill-editor toolbar="minimal" style="height: 100px; margin-top: -66px" v-model="texteQuestion"/>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Note par défaut</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px" v-model="noteDefaut"/></td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback général</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="generalFeedback"/>
</td>
</tr>
<!-- partie spécifique à edit_vrai_faux -->
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Réponse correcte</td>
<td style="width: 70%; text-align: left">
<select style="height: 25px" v-model="reponseCorrecte">
<option :selected="reponseCorrecte === 'Vrai'">Vrai</option>
<option :selected="reponseCorrecte === 'Faux'">Faux</option>
</select>
</td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback pour la réponse "Vrai"</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px" v-model="feedbackVrai"/>
</td>
</tr>
<tr style="height: 225px">
<td style="width: 30%; text-align: left">Feedback pour la réponse "Faux"</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: -66px; color: white" v-model="feedbackFaux"/>
</td>
</tr>
</table>
<button style="width: auto; height: auto; margin-left: -100px; position: fixed; bottom: 18px" v-on:click="action('modifier')">modifier</button>
<button style="width: auto; height: auto; margin-left: -15px; position: fixed; bottom: 18px" v-on:click="action('arriere')">retour en arriere</button>
</div>
</div>
</template>
<script>
//import Service from "@/service/Service";
export default {
name: "Edit_Vrai_Faux",
props: {
// mode sombre activé ou non
darktheme: {},
//la question Parsee
questionParsee: {}
},
data: function () {
return {
//questionParsee: '',
nomQuestion: 'chameau',
texteQuestion: 'chocolat',
noteDefaut: 0,
generalFeedback: '',
reponseCorrecte: '',
feedbackVrai: '',
feedbackFaux: ''
}
},
methods: {
action: function (actionChoisie) {
if (actionChoisie === 'arriere'){
this.$emit("actionMoodle", {action: actionChoisie})
} else {
this.questionParsee.nom_question = this.nomQuestion
this.questionParsee.intitule_question = this.texteQuestion
this.questionParsee.note_defaut = this.noteDefaut
this.questionParsee.feedback_general = this.generalFeedback
this.questionParsee.bonne_reponse = this.reponseCorrecte
this.questionParsee.liste_feedback[1] = this.feedbackVrai
this.questionParsee.liste_feedback[3] = this.feedbackFaux
this.$emit("actionMoodle", {action: actionChoisie, questionParsee: this.questionParsee})
}
}
},
watch: {
questionParsee: function () {
// let that = this
// Service.parserTexte(JSON.stringify(this.idContenu)).then(function (response) {
if (this.questionParsee.type_question === 'truefalse') {
this.nomQuestion = this.questionParsee.nom_question
this.texteQuestion = this.questionParsee.intitule_question
this.noteDefaut = this.questionParsee.note_defaut
this.generalFeedback = this.questionParsee.feedback_general
this.reponseCorrecte = this.questionParsee.bonne_reponse
this.feedbackVrai = this.questionParsee.liste_feedback[1]
this.feedbackFaux = this.questionParsee.liste_feedback[3]
}
// })
// alert("Shirobakol")
}
}
}
</script>
<style scoped>
label {
margin-right: 5px;
margin-top: 10px;
}
.edit {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: whitesmoke;
}
.editDark {
width: 60vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
background: darkslategray;
color: whitesmoke;
}
#body {
overflow-y: auto;
}
#full {
height: 79.35vh;
width: 100%;
background: white;
margin-top: -1.75vh;
}
.column {
flex: 50%;
}
td > * {
vertical-align: middle;
}
</style>
<template>
<div>
<p>{{intituleQuestion}} (Note sur {{noteDefaut}})</p>
<p>Réponses possibles : ({{(reponses.length)}}) </p>
<div v-for="i in reponses.length" :key="i">
<ul>
<li> {{reponses[i-1]}} ({{notes[i-1]}} %)</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "Question_Calculee_Simple",
props: {
questionParsee: {}
},
data: function () {
return {
intituleQuestion: '',
noteDefaut: '',
reponses: [],
notes: [],
prefixes: ['', '', '', '', '']
}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'calculatedsimple') {
this.noteDefaut = this.questionParsee.note_defaut
let div = document.createElement("div");
div.innerHTML = this.questionParsee.intitule_question;
this.intituleQuestion = div.innerText
div.remove()
this.reponses = this.questionParsee.liste_reponse
this.notes = this.questionParsee.liste_note
}
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<div>
<p>{{intituleQuestion}} (Note sur {{noteDefaut}})</p>
<div v-for="i in reponses.length" :key="i">
<input type="radio" name="choixMultiple">
<label> {{prefixes[i-1]}}. {{ transformerTexte(reponses[i-1]) }} ({{notes[i-1]}} %)</label><br> </div>
</div>
</template>
<script>
export default {
name: "Question_Choix_Multiple",
props: {
questionParsee: {}
},
data: function () {
return {
intituleQuestion: '',
noteDefaut: '',
reponses: [],
notes: [],
prefixes: ['', '', '', '', '']
}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'multichoice') {
this.noteDefaut = this.questionParsee.note_defaut
let div = document.createElement("div");
div.innerHTML = this.questionParsee.intitule_question;
this.intituleQuestion = div.innerText
div.remove()
switch (this.questionParsee.numerotation) {
case "abc":
this.prefixes = ['a', 'b', 'c', 'd', 'e']
break
case "ABCD":
this.prefixes = ['A', 'B', 'C', 'D', 'E']
break
case "123":
this.prefixes = ['1', '2', '3', '4', '5']
break
case "none":
break
}
this.reponses = this.questionParsee.liste_reponse
this.notes = this.questionParsee.liste_note
}
}
},
methods: {
transformerTexte: function (texte) {
let div = document.createElement("div");
div.innerHTML = texte;
let texteRaffine = div.innerText
div.remove()
return texteRaffine
}
}
}
</script>
<style scoped>
label {
margin-left: 4px;
}
</style>
<template>
<div>
<p>{{intituleQuestion}} (Note sur {{noteDefaut}})</p>
<p>Réponses possibles : ({{(reponses.length)}}) </p>
<div v-for="i in reponses.length" :key="i">
<ul>
<li> {{reponses[i-1]}} ({{notes[i-1]}} %)</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "Question_Numerique",
props: {
questionParsee: {}
},
data: function () {
return {
intituleQuestion: '',
noteDefaut: '',
reponses: [],
notes: [],
prefixes: ['', '', '', '', '']
}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'numerical') {
this.noteDefaut = this.questionParsee.note_defaut
let div = document.createElement("div");
div.innerHTML = this.questionParsee.intitule_question;
this.intituleQuestion = div.innerText
div.remove()
//console.log(this.questionParsee)
this.reponses = this.questionParsee.liste_reponse
this.notes = this.questionParsee.liste_note
}
}
},
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<div>
<p>{{intituleQuestion}} (Note sur {{noteDefaut}})</p>
<p>Réponses possibles : ({{(reponses.length)}}) </p>
<div v-for="i in reponses.length" :key="i">
<ul>
<li> {{reponses[i - 1]}} ({{notes [i - 1]}} %)</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "Question_Reponse_Courte",
props: {
questionParsee: {}
},
data: function () {
return {
intituleQuestion: '',
noteDefaut: '',
reponses: [],
notes: []
}
},
watch: {
questionParsee: function () {
//this.intituleQuestion = this.questionParsee.intitule_question
if (this.questionParsee.type_question === 'shortanswer') {
this.noteDefaut = this.questionParsee.note_defaut
let div = document.createElement("div");
div.innerHTML = this.questionParsee.intitule_question;
this.intituleQuestion = div.innerText
div.remove()
this.reponses = this.questionParsee.liste_reponse.filter(note => note)
this.notes = this.questionParsee.liste_note
// alert("reponses : " + this.reponses)
}
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<div>
<p>{{intituleQuestion}} (Note sur {{noteDefault}})</p>
<input type="radio" name="choixVraiFaux">
<label> {{ transformerTexte(listeFeedback[0]) }}</label><br>
<input type="radio" name="choixVraiFaux">
<label> {{ transformerTexte(listeFeedback[2]) }}</label><br>
<!--
Besoin de :
intitule_question
note_default
listeFeedback
-->
</div>
</template>
<script>
export default {
name: "Question_Vrai_Faux",
props: {
questionParsee: {}
},
watch: {
questionParsee: function () {
if (this.questionParsee.type_question === 'truefalse') {
let div = document.createElement("div");
div.innerHTML = this.questionParsee.intitule_question;
this.intituleQuestion = div.innerText
div.remove()
this.noteDefault = this.questionParsee.note_defaut
this.listeFeedback = this.questionParsee.liste_feedback
}
}
},
data: function () {
return {
intituleQuestion: "",
noteDefault: "",
listeFeedback: ""
}
},
methods: {
transformerTexte: function (texte) {
return texte === 'true' ? 'Vrai' : 'Faux'
}
}
}
</script>
<style scoped>
label {
margin-left: 4px;
}
</style>
\ No newline at end of file
......@@ -8,6 +8,13 @@ import BootstrapVue from "bootstrap-vue"
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
Vue.use(VueQuillEditor, /* { default global options } */)
//import Index from '@/Index'
Vue.config.productionTip = false
......
import axios from 'axios'
const urlBase = "http://127.0.0.1:5000/"
//const urlBase = "http://193.70.2.155:5000/"
//const urlBase = "http://193.70.2.155/api/"
const users = "utilisateurs/"
const contenus = "contenus/"
const en_cours = "en_cours/"
......@@ -111,6 +111,9 @@ export default {
recupererNoteContenu(idContenu, auteur, version){
return axios.get(urlBase + contenus + "recupererNote?auteur=" + auteur + "&version=" + version + "&id_contenu=" + idContenu, this.getHeader(localStorage.token))
},
modifierXML(data){
return axios.patch(urlBase + contenus + "modifierXML", data, this.getHeader(localStorage.token))
},
// gestion des contenus - fonctions spéciales tags
ajouterTagLibre(data){
return axios.patch(urlBase + contenus + "newTagLibre", data, this.getHeader(localStorage.token))
......@@ -133,6 +136,9 @@ export default {
modifierTagsFixes(data) {
return axios.patch(urlBase + contenus + "modifierTags", data, this.getHeader(localStorage.token))
},
parserTexte(id_contenu) {
return axios.get(urlBase + contenus + "parserContenu/" + id_contenu, this.getHeader(localStorage.token))
},
// gestion des en-cours
creerEnCours(data) {
return axios.post(urlBase + en_cours + "newEnCours", data, this.getHeader(localStorage.token))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment