|
27
|
1 |
var curentjson = ""; |
|
|
2 |
var typeTri = "treemap"; |
|
|
3 |
var currentfromdate = "07/01/2007"; |
|
|
4 |
var currenttodate = "12/01/2012"; |
|
|
5 |
var currentcategories = []; |
|
|
6 |
|
|
|
7 |
|
|
|
8 |
function launchpage(json) |
|
|
9 |
{ |
|
|
10 |
curentjson = json; |
|
|
11 |
if (typeTri == "treemap") |
|
|
12 |
{ |
|
|
13 |
var k =1; |
|
|
14 |
content = "<div class=\"actus\">"; |
|
|
15 |
for (i = 0; i < json.clusters.length && i<4; i++) |
|
|
16 |
{ |
|
|
17 |
content += "<a id=\""+json.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster/"+json.query.query_id+"/"+json.clusters[i].id+"/0/10\"><div class=\"actu\"><img src=\"/static/img/home-visuel-"+k+".jpg\" alt=\"\" /><div class=\"inner-actu\">"; |
|
|
18 |
content += "<h2> "; |
|
|
19 |
content += json.clusters[i].title; |
|
|
20 |
content += "</h2></div></div></a>"; |
|
|
21 |
k++; |
|
|
22 |
} |
|
|
23 |
content +="</div>"; |
|
|
24 |
} |
|
|
25 |
else |
|
|
26 |
{ |
|
|
27 |
content = "<div class=\"articles\">"; |
|
|
28 |
for (i = 0; i < json.clusters.length && i<4; i++) |
|
|
29 |
{ |
|
|
30 |
content += "<div name=\"cluster_id\" class=\"article\" id=\""+json.clusters[i].id+"\"><div class=\"inner-article clearfix\"><h2><a title=\"Lire l\'article\" id=\""+json.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster/"+json.query.query_id+"/"+json.clusters[i].id+"/0/10\">"; |
|
|
31 |
content += json.clusters[i].title; |
|
|
32 |
content += "</a></h2><p class=\"number-article\"><a href=\"#\">"; |
|
|
33 |
content += json.clusters[i].documents_number; |
|
|
34 |
content +=" articles | "; |
|
|
35 |
content += json.clusters[i].annotations.length; |
|
|
36 |
content += " annotations </a><a title=\"ajouter une annotation\" class=\"add-annotation\" href=\"#\"></a></p> <div class=\"article-annotations\"><a title=\"title\" class=\"blue\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"green\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"red\" href=\"#\" style=\"width:40%;\"></a><a title=\"title\" class=\"empty\" href=\"#\" style=\"width:20%;\"></a></div><div class=\"article-content\">"; |
|
|
37 |
content +="<div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div>"; |
|
|
38 |
content +="<p class=\"resume\">"; |
|
|
39 |
content += json.clusters[i].abstract; |
|
|
40 |
content += "</p><ul class=\"articlelinks\"><ul>"; |
|
|
41 |
|
|
|
42 |
for (j = 0; j < json.clusters[i].documents.length; j++) |
|
|
43 |
{ |
|
|
44 |
content += "<li><a href=\"\" id=\""+json.clusters[i].documents[j].id+"\">"; |
|
|
45 |
content += json.clusters[i].documents[j].title; |
|
|
46 |
content += "</a></li>"; |
|
|
47 |
} |
|
|
48 |
content +="</ul></ul>"; |
|
|
49 |
content +="</div></div></div>"; |
|
|
50 |
} |
|
|
51 |
content +="</div>"; |
|
|
52 |
} |
|
|
53 |
$("#right").empty(); |
|
|
54 |
$(content).appendTo("#right"); |
|
|
55 |
} |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
function refreshview(type) |
|
|
59 |
{ |
|
|
60 |
typeTri = type; |
|
|
61 |
if(type == 'treemap') |
|
|
62 |
{ |
|
|
63 |
typeTri = "treemap"; |
|
|
64 |
var k =1; |
|
|
65 |
content = "<div class=\"actus\">"; |
|
|
66 |
for (i = 0; i < curentjson.clusters.length && i<4; i++) |
|
|
67 |
{ |
|
|
68 |
content += "<a id=\""+curentjson.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster/"+curentjson.query.query_id+"/"+curentjson.clusters[i].id+"/0/10\"><div class=\"actu\"><img src=\"/static/img/home-visuel-"+k+".jpg\" alt=\"\" /><div class=\"inner-actu\">"; |
|
|
69 |
content += "<h2> "; |
|
|
70 |
content += curentjson.clusters[i].title; |
|
|
71 |
content += "</h2></div></div></a>"; |
|
|
72 |
k++; |
|
|
73 |
} |
|
|
74 |
content +="</div>"; |
|
|
75 |
$("#right").empty(); |
|
|
76 |
$(content).appendTo("#right"); |
|
|
77 |
} |
|
|
78 |
else |
|
|
79 |
{ |
|
|
80 |
typeTri = "liste"; |
|
|
81 |
content = "<div class=\"articles\">"; |
|
|
82 |
for (i = 0; i < curentjson.clusters.length && i<4; i++) |
|
|
83 |
{ |
|
|
84 |
content += "<div name=\"cluster_id\" class=\"article\" id=\""+curentjson.clusters[i].id+"\"><div class=\"inner-article clearfix\"><h2><a title=\"Lire l\'article\" id=\""+curentjson.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster?query_id="+curentjson.query.query_id+"&cluster_id="+curentjson.clusters[i].id+"&offset=0&count=10\">"; |
|
|
85 |
content += curentjson.clusters[i].title; |
|
|
86 |
content += "</a></h2><p class=\"number-article\"><a href=\"#\">"; |
|
|
87 |
content += curentjson.clusters[i].documents_number; |
|
|
88 |
content +=" articles | "; |
|
|
89 |
content += curentjson.clusters[i].annotations.length; |
|
|
90 |
content += " annotations </a><a title=\"ajouter une annotation\" class=\"add-annotation\" href=\"#\"></a></p> <div class=\"article-annotations\"><a title=\"title\" class=\"blue\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"green\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"red\" href=\"#\" style=\"width:40%;\"></a><a title=\"title\" class=\"empty\" href=\"#\" style=\"width:20%;\"></a></div><div class=\"article-content\">"; |
|
|
91 |
content +="<div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div>"; |
|
|
92 |
content +="<p class=\"resume\">"; |
|
|
93 |
content += curentjson.clusters[i].abstract; |
|
|
94 |
content += "</p><ul class=\"articlelinks\"><ul>"; |
|
|
95 |
|
|
|
96 |
for (j = 0; j < curentjson.clusters[i].documents.length; j++) |
|
|
97 |
{ |
|
|
98 |
content += "<li><a href=\"\" id=\""+curentjson.clusters[i].documents[j].id+"\">"; |
|
|
99 |
content += curentjson.clusters[i].documents[j].title; |
|
|
100 |
content += "</a></li>"; |
|
|
101 |
} |
|
|
102 |
content +="</ul></ul>"; |
|
|
103 |
content +="</div></div></div>"; |
|
|
104 |
} |
|
|
105 |
content +="</div>"; |
|
|
106 |
$("#right").empty(); |
|
|
107 |
$(content).appendTo("#right"); |
|
|
108 |
} |
|
|
109 |
} |
|
|
110 |
|
|
|
111 |
$(function(){ |
|
|
112 |
|
|
|
113 |
|
|
|
114 |
$('#recherche_button').click(function() { |
|
|
115 |
|
|
|
116 |
$('#from_date').val(currentfromdate); |
|
|
117 |
$('#to_date').val(currenttodate); |
|
|
118 |
|
|
|
119 |
//$['categories'] = array('inter', 'france', 'eco'); |
|
|
120 |
|
|
|
121 |
|
|
|
122 |
$.each(currentcategories, function() { |
|
|
123 |
if(this != undefined) |
|
|
124 |
{ |
|
|
125 |
$('<input />').attr('type', 'hidden') |
|
|
126 |
.attr('name', 'categories') |
|
|
127 |
.attr('value', this) |
|
|
128 |
.appendTo('#ajax1'); |
|
|
129 |
} |
|
|
130 |
|
|
|
131 |
}); |
|
|
132 |
/*var i=0; |
|
|
133 |
$("input[name='categories']").each( function() { |
|
|
134 |
if(currentcategories[i] != undefined) |
|
|
135 |
{ |
|
|
136 |
alert(currentcategories[i]); |
|
|
137 |
|
|
|
138 |
$(this).attr('value', currentcategories[i]); |
|
|
139 |
} |
|
|
140 |
/*else |
|
|
141 |
{ |
|
|
142 |
return false; |
|
|
143 |
}*/ |
|
|
144 |
/*i++; |
|
|
145 |
|
|
|
146 |
}); |
|
|
147 |
*/ |
|
|
148 |
|
|
|
149 |
$('#ajax1').submit(); |
|
|
150 |
}); |
|
|
151 |
|
|
|
152 |
// Formulaire POST AJAX |
|
|
153 |
$("#ajax1").submit( function() |
|
|
154 |
{ |
|
|
155 |
var urlSubmit = $(this).attr('action'); |
|
|
156 |
|
|
|
157 |
/*var params = [ |
|
|
158 |
{ |
|
|
159 |
name: "adress", |
|
|
160 |
value: window.location.pathname |
|
|
161 |
}, |
|
|
162 |
{ |
|
|
163 |
name: "time", |
|
|
164 |
value: new Date().getTime() |
|
|
165 |
} |
|
|
166 |
]; |
|
|
167 |
|
|
|
168 |
$.each(currentcategories, function(i,param) |
|
|
169 |
{ |
|
|
170 |
|
|
|
171 |
|
|
|
172 |
$('<input />').attr('type', 'hidden') |
|
|
173 |
.attr('name', param.name) |
|
|
174 |
.attr('value', param.value) |
|
|
175 |
.appendTo('#ajax1'); |
|
|
176 |
});*/ |
|
|
177 |
|
|
|
178 |
|
|
|
179 |
$.ajax( |
|
|
180 |
{ |
|
|
181 |
type: "POST", |
|
|
182 |
url: urlSubmit, |
|
|
183 |
data : $(this).serializeArray(), |
|
|
184 |
success: function(data) { |
|
|
185 |
var json = jQuery.parseJSON(data); |
|
|
186 |
var k =1; |
|
|
187 |
alert(currentfromdate); |
|
|
188 |
if (typeTri == "treemap") |
|
|
189 |
{ |
|
|
190 |
content = "<div class=\"actus\">"; |
|
|
191 |
for (i = 0; i < json.clusters.length & i<4; i++) |
|
|
192 |
{ |
|
|
193 |
content += "<a id=\""+json.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster/"+json.query.query_id+"/"+json.clusters[i].id+"/0/10\"><div class=\"actu\"><img src=\"/static/img/home-visuel-"+k+".jpg\" alt=\"\" /><div class=\"inner-actu\">"; |
|
|
194 |
content += "<h2> "; |
|
|
195 |
content += json.clusters[i].title; |
|
|
196 |
content += "</h2></div></div></a>"; |
|
|
197 |
k++; |
|
|
198 |
} |
|
|
199 |
content +="</div>"; |
|
|
200 |
} |
|
|
201 |
else |
|
|
202 |
{ |
|
|
203 |
content = "<div class=\"articles\">"; |
|
|
204 |
for (i = 0; i < json.clusters.length && i<4; i++) |
|
|
205 |
{ |
|
|
206 |
content += "<div name=\"cluster_id\" class=\"article\" id=\""+json.clusters[i].id+"\"><div class=\"inner-article clearfix\"><h2><a title=\"Lire l\'article\" id=\""+json.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster/"+json.query.query_id+"/"+json.clusters[i].id+"/0/10\">"; |
|
|
207 |
content += json.clusters[i].title; |
|
|
208 |
content += "</a></h2><p class=\"number-article\"><a href=\"#\">"; |
|
|
209 |
content += json.clusters[i].documents_number; |
|
|
210 |
content +=" articles | "; |
|
|
211 |
content += json.clusters[i].annotations.length; |
|
|
212 |
content += " annotations </a><a title=\"ajouter une annotation\" class=\"add-annotation\" href=\"#\"></a></p> <div class=\"article-annotations\"><a title=\"title\" class=\"blue\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"green\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"red\" href=\"#\" style=\"width:40%;\"></a><a title=\"title\" class=\"empty\" href=\"#\" style=\"width:20%;\"></a></div><div class=\"article-content\">"; |
|
|
213 |
content +="<div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div>"; |
|
|
214 |
content +="<p class=\"resume\">"; |
|
|
215 |
content += json.clusters[i].abstract; |
|
|
216 |
content += "</p><ul class=\"articlelinks\"><ul>"; |
|
|
217 |
|
|
|
218 |
for (j = 0; j < json.clusters[i].documents.length; j++) |
|
|
219 |
{ |
|
|
220 |
content += "<li><a href=\"\" id=\""+json.clusters[i].documents[j].id+"\">"; |
|
|
221 |
content += json.clusters[i].documents[j].title; |
|
|
222 |
content += "</a></li>"; |
|
|
223 |
} |
|
|
224 |
content +="</ul></ul>"; |
|
|
225 |
content +="</div></div></div>"; |
|
|
226 |
} |
|
|
227 |
content +="</div>"; |
|
|
228 |
} |
|
|
229 |
$("#right").empty(); |
|
|
230 |
$(content).appendTo("#right"); |
|
|
231 |
curentjson = json; |
|
|
232 |
} |
|
|
233 |
}); |
|
|
234 |
return false; |
|
|
235 |
}); |
|
|
236 |
|
|
|
237 |
// Formulaire POST AJAX |
|
|
238 |
$("#ajax2").submit( function() |
|
|
239 |
{ |
|
|
240 |
alert('ajax2'); |
|
|
241 |
var urlSubmit = $(this).attr('action'); |
|
|
242 |
currentcategories = []; |
|
|
243 |
/*var data = { 'categories' : []};*/ |
|
|
244 |
$("input:checked").each(function() { |
|
|
245 |
/*data['categories'].push($(this).val());*/ |
|
|
246 |
currentcategories.push($(this).val()); |
|
|
247 |
}); |
|
|
248 |
currentfromdate = $("#pickeddatebegin").val(); |
|
|
249 |
currenttodate = $("#pickeddateend").val(); |
|
|
250 |
|
|
|
251 |
$.ajax( |
|
|
252 |
{ |
|
|
253 |
type: "POST", |
|
|
254 |
url: urlSubmit, |
|
|
255 |
data : $(this).serializeArray(), |
|
|
256 |
success: function(data) { |
|
|
257 |
var json = jQuery.parseJSON(data); |
|
|
258 |
var k =1; |
|
|
259 |
if (typeTri == "treemap") |
|
|
260 |
{ |
|
|
261 |
content = "<div class=\"actus\">"; |
|
|
262 |
for (i = 0; i < json.clusters.length & i<4; i++) |
|
|
263 |
{ |
|
|
264 |
content += "<a id=\""+json.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster/"+json.query.query_id+"/"+json.clusters[i].id+"/0/10\"><div class=\"actu\"><img src=\"/static/img/home-visuel-"+k+".jpg\" alt=\"\" /><div class=\"inner-actu\">"; |
|
|
265 |
content += "<h2> "; |
|
|
266 |
content += json.clusters[i].title; |
|
|
267 |
content += "</h2></div></div></a>"; |
|
|
268 |
k++; |
|
|
269 |
} |
|
|
270 |
content +="</div>"; |
|
|
271 |
} |
|
|
272 |
else |
|
|
273 |
{ |
|
|
274 |
content = "<div class=\"articles\">"; |
|
|
275 |
for (i = 0; i < json.clusters.length && i<4; i++) |
|
|
276 |
{ |
|
|
277 |
content += "<div name=\"cluster_id\" class=\"article\" id=\""+json.clusters[i].id+"\"><div class=\"inner-article clearfix\"><h2><a title=\"Lire l\'article\" id=\""+json.clusters[i].id+"\" href=\"http://localhost:8000/documents_cluster/"+json.query.query_id+"/"+json.clusters[i].id+"/0/10\">"; |
|
|
278 |
content += json.clusters[i].title; |
|
|
279 |
content += "</a></h2><p class=\"number-article\"><a href=\"#\">"; |
|
|
280 |
content += json.clusters[i].documents_number; |
|
|
281 |
content +=" articles | "; |
|
|
282 |
content += json.clusters[i].annotations.length; |
|
|
283 |
content += " annotations </a><a title=\"ajouter une annotation\" class=\"add-annotation\" href=\"#\"></a></p> <div class=\"article-annotations\"><a title=\"title\" class=\"blue\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"green\" href=\"#\" style=\"width:20%;\"></a><a title=\"title\" class=\"red\" href=\"#\" style=\"width:40%;\"></a><a title=\"title\" class=\"empty\" href=\"#\" style=\"width:20%;\"></a></div><div class=\"article-content\">"; |
|
|
284 |
content +="<div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div>"; |
|
|
285 |
content +="<p class=\"resume\">"; |
|
|
286 |
content += json.clusters[i].abstract; |
|
|
287 |
content += "</p><ul class=\"articlelinks\"><ul>"; |
|
|
288 |
|
|
|
289 |
for (j = 0; j < json.clusters[i].documents.length; j++) |
|
|
290 |
{ |
|
|
291 |
content += "<li><a href=\"\" id=\""+json.clusters[i].documents[j].id+"\">"; |
|
|
292 |
content += json.clusters[i].documents[j].title; |
|
|
293 |
content += "</a></li>"; |
|
|
294 |
} |
|
|
295 |
content +="</ul></ul>"; |
|
|
296 |
content +="</div></div></div>"; |
|
|
297 |
} |
|
|
298 |
content +="</div>"; |
|
|
299 |
} |
|
|
300 |
$("#right").empty(); |
|
|
301 |
$(content).appendTo("#right"); |
|
|
302 |
curentjson = json; |
|
|
303 |
} |
|
|
304 |
}); |
|
|
305 |
return false; |
|
|
306 |
}); |
|
|
307 |
|
|
|
308 |
$('.checkbox_category').click(function(){ |
|
|
309 |
/*var theValue = $(this).val();*/ |
|
|
310 |
$('#ajax2').submit(); |
|
|
311 |
}); |
|
|
312 |
|
|
|
313 |
});//jQuery |