Utilisateur:

Contrôle d'assistance

Storyboard

>Modèle

ID:(1961, 0)


function show_div(num) { for (i = 0; i < num; i++) $("#fld_" + i.toString()).show(); } function one_div(idx, num) { for (i = 0; i < num; i++) (idx == i) ? $("#fld_" + i).show() : $("#fld_" + i).hide(); } function content_adapt() { // getView {purl} var language = ['','en','es','de','pt','fr']; // keys var code = getCookie('druyd1'); if(code == '' || code == '[]'){ code = '{}'; setCookie('druyd1',code,365); } arrcode = JSON.parse(code); // base var cookie = getCookie('druyd0'); if(cookie != '' && cookie.length > 0){ url_structure = window.location.href.split('/'); structure_arr = url_structure[url_structure.length-2].split('-'); slang = url_structure[url_structure.length-1]; nlang = language.indexOf(slang); if(nlang == undefined){ nlang = 1; } var code = getCookie('druyd1'); var obj = JSON.parse(code); $('#title').text("Lectures"); if(structure_arr.length == 2){ keys = url_structure[url_structure.length-2].split('-'); id_semester = keys[1]; id_main = obj.id_subjet; $.ajax({ type:'POST', url: '/getSemesterLectures', data: JSON.stringify([id_semester, "Select", nlang]), contentType:'application/json', dataType: 'json', success: function(data){ main_idx = getIdxComboBox(id_main, data[0]); setupCombobox($('#cb_main'), '100%', data[0], main_idx, false); pub_arr = data[1]; if(main_idx > 0){ $('input:radio[name=status]').val([pub_arr[main_idx]]); } } }); } } en_user_cookie = getCookie('druyd'); if(de_user_cookie != '' && de_user_cookie.length > 0){ user_data = JSON.parse(de_user_cookie); if(user_data[0] == 1){ $('#save_clipboard').removeAttr('hidden'); $('#load_clipboard').removeAttr('hidden'); } $('#savefile').removeAttr('hidden'); $('#loadfile').removeAttr('hidden'); } } $(document).ready(function () { $('#cb_main').on('select',function(event){ if(structure_arr.length == 2){ main_idx = $('#cb_main').jqxComboBox('getSelectedIndex'); id_main = $('#cb_main').val(); if(main_idx == 0){ $('#list').html(''); } else { $('input:radio[name=status]').val([pub_arr[main_idx]]); $.ajax({ type:'POST', url: '/getLectureStudents', data: JSON.stringify([id_semester,id_main]), contentType:'application/json', dataType: 'json', success: function(data){ tabdat = data; user_idx = []; for(var i = 0;i < tabdat.length;i++){ user_idx.push(tabdat[i][0]); } writeReport(); } }); } } }); $('#update').click(function(){ if(structure_arr.length == 2){ main_idx = $('#cb_main').jqxComboBox('getSelectedIndex'); id_main = $('#cb_main').val(); if(main_idx == 0){ $('#list').html(''); } else { $('input:radio[name=status]').val([pub_arr[main_idx]]); $.ajax({ type:'POST', url: '/getLectureStudents', data: JSON.stringify([id_semester,id_main]), contentType:'application/json', dataType: 'json', success: function(data){ tabdat = data; user_idx = []; for(var i = 0;i < tabdat.length;i++){ user_idx.push(tabdat[i][0]); } writeReport(); } }); } } }); $('input[type=radio][name=status]').change(function() { main_idx = $('#cb_main').jqxComboBox('getSelectedIndex'); id_main = $('#cb_main').val(); $.ajax({ type:'POST', url: '/setLectureStatus', data: JSON.stringify([id_main,$('input[name="status"]:checked').val()]), contentType:'application/json', dataType: 'json', success: function(data){ pub_arr[main_idx] = $('input[name="status"]:checked').val(); } }); }); var idx = 0; var num = parseInt("1", 10) || 0; function resizeContent(){ const headH = $('#head').length ? $('#head').height() : 0; const toolbarH = $('#sb-toolbar').outerHeight() || 0; const H = window.innerHeight - headH - toolbarH - 16; $("#sb-content").css({ height: H + "px" }); } resizeContent(); $(window).on("resize", resizeContent); function lr_show(){ $("#lr").removeClass("d-none").addClass("d-flex"); } function lr_hide(){ $("#lr").removeClass("d-flex").addClass("d-none"); $("#cnt").text(""); } function renderMode(){ const v = $('#select input[type=radio]:checked').val(); // "1"|"2"|"3" if (v === "2") { lr_show(); $("#cnt").text((idx + 1) + " of " + num); one_div(idx, num); $("#fld_video").hide(); } else if (v === "3") { lr_hide(); one_div(-1, num); $("#fld_video").show(); } else { lr_hide(); show_div(num); $("#fld_video").hide(); } } // Bind radios $('#select input[type=radio]').off('change.story').on('change.story', function () { resizeContent(); renderMode(); }); // Initial correct state (fixes: lr visible at start / missing text on first select) renderMode(); // Arrows (only meaningful in mode 2) $("#left").off('click.story').on('click.story', function () { idx--; if (idx < 0) idx = num - 1; $("#cnt").text((idx + 1) + " of " + num); one_div(idx, num); }); $("#right").off('click.story').on('click.story', function () { idx++; if (idx > num - 1) idx = 0; $("#cnt").text((idx + 1) + " of " + num); one_div(idx, num); }); // Toggle index-panel $("#ctrl").off('click.story').on('click.story', function () { if ($("#index-panel").is(":visible")) { $("#index-panel").hide(); $('#mainSplitter').jqxSplitter({ panels: [{ size: '0%' }, { size: '100%' }] }); $("#arrow").attr("src", "/static/icons/chevronright32b.png"); } else { $("#index-panel").show(); $('#mainSplitter').jqxSplitter({ panels: [{ size: '25%' }, { size: '75%' }] }); $("#arrow").attr("src", "/static/icons/chevronleft32b.png"); } }); // Rabbit back: aquí lo dejamos disabled hasta que conectes tu stack real // $("#rabbit-back").prop("disabled", false).on("click", function(){ ... }); });