|
27
|
1 |
function articles(json) |
|
37
|
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++) |
|
27
|
13 |
{ |
|
37
|
14 |
if(json.query.categories[j] == "International") |
|
|
15 |
{ |
|
|
16 |
$('input[name=categories1]').attr('checked', true); |
|
|
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") |
|
27
|
23 |
{ |
|
37
|
24 |
$('input[name=categories3]').attr('checked', true); |
|
|
25 |
} |
|
|
26 |
else if(json.query.categories[j] == "Culture") |
|
|
27 |
{ |
|
|
28 |
$('input[name=categories4]').attr('checked', true); |
|
27
|
29 |
} |
|
37
|
30 |
} |
|
27
|
31 |
|
|
37
|
32 |
content = "<div class=\"articles\">"; |
|
|
33 |
for (i = 0; i < json.documents.length; i++) |
|
|
34 |
{ |
|
|
35 |
|
|
44
|
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.documents[i].id+"\">"; |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
content += "<div class=\"article\"><div class=\"inner-article clearfix\"><h2><form id=\"myarticle"+json.documents[i].id+"\" method=\"post\" action=\"/article/"+json.documents[i].id+"/\" ><input type=\"hidden\" id=\"urlCluster\" name=\"urlCluster\" value=\""+document.URL+"\"><input type=\"hidden\" id=\"clustertitle\" name=\"clustertitle\" value=\""+json.cluster_title+"\"><a onclick=\"articleSubmit("+json.documents[i].id+"); return false;\" style=\"cursor:pointer;\">"; |
|
|
40 |
|
|
37
|
41 |
content += json.documents[i].title; |
|
44
|
42 |
content += " »</a></form></h2><p class=\"author\"><a href=\"#\">"; |
|
37
|
43 |
content += json.documents[i].date; |
|
|
44 |
content += " </a><br/> by <a href=\"#\">"; |
|
|
45 |
content += json.documents[i].author[0].name; |
|
|
46 |
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\">"; |
|
|
47 |
content += json.documents[i].abstract; |
|
|
48 |
content += " </p></div></div></div>"; |
|
27
|
49 |
} |
|
37
|
50 |
content +="</div>"; |
|
|
51 |
$("#right").empty(); |
|
|
52 |
$(content).appendTo("#right"); |
|
|
53 |
} |
|
|
54 |
|
|
44
|
55 |
function articleSubmit(id) |
|
|
56 |
{ |
|
|
57 |
$('#myarticle'+id).submit(); |
|
|
58 |
} |
|
27
|
59 |
|
|
|
60 |
$(function(){ |
|
|
61 |
|
|
|
62 |
// Formulaire POST AJAX |
|
|
63 |
$("#ajax3").submit( function() |
|
|
64 |
{ |
|
|
65 |
var urlSubmit = $(this).attr('action'); |
|
|
66 |
currentcategories = []; |
|
|
67 |
/*var data = { 'categories' : []};*/ |
|
|
68 |
$("input:checked").each(function() { |
|
|
69 |
/*data['categories'].push($(this).val());*/ |
|
|
70 |
currentcategories.push($(this).val()); |
|
|
71 |
}); |
|
|
72 |
currentfromdate= $("#pickeddatebegin").val(); |
|
|
73 |
currenttodate= $("#pickeddateend").val(); |
|
|
74 |
|
|
|
75 |
$.ajax( |
|
|
76 |
{ |
|
|
77 |
type: "POST", |
|
|
78 |
url: urlSubmit, |
|
|
79 |
data : $(this).serializeArray(), |
|
|
80 |
success: function(data) { |
|
|
81 |
|
|
|
82 |
var json = jQuery.parseJSON(data); |
|
|
83 |
|
|
|
84 |
content = "<div class=\"articles\">"; |
|
|
85 |
for (i = 0; i < json.documents.length; i++) |
|
|
86 |
{ |
|
|
87 |
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+"\">"; |
|
|
88 |
content += json.documents[i].title; |
|
|
89 |
content += " »</a></h2><p class=\"author\"><a href=\"#\">"; |
|
|
90 |
content += json.documents[i].date; |
|
|
91 |
content += " </a><br/> by <a href=\"#\">"; |
|
|
92 |
content += json.documents[i].author[0].name; |
|
|
93 |
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\">"; |
|
|
94 |
content += json.documents[i].abstract; |
|
|
95 |
content += " </p></div></div></div>"; |
|
|
96 |
} |
|
|
97 |
content +="</div>"; |
|
|
98 |
$("#right").empty(); |
|
|
99 |
$(content).appendTo("#right"); |
|
|
100 |
} |
|
|
101 |
}); |
|
|
102 |
return false; |
|
|
103 |
}); |
|
|
104 |
|
|
37
|
105 |
$('#ajaxfiltretreemapdoc').click(function() |
|
|
106 |
{ |
|
|
107 |
$('#ajaxfiltretreemapdoc').submit(); |
|
|
108 |
}); |
|
|
109 |
|
|
27
|
110 |
$('.checkbox_category').click(function(){ |
|
|
111 |
/*var theValue = $(this).val();*/ |
|
|
112 |
$('#ajax3').submit(); |
|
|
113 |
}); |
|
|
114 |
|
|
|
115 |
});//jQuery |