|
37
|
1 |
var currentjsonStreamgraph = ""; |
|
|
2 |
var currentjsonTreemap = ""; |
|
|
3 |
var currentText = ""; |
|
|
4 |
var typeTri = "treemap"; |
|
|
5 |
var currentfromdate = ""; |
|
|
6 |
var currenttodate = ""; |
|
|
7 |
var currentcategories = []; |
|
|
8 |
var firsttimefiltre = true; |
|
|
9 |
var firsttimerequest = true; |
|
|
10 |
var currentqueryidtreemap= ""; |
|
|
11 |
var currentqueryidstreamgraph= ""; |
|
|
12 |
var currentuser = ""; |
|
27
|
13 |
|
|
|
14 |
|
|
37
|
15 |
/*function launchpage(json) |
|
27
|
16 |
{ |
|
|
17 |
curentjson = json; |
|
|
18 |
if (typeTri == "treemap") |
|
|
19 |
{ |
|
|
20 |
var k =1; |
|
|
21 |
content = "<div class=\"actus\">"; |
|
|
22 |
for (i = 0; i < json.clusters.length && i<4; i++) |
|
|
23 |
{ |
|
|
24 |
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\">"; |
|
|
25 |
content += "<h2> "; |
|
|
26 |
content += json.clusters[i].title; |
|
|
27 |
content += "</h2></div></div></a>"; |
|
|
28 |
k++; |
|
|
29 |
} |
|
|
30 |
content +="</div>"; |
|
|
31 |
} |
|
|
32 |
else |
|
|
33 |
{ |
|
|
34 |
content = "<div class=\"articles\">"; |
|
|
35 |
for (i = 0; i < json.clusters.length && i<4; i++) |
|
|
36 |
{ |
|
|
37 |
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\">"; |
|
|
38 |
content += json.clusters[i].title; |
|
|
39 |
content += "</a></h2><p class=\"number-article\"><a href=\"#\">"; |
|
|
40 |
content += json.clusters[i].documents_number; |
|
|
41 |
content +=" articles | "; |
|
|
42 |
content += json.clusters[i].annotations.length; |
|
|
43 |
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\">"; |
|
|
44 |
content +="<div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div>"; |
|
|
45 |
content +="<p class=\"resume\">"; |
|
|
46 |
content += json.clusters[i].abstract; |
|
|
47 |
content += "</p><ul class=\"articlelinks\"><ul>"; |
|
|
48 |
|
|
|
49 |
for (j = 0; j < json.clusters[i].documents.length; j++) |
|
|
50 |
{ |
|
|
51 |
content += "<li><a href=\"\" id=\""+json.clusters[i].documents[j].id+"\">"; |
|
|
52 |
content += json.clusters[i].documents[j].title; |
|
|
53 |
content += "</a></li>"; |
|
|
54 |
} |
|
|
55 |
content +="</ul></ul>"; |
|
|
56 |
content +="</div></div></div>"; |
|
|
57 |
} |
|
|
58 |
content +="</div>"; |
|
|
59 |
} |
|
|
60 |
$("#right").empty(); |
|
|
61 |
$(content).appendTo("#right"); |
|
|
62 |
} |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
function refreshview(type) |
|
|
66 |
{ |
|
|
67 |
typeTri = type; |
|
|
68 |
if(type == 'treemap') |
|
|
69 |
{ |
|
|
70 |
typeTri = "treemap"; |
|
|
71 |
var k =1; |
|
|
72 |
content = "<div class=\"actus\">"; |
|
|
73 |
for (i = 0; i < curentjson.clusters.length && i<4; i++) |
|
|
74 |
{ |
|
|
75 |
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\">"; |
|
|
76 |
content += "<h2> "; |
|
|
77 |
content += curentjson.clusters[i].title; |
|
|
78 |
content += "</h2></div></div></a>"; |
|
|
79 |
k++; |
|
|
80 |
} |
|
|
81 |
content +="</div>"; |
|
|
82 |
$("#right").empty(); |
|
|
83 |
$(content).appendTo("#right"); |
|
|
84 |
} |
|
|
85 |
else |
|
|
86 |
{ |
|
|
87 |
typeTri = "liste"; |
|
|
88 |
content = "<div class=\"articles\">"; |
|
|
89 |
for (i = 0; i < curentjson.clusters.length && i<4; i++) |
|
|
90 |
{ |
|
|
91 |
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\">"; |
|
|
92 |
content += curentjson.clusters[i].title; |
|
|
93 |
content += "</a></h2><p class=\"number-article\"><a href=\"#\">"; |
|
|
94 |
content += curentjson.clusters[i].documents_number; |
|
|
95 |
content +=" articles | "; |
|
|
96 |
content += curentjson.clusters[i].annotations.length; |
|
|
97 |
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\">"; |
|
|
98 |
content +="<div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div>"; |
|
|
99 |
content +="<p class=\"resume\">"; |
|
|
100 |
content += curentjson.clusters[i].abstract; |
|
|
101 |
content += "</p><ul class=\"articlelinks\"><ul>"; |
|
|
102 |
|
|
|
103 |
for (j = 0; j < curentjson.clusters[i].documents.length; j++) |
|
|
104 |
{ |
|
|
105 |
content += "<li><a href=\"\" id=\""+curentjson.clusters[i].documents[j].id+"\">"; |
|
|
106 |
content += curentjson.clusters[i].documents[j].title; |
|
|
107 |
content += "</a></li>"; |
|
|
108 |
} |
|
|
109 |
content +="</ul></ul>"; |
|
|
110 |
content +="</div></div></div>"; |
|
|
111 |
} |
|
|
112 |
content +="</div>"; |
|
|
113 |
$("#right").empty(); |
|
|
114 |
$(content).appendTo("#right"); |
|
|
115 |
} |
|
|
116 |
} |
|
37
|
117 |
*/ |
|
|
118 |
/*function setAffichage(typeTri) |
|
|
119 |
{ |
|
|
120 |
alert(typeTri); |
|
|
121 |
$('<input />').attr('type', 'hidden') |
|
|
122 |
.attr('name', 'typeTri') |
|
|
123 |
.attr('value', typeTri) |
|
|
124 |
.appendTo('#setAffichage'); |
|
|
125 |
|
|
|
126 |
$("#setAffichage").submit(); |
|
|
127 |
}*/ |
|
27
|
128 |
|
|
37
|
129 |
function setCategories(json) |
|
|
130 |
{ |
|
|
131 |
|
|
|
132 |
$("#pickeddatebegin").val(json.query.from_date); |
|
|
133 |
$("#pickeddateend").val(json.query.to_date); |
|
|
134 |
$("#recherche_id").val(json.query.text); |
|
|
135 |
|
|
|
136 |
$('input[name=categories1]').attr('checked', false); |
|
|
137 |
$('input[name=categories2]').attr('checked', false); |
|
|
138 |
$('input[name=categories3]').attr('checked', false); |
|
|
139 |
$('input[name=categories4]').attr('checked', false); |
|
|
140 |
|
|
|
141 |
if(json.query.typeTri == "treemap") |
|
|
142 |
{ |
|
|
143 |
$('#treemapaff').click(); |
|
|
144 |
} |
|
|
145 |
|
|
|
146 |
if(json.query.typeTri == "liste") |
|
|
147 |
{ |
|
|
148 |
$('#listehref').click(); |
|
|
149 |
} |
|
27
|
150 |
|
|
37
|
151 |
for (j = 0; j < json.query.categories.length; j++) |
|
|
152 |
{ |
|
|
153 |
if(json.query.categories[j] == "International") |
|
|
154 |
{ |
|
|
155 |
$('input[name=categories1]').attr('checked', true); |
|
|
156 |
} |
|
|
157 |
else if(json.query.categories[j] == "France") |
|
|
158 |
{ |
|
|
159 |
$('input[name=categories2]').attr('checked', true); |
|
|
160 |
} |
|
|
161 |
else if(json.query.categories[j] == "Economie") |
|
|
162 |
{ |
|
|
163 |
$('input[name=categories3]').attr('checked', true); |
|
|
164 |
} |
|
|
165 |
else if(json.query.categories[j] == "Culture") |
|
|
166 |
{ |
|
|
167 |
$('input[name=categories4]').attr('checked', true); |
|
|
168 |
} |
|
|
169 |
} |
|
|
170 |
} |
|
|
171 |
|
|
|
172 |
function updatedossierdoc(json) |
|
|
173 |
{ |
|
|
174 |
//alert('updatedossierdoc'+json.dossierDocs); |
|
|
175 |
content=""; |
|
|
176 |
for (i = 0; i < json.dossierDocs.length ; i++) |
|
|
177 |
{ |
|
|
178 |
content += "<li class=\"clearfix\"> <a href=\"/documentary_files/" |
|
|
179 |
content += json.user; |
|
|
180 |
content += "/"; |
|
|
181 |
content += json.dossierDocs[i].id; |
|
|
182 |
content += "\"><img src=\""; |
|
|
183 |
content += json.dossierDocs[i].url; |
|
|
184 |
content += "\" alt=\"\" width=\"50px\" height=\"29px\"/><span class=\"documentaire-texte\"><h3>"; |
|
|
185 |
content += json.dossierDocs[i].title; |
|
|
186 |
content += "</h3><p>"; |
|
|
187 |
content += json.dossierDocs[i].description; |
|
|
188 |
content += "</p></span></a></li>"; |
|
|
189 |
} |
|
|
190 |
//alert(content); |
|
|
191 |
$("#mesdossiers").empty(); |
|
|
192 |
$(content).appendTo("#mesdossiers"); |
|
|
193 |
} |
|
|
194 |
|
|
|
195 |
function getDossierDocs(user) |
|
|
196 |
{ |
|
|
197 |
|
|
|
198 |
if(user != "") |
|
|
199 |
{ |
|
|
200 |
window.location.href = "http://localhost:8000/documentary_files/"+user; |
|
|
201 |
} |
|
|
202 |
else |
|
|
203 |
{ |
|
|
204 |
alert('Vous devez vous connecter.'); |
|
|
205 |
} |
|
|
206 |
|
|
|
207 |
} |
|
|
208 |
|
|
|
209 |
function launchsearch() |
|
|
210 |
{ |
|
27
|
211 |
|
|
37
|
212 |
currentfromdate = $("#pickeddatebegin").val(); |
|
|
213 |
currenttodate = $("#pickeddateend").val(); |
|
|
214 |
currentText = $("#recherche_id").val(); |
|
|
215 |
currentcategories =[]; |
|
|
216 |
|
|
|
217 |
$("input:checked").each(function() { |
|
|
218 |
currentcategories.push($(this).val()); |
|
|
219 |
}); |
|
|
220 |
|
|
|
221 |
$("input:checkbox:not(:checked)").each(function() { |
|
|
222 |
currentcategories.push(''); |
|
|
223 |
}); |
|
|
224 |
|
|
|
225 |
if ($("#ajaxtreemap input[name=from_date]").val() != undefined) |
|
|
226 |
{ |
|
|
227 |
$("#ajaxtreemap input[name=from_date]").val(currentfromdate); |
|
|
228 |
} |
|
|
229 |
else |
|
|
230 |
{ |
|
|
231 |
$('<input />').attr('type', 'hidden') |
|
|
232 |
.attr('name', 'from_date') |
|
|
233 |
.attr('value', currentfromdate) |
|
|
234 |
.appendTo('#ajaxtreemap'); |
|
|
235 |
} |
|
|
236 |
|
|
|
237 |
if ($("#ajaxtreemap input[name=to_date]").val() != undefined) |
|
|
238 |
{ |
|
|
239 |
$("#ajaxtreemap input[name=to_date]").val(currenttodate); |
|
|
240 |
} |
|
|
241 |
else |
|
27
|
242 |
{ |
|
|
243 |
$('<input />').attr('type', 'hidden') |
|
37
|
244 |
.attr('name', 'to_date') |
|
|
245 |
.attr('value', currenttodate) |
|
|
246 |
.appendTo('#ajaxtreemap'); |
|
27
|
247 |
} |
|
|
248 |
|
|
37
|
249 |
var i=1; |
|
|
250 |
$.each(currentcategories, function() |
|
|
251 |
{ |
|
|
252 |
if(this != undefined) |
|
|
253 |
{ |
|
|
254 |
if (firsttimerequest == false) |
|
27
|
255 |
{ |
|
37
|
256 |
$("#ajaxtreemap input[name=categories"+i+"]").val(this); |
|
|
257 |
i++; |
|
27
|
258 |
} |
|
|
259 |
else |
|
|
260 |
{ |
|
37
|
261 |
|
|
|
262 |
$('<input />').attr('type', 'hidden') |
|
|
263 |
.attr('name', 'categories'+i) |
|
|
264 |
.attr('value', this) |
|
|
265 |
.appendTo('#ajaxtreemap'); |
|
|
266 |
i++; |
|
27
|
267 |
} |
|
37
|
268 |
} |
|
|
269 |
|
|
|
270 |
}); |
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
if ($("#ajaxstreamgraph input[name=from_date]").val() != undefined) |
|
|
275 |
{ |
|
|
276 |
$("#ajaxstreamgraph input[name=from_date]").val(currentfromdate); |
|
|
277 |
} |
|
|
278 |
else |
|
|
279 |
{ |
|
|
280 |
$('<input />').attr('type', 'hidden') |
|
|
281 |
.attr('name', 'from_date') |
|
|
282 |
.attr('value', currentfromdate) |
|
|
283 |
.appendTo('#ajaxstreamgraph'); |
|
|
284 |
} |
|
|
285 |
|
|
|
286 |
if ($("#ajaxstreamgraph input[name=to_date]").val() != undefined) |
|
|
287 |
{ |
|
|
288 |
$("#ajaxstreamgraph input[name=to_date]").val(currenttodate); |
|
|
289 |
} |
|
|
290 |
else |
|
|
291 |
{ |
|
|
292 |
$('<input />').attr('type', 'hidden') |
|
|
293 |
.attr('name', 'to_date') |
|
|
294 |
.attr('value', currenttodate) |
|
|
295 |
.appendTo('#ajaxstreamgraph'); |
|
|
296 |
} |
|
|
297 |
|
|
|
298 |
if ($("#ajaxstreamgraph input[name=recherche]").val() != undefined) |
|
|
299 |
{ |
|
|
300 |
$("#ajaxstreamgraph input[name=recherche]").val(currentText); |
|
|
301 |
} |
|
|
302 |
else |
|
|
303 |
{ |
|
|
304 |
$('<input />').attr('type', 'hidden') |
|
|
305 |
.attr('name', 'recherche') |
|
|
306 |
.attr('value', currentText) |
|
|
307 |
.appendTo('#ajaxstreamgraph'); |
|
|
308 |
} |
|
|
309 |
|
|
|
310 |
|
|
|
311 |
var j=1; |
|
|
312 |
$.each(currentcategories, function() |
|
|
313 |
{ |
|
|
314 |
if(this != undefined) |
|
|
315 |
{ |
|
|
316 |
if (firsttimerequest == false) |
|
|
317 |
{ |
|
|
318 |
$("#ajaxstreamgraph input[name=categories"+j+"]").val(this); |
|
|
319 |
j++; |
|
|
320 |
} |
|
|
321 |
else |
|
|
322 |
{ |
|
|
323 |
$('<input />').attr('type', 'hidden') |
|
|
324 |
.attr('name', 'categories'+j) |
|
|
325 |
.attr('value', this) |
|
|
326 |
.appendTo('#ajaxstreamgraph'); |
|
|
327 |
j++; |
|
|
328 |
} |
|
|
329 |
} |
|
|
330 |
|
|
|
331 |
}); |
|
|
332 |
|
|
|
333 |
firsttimerequest = false; |
|
|
334 |
|
|
|
335 |
$("#ajaxstreamgraph").submit(); |
|
|
336 |
$('#ajaxtreemap').submit(); |
|
|
337 |
} |
|
|
338 |
$(function(){ |
|
|
339 |
|
|
|
340 |
$('#login_button').click(function() { |
|
|
341 |
|
|
|
342 |
$('#ajaxlogin').submit(); |
|
|
343 |
}); |
|
|
344 |
|
|
|
345 |
$('#treemapaff').click(function() |
|
|
346 |
{ |
|
|
347 |
$.ajax( |
|
|
348 |
{ |
|
|
349 |
type: "POST", |
|
|
350 |
url: "/", |
|
|
351 |
data : "typeTri=treemap&requestType=setAffichage", |
|
|
352 |
success: function(data) { |
|
|
353 |
|
|
27
|
354 |
} |
|
|
355 |
}); |
|
37
|
356 |
|
|
|
357 |
}); |
|
27
|
358 |
|
|
37
|
359 |
$('#listehref').click(function() |
|
|
360 |
{ |
|
|
361 |
$.ajax( |
|
|
362 |
{ |
|
|
363 |
type: "POST", |
|
|
364 |
url: "/", |
|
|
365 |
data : "typeTri=liste&requestType=setAffichage", |
|
|
366 |
success: function(data) { |
|
|
367 |
|
|
|
368 |
} |
|
|
369 |
}); |
|
|
370 |
}); |
|
|
371 |
|
|
|
372 |
$("#ajaxlogin").submit( function() |
|
27
|
373 |
{ |
|
|
374 |
var urlSubmit = $(this).attr('action'); |
|
|
375 |
|
|
|
376 |
$.ajax( |
|
|
377 |
{ |
|
|
378 |
type: "POST", |
|
|
379 |
url: urlSubmit, |
|
|
380 |
data : $(this).serializeArray(), |
|
|
381 |
success: function(data) { |
|
|
382 |
var json = jQuery.parseJSON(data); |
|
37
|
383 |
|
|
|
384 |
showResults(json); |
|
27
|
385 |
curentjson = json; |
|
|
386 |
} |
|
|
387 |
}); |
|
|
388 |
return false; |
|
37
|
389 |
|
|
|
390 |
}); |
|
|
391 |
|
|
|
392 |
|
|
|
393 |
|
|
|
394 |
$('#recherche_button').click(function() { |
|
|
395 |
launchsearch(); |
|
|
396 |
|
|
|
397 |
}); |
|
|
398 |
|
|
|
399 |
// Formulaire POST AJAX |
|
|
400 |
$("#ajaxtreemap").submit( function() |
|
|
401 |
{ |
|
|
402 |
var urlSubmit = $(this).attr('action'); |
|
|
403 |
$.ajax( |
|
|
404 |
{ |
|
|
405 |
type: "POST", |
|
|
406 |
url: urlSubmit, |
|
|
407 |
data : $(this).serializeArray(), |
|
|
408 |
success: function(data) { |
|
|
409 |
currentjsonTreemap = data; |
|
|
410 |
var json = jQuery.parseJSON(data); |
|
|
411 |
currentqueryidtreemap = json.query.query_id; |
|
|
412 |
showResults(json); |
|
|
413 |
} |
|
|
414 |
}); |
|
|
415 |
return false; |
|
|
416 |
}); |
|
|
417 |
|
|
|
418 |
// Formulaire POST AJAX |
|
|
419 |
$("#ajaxstreamgraph").submit( function() |
|
|
420 |
{ |
|
|
421 |
|
|
|
422 |
var urlSubmit = $(this).attr('action'); |
|
|
423 |
|
|
|
424 |
$.ajax( |
|
|
425 |
{ |
|
|
426 |
type: "POST", |
|
|
427 |
url: urlSubmit, |
|
|
428 |
data : $(this).serializeArray(), |
|
|
429 |
success: function(data) { |
|
|
430 |
currentjsonStreamgraph = data; |
|
|
431 |
var json = jQuery.parseJSON(data); |
|
|
432 |
loadStreamgraph(json); |
|
|
433 |
//currentqueryidstreamgraph = json.query.query_id; |
|
|
434 |
|
|
|
435 |
} |
|
|
436 |
}); |
|
|
437 |
return false; |
|
|
438 |
}); |
|
|
439 |
|
|
|
440 |
// Formulaire POST AJAX |
|
|
441 |
$("#ajaxfiltretreemap").submit(function() |
|
|
442 |
{ |
|
|
443 |
var urlSubmit = $(this).attr('action'); |
|
|
444 |
|
|
|
445 |
if (($(this).attr('action')).indexOf("next") !== -1) |
|
|
446 |
{ |
|
|
447 |
var myurl = ($(this).attr('action')).split('/'); |
|
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
|
451 |
if ($("#ajaxfiltretreemap input[name=docId]").val() != undefined) |
|
|
452 |
{ |
|
|
453 |
$("#ajaxfiltretreemap input[name=docId]").val(myurl[4]); |
|
|
454 |
} |
|
|
455 |
else |
|
|
456 |
{ |
|
|
457 |
$('<input />').attr('type', 'hidden') |
|
|
458 |
.attr('name', 'docId') |
|
|
459 |
.attr('value', myurl[4]) |
|
|
460 |
.appendTo('#ajaxfiltretreemap'); |
|
|
461 |
} |
|
|
462 |
} |
|
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
|
466 |
if ($("#ajaxfiltretreemap input[name=recherche]").val() != undefined) |
|
|
467 |
{ |
|
|
468 |
$("#ajaxfiltretreemap input[name=recherche]").val($("#recherche_id").val()); |
|
|
469 |
} |
|
|
470 |
else |
|
|
471 |
{ |
|
|
472 |
$('<input />').attr('type', 'hidden') |
|
|
473 |
.attr('name', 'recherche') |
|
|
474 |
.attr('value', $("#recherche_id").val()) |
|
|
475 |
.appendTo('#ajaxfiltretreemap'); |
|
|
476 |
} |
|
|
477 |
|
|
|
478 |
|
|
|
479 |
$('#ajaxfiltrestreamgraph').submit(); |
|
|
480 |
|
|
|
481 |
$.ajax( |
|
|
482 |
{ |
|
|
483 |
type: "POST", |
|
|
484 |
url: urlSubmit, |
|
|
485 |
data : $(this).serializeArray(), |
|
|
486 |
success: function(data) { |
|
|
487 |
currentjsonTreemap = data; |
|
|
488 |
var json = jQuery.parseJSON(data); |
|
|
489 |
showResults(json); |
|
|
490 |
//curentjson = json; |
|
|
491 |
document.getElementById('titleleft').innerHTML = ""; |
|
|
492 |
} |
|
|
493 |
}); |
|
|
494 |
return false; |
|
27
|
495 |
}); |
|
|
496 |
|
|
37
|
497 |
// Formulaire POST AJAX |
|
|
498 |
$("#ajaxfiltrestreamgraph").submit( function() |
|
|
499 |
{ |
|
|
500 |
|
|
|
501 |
if (($(this).attr('action')).indexOf("next") !== -1) |
|
|
502 |
{ |
|
|
503 |
var myurl = ($(this).attr('action')).split('/'); |
|
|
504 |
$('<input />').attr('type', 'hidden') |
|
|
505 |
.attr('name', 'docId') |
|
|
506 |
.attr('value', myurl[4]) |
|
|
507 |
.appendTo('#ajaxfiltrestreamgraph'); |
|
|
508 |
} |
|
|
509 |
|
|
|
510 |
currentfromdate = $("#pickeddatebegin").val(); |
|
|
511 |
currenttodate = $("#pickeddateend").val(); |
|
|
512 |
|
|
|
513 |
if ($("#ajaxfiltrestreamgraph input[name=from_date]").val() != undefined) |
|
|
514 |
{ |
|
|
515 |
$("#ajaxfiltrestreamgraph input[name=from_date]").val(currentfromdate); |
|
|
516 |
} |
|
|
517 |
else |
|
|
518 |
{ |
|
|
519 |
$('<input />').attr('type', 'hidden') |
|
|
520 |
.attr('name', 'from_date') |
|
|
521 |
.attr('value', currentfromdate) |
|
|
522 |
.appendTo('#ajaxfiltrestreamgraph'); |
|
|
523 |
} |
|
|
524 |
|
|
|
525 |
if ($("#ajaxfiltrestreamgraph input[name=to_date]").val() != undefined) |
|
|
526 |
{ |
|
|
527 |
$("#ajaxfiltrestreamgraph input[name=to_date]").val(currenttodate); |
|
|
528 |
} |
|
|
529 |
else |
|
|
530 |
{ |
|
|
531 |
$('<input />').attr('type', 'hidden') |
|
|
532 |
.attr('name', 'to_date') |
|
|
533 |
.attr('value', currenttodate) |
|
|
534 |
.appendTo('#ajaxfiltrestreamgraph'); |
|
|
535 |
} |
|
|
536 |
|
|
|
537 |
currentcategories =[]; |
|
|
538 |
|
|
|
539 |
$("input:checked").each(function() { |
|
|
540 |
currentcategories.push($(this).val()); |
|
|
541 |
}); |
|
|
542 |
|
|
|
543 |
$("input:checkbox:not(:checked)").each(function() { |
|
|
544 |
currentcategories.push(''); |
|
|
545 |
}); |
|
|
546 |
var i=1; |
|
|
547 |
$.each(currentcategories, function() |
|
|
548 |
{ |
|
|
549 |
if(this != undefined) |
|
|
550 |
{ |
|
|
551 |
if (firsttimefiltre == false) |
|
|
552 |
{ |
|
|
553 |
$("#ajaxfiltrestreamgraph input[name=categories"+i+"]").val(this); |
|
|
554 |
i++; |
|
|
555 |
} |
|
|
556 |
else |
|
|
557 |
{ |
|
|
558 |
$('<input />').attr('type', 'hidden') |
|
|
559 |
.attr('name', 'categories'+i+'') |
|
|
560 |
.attr('value', this) |
|
|
561 |
.appendTo('#ajaxfiltrestreamgraph'); |
|
|
562 |
i++; |
|
|
563 |
} |
|
|
564 |
} |
|
|
565 |
|
|
|
566 |
}); |
|
|
567 |
|
|
|
568 |
firsttimefiltre = false; |
|
|
569 |
var urlSubmit = $(this).attr('action'); |
|
|
570 |
|
|
|
571 |
$.ajax( |
|
|
572 |
{ |
|
|
573 |
type: "POST", |
|
|
574 |
url: urlSubmit, |
|
|
575 |
data : $(this).serializeArray(), |
|
|
576 |
success: function(data) { |
|
|
577 |
currentjsonStreamgraph = data; |
|
|
578 |
var json = jQuery.parseJSON(data); |
|
|
579 |
loadStreamgraph(json); |
|
|
580 |
} |
|
|
581 |
}); |
|
|
582 |
return false; |
|
|
583 |
}); |
|
|
584 |
|
|
|
585 |
$('.checkbox_category').click(function() |
|
|
586 |
{ |
|
|
587 |
// $("#categories1").removeAttr('checked'); |
|
|
588 |
//$('input[name=categories1]').removeAttr('checked'); |
|
|
589 |
$('#ajaxfiltretreemap').submit(); |
|
27
|
590 |
}); |
|
37
|
591 |
|
|
|
592 |
|
|
|
593 |
// Formulaire POST AJAX |
|
|
594 |
$("#ajaxdocumentaryfile").submit(function() |
|
|
595 |
{ |
|
|
596 |
currentuser = $("#user_connected").text(); |
|
|
597 |
|
|
|
598 |
$('<input />').attr('type', 'hidden') |
|
|
599 |
.attr('name', 'user') |
|
|
600 |
.attr('value', currentuser) |
|
|
601 |
.appendTo('#ajaxdocumentaryfile'); |
|
|
602 |
|
|
|
603 |
$('<input />').attr('type', 'hidden') |
|
|
604 |
.attr('name', 'jsontreemap') |
|
|
605 |
.attr('value', currentjsonTreemap) |
|
|
606 |
.appendTo('#ajaxdocumentaryfile'); |
|
|
607 |
|
|
|
608 |
$('<input />').attr('type', 'hidden') |
|
|
609 |
.attr('name', 'jsonstreamgraph') |
|
|
610 |
.attr('value', currentjsonStreamgraph) |
|
|
611 |
.appendTo('#ajaxdocumentaryfile'); |
|
|
612 |
|
|
|
613 |
$('<input />').attr('type', 'hidden') |
|
|
614 |
.attr('name', 'query_id') |
|
|
615 |
.attr('value', currentqueryidtreemap) |
|
|
616 |
.appendTo('#ajaxdocumentaryfile'); |
|
|
617 |
|
|
|
618 |
$('<input />').attr('type', 'hidden') |
|
|
619 |
.attr('name', 'visibility') |
|
|
620 |
.attr('value', 'private') |
|
|
621 |
.appendTo('#ajaxdocumentaryfile'); |
|
|
622 |
|
|
|
623 |
var urlSubmit = $(this).attr('action'); |
|
|
624 |
$.ajax( |
|
|
625 |
{ |
|
|
626 |
type: "POST", |
|
|
627 |
url: urlSubmit, |
|
|
628 |
data : $(this).serializeArray(), |
|
|
629 |
success: function(data) { |
|
|
630 |
$('#ajaxupdatedossierdoc').submit(); |
|
|
631 |
} |
|
|
632 |
}); |
|
|
633 |
return false; |
|
|
634 |
}); |
|
|
635 |
|
|
|
636 |
// Formulaire POST AJAX |
|
|
637 |
$("#ajaxupdatedossierdoc").submit(function() |
|
|
638 |
{ |
|
|
639 |
currentuser = $("#user_connected").text(); |
|
|
640 |
$('<input />').attr('type', 'hidden') |
|
|
641 |
.attr('name', 'user') |
|
|
642 |
.attr('value', currentuser) |
|
|
643 |
.appendTo('#ajaxupdatedossierdoc'); |
|
|
644 |
|
|
|
645 |
var urlSubmit = $(this).attr('action'); |
|
|
646 |
$.ajax( |
|
|
647 |
{ |
|
|
648 |
type: "POST", |
|
|
649 |
url: urlSubmit, |
|
|
650 |
data : $(this).serializeArray(), |
|
|
651 |
success: function(data) |
|
|
652 |
{ |
|
|
653 |
//alert(data); |
|
|
654 |
var json = jQuery.parseJSON(data); |
|
|
655 |
updatedossierdoc(json); |
|
|
656 |
} |
|
|
657 |
}); |
|
|
658 |
return false; |
|
|
659 |
}); |
|
|
660 |
|
|
|
661 |
|
|
|
662 |
$( "#dialog-form" ).dialog({ |
|
|
663 |
autoOpen: false, |
|
|
664 |
height: 250, |
|
|
665 |
width: 350, |
|
|
666 |
modal: false, |
|
|
667 |
buttons: { |
|
|
668 |
"Créer dossier": function() { |
|
|
669 |
$('#ajaxdocumentaryfile').submit(); |
|
|
670 |
$( this ).dialog( "close" ); |
|
|
671 |
}, |
|
|
672 |
"Annuler": function() { |
|
|
673 |
|
|
|
674 |
$( this ).dialog( "close" ); |
|
|
675 |
} |
|
|
676 |
}, |
|
|
677 |
close: function() { |
|
|
678 |
allFields.val( "" ).removeClass( "ui-state-error" ); |
|
|
679 |
} |
|
|
680 |
}); |
|
|
681 |
$( "#create-dossierDoc" ).click(function() { |
|
|
682 |
|
|
|
683 |
currentuser = $("#user_connected").text(); |
|
|
684 |
|
|
|
685 |
if(currentuser != "") |
|
|
686 |
{ |
|
|
687 |
$( "#dialog-form" ).dialog( "open" ); |
|
|
688 |
} |
|
|
689 |
else |
|
|
690 |
{ |
|
|
691 |
alert('Vous devez vous connecter.'); |
|
|
692 |
} |
|
|
693 |
|
|
|
694 |
|
|
|
695 |
|
|
|
696 |
}); |
|
|
697 |
|
|
|
698 |
|
|
27
|
699 |
|
|
|
700 |
});//jQuery |