diff -r 94f586daa623 -r 8ca7f2cea729 alcatel/static/js/cluster.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alcatel/static/js/cluster.js Thu Jan 24 16:58:55 2013 +0100 @@ -0,0 +1,99 @@ +function articles(json) + { + $("#pickeddatebegincluster").val(json.query.from_date); + $("#pickeddateendcluster").val(json.query.to_date); + $("#recherche").val(json.query.text); + for (j = 0; j < json.query.categories.length; j++) + { + if(json.query.categories[j] == "International") + { + alert('Inter'); + $('input[id=categorie1]').attr('checked', true); + } + else if(json.query.categories[j] == "France") + { + alert('France'); + $('input[id=categorie2]').attr('checked', true); + } + else if(json.query.categories[j] == "Economie") + { + alert('Economie'); + $('input[id=categorie3]').attr('checked', true); + } + else + { + alert('Culture'); + $('input[id=categorie4]').attr('checked', true); + } + } + + + content = "
"; + for (i = 0; i < json.documents.length; i++) + { + content += "

"; + content += json.documents[i].title; + content += " »

"; + content += json.documents[i].date; + content += "
by "; + content += json.documents[i].author[0].name; + content += "

\"\"

"; + content += json.documents[i].abstract; + content += "

"; + } + content +="
"; + $("#right").empty(); + $(content).appendTo("#right"); + } + +$(function(){ + + // Formulaire POST AJAX + $("#ajax3").submit( function() + { + var urlSubmit = $(this).attr('action'); + currentcategories = []; + /*var data = { 'categories' : []};*/ + $("input:checked").each(function() { + /*data['categories'].push($(this).val());*/ + currentcategories.push($(this).val()); + }); + currentfromdate= $("#pickeddatebegin").val(); + currenttodate= $("#pickeddateend").val(); + + $.ajax( + { + type: "POST", + url: urlSubmit, + data : $(this).serializeArray(), + success: function(data) { + + var json = jQuery.parseJSON(data); + + content = "
"; + for (i = 0; i < json.documents.length; i++) + { + content += "

"; + content += json.documents[i].title; + content += " »

"; + content += json.documents[i].date; + content += "
by "; + content += json.documents[i].author[0].name; + content += "

\"\"

"; + content += json.documents[i].abstract; + content += "

"; + } + content +="
"; + $("#right").empty(); + $(content).appendTo("#right"); + } + }); + return false; + }); + + $('.checkbox_category').click(function(){ + /*var theValue = $(this).val();*/ + $('#ajax3').submit(); + }); + +});//jQuery \ No newline at end of file