summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/templates/page-replace.html
blob: d0e9f766c49d8b024a6267f46f70286388cf8136 (plain) (blame)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<h1>{{lang_replaceMachinesHeading}}</h1>

<style>
	.reptable {
		border-collapse: separate;
		border-spacing: 2px;
	}
	.reptable td.a {
		padding: 2px;
		border:1px solid #ccc;
		border-radius: 3px;
		background: #eee;
		vertical-align: top;
	}
	.reptable td.b {
		font-size: 300%;
	}
</style>

<p>
	{{lang_replaceInstructions}}
</p>

<form method="post" action="?do=statistics&amp;show=replace">
	<input type="hidden" name="token" value="{{token}}">
	<table class="reptable">
		<thead>
		<tr>
			<th>{{lang_replaceOld}}</th>
			<th></th>
			<th>{{lang_replaceNew}}</th>
			<th></th>
		</tr>
		</thead>
		<tbody>
		{{#pairs}}
			<tr>
				<td class="a">
					<div><b>{{oldhost}}</b> {{oldip}}</div>
					<div class="slx-bold">{{oldmodel}}</div>
					<div class="small">{{oldmac}} – {{olduuid}}</div>
					<div>{{lang_lastSeen}}: {{oldlastseen_s}}</div>
				</td>
				<td class="b">&rightarrow;</td>
				<td class="a">
					<div><b>{{newhost}}</b> {{newip}}</div>
					<div class="slx-bold">{{newmodel}}</div>
					<div class="small">{{newmac}} – {{newuuid}}</div>
					<div>{{lang_firstSeen}}: {{newfirstseen_s}}</div>
				</td>
				<td>
					<div class="checkbox checkbox-inline">
						<input type="checkbox" name="replace[]" value="{{olduuid}}x{{newuuid}}">
						<label></label>
					</div>
				</td>
			</tr>
		{{/pairs}}
		</tbody>
	</table>

	<div class="text-right">
		<button type="button" class="btn btn-danger" name="action" value="replace" data-toggle="modal" data-target="#confirm-dialog">
			<span class="glyphicon glyphicon-floppy-disk"></span>
			{{lang_replace}}
			(<span id="rep-count">0</span>)
		</button>
	</div>

	<div class="modal fade" id="confirm-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">{{lang_replace}}</h4>
				</div>
				<div class="modal-body">
					{{lang_sureReplaceNoUndo}}
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
					<button type="submit" name="action" value="replace" class="btn btn-danger">
						<span class="glyphicon glyphicon-floppy-disk"></span>
						{{lang_replace}}
					</button>
				</div>
			</div>
		</div>
	</div>
</form>

<script type="application/javascript"><!--
	document.addEventListener('DOMContentLoaded', function () {
		$('td.a').click(function () {
			var $cb = $(this).parent().find('input:checkbox');
			$cb.prop('checked', !$cb.is(':checked'));
			cbChanged();
		});
		$('input:checkbox').change(function () {
			cbChanged();
		});
		function cbChanged() {
			var cnt = $('input:checkbox:checked').length;
			$('#rep-count').text(cnt).parent().prop('disabled', cnt === 0);
		}
		cbChanged();
	});
//--></script>