Nextrek
Diff Revisions
757
vs
758
for /legal-map/js/articolo.js
|
@@ -1,4 +1,64 @@ |
1 |
1 |
|
function VisualizzaArticolo(clicked, folder, filename, p4, p5) { //p4 e p5 attualmente sono uguali rispettivamente a "dls" e null |
2 |
|
- |
var element = $(clicked); |
3 |
|
- |
element.closest("li").append("<div class='articolo'>Div da inserire</div>"); |
|
2 |
+ |
|
|
3 |
+ |
function ajaxVisualizzaArticolo(data, type) { |
|
4 |
+ |
//$(clicked).closest("li").append("<div class='articolo'>"+data+"</div>"); |
|
5 |
+ |
$("#articolo-"+folder+"_"+filename+" ."+type).append(data); |
|
6 |
+ |
|
|
7 |
+ |
//controllo se l'altra colonna è stata già caricata. Se sì, allora mostra l'articolo |
|
8 |
+ |
if ((type == "originale" && $("#articolo-"+folder+"_"+filename+" .schema").html!="") || |
|
9 |
+ |
(type == "schema" && $("#articolo-"+folder+"_"+filename+" .originale").html!="")) { |
|
10 |
+ |
$("#articolo-"+folder+"_"+filename).css("display", "table"); //mostra l'articolo |
|
11 |
+ |
} |
|
12 |
+ |
} |
|
13 |
+ |
|
|
14 |
+ |
if ($("#articolo-"+folder+"_"+filename).length > 0) { |
|
15 |
+ |
$("#articolo-"+folder+"_"+filename).show(); |
|
16 |
+ |
} else { |
|
17 |
+ |
var htmlToAppend = "<div id='articolo-"+folder+"_"+filename+"' class='articolo' style='display:none;'>"; |
|
18 |
+ |
htmlToAppend += "<div class='originale'></div>"; |
|
19 |
+ |
htmlToAppend += "<div class='ristrutturato' style='display:none;'></div>"; |
|
20 |
+ |
htmlToAppend += "<div class='schema'></div>"; |
|
21 |
+ |
htmlToAppend += "</div>"; |
|
22 |
+ |
|
|
23 |
+ |
$(clicked).closest("li").append(htmlToAppend); |
|
24 |
+ |
|
|
25 |
+ |
$.ajax({ //caricamento articolo originale |
|
26 |
+ |
url: "./ajax/openArticle.php", |
|
27 |
+ |
data: { |
|
28 |
+ |
html: folder+"/"+filename+"_O.htm" |
|
29 |
+ |
}, |
|
30 |
+ |
dataType: "HTML", |
|
31 |
+ |
type: "GET", |
|
32 |
+ |
success: function(data) { |
|
33 |
+ |
ajaxVisualizzaArticolo(data, "originale"); |
|
34 |
+ |
}, |
|
35 |
+ |
error: function(request) { |
|
36 |
+ |
if (request.status == 404) { |
|
37 |
+ |
alert("File non trovato"); |
|
38 |
+ |
} else { |
|
39 |
+ |
alert("Errore nell'apertura dell'articolo"); |
|
40 |
+ |
} |
|
41 |
+ |
} |
|
42 |
+ |
}); |
|
43 |
+ |
|
|
44 |
+ |
|
|
45 |
+ |
$.ajax({ //caricamento visuali (tab "Schema") |
|
46 |
+ |
url: "./ajax/openArticle.php", |
|
47 |
+ |
data: { |
|
48 |
+ |
html: folder+"/"+filename+"_V.htm" |
|
49 |
+ |
}, |
|
50 |
+ |
dataType: "HTML", |
|
51 |
+ |
type: "GET", |
|
52 |
+ |
success: function(data) { |
|
53 |
+ |
ajaxVisualizzaArticolo(data, "schema"); |
|
54 |
+ |
}, |
|
55 |
+ |
error: function(request) { |
|
56 |
+ |
if (request.status == 404) { |
|
57 |
+ |
alert("File non trovato"); |
|
58 |
+ |
} else { |
|
59 |
+ |
alert("Errore nell'apertura dell'articolo"); |
|
60 |
+ |
} |
|
61 |
+ |
} |
|
62 |
+ |
}); |
|
63 |
+ |
} |
4 |
64 |
|
} |