summaryrefslogblamecommitdiffstats
path: root/modules-available/dozmod/templates/images-delete.html
blob: 0ee90835026d04ce86d0a76e8b99f5e99a711f6d (plain) (tree)
1
2
3
4
5
6
7
8






                                   
                                                         









                                                                                                            
                                                                                                                                           
                                                                              



                                                                                                                                       




                                                           




                                                                                                                                                                                    
                                                                                                                                                        























                                                                                                                                               



























                                                                                             
               
<h2>{{lang_heading}}</h2>

<div class="panel panel-default">
	<div class="panel-heading">
		{{lang_subHeading}}
	</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="action" value="delimages">
				<table class="table table-stripped table-condensed">
					<thead>
						<tr>
							<th>{{lang_image}}</th>
							<th>{{lang_version}}</th>
							<th>{{lang_owner}}</th>
							<th><span class="glyphicon glyphicon-upload" title="{{lang_hasNewer}}"></span></th>
							<th>{{lang_size}}</th>
							<th>
								<input id="del-all" type="checkbox" onclick="slxChangeAll()">
								<span class="glyphicon glyphicon-trash" title="{{lang_delete}}"></span>
							</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">{{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-right text-nowrap">{{filesize}}</td>
							<td><input class="del-check" name="images[{{imageversionid}}]" type="checkbox" {{checked}}></td>
						</tr>
						{{/images}}
					</tbody>
				</table>
				<button id="delbtn" class="btn btn-danger" type="submit" name="button" value="save">{{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>