Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<html>
<body>
<div>
	<button onclick="espandi_confronta_versioni('$id$')">Confronta con versioni precedenti</button>
	<div id="$id$" class="hidden">
		<br/>
		Versioni: <select id="sx-$id$"></select> <select id="dx-$id$"></select> <button onclick="vai_a('sx-$id$','dx-$id$')">Vai a</button>
	</div>
</div>

<script>

var versioni = $versioni$;

function init_combo(id_select) {
	var select = document.getElementById(id_select),
		option,
		i = 0,
		il = versioni.length;

	for (; i < il; i += 1) {
		option = document.createElement('option');
		option.setAttribute('value', versioni[i].value);
		option.appendChild(document.createTextNode(versioni[i].text));
		select.appendChild(option);
	}
}

function espandi_confronta_versioni(el) {
	$('#'+el).toggleClass("hidden");
}

function vai_a(id1, id2) {
	var sel1 = document.getElementById(id1);
	var opt1 = sel1.options[sel1.selectedIndex].value;

	var sel2 = document.getElementById(id2);
	var opt2 = sel2.options[sel2.selectedIndex].value;

	$.ajax({
			url: "./ajax/openDiff.php",
			data: {
				original: opt1,
				changed: opt2
			},
			dataType: "json",
			type: "GET",
			success: function(data) {
				$('#$id$-output').prettyTextDiff({
					cleanup: true,
					diffContainer: $('#$id$-output'),
					originalContent: data.originalContent,
					changedContent: data.changedContent
			  	});
			},
			error: function(request) {
				if (request.status == 404) {
					alert("File non trovato: "+folderPopup+"/"+filenamePopup);
				} else {
					alert("Errore nell'apertura del popup");
				}
			}
		});
}

init_combo("sx-$id$");
init_combo("dx-$id$");

</script>
</body>
</html>

Commits for Nextrek/legal-map/ajax/templates/confronta_versioni.html

Diff revisions: vs.
Revision Author Commited Message
794 Diff Diff DRuega picture DRuega Tue 06 Oct, 2015 00:07:21 +0000

Prima interpretazione del "Diff"

793 DRuega picture DRuega Mon 05 Oct, 2015 21:45:40 +0000

Primo pezzo di “Confronta con versioni precedenti”.
Il tasto compare solo sugli Originali e solo se ci sono dei documenti revisionati.
Per ora popula solo le combobox.