diff --git a/amd/build/jmodule.min.js b/amd/build/jmodule.min.js index 345c79bbc39f21faa233c7d1ea1d343e02b0b5d6..3f1f3cb44bc7704f00e9ca2a5c63fea85deb4fb6 100644 --- a/amd/build/jmodule.min.js +++ b/amd/build/jmodule.min.js @@ -1,2 +1,2 @@ -/*! hshcourselist 2018-01-29 */ -define(["jquery"],function(a){function b(){var a=document.location.toString(),b=a.indexOf("/",a.indexOf("://")+3),c=a.substring(0,b)+"/",d=a.indexOf("/",a.indexOf(c)+c.length);return a.substring(0,d)}function c(c,d,e,f,g,h,i,j){d&&(a("#hshcourseprogress").show(),a.ajax({type:"GET",url:b()+"/blocks/hshcourselist/hshcourselist.php",data:"course="+c+"&instanceid="+f+"&sesskey="+g+"&contextid="+h+"&idSearching="+i+"&orderbysemester="+j,dataType:"json",success:function(c){var d=JSON.stringify(c),f=JSON.parse(d),g=a("<ul class='list-group' id='hshcourselistul'></ul>");f.length>0&&a.each(f,function(c,d){switch(e){case"0":displaystr=d.shortname;break;case"1":displaystr=d.fullname;break;case"2":displaystr=d.shortname+": "+d.fullname;break;default:displaystr=d.fullname}a('<li class="list-group-item hshcoursesearchlistitem " value="'+d.id+'"><a href="'+b()+"/course/view.php?id="+d.id+'">'+displaystr+"</a> </li>").appendTo(g)}),a("#hshcourselistul").replaceWith(g),a("#hshcourseprogress").hide()},error:function(){console.error("error"),"abort"!==o.statusText&&(a("#hshcourseprogress").hide(),void 0!==o.statusText&&console.error("ABORT + STATUS : "+o.statusText))}}))}return{init:function(b){var d,b=b,e=b.instanceid,f=b.sesskey,g=b.displaymode,h=b.contextid,i=!1,j=!1,k=b.orderbysemester;a("#hshcourseprogress").hide(),a(".idSarchingLabel").hide(),a("#orderbysemestercheckbox_id").on("change",function(){k=document.getElementById("orderbysemestercheckbox_id").checked,i=!0,d=document.getElementById("hshcourselistsearch").value,"#"===d.slice(0,1)?(a(".idSarchingLabel").show(),j=!0,d=d.slice(1)):(a(".idSarchingLabel").hide(),j=!1),c(d,i,g,e,f,h,j,k)}),a("#hshcourselistsearch").on("keyup",function(b){var l=b.keyCode;k=document.getElementById("orderbysemestercheckbox_id").checked,40!==l&&38!==l&&13!==l&&(i=!0,d=document.getElementById("hshcourselistsearch").value,"#"===d.slice(0,1)?(a(".idSarchingLabel").show(),j=!0,d=d.slice(1)):(a(".idSarchingLabel").hide(),j=!1),c(d,i,g,e,f,h,j,k))}),a("#hshcourseform").on("submit",function(a){a.preventDefault,i=!0,j=!1,k=document.getElementById("orderbysemestercheckbox_id").checked,d=document.getElementById("hshcourselistsearch").value,"#"===d.slice(0,1)?(j=!0,d=d.slice(1)):j=!1,c(d,i,g,e,f,h,j,k)})}}}); \ No newline at end of file +/*! hshcourselist 2018-08-29 */ +define(["jquery"],function(a){function b(){var a=document.location.toString(),b=a.indexOf("/",a.indexOf("://")+3);return a.substring(0,b)+"/"}function c(c,d,e,f,g,h,i,j){d&&(a("#hshcourseprogress").show(),a.ajax({type:"GET",url:b()+"/blocks/hshcourselist/hshcourselist.php",data:"course="+c+"&instanceid="+f+"&sesskey="+g+"&contextid="+h+"&idSearching="+i+"&orderbysemester="+j,dataType:"json",success:function(c){var d=JSON.stringify(c),f=JSON.parse(d),g=a("<ul class='list-group' id='hshcourselistul'></ul>");f.length>0&&a.each(f,function(c,d){switch(e){case"0":displaystr=d.shortname;break;case"1":displaystr=d.fullname;break;case"2":displaystr=d.shortname+": "+d.fullname;break;default:displaystr=d.fullname}a('<li class="list-group-item hshcoursesearchlistitem " value="'+d.id+'"><a href="'+b()+"/course/view.php?id="+d.id+'">'+displaystr+"</a> </li>").appendTo(g)}),a("#hshcourselistul").replaceWith(g),a("#hshcourseprogress").hide()},error:function(){console.error("error"),"abort"!==o.statusText&&(a("#hshcourseprogress").hide(),void 0!==o.statusText&&console.error("ABORT + STATUS : "+o.statusText))}}))}return{init:function(b){var d,b=b,e=b.instanceid,f=b.sesskey,g=b.displaymode,h=b.contextid,i=!1,j=!1,k=b.orderbysemester;a("#hshcourseprogress").hide(),a(".idSarchingLabel").hide(),a("#orderbysemestercheckbox_id").on("change",function(){k=document.getElementById("orderbysemestercheckbox_id").checked,i=!0,d=document.getElementById("hshcourselistsearch").value,"#"===d.slice(0,1)?(a(".idSarchingLabel").show(),j=!0,d=d.slice(1)):(a(".idSarchingLabel").hide(),j=!1),c(d,i,g,e,f,h,j,k)}),a("#hshcourselistsearch").on("keyup",function(b){var l=b.keyCode;k=document.getElementById("orderbysemestercheckbox_id").checked,40!==l&&38!==l&&13!==l&&(i=!0,d=document.getElementById("hshcourselistsearch").value,"#"===d.slice(0,1)?(a(".idSarchingLabel").show(),j=!0,d=d.slice(1)):(a(".idSarchingLabel").hide(),j=!1),c(d,i,g,e,f,h,j,k))}),a("#hshcourseform").on("submit",function(a){a.preventDefault,i=!0,j=!1,k=document.getElementById("orderbysemestercheckbox_id").checked,d=document.getElementById("hshcourselistsearch").value,"#"===d.slice(0,1)?(j=!0,d=d.slice(1)):j=!1,c(d,i,g,e,f,h,j,k)})}}}); \ No newline at end of file diff --git a/amd/src/jmodule.js b/amd/src/jmodule.js index 878b3ed71a2be20637312f1ca24377c25b80e54c..e2bcbed25e2e31676e1fe3d49caa79d291fb1816 100644 --- a/amd/src/jmodule.js +++ b/amd/src/jmodule.js @@ -3,9 +3,10 @@ define(['jquery'], function ($) { var _location = document.location.toString(); var applicationNameIndex = _location.indexOf('/', _location.indexOf('://') + 3); var applicationName = _location.substring(0, applicationNameIndex) + '/'; - var webFolderIndex = _location.indexOf('/', _location.indexOf(applicationName) + applicationName.length); - var webFolderFullPath = _location.substring(0, webFolderIndex); - return webFolderFullPath; + return applicationName; + //var webFolderIndex = _location.indexOf('/', _location.indexOf(applicationName) + applicationName.length); + //var webFolderFullPath = _location.substring(0, webFolderIndex); + //return webFolderFullPath; } function search(searchstring, reloadBool, displaymode, instanceid, sesskey, contextid, idSearching, orderbysemester) { @@ -15,8 +16,8 @@ define(['jquery'], function ($) { type: 'GET', url: getRootWebSitePath() + '/blocks/hshcourselist/hshcourselist.php', data: 'course=' + searchstring + '&instanceid=' + instanceid - + '&sesskey=' + sesskey + '&contextid=' + contextid - + '&idSearching=' + idSearching + '&orderbysemester=' + orderbysemester, + + '&sesskey=' + sesskey + '&contextid=' + contextid + + '&idSearching=' + idSearching + '&orderbysemester=' + orderbysemester, dataType: "json", success: function (response) { var plainJSON = JSON.stringify(response); @@ -79,7 +80,7 @@ define(['jquery'], function ($) { $("#hshcourseprogress").hide(); $(".idSarchingLabel").hide(); - $('#orderbysemestercheckbox_id').on('change', function () { + $('#orderbysemestercheckbox_id').on('change', function () { orderbysemester = document.getElementById('orderbysemestercheckbox_id').checked; reloadList = true; searchstring = document.getElementById('hshcourselistsearch').value;