1 function articles(json) |
1 function articles(json) |
|
2 { |
|
3 document.getElementById('titleleft').innerHTML = json.cluster_title+ " »"; |
|
4 $("#pickeddatebegin").val(json.query.from_date); |
|
5 $("#pickeddateend").val(json.query.to_date); |
|
6 $("#recherche_id").val(json.query.text); |
|
7 $('input[name=categories1]').attr('checked', false); |
|
8 $('input[name=categories2]').attr('checked', false); |
|
9 $('input[name=categories3]').attr('checked', false); |
|
10 $('input[name=categories4]').attr('checked', false); |
|
11 //document.getElementById('affichage').style.display = "none"; |
|
12 for (j = 0; j < json.query.categories.length; j++) |
2 { |
13 { |
3 $("#pickeddatebegincluster").val(json.query.from_date); |
14 if(json.query.categories[j] == "International") |
4 $("#pickeddateendcluster").val(json.query.to_date); |
|
5 $("#recherche").val(json.query.text); |
|
6 for (j = 0; j < json.query.categories.length; j++) |
|
7 { |
15 { |
8 if(json.query.categories[j] == "International") |
16 $('input[name=categories1]').attr('checked', true); |
9 { |
|
10 alert('Inter'); |
|
11 $('input[id=categorie1]').attr('checked', true); |
|
12 } |
|
13 else if(json.query.categories[j] == "France") |
|
14 { |
|
15 alert('France'); |
|
16 $('input[id=categorie2]').attr('checked', true); |
|
17 } |
|
18 else if(json.query.categories[j] == "Economie") |
|
19 { |
|
20 alert('Economie'); |
|
21 $('input[id=categorie3]').attr('checked', true); |
|
22 } |
|
23 else |
|
24 { |
|
25 alert('Culture'); |
|
26 $('input[id=categorie4]').attr('checked', true); |
|
27 } |
|
28 } |
17 } |
|
18 else if(json.query.categories[j] == "France") |
|
19 { |
|
20 $('input[name=categories2]').attr('checked', true); |
|
21 } |
|
22 else if(json.query.categories[j] == "Economie") |
|
23 { |
|
24 $('input[name=categories3]').attr('checked', true); |
|
25 } |
|
26 else if(json.query.categories[j] == "Culture") |
|
27 { |
|
28 $('input[name=categories4]').attr('checked', true); |
|
29 } |
|
30 } |
|
31 |
|
32 content = "<div class=\"articles\">"; |
|
33 for (i = 0; i < json.documents.length; i++) |
|
34 { |
29 |
35 |
|
36 content += "<div class=\"article\"><div class=\"inner-article clearfix\"><h2><a id=\""+json.documents[i].id+"\" title=\"Lire l\'article\" href=\"http://localhost:8000/article/"+json.cluster_title+"/"+json.documents[i].id+"\">"; |
|
37 content += json.documents[i].title; |
|
38 content += " »</a></h2><p class=\"author\"><a href=\"#\">"; |
|
39 content += json.documents[i].date; |
|
40 content += " </a><br/> by <a href=\"#\">"; |
|
41 content += json.documents[i].author[0].name; |
|
42 content += "</a></p><div class=\"article-content\"><div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div><p class=\"resume\">"; |
|
43 content += json.documents[i].abstract; |
|
44 content += " </p></div></div></div>"; |
|
45 } |
|
46 content +="</div>"; |
|
47 $("#right").empty(); |
|
48 $(content).appendTo("#right"); |
|
49 } |
30 |
50 |
31 content = "<div class=\"articles\">"; |
51 |
32 for (i = 0; i < json.documents.length; i++) |
|
33 { |
|
34 content += "<div class=\"article\"><div class=\"inner-article clearfix\"><h2><a id=\""+json.documents[i].id+"\" title=\"Lire l\'article\" href=\""+json.documents[i].url_document+"\">"; |
|
35 content += json.documents[i].title; |
|
36 content += " »</a></h2><p class=\"author\"><a href=\"#\">"; |
|
37 content += json.documents[i].date; |
|
38 content += " </a><br/> by <a href=\"#\">"; |
|
39 content += json.documents[i].author[0].name; |
|
40 content += "</a></p><div class=\"article-content\"><div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div><p class=\"resume\">"; |
|
41 content += json.documents[i].abstract; |
|
42 content += " </p></div></div></div>"; |
|
43 } |
|
44 content +="</div>"; |
|
45 $("#right").empty(); |
|
46 $(content).appendTo("#right"); |
|
47 } |
|
48 |
52 |
49 $(function(){ |
53 $(function(){ |
50 |
54 |
51 // Formulaire POST AJAX |
55 // Formulaire POST AJAX |
52 $("#ajax3").submit( function() |
56 $("#ajax3").submit( function() |