Skip to content
Snippets Groups Projects
Commit 96ae5f46 authored by Elke Kreim's avatar Elke Kreim
Browse files

Change action url if no results found

parent 3291362a
No related branches found
No related tags found
No related merge requests found
define("block_hshcourselist/jmodule",["jquery"],(function($){function search(searchstring,reloadBool,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot){reloadBool&&($("#hshcourseprogress").show(),$.ajax({type:"GET",url:wwwroot+"/blocks/hshcourselist/hshcourselist.php",data:"course="+searchstring+"&instanceid="+instanceid+"&sesskey="+sesskey+"&contextid="+contextid+"&idsearching="+idsearching+"&orderbysemester="+orderbysemester,dataType:"json",success:function(response){var plainJSON=JSON.stringify(response),courses=JSON.parse(plainJSON),list=$("<ul class='list-group' id='hshcourselistul'></ul>");courses.length>0?$.each(courses,(function(index,course){switch(displaymode){case"0":displaystr=course.shortname;break;case"1":default:displaystr=course.fullname;break;case"2":displaystr=course.shortname+": "+course.fullname}$('<li class="list-group-item hshcoursesearchlistitem " value="'+course.id+'"><a href="'+wwwroot+"/course/view.php?id="+course.id+'">'+displaystr+"</a> </li>").appendTo(list)})):$('<li class="list-group-item hshcoursesearchlistitem " value=""><a href="'+wwwroot+'/my/">Keine Ergebnisse gefunden.</a> </li>').appendTo(list),$("#hshcourselistul").replaceWith(list),$("#hshcourseprogress").hide()},error:function(a){$(location).attr("href",wwwroot+"/my/")}}))}return{init:function(jsdataobject,wwwroot){var searchstring,instanceid=(jsdataobject=jsdataobject).instanceid,sesskey=jsdataobject.sesskey,displaymode=jsdataobject.displaymode,contextid=jsdataobject.contextid,reloadList=!1,idsearching=!1,orderbysemester=jsdataobject.orderbysemester;$("#hshcourseprogress").hide(),$(".idSarchingLabel").hide(),$("#orderbysemestercheckbox_id").on("change",(function(){orderbysemester=document.getElementById("orderbysemestercheckbox_id").checked,reloadList=!0,"#"===(searchstring=(searchstring=(searchstring=document.getElementById("hshcourselistsearch").value).replace(/%/g,"")).trim()).slice(0,1)?($(".idSarchingLabel").show(),idsearching=!0,searchstring=searchstring.slice(1)):($(".idSarchingLabel").hide(),idsearching=!1),(1==idsearching||searchstring.length>=3)&&search(searchstring,reloadList,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot)})),$("#hshcourselistsearch").on("keyup",(function(e){var key=e.keyCode;orderbysemester=document.getElementById("orderbysemestercheckbox_id").checked,40!==key&&38!==key&&13!==key&&(reloadList=!0,"#"===(searchstring=(searchstring=(searchstring=document.getElementById("hshcourselistsearch").value).replace(/%/g,"")).trim()).slice(0,1)?($(".idSarchingLabel").show(),idsearching=!0,searchstring=searchstring.slice(1)):($(".idSarchingLabel").hide(),idsearching=!1),1==idsearching||searchstring.length>=3?search(searchstring,reloadList,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot):$("#hshcourselistul").children().remove())})),$("#hshcourseform").on("submit",(function(e){e.preventDefault,reloadList=!0,idsearching=!1,orderbysemester=document.getElementById("orderbysemestercheckbox_id").checked,"#"===(searchstring=(searchstring=(searchstring=document.getElementById("hshcourselistsearch").value).replace(/%/g,"")).trim()).slice(0,1)?(idsearching=!0,searchstring=searchstring.slice(1)):idsearching=!1,(1==idsearching||searchstring.length>=3)&&search(searchstring,reloadList,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot)}))}}})); define("block_hshcourselist/jmodule",["jquery"],(function($){function search(searchstring,reloadBool,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot){reloadBool&&($("#hshcourseprogress").show(),$.ajax({type:"GET",url:wwwroot+"/blocks/hshcourselist/hshcourselist.php",data:"course="+searchstring+"&instanceid="+instanceid+"&sesskey="+sesskey+"&contextid="+contextid+"&idsearching="+idsearching+"&orderbysemester="+orderbysemester,dataType:"json",success:function(response){var plainJSON=JSON.stringify(response),courses=JSON.parse(plainJSON),list=$("<ul class='list-group' id='hshcourselistul'></ul>");courses.length>0?$.each(courses,(function(index,course){let displaystr;switch(displaymode){case"0":displaystr=course.shortname;break;case"1":default:displaystr=course.fullname;break;case"2":displaystr=course.shortname+": "+course.fullname}$('<li class="list-group-item hshcoursesearchlistitem " value="'+course.id+'"><a href="'+wwwroot+"/course/view.php?id="+course.id+'">'+displaystr+"</a> </li>").appendTo(list)})):$('<li class="list-group-item hshcoursesearchlistitem " value=""><a href="'+wwwroot+'/my/">Keine Ergebnisse gefunden.</a> </li>').appendTo(list),$("#hshcourselistul").replaceWith(list),$("#hshcourseprogress").hide()},error:function(a){console.error("error "+JSON.stringify(a))}}))}return{init:function(jsdataobject,wwwroot){var searchstring,instanceid=(jsdataobject=jsdataobject).instanceid,sesskey=jsdataobject.sesskey,displaymode=jsdataobject.displaymode,contextid=jsdataobject.contextid,reloadList=!1,idsearching=!1,orderbysemester=jsdataobject.orderbysemester;$("#hshcourseprogress").hide(),$(".idSarchingLabel").hide(),$("#orderbysemestercheckbox_id").on("change",(function(){orderbysemester=document.getElementById("orderbysemestercheckbox_id").checked,reloadList=!0,"#"===(searchstring=(searchstring=(searchstring=document.getElementById("hshcourselistsearch").value).replace(/%/g,"")).trim()).slice(0,1)?($(".idSarchingLabel").show(),idsearching=!0,searchstring=searchstring.slice(1)):($(".idSarchingLabel").hide(),idsearching=!1),(!0===idsearching||searchstring.length>=3)&&search(searchstring,reloadList,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot)})),$("#hshcourselistsearch").on("keyup",(function(e){var key=e.keyCode;orderbysemester=document.getElementById("orderbysemestercheckbox_id").checked,40!==key&&38!==key&&13!==key&&(reloadList=!0,"#"===(searchstring=(searchstring=(searchstring=document.getElementById("hshcourselistsearch").value).replace(/%/g,"")).trim()).slice(0,1)?($(".idSarchingLabel").show(),idsearching=!0,searchstring=searchstring.slice(1)):($(".idSarchingLabel").hide(),idsearching=!1),!0===idsearching||searchstring.length>=3?search(searchstring,reloadList,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot):$("#hshcourselistul").children().remove())})),$("#hshcourseform").on("submit",(function(e){e.preventDefault,reloadList=!0,idsearching=!1,orderbysemester=document.getElementById("orderbysemestercheckbox_id").checked,"#"===(searchstring=(searchstring=(searchstring=document.getElementById("hshcourselistsearch").value).replace(/%/g,"")).trim()).slice(0,1)?(idsearching=!0,searchstring=searchstring.slice(1)):idsearching=!1,(!0===idsearching||searchstring.length>=3)&&search(searchstring,reloadList,displaymode,instanceid,sesskey,contextid,idsearching,orderbysemester,wwwroot)}))}}}));
//# sourceMappingURL=jmodule.min.js.map //# sourceMappingURL=jmodule.min.js.map
\ No newline at end of file
This diff is collapsed.
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
* @copyright 2018 Tobias Baden, Hochschule Hannover * @copyright 2018 Tobias Baden, Hochschule Hannover
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
define("block_hshcourselist/listselect",["jquery"],(function($){function changeActionString(current,wwwroot){var actionString=wwwroot+"/course/view.php?id="+current.val();$("#hshcourseform").attr("action",actionString)}return{init:function(wwwroot){$("input").keydown((function(e){var current,listItems=$(".hshcoursesearchlistitem"),selected=listItems.filter(".activeCourseSearch"),key=e.keyCode;if(40===key||38===key||13===key){var target;(target=listItems).removeClass("active"),target.removeClass("activeCourseSearch"),38===key?changeActionString(current=!selected.length||selected.is(":first-child")?listItems.last():selected.prev(),wwwroot):40===key?changeActionString(current=!selected.length||selected.is(":last-child")?listItems.eq(0):selected.next(),wwwroot):13===key&&(current=selected,isNaN(current.val())&&(current=listItems.eq(0)),changeActionString(current,wwwroot)),function(target){target.addClass("active"),target.addClass("activeCourseSearch")}(current);var element,windowSize,elementPosition,elementBottom,elementTop,scrollToElement=document.getElementsByClassName("activeCourseSearch")[0];element=scrollToElement,windowSize=window.innerHeight,elementPosition=element.getBoundingClientRect(),elementBottom=elementPosition.bottom,elementTop=elementPosition.top,elementBottom>windowSize&&element.scrollIntoView({block:"end",behavior:"smooth"}),elementTop<0&&element.scrollIntoView({block:"start",behavior:"smooth"})}}))}}})); define("block_hshcourselist/listselect",["jquery"],(function($){function changeActionString(current,wwwroot){let actionString=wwwroot;0!==current.val()?actionString+="/course/view.php?id="+current.val():actionString+="/my",$("#hshcourseform").attr("action",actionString)}return{init:function(wwwroot){$("input").keydown((function(e){var current,listItems=$(".hshcoursesearchlistitem"),selected=listItems.filter(".activeCourseSearch"),key=e.keyCode;if(40===key||38===key||13===key){var target;(target=listItems).removeClass("active"),target.removeClass("activeCourseSearch"),38===key?changeActionString(current=!selected.length||selected.is(":first-child")?listItems.last():selected.prev(),wwwroot):40===key?changeActionString(current=!selected.length||selected.is(":last-child")?listItems.eq(0):selected.next(),wwwroot):13===key&&(current=selected,isNaN(current.val())&&(current=listItems.eq(0)),changeActionString(current,wwwroot)),function(target){target.addClass("active"),target.addClass("activeCourseSearch")}(current);var element,windowSize,elementPosition,elementBottom,elementTop,scrollToElement=document.getElementsByClassName("activeCourseSearch")[0];element=scrollToElement,windowSize=window.innerHeight,elementPosition=element.getBoundingClientRect(),elementBottom=elementPosition.bottom,elementTop=elementPosition.top,elementBottom>windowSize&&element.scrollIntoView({block:"end",behavior:"smooth"}),elementTop<0&&element.scrollIntoView({block:"start",behavior:"smooth"})}}))}}}));
//# sourceMappingURL=listselect.min.js.map //# sourceMappingURL=listselect.min.js.map
\ No newline at end of file
{"version":3,"file":"listselect.min.js","sources":["../src/listselect.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n *\n * @package theme_hsh_boost_campus\n * @copyright 2018 Tobias Baden, Hochschule Hannover\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n\ndefine([\"jquery\"], function($) {\n function changeActionString(current, wwwroot) {\n var actionString = wwwroot + \"/course/view.php?id=\" + current.val();\n $(\"#hshcourseform\").attr(\"action\", actionString);\n }\n\n function setInactive(target) {\n target.removeClass(\"active\");\n target.removeClass(\"activeCourseSearch\");\n }\n\n function setActive(target) {\n target.addClass(\"active\");\n target.addClass(\"activeCourseSearch\");\n }\n\n function scrollIntoViewIfNeeded(element) {\n var windowSize = window.innerHeight;\n var elementPosition = element.getBoundingClientRect();\n var elementBottom = elementPosition.bottom;\n var elementTop = elementPosition.top;\n\n if (elementBottom > windowSize) {\n // Scroll an den unteren Rand des Bildes.\n element.scrollIntoView({ block: \"end\", behavior: \"smooth\" });\n }\n if (elementTop < 0) {\n // Scroll an den oberen Rand des Bildes.\n element.scrollIntoView({ block: \"start\", behavior: \"smooth\" });\n }\n }\n\n return {\n init: function(wwwroot) {\n $(\"input\").keydown(function(e) {\n var listItems = $(\".hshcoursesearchlistitem\");\n var selected = listItems.filter(\".activeCourseSearch\");\n var current;\n var key = e.keyCode;\n\n if (key !== 40 && key !== 38 && key !== 13) {\n return;\n }\n\n setInactive(listItems);\n\n if (key === 38) {\n // KEY UP!\n if (!selected.length || selected.is(\":first-child\")) {\n current = listItems.last();\n } else {\n current = selected.prev();\n }\n changeActionString(current, wwwroot);\n } else if (key === 40) {\n // KEY DOWN!\n if (!selected.length || selected.is(\":last-child\")) {\n current = listItems.eq(0);\n } else {\n current = selected.next();\n }\n changeActionString(current, wwwroot);\n } else if (key === 13) {\n // KEY ENTER!\n current = selected;\n if (isNaN(current.val())) {\n current = listItems.eq(0);\n }\n changeActionString(current, wwwroot);\n }\n\n setActive(current);\n var scrollToElement = document.getElementsByClassName(\n \"activeCourseSearch\"\n )[0];\n scrollIntoViewIfNeeded(scrollToElement);\n });\n }\n };\n});\n"],"names":["define","$","changeActionString","current","wwwroot","actionString","val","attr","init","keydown","e","listItems","selected","filter","key","keyCode","target","removeClass","length","is","last","prev","eq","next","isNaN","addClass","setActive","element","windowSize","elementPosition","elementBottom","elementTop","scrollToElement","document","getElementsByClassName","window","innerHeight","getBoundingClientRect","bottom","top","scrollIntoView","block","behavior"],"mappings":";;;;;;AAuBAA,wCAAO,CAAC,WAAW,SAASC,YACfC,mBAAmBC,QAASC,aAC7BC,aAAeD,QAAU,uBAAyBD,QAAQG,MAC9DL,EAAE,kBAAkBM,KAAK,SAAUF,oBA6BhC,CACHG,KAAM,SAASJ,SACXH,EAAE,SAASQ,SAAQ,SAASC,OAGpBP,QAFAQ,UAAYV,EAAE,4BACdW,SAAWD,UAAUE,OAAO,uBAE5BC,IAAMJ,EAAEK,WAEA,KAARD,KAAsB,KAARA,KAAsB,KAARA,SAlCvBE,QAAAA,OAsCGL,WArCbM,YAAY,UACnBD,OAAOC,YAAY,sBAsCC,KAARH,IAOAZ,mBAJIC,SADCS,SAASM,QAAUN,SAASO,GAAG,gBACtBR,UAAUS,OAEVR,SAASS,OAEKjB,SACb,KAARU,IAOPZ,mBAJIC,SADCS,SAASM,QAAUN,SAASO,GAAG,eACtBR,UAAUW,GAAG,GAEbV,SAASW,OAEKnB,SACb,KAARU,MAEPX,QAAUS,SACNY,MAAMrB,QAAQG,SACdH,QAAUQ,UAAUW,GAAG,IAE3BpB,mBAAmBC,QAASC,mBAzDzBY,QACfA,OAAOS,SAAS,UAChBT,OAAOS,SAAS,sBA0DRC,CAAUvB,aAvDUwB,QACxBC,WACAC,gBACAC,cACAC,WAoDQC,gBAAkBC,SAASC,uBAC3B,sBACF,GA1DkBP,QA2DGK,gBA1D3BJ,WAAaO,OAAOC,YACpBP,gBAAkBF,QAAQU,wBAC1BP,cAAgBD,gBAAgBS,OAChCP,WAAaF,gBAAgBU,IAE7BT,cAAgBF,YAEhBD,QAAQa,eAAe,CAAEC,MAAO,MAAOC,SAAU,WAEjDX,WAAa,GAEbJ,QAAQa,eAAe,CAAEC,MAAO,QAASC,SAAU"} {"version":3,"file":"listselect.min.js","sources":["../src/listselect.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n *\n * @package theme_hsh_boost_campus\n * @copyright 2018 Tobias Baden, Hochschule Hannover\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n\ndefine([\"jquery\"], function($) {\n function changeActionString(current, wwwroot) {\n let actionString = wwwroot;\n if (current.val() !== 0) {\n actionString += \"/course/view.php?id=\" + current.val();\n } else {\n actionString += \"/my\";\n }\n $(\"#hshcourseform\").attr(\"action\", actionString);\n }\n\n function setInactive(target) {\n target.removeClass(\"active\");\n target.removeClass(\"activeCourseSearch\");\n }\n\n function setActive(target) {\n target.addClass(\"active\");\n target.addClass(\"activeCourseSearch\");\n }\n\n function scrollIntoViewIfNeeded(element) {\n var windowSize = window.innerHeight;\n var elementPosition = element.getBoundingClientRect();\n var elementBottom = elementPosition.bottom;\n var elementTop = elementPosition.top;\n\n if (elementBottom > windowSize) {\n // Scroll an den unteren Rand des Bildes.\n element.scrollIntoView({ block: \"end\", behavior: \"smooth\" });\n }\n if (elementTop < 0) {\n // Scroll an den oberen Rand des Bildes.\n element.scrollIntoView({ block: \"start\", behavior: \"smooth\" });\n }\n }\n\n return {\n init: function(wwwroot) {\n $(\"input\").keydown(function(e) {\n var listItems = $(\".hshcoursesearchlistitem\");\n var selected = listItems.filter(\".activeCourseSearch\");\n var current;\n var key = e.keyCode;\n\n if (key !== 40 && key !== 38 && key !== 13) {\n return;\n }\n\n setInactive(listItems);\n\n if (key === 38) {\n // KEY UP!\n if (!selected.length || selected.is(\":first-child\")) {\n current = listItems.last();\n } else {\n current = selected.prev();\n }\n changeActionString(current, wwwroot);\n } else if (key === 40) {\n // KEY DOWN!\n if (!selected.length || selected.is(\":last-child\")) {\n current = listItems.eq(0);\n } else {\n current = selected.next();\n }\n changeActionString(current, wwwroot);\n } else if (key === 13) {\n // KEY ENTER!\n current = selected;\n if (isNaN(current.val())) {\n current = listItems.eq(0);\n }\n changeActionString(current, wwwroot);\n }\n\n setActive(current);\n var scrollToElement = document.getElementsByClassName(\n \"activeCourseSearch\"\n )[0];\n scrollIntoViewIfNeeded(scrollToElement);\n });\n }\n };\n});\n"],"names":["define","$","changeActionString","current","wwwroot","actionString","val","attr","init","keydown","e","listItems","selected","filter","key","keyCode","target","removeClass","length","is","last","prev","eq","next","isNaN","addClass","setActive","element","windowSize","elementPosition","elementBottom","elementTop","scrollToElement","document","getElementsByClassName","window","innerHeight","getBoundingClientRect","bottom","top","scrollIntoView","block","behavior"],"mappings":";;;;;;AAuBAA,wCAAO,CAAC,WAAW,SAASC,YACfC,mBAAmBC,QAASC,aAC7BC,aAAeD,QACG,IAAlBD,QAAQG,MACRD,cAAgB,uBAAyBF,QAAQG,MAEjDD,cAAgB,MAEpBJ,EAAE,kBAAkBM,KAAK,SAAUF,oBA6BhC,CACHG,KAAM,SAASJ,SACXH,EAAE,SAASQ,SAAQ,SAASC,OAGpBP,QAFAQ,UAAYV,EAAE,4BACdW,SAAWD,UAAUE,OAAO,uBAE5BC,IAAMJ,EAAEK,WAEA,KAARD,KAAsB,KAARA,KAAsB,KAARA,SAlCvBE,QAAAA,OAsCGL,WArCbM,YAAY,UACnBD,OAAOC,YAAY,sBAsCC,KAARH,IAOAZ,mBAJIC,SADCS,SAASM,QAAUN,SAASO,GAAG,gBACtBR,UAAUS,OAEVR,SAASS,OAEKjB,SACb,KAARU,IAOPZ,mBAJIC,SADCS,SAASM,QAAUN,SAASO,GAAG,eACtBR,UAAUW,GAAG,GAEbV,SAASW,OAEKnB,SACb,KAARU,MAEPX,QAAUS,SACNY,MAAMrB,QAAQG,SACdH,QAAUQ,UAAUW,GAAG,IAE3BpB,mBAAmBC,QAASC,mBAzDzBY,QACfA,OAAOS,SAAS,UAChBT,OAAOS,SAAS,sBA0DRC,CAAUvB,aAvDUwB,QACxBC,WACAC,gBACAC,cACAC,WAoDQC,gBAAkBC,SAASC,uBAC3B,sBACF,GA1DkBP,QA2DGK,gBA1D3BJ,WAAaO,OAAOC,YACpBP,gBAAkBF,QAAQU,wBAC1BP,cAAgBD,gBAAgBS,OAChCP,WAAaF,gBAAgBU,IAE7BT,cAAgBF,YAEhBD,QAAQa,eAAe,CAAEC,MAAO,MAAOC,SAAU,WAEjDX,WAAa,GAEbJ,QAAQa,eAAe,CAAEC,MAAO,QAASC,SAAU"}
\ No newline at end of file \ No newline at end of file
...@@ -31,6 +31,7 @@ define(['jquery'], function ($) { ...@@ -31,6 +31,7 @@ define(['jquery'], function ($) {
var list = $("<ul class='list-group' id='hshcourselistul'></ul>"); var list = $("<ul class='list-group' id='hshcourselistul'></ul>");
if (courses.length > 0) { if (courses.length > 0) {
$.each(courses, function (index, course) { $.each(courses, function (index, course) {
let displaystr
switch (displaymode) { switch (displaymode) {
case '0': case '0':
displaystr = course.shortname; displaystr = course.shortname;
...@@ -61,10 +62,9 @@ define(['jquery'], function ($) { ...@@ -61,10 +62,9 @@ define(['jquery'], function ($) {
$("#hshcourseprogress").hide(); $("#hshcourseprogress").hide();
}, },
error: function (a) { error: function (a) {
$(location).attr('href', wwwroot + '/my/'); console.error("error " + JSON.stringify(a));
} }
}); });
} else {
} }
} }
...@@ -79,7 +79,6 @@ define(['jquery'], function ($) { ...@@ -79,7 +79,6 @@ define(['jquery'], function ($) {
var idsearching = false; var idsearching = false;
var searchstring; var searchstring;
var orderbysemester = jsdataobject.orderbysemester; var orderbysemester = jsdataobject.orderbysemester;
var displaystr;
$("#hshcourseprogress").hide(); $("#hshcourseprogress").hide();
$(".idSarchingLabel").hide(); $(".idSarchingLabel").hide();
...@@ -98,8 +97,18 @@ define(['jquery'], function ($) { ...@@ -98,8 +97,18 @@ define(['jquery'], function ($) {
$(".idSarchingLabel").hide(); $(".idSarchingLabel").hide();
idsearching = false; idsearching = false;
} }
if (idsearching == true || searchstring.length >= 3) { if (idsearching === true || searchstring.length >= 3) {
search(searchstring, reloadList, displaymode, instanceid, sesskey, contextid, idsearching, orderbysemester, wwwroot); search(
searchstring,
reloadList,
displaymode,
instanceid,
sesskey,
contextid,
idsearching,
orderbysemester,
wwwroot
);
} else { } else {
// Search start after 3 chars or searching by id. // Search start after 3 chars or searching by id.
} }
...@@ -121,8 +130,18 @@ define(['jquery'], function ($) { ...@@ -121,8 +130,18 @@ define(['jquery'], function ($) {
$(".idSarchingLabel").hide(); $(".idSarchingLabel").hide();
idsearching = false; idsearching = false;
} }
if (idsearching == true || searchstring.length >= 3) { if (idsearching === true || searchstring.length >= 3) {
search(searchstring, reloadList, displaymode, instanceid, sesskey, contextid, idsearching, orderbysemester, wwwroot); search(
searchstring,
reloadList,
displaymode,
instanceid,
sesskey,
contextid,
idsearching,
orderbysemester,
wwwroot
);
} else { } else {
// Search start after 3 chars or searching by id. // Search start after 3 chars or searching by id.
$('#hshcourselistul').children().remove(); $('#hshcourselistul').children().remove();
...@@ -143,12 +162,12 @@ define(['jquery'], function ($) { ...@@ -143,12 +162,12 @@ define(['jquery'], function ($) {
} else { } else {
idsearching = false; idsearching = false;
} }
if (idsearching == true || searchstring.length >= 3) { if (idsearching === true || searchstring.length >= 3) {
search(searchstring, reloadList, displaymode, instanceid, sesskey, contextid, idsearching, orderbysemester, wwwroot); search(searchstring, reloadList, displaymode, instanceid, sesskey, contextid, idsearching, orderbysemester, wwwroot);
} else { } else {
// Search start after 3 chars or searching by id. // Search start after 3 chars or searching by id.
} }
}); });
},
} }
};
}); });
...@@ -23,7 +23,12 @@ ...@@ -23,7 +23,12 @@
define(["jquery"], function($) { define(["jquery"], function($) {
function changeActionString(current, wwwroot) { function changeActionString(current, wwwroot) {
var actionString = wwwroot + "/course/view.php?id=" + current.val(); let actionString = wwwroot;
if (current.val() !== 0) {
actionString += "/course/view.php?id=" + current.val();
} else {
actionString += "/my";
}
$("#hshcourseform").attr("action", actionString); $("#hshcourseform").attr("action", actionString);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment