summaryrefslogtreecommitdiffstats
path: root/modules-available/dozmod/templates/images-delete.html
blob: 7869042649149b020d0be4f1c52fb83c3bd3914d (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
<h1>{{lang_bwlehrpoolsuite}}</h1>

<div class="panel panel-default">
	<div class="panel-heading">
		{{lang_heading}}
	</div>
	<div class="panel-body">
		<p>{{lang_description_delete_images}}</p>
		<div class="table-responsive">
			<form id="delform" method="post" action="?do=DozMod" onsubmit="return slxPostdel()">
				<input type="hidden" name="token" value="{{token}}">
				<input type="hidden" name="section" value="expiredimages">
				<input type="hidden" name="action" value="delimages">
				<table class="table table-stripped table-condensed stupidtable">
					<thead>
						<tr>
							<th data-sort="string">{{lang_image}}</th>
							<th data-sort="int">{{lang_version}}</th>
							<th data-sort="string">{{lang_owner}}</th>
							<th><span class="glyphicon glyphicon-upload" title="{{lang_hasNewer}}"></span></th>
							<th data-sort="int">{{lang_size}}</th>
							<th>
								<div class="checkbox">
									<input id="del-all" type="checkbox" onclick="slxChangeAll()">
									<label for="del-all"></label>
									<span class="glyphicon glyphicon-trash" title="{{lang_delete}}"></span>
								</div>
							</th>
						</tr>
					</thead>
					<tbody>
						{{#images}}
						<tr>
							<td class="text-left text-nowrap {{name_extra_class}}">{{displayname}}<br><span class="small">{{imageversionid}}</span></td>
							<td class="text-left text-nowrap" data-sort-value="{{createtime}}" >{{version}}</td>
							<td class="text-left text-nowrap"><a href="mailto:{{email}}">{{lastname}}, {{firstname}}</a></td>
							<td class="text-left text-nowrap"><span class="glyphicon {{hasNewerClass}}"></span></td>
							<td class="text-left text-nowrap" data-sort-value="{{rawfilesize}}">{{filesize}}</td>
							<td>
								<div class="checkbox">
									<input type="checkbox" id="images[{{imageversionid}}]" class="del-check" name="images[{{imageversionid}}]" {{checked}}>
									<label for="images[{{imageversionid}}]"></label>
								</div>
							</td>
						</tr>
						{{/images}}
					</tbody>
				</table>
				<button {{^allowedDelete}}disabled{{/allowedDelete}} style="margin-left: 20px" id="delbtn" class="btn btn-danger pull-right" type="submit" name="button" value="save"><span class="glyphicon glyphicon-trash"></span> {{lang_delButton}}</button>
			</form>
			<pre style="display:none" id="deloutput"></pre>
		</div>
	</div>
</div>

<script type="text/javascript"><!--

function slxPostdel() {
	var f = $('#delform');
	$('#delbtn').prop('disabled', true);
	$.post('?do=DozMod', f.serialize()).done(function (data) {
		$('#deloutput').text(data).css('display', '');
	}).fail(function () {
		$('#deloutput').text('ERROR').css('display', '');
	});
	return false;
}

function slxChangeAll()
{
	if ($('#del-all').is(':checked')) {
		$('.del-check').prop('checked', true);
	} else {
		$('.del-check').prop('checked', false);
	}
}

function slxChangeSingle()
{
	var ons = 0;
	var offs = 0;
	$('.del-check').each(function(idx, elem) {
		if (elem.checked) {
			ons++;
		} else {
			offs++;
		}
	});
	$('#del-all').prop('checked', offs === 0).prop('indeterminate', ons > 0 && offs > 0);
}

document.addEventListener("DOMContentLoaded", function() {
	$('.del-check').click(slxChangeSingle);
	slxChangeSingle();
}, false);

//--> </script>