Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/inc/lib/search/search_widget.js

41 lines
1.4 KiB

$(document).ready(function() {
/* toggle advanced view */
$('a#tags-toggle').click(function() {
$('#tags').toggle(150);
return false;
});
/* reset terms form */
$('#tags-clean').click(function() {
// clear multiple select
$('select option:selected').each(function () {
$(this).attr('selected', '');
});
return false;
});
/* ajax suggestions */
$('#query').autocomplete('search_suggestions.php', {
multiple: false,
selectFirst: false,
mustMatch: false,
autoFill: false
});
/* prefilter form */
$('#prefilter').change(function () {
var str = "";
$("#prefilter option:selected").each(function () {
str += $(this).text() + " ";
});
process_terms = function(data) {
$(".sf-select-multiple").html("");
$.each(data, function(i,item) {
$.each(item.terms, function(index, term) {
$('<option />').val(index).text(term).appendTo("#sf-" + item.prefix);
});
});
};
url = "/main/inc/lib/search/get_terms.php";
params = "?term=" + $(this).val() + "&prefix=" + $(this).attr("title") + "&operator=" + $("input[@name=operator]:checked").val();
$.getJSON(url + params, process_terms);
});
});