Gitlab CSE Unil

Commit 7cfe5f3f authored by M. Chardon's avatar M. Chardon
Browse files

autoriser tout type de fichier audio et tout type de pj lors de la remise d'un devoir

parent 5a3b9b7e
define(["jquery","mod_audioannotation/justWave","mod_audioannotation/editor","mod_audioannotation/rightMenu"],function(a,b,c,d){function e(a){e.currentUser="userid"in a?a.userid:null,e.courseid="course"in a?a.course:null,e.audioannotation="audioannotation"in a?a.audioannotation:null,e.eval="eval"in a?a.eval:0,e.iswriting="iswriting"in a?a.iswriting:0,e.pairing="pairing"in a?a.pairing:0;var f="repo"in a?a.repo:null,g="assignparts"in a?a.assignparts:null,h=null;if(g)try{h=JSON.parse(g)}catch(i){window.console.error(i)}var j="tags"in a?a.tags:null,k=null;if(j)try{k=JSON.parse(j)}catch(i){window.console.error(i)}if(e.wavePlayer=new b(this),e.editors=[],h)for(var l=0;l<h.length;l++){e.editors[h[l].id]=new c({controler:this,courseid:e.courseid,assignpart:h[l],audioannotation:e.audioannotation,tags:k,repo:f});var m=new b(this,e.editors[h[l].id]);e.editors[h[l].id].setWavePlayer(m),this.initWave(m,"justwave",h[l].id)}this.initTrigger(),e.rightMenu=new d({controler:this}),this.initDisplay()}return e.courseid=-1,e.audioannotation=-1,e.wavePlayer=null,e.prototype.editors=null,e.rightMenu=null,e.lastP=null,e.eval=0,e.iswriting=0,e.pairing=0,e.currentUser=null,e.prototype.initTrigger=function(){1!=e.eval&&1!=e.iswriting||a(".btn_add_annotation").on("click",function(){e.editors[a(this).data("assignpart")].notify("add")}),a(".select_tqs").on("change",function(){var b=a(this).data("assignpart");e.editors[b].notify("displaytqs",{tag:a("#select_tag"+b).val(),question:a("#select_question"+b).val(),statut:a("#select_statut"+b).val(),author:a("#select_author"+b).val()})}),a("li[data-annotation]").on("click",function(){var b=a(this).data("annotation"),c=a(this).parents(".annotationGroupAccordion").data("assignpart");b&&e.editors[c].notify("view",{annotation:b})})},e.prototype.initWave=function(b,c,d){b.init(c),b.drawWaveDisplay(a(".justwave"+d+" audio"))},e.prototype.initAnnotations=function(){for(var a=0;a<e.editors.length;a++)e.editors[a]&&e.editors[a].initAnnotationsDisplay()},e.prototype.initDisplay=function(){function b(){var b=a('input[name="remediation"]:checked').val();1==b?a('input[name="notification"]').parents("div.fitem").show():a('input[name="notification"]').parents("div.fitem").hide()}a("#id_grade").on("change",function(){a(this).val()?a("input[name=gradeempty]").val(0):a("input[name=gradeempty]").val(1)}),a("div[data-parent='#accordionAssignPart']").on("show.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-right");c.removeClass("fa-caret-right"),c.addClass("fa-caret-down")}),a("div[data-parent='#accordionAssignPart']").on("hide.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-down");c.removeClass("fa-caret-down"),c.addClass("fa-caret-right")}),b(),a('input[name="remediation"]').on("change",function(){b()})},e.prototype.notify=function(a,b,c){switch(a){case"loadedmetadata":this.initAnnotations();break;case"addannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("add");break;case"editannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("edit");break;case"viewannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("view");break;case"deleteannotation":if("rightMenu"===b)for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].notify("delete",c);else for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("delete")}},e.prototype.getEval=function(){return e.eval},e.prototype.isWriting=function(){return e.iswriting},e.prototype.getPairing=function(){return e.pairing},e.prototype.getCurrentUser=function(){return e.currentUser},e});
\ No newline at end of file
define(["jquery","mod_audioannotation/justWave","mod_audioannotation/editor","mod_audioannotation/rightMenu"],function(a,b,c,d){function e(a){e.currentUser="userid"in a?a.userid:null,e.courseid="course"in a?a.course:null,e.audioannotation="audioannotation"in a?a.audioannotation:null,e.eval="eval"in a?a.eval:0,e.iswriting="iswriting"in a?a.iswriting:0,e.pairing="pairing"in a?a.pairing:0;var f="repo"in a?a.repo:null,g="assignparts"in a?a.assignparts:null,h=null;if(g)try{h=JSON.parse(g)}catch(i){window.console.error(i)}var j="tags"in a?a.tags:null,k=null;if(j)try{k=JSON.parse(j)}catch(i){window.console.error(i)}if(e.wavePlayer=new b(this),e.editors=[],h)for(var l=0;l<h.length;l++){e.editors[h[l].id]=new c({controler:this,courseid:e.courseid,assignpart:h[l],audioannotation:e.audioannotation,tags:k,repo:f});var m=new b(this,e.editors[h[l].id]);e.editors[h[l].id].setWavePlayer(m),this.initWave(m,"justwave",h[l].id)}this.initTrigger(),e.rightMenu=new d({controler:this}),this.initDisplay()}return e.courseid=-1,e.audioannotation=-1,e.wavePlayer=null,e.prototype.editors=null,e.rightMenu=null,e.lastP=null,e.eval=0,e.iswriting=0,e.pairing=0,e.currentUser=null,e.prototype.initTrigger=function(){1!=e.eval&&1!=e.iswriting||a(".btn_add_annotation").on("click",function(){e.editors[a(this).data("assignpart")].notify("add")}),a(".select_tqs").on("change",function(){var b=a(this).data("assignpart");e.editors[b].notify("displaytqs",{tag:a("#select_tag"+b).val(),question:a("#select_question"+b).val(),statut:a("#select_statut"+b).val(),author:a("#select_author"+b).val()})}),a("li[data-annotation]").on("click",function(){var b=a(this).data("annotation"),c=a(this).parents(".annotationGroupAccordion").data("assignpart");b&&e.editors[c].notify("view",{annotation:b})}),a("#id_grade").on("change",function(){a(this).val()?a("input[name=gradeempty]").val(0):a("input[name=gradeempty]").val(1)}),a("div[data-parent='#accordionAssignPart']").on("show.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-right");c.removeClass("fa-caret-right"),c.addClass("fa-caret-down")}),a("div[data-parent='#accordionAssignPart']").on("hide.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-down");c.removeClass("fa-caret-down"),c.addClass("fa-caret-right")})},e.prototype.initWave=function(b,c,d){b.init(c),b.drawWaveDisplay(a(".justwave"+d+" audio"))},e.prototype.initAnnotations=function(){for(var a=0;a<e.editors.length;a++)e.editors[a]&&e.editors[a].initAnnotationsDisplay()},e.prototype.initDisplay=function(){function b(){var b=a('input[name="remediation"]:checked').val();1==b?a('input[name="notification"]').parents("div.fitem").show():a('input[name="notification"]').parents("div.fitem").hide()}b(),a('input[name="remediation"]').on("change",function(){b()})},e.prototype.notify=function(a,b,c){switch(a){case"loadedmetadata":this.initAnnotations();break;case"addannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("add");break;case"editannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("edit");break;case"viewannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("view");break;case"deleteannotation":if("rightMenu"===b)for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].notify("delete",c);else for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("delete")}},e.prototype.getEval=function(){return e.eval},e.prototype.isWriting=function(){return e.iswriting},e.prototype.getPairing=function(){return e.pairing},e.prototype.getCurrentUser=function(){return e.currentUser},e});
\ No newline at end of file
define(["jquery","mod_audioannotation/record"],function(a,b){function c(a){c.repo="repo"in a?a.repo:null,c.limit="limit"in a&&a.limit>0?1e3*a.limit:null,c.nbRendu="nbRendu"in a&&a.nbRendu>0?a.nbRendu:1,this.init()}c.constraints={audio:!0},c.sourceBuffer=null,c.mediaRecorder=null,c.recordedBlobs=null,c.repo=-1,c.limit=null,c.nbRendu=1,c.records=null,c.statut="off",c.prototype.mediaSource=null,c.pauseTimestamp=0,c.prototype.init=function(){c.records=[];for(var f=0;f<c.nbRendu;f++){var g=[];g.manager=this,g.limit=c.limit,g.repo=c.repo,g.indice=f,c.records[f]=new b(g)}if(a("#audioworkspace").remove(),c.mediaSource=new MediaSource,c.mediaSource.addEventListener("sourceopen",e,!1),!navigator.mediaDevices||!window.MediaRecorder)return void alert("nowebrtc");if(!navigator.mediaDevices.getUserMedia)return void alert("getUserMedia is not supported by your browser");navigator.permissions.query({name:"microphone"}).then(function(a){window.console.log(a.state),window.stream&&window.stream.getTracks().forEach(function(a){a.stop()})})["catch"](function(a){window.console.log("Got error :",a)}),c.mediaRecorder&&"inactive"!==c.mediaRecorder.state&&c.mediaRecorder.stop(),window.stream&&window.stream.getTracks().forEach(function(a){"ended"!==a.readyState&&a.stop()});var h=null;navigator.mediaDevices.enumerateDevices().then(function(b){function e(a){window.console.log("Got stream, time diff :",Date.now()-l),d(a)}function f(a){m++;var b={audio:{deviceId:{exact:a}}};navigator.mediaDevices.getUserMedia(b).then(e)["catch"](g)}function g(b){i&&m<i.length?f(i[m]):(alert("microphone no available"),window.console.log("GUM failed with error, time diff: ",Date.now()-l),window.console.error("navigator.getUserMedia error:",b.name+": "+b.message),a(c.errorMsgElement).html("navigator.getUserMedia error:"+b.toString()))}var i=[];window.console.log(b);for(var j=0;j!==b.length;++j){var k=b[j];"audioinput"===k.kind&&(h=k.deviceId,window.console.log(h),i.push(h))}if(!h)return void alert("not available microphone");var l=Date.now(),m=0;navigator.mediaDevices.getUserMedia({audio:!0}).then(e)["catch"](g)})};var d=function(b){a(".btn-record").each(function(){a(this).prop("indice")>=0&&c.records[a(this).prop("indice")].initDisplayRecordButton(!0)}),window.console.log("getUserMedia() got stream:",b),window.stream=b},e=function(){window.console.log("MediaSource opened"),c.sourceBuffer=c.mediaSource.addSourceBuffer("audio/ogg"),window.console.log("Source buffer: ",c.sourceBuffer)};c.prototype.startRecording=function(b){if("off"!==c.statut)return!1;c.statut="on",c.recordedBlobs=[],c.initTimestamp=-1,c.pauseTimestamp=0;var d=null;try{c.mediaRecorder=new MediaRecorder(window.stream,d)}catch(e){return window.console.error("Exception while creating MediaRecorder:",e),void a(this.errorMsgElement).html("Exception while creating MediaRecorder: "+JSON.stringify(e))}return window.console.log("Created MediaRecorder",c.mediaRecorder,"with options",d),c.mediaRecorder.addEventListener("stop",function(d){a("#audiotime"+b).text(""),c.timestampStop=0,window.console.log("Recorder stopped: ",d)},!1),c.mediaRecorder.addEventListener("dataavailable",function(a){f(a,b)},!1),c.mediaRecorder.start(10),window.console.log("MediaRecorder started",c.mediaRecorder),!0};var f=function(b,d){if(b.data&&b.data.size>0){c.initTimestamp<0&&(c.initTimestamp=b.timeStamp);var e=b.timeStamp-c.initTimestamp-c.pauseTimestamp,f=new Date(e);f.setHours(f.getHours()-1);var g=f.getHours()<10?"0"+f.getHours():f.getHours(),h=f.getMinutes()<10?"0"+f.getMinutes():f.getMinutes(),i=f.getSeconds()<10?"0"+f.getSeconds():f.getSeconds(),j=g+":"+h+":"+i;a("#audiotime"+d).text(j),c.limit&&e>c.limit&&(c.timestampStop&&0!==c.timestampStop||(c.timestampStop=1,c.records[d].stopRecord())),c.recordedBlobs.push(b.data)}};return c.prototype.stopRecording=function(a){c.statut="off",c.mediaRecorder.stop(),window.console.log("Recorded Blobs: ",c.recordedBlobs);var b=c.recordedBlobs;c.records[a].sendBlob(b),this.sendFile(b,a)},c.prototype.sendFile=function(b,d){a("#sending"+d).show();var e=new Blob(b),f=new window.FormData,g=(1e3*Math.random()).toString().replace(".","");f.append("repo_upload_file",e,g),f.append("itemid",g),f.append("title",g),f.append("repo_id",c.repo),f.append("env","editor"),f.append("sesskey",M.cfg.sesskey),f.append("savepath","/"),f.append("ctx_id",M.cfg.contextid);var h=M.cfg.wwwroot+"/repository/repository_ajax.php?action=upload",i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){if(4===this.readyState&&200===this.status){a("#sending"+d).hide();var b=i.response,c=JSON.parse(b);a("input[name='filerecord"+d+"']").val(c.file),a("input[name='file"+d+"']").parent().parent().addClass("disabled"),a("#sendok"+d).show().fadeOut(3e3)}else this.readyState>200&&(a("#sending"+d).hide(),a("#sendko"+d).show())},!1),i.open("POST",h,!0),i.send(f)},c.prototype.pauseRecording=function(a){c.mediaRecorder&&(c.pauseBeginTimestamp=a.timeStamp,c.mediaRecorder.pause(),window.console.log("MediaRecorder paused",c.mediaRecorder))},c.prototype.resumeRecording=function(a){c.mediaRecorder&&(c.pauseTimestamp+=a.timeStamp-c.pauseBeginTimestamp,c.mediaRecorder.resume(),window.console.log("MediaRecorder resumed",c.mediaRecorder))},c.prototype.reset=function(){for(var a=0;a<c.records.length;a++)c.records[a].reset()},c});
\ No newline at end of file
define(["jquery","mod_audioannotation/record"],function(a,b){function c(a){c.repo="repo"in a?a.repo:null,c.limit="limit"in a&&a.limit>0?1e3*a.limit:null,c.nbRendu="nbRendu"in a&&a.nbRendu>0?a.nbRendu:1,this.init(),this.initDisplay()}c.constraints={audio:!0},c.sourceBuffer=null,c.mediaRecorder=null,c.recordedBlobs=null,c.repo=-1,c.limit=null,c.nbRendu=1,c.records=null,c.statut="off",c.prototype.mediaSource=null,c.pauseTimestamp=0,c.prototype.init=function(){c.records=[];for(var f=0;f<c.nbRendu;f++){var g=[];g.manager=this,g.limit=c.limit,g.repo=c.repo,g.indice=f,c.records[f]=new b(g)}if(a("#audioworkspace").remove(),c.mediaSource=new MediaSource,c.mediaSource.addEventListener("sourceopen",e,!1),!navigator.mediaDevices||!window.MediaRecorder)return void alert("nowebrtc");if(!navigator.mediaDevices.getUserMedia)return void alert("getUserMedia is not supported by your browser");navigator.permissions.query({name:"microphone"}).then(function(a){window.console.log(a.state),window.stream&&window.stream.getTracks().forEach(function(a){a.stop()})})["catch"](function(a){window.console.log("Got error :",a)}),c.mediaRecorder&&"inactive"!==c.mediaRecorder.state&&c.mediaRecorder.stop(),window.stream&&window.stream.getTracks().forEach(function(a){"ended"!==a.readyState&&a.stop()});var h=null;navigator.mediaDevices.enumerateDevices().then(function(b){function e(a){window.console.log("Got stream, time diff :",Date.now()-l),d(a)}function f(a){m++;var b={audio:{deviceId:{exact:a}}};navigator.mediaDevices.getUserMedia(b).then(e)["catch"](g)}function g(b){i&&m<i.length?f(i[m]):(alert("microphone no available"),window.console.log("GUM failed with error, time diff: ",Date.now()-l),window.console.error("navigator.getUserMedia error:",b.name+": "+b.message),a(c.errorMsgElement).html("navigator.getUserMedia error:"+b.toString()))}var i=[];window.console.log(b);for(var j=0;j!==b.length;++j){var k=b[j];"audioinput"===k.kind&&(h=k.deviceId,window.console.log(h),i.push(h))}if(!h)return void alert("not available microphone");var l=Date.now(),m=0;navigator.mediaDevices.getUserMedia({audio:!0}).then(e)["catch"](g)})},c.prototype.initDisplay=function(){a.fn.justtext=function(){return a(this).clone().children().remove().end().text()},a(".audiofilepicker .form-filetypes-descriptions > ul").each(function(){var b=a(this).children("li");if(b&&!(b.length<2)){var c=a("<li></li>"),d=b[0],e=a(d).justtext();e=e.replace(/\ \((.*)\)/g,""),c.append(e);var f=a(d).children(),g="";f.each(function(){g=a(this).clone(),g.html("")}),b.each(function(){a(this).children().each(function(){g.append(a(this).text()+" ")}),a(this).remove()}),c.append(g),a(this).append(c)}})};var d=function(b){a(".btn-record").each(function(){a(this).prop("indice")>=0&&c.records[a(this).prop("indice")].initDisplayRecordButton(!0)}),window.console.log("getUserMedia() got stream:",b),window.stream=b},e=function(){window.console.log("MediaSource opened"),c.sourceBuffer=c.mediaSource.addSourceBuffer("audio/ogg"),window.console.log("Source buffer: ",c.sourceBuffer)};c.prototype.startRecording=function(b){if("off"!==c.statut)return!1;c.statut="on",c.recordedBlobs=[],c.initTimestamp=-1,c.pauseTimestamp=0;var d=null;try{c.mediaRecorder=new MediaRecorder(window.stream,d)}catch(e){return window.console.error("Exception while creating MediaRecorder:",e),void a(this.errorMsgElement).html("Exception while creating MediaRecorder: "+JSON.stringify(e))}return window.console.log("Created MediaRecorder",c.mediaRecorder,"with options",d),c.mediaRecorder.addEventListener("stop",function(d){a("#audiotime"+b).text(""),c.timestampStop=0,window.console.log("Recorder stopped: ",d)},!1),c.mediaRecorder.addEventListener("dataavailable",function(a){f(a,b)},!1),c.mediaRecorder.start(10),window.console.log("MediaRecorder started",c.mediaRecorder),!0};var f=function(b,d){if(b.data&&b.data.size>0){c.initTimestamp<0&&(c.initTimestamp=b.timeStamp);var e=b.timeStamp-c.initTimestamp-c.pauseTimestamp,f=new Date(e);f.setHours(f.getHours()-1);var g=f.getHours()<10?"0"+f.getHours():f.getHours(),h=f.getMinutes()<10?"0"+f.getMinutes():f.getMinutes(),i=f.getSeconds()<10?"0"+f.getSeconds():f.getSeconds(),j=g+":"+h+":"+i;a("#audiotime"+d).text(j),c.limit&&e>c.limit&&(c.timestampStop&&0!==c.timestampStop||(c.timestampStop=1,c.records[d].stopRecord())),c.recordedBlobs.push(b.data)}};return c.prototype.stopRecording=function(a){c.statut="off",c.mediaRecorder.stop(),window.console.log("Recorded Blobs: ",c.recordedBlobs);var b=c.recordedBlobs;c.records[a].sendBlob(b),this.sendFile(b,a)},c.prototype.sendFile=function(b,d){a("#sending"+d).show();var e=new Blob(b),f=new window.FormData,g=(1e3*Math.random()).toString().replace(".","");f.append("repo_upload_file",e,g),f.append("itemid",g),f.append("title",g),f.append("repo_id",c.repo),f.append("env","editor"),f.append("sesskey",M.cfg.sesskey),f.append("savepath","/"),f.append("ctx_id",M.cfg.contextid);var h=M.cfg.wwwroot+"/repository/repository_ajax.php?action=upload",i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){if(4===this.readyState&&200===this.status){a("#sending"+d).hide();var b=i.response,c=JSON.parse(b);a("input[name='filerecord"+d+"']").val(c.file),a("input[name='file"+d+"']").parent().parent().addClass("disabled"),a("#sendok"+d).show().fadeOut(3e3)}else this.readyState>200&&(a("#sending"+d).hide(),a("#sendko"+d).show())},!1),i.open("POST",h,!0),i.send(f)},c.prototype.pauseRecording=function(a){c.mediaRecorder&&(c.pauseBeginTimestamp=a.timeStamp,c.mediaRecorder.pause(),window.console.log("MediaRecorder paused",c.mediaRecorder))},c.prototype.resumeRecording=function(a){c.mediaRecorder&&(c.pauseTimestamp+=a.timeStamp-c.pauseBeginTimestamp,c.mediaRecorder.resume(),window.console.log("MediaRecorder resumed",c.mediaRecorder))},c.prototype.reset=function(){for(var a=0;a<c.records.length;a++)c.records[a].reset()},c});
\ No newline at end of file
......@@ -138,6 +138,26 @@ define(['jquery', 'mod_audioannotation/justWave', 'mod_audioannotation/editor',
);
}
});
$('#id_grade').on('change', function () {
if (!$(this).val()) {
$('input[name=gradeempty]').val(1);
} else {
$('input[name=gradeempty]').val(0);
}
});
//display trigger
$("div[data-parent='#accordionAssignPart']").on("show.bs.collapse", function () {
var divTitle = $("div[data-target='#" + $(this).attr('id') + "']");
var i = divTitle.find('i.fa-caret-right');
i.removeClass('fa-caret-right');
i.addClass('fa-caret-down');
});
$("div[data-parent='#accordionAssignPart']").on("hide.bs.collapse", function () {
var divTitle = $("div[data-target='#" + $(this).attr('id') + "']");
var i = divTitle.find('i.fa-caret-down');
i.removeClass('fa-caret-down');
i.addClass('fa-caret-right');
});
};
/**
......@@ -166,25 +186,6 @@ define(['jquery', 'mod_audioannotation/justWave', 'mod_audioannotation/editor',
* Init global dispay
*/
Controler.prototype.initDisplay = function () {
$('#id_grade').on('change', function () {
if (!$(this).val()) {
$('input[name=gradeempty]').val(1);
} else {
$('input[name=gradeempty]').val(0);
}
});
$("div[data-parent='#accordionAssignPart']").on("show.bs.collapse", function () {
var divTitle = $("div[data-target='#" + $(this).attr('id') + "']");
var i = divTitle.find('i.fa-caret-right');
i.removeClass('fa-caret-right');
i.addClass('fa-caret-down');
});
$("div[data-parent='#accordionAssignPart']").on("hide.bs.collapse", function () {
var divTitle = $("div[data-target='#" + $(this).attr('id') + "']");
var i = divTitle.find('i.fa-caret-down');
i.removeClass('fa-caret-down');
i.addClass('fa-caret-right');
});
function initVisuNotification() {
var val = $('input[name="remediation"]:checked').val();
if (val == 1) {
......
......@@ -64,6 +64,7 @@ define(['jquery', 'mod_audioannotation/record'],
RecordsManager.nbRendu = 'nbRendu' in data && data['nbRendu'] > 0 ? data['nbRendu'] : 1;
//initialize
this.init();
this.initDisplay();
}
/*************
......@@ -176,6 +177,41 @@ define(['jquery', 'mod_audioannotation/record'],
return;
}
};
RecordsManager.prototype.initDisplay = function () {
$.fn.justtext = function () {
return $(this).clone()
.children()
.remove()
.end()
.text();
};
//change file audio picker filetype display
$('.audiofilepicker .form-filetypes-descriptions > ul').each(function () {
var lis = $(this).children('li');
if (!lis || lis.length < 2) {
return;
}
var lifinal = $('<li></li>');
var lifirst = lis[0];
var content = $(lifirst).justtext();
content = content.replace(/\ \((.*)\)/g, '');
lifinal.append(content);
var child = $(lifirst).children();
var span = "";
child.each(function () {
span = $(this).clone();
span.html("");
});
lis.each(function () {
$(this).children().each(function () {
span.append($(this).text() + " ");
});
$(this).remove();
});
lifinal.append(span);
$(this).append(lifinal);
});
};
/**
* Close MediaSource
* @param {UserMedia} stream
......
......@@ -138,7 +138,7 @@ class assignaudio_form extends moodleform {
if ($audioannotation->dragdrop) {
$name = get_string('formassign_recordfile', AUDIOANNOT_MODNAME);
$mform->addElement('filepicker', 'file' . $i, $name, null, array('maxbytes' => $audioannotation->filelimit * 1000, 'accepted_types' => array('.aiff', '.amr', '.m4a', '.mp3', '.ogg', '.wav', '.wma')));
$mform->addElement('filepicker', 'file' . $i, $name, array('class' => 'audiofilepicker'), array('maxbytes' => $audioannotation->filelimit * 1000, 'accepted_types' => array('audio')));
$mform->setType('file' . $i, PARAM_FILE);
//$mform->disabledIf('file', assignaudio_form::FIELDRECORDFIELD, 'ne', '-1');
}
......@@ -149,7 +149,7 @@ class assignaudio_form extends moodleform {
$name = get_string('formassign_annexes', AUDIOANNOT_MODNAME);
$mform->addElement('filemanager', 'annexes' . $i, $name, null, array('subdirs' => 0, 'maxbytes' => 10485760, 'areamaxbytes' => 10485760, 'maxfiles' => 5,
'accepted_types' => array('document'), 'return_types' => FILE_INTERNAL | FILE_EXTERNAL));
'accepted_types' => '*', 'return_types' => FILE_INTERNAL | FILE_EXTERNAL));
$mform->addElement(assignaudio_form::HIDDENTYPE, 'renduid' . $i);
$mform->setType('renduid' . $i, PARAM_INT);
......
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