Commit b4d05c40 authored by Myriam Delaruelle's avatar Myriam Delaruelle

Bugfix #05: gestion du conflit avec jquery sur certains Moodles

parent e7a3927c
......@@ -306,6 +306,7 @@ class view_competency_iena_competencies
<script type=\"text/javascript\" charset=\"utf8\" src=\"https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js\"></script>
<script>
$(document).ready(function() {
$.noConflict();
var table = $('#example').DataTable( {
\"language\": {
\"url\": \"https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json\",
......
......@@ -36,92 +36,93 @@ class view_competency_iena_competencies_mgmt
<script>
$(document).ready(function() {
$('#tab_mgmt').DataTable({
responsive: true,
\"language\": {
\"url\": \"https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json\"
},
\"bSort\": false,
scrollCollapse: true,
fixedColumns: {
leftColumns: 1
}
});
$.noConflict();
$('#tab_mgmt').DataTable({
responsive: true,
\"language\": {
\"url\": \"https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json\"
},
\"bSort\": false,
scrollCollapse: true,
fixedColumns: {
leftColumns: 1
}
});
setTimeout(function() {
$('#tab_mgmt_filter').hide();
$('#tab_mgmt_length').hide();
$('#tab_mgmt_info').hide();
}, 500);
setTimeout(function() {
$('#tab_mgmt_filter').hide();
$('#tab_mgmt_length').hide();
$('#tab_mgmt_info').hide();
}, 500);
$('.fram-iena').hide();
// $('#btn-comp-iena').hide();
$('.fram-iena').hide();
// $('#btn-comp-iena').hide();
$( '#select-framework' ).on( 'change', function () {
$('.fram-iena').hide();
$('#fram-'+$(this).val()).show();
});
$( '#select-framework' ).on( 'change', function () {
$('.fram-iena').hide();
$('#fram-'+$(this).val()).show();
});
$('#btn-comp-iena').click(function(){
var idcomp = $('#id-comp-iena').val();
var idcourse = $('#id-course-iena').val();
var value = [];
value[0] = idcomp;
value[1] = idcourse;
$.ajax({
url: '$CFG->wwwroot/blocks/competency_iena/competency_iena_competencies_api.php?courseid='+idcourse,
type: 'POST',
timeout: 10000,
contentType: 'application/x-www-form-urlencoded',
data: {addcomp:value},
success: function(result) {
if (result.trim() == \"true\"){
location.reload();
} else {
alert('Cette compétence est déja liée au cours.');
}
}
});
$('#btn-comp-iena').click(function(){
var idcomp = $('#id-comp-iena').val();
var idcourse = $('#id-course-iena').val();
var value = [];
value[0] = idcomp;
value[1] = idcourse;
$.ajax({
url: '$CFG->wwwroot/blocks/competency_iena/competency_iena_competencies_api.php?courseid='+idcourse,
type: 'POST',
timeout: 10000,
contentType: 'application/x-www-form-urlencoded',
data: {addcomp:value},
success: function(result) {
if (result.trim() == \"true\"){
location.reload();
} else {
alert('Cette compétence est déja liée au cours.');
}
}
});
});
});
$('#filter-iena-competence').keyup(function(){
var searchText = $(this).val();
$('ul > li').each(function(){
var reg = new RegExp(searchText, 'gi');
var currentLiText = $(this).text();
var showCurrentLi = reg.test(currentLiText);
if (searchText){
$(this).toggle(showCurrentLi);
} else {
$(this).hide(showCurrentLi);
$('#fram-'+$( '#select-framework' ).val()).show();
}
});
});
$('#filter-iena-competence').keyup(function(){
var searchText = $(this).val();
$('ul > li').each(function(){
var reg = new RegExp(searchText, 'gi');
var currentLiText = $(this).text();
var showCurrentLi = reg.test(currentLiText);
if (searchText){
$(this).toggle(showCurrentLi);
} else {
$(this).hide(showCurrentLi);
$('#fram-'+$( '#select-framework' ).val()).show();
}
});
});
});
});
function showFilter(obj)
{
var p = obj.parentNode;
var c = p.children;
function showFilter(obj)
{
var p = obj.parentNode;
var c = p.children;
if (c[2].dataset.edit == 'editOn') {
c[0].setAttribute(\"style\", \"display:inline\");
c[1].setAttribute(\"style\", \"display:none\");
c[2].dataset.edit = 'editOff';
} else {
c[0].setAttribute(\"style\", \"display:none\");
c[1].setAttribute(\"style\", \"display:inline\");
c[2].dataset.edit = 'editOn';
}
if (c[2].dataset.edit == 'editOn') {
c[0].setAttribute(\"style\", \"display:inline\");
c[1].setAttribute(\"style\", \"display:none\");
c[2].dataset.edit = 'editOff';
} else {
c[0].setAttribute(\"style\", \"display:none\");
c[1].setAttribute(\"style\", \"display:inline\");
c[2].dataset.edit = 'editOn';
}
// console.log(c)
// console.log(c)
// c[2].setAttribute(\"style\", \"display:none\");
// c[2].setAttribute(\"style\", \"display:none\");
}
......
......@@ -157,6 +157,7 @@ class view_competency_iena_competency_students
<script type=\"text/javascript\" charset=\"utf8\" src=\"https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js\"></script>
<script>
$(document).ready(function() {
$.noConflict();
var table = $('#example').DataTable( {
\"language\": {
\"url\": \"https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json\"
......
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