|
|
<h1>{{lang_bwlehrpoolsuite}}</h1>
<div class="panel panel-default">
<div class="panel-heading">
{{lang_deleteExpiredHeading}}
</div>
<div class="panel-body">
<p>{{lang_description_delete_images}}</p>
<div class="table-responsive">
<form id="delform" method="post" action="?do=dozmod">
<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">
<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="?do=dozmod&section=actionlog&action=showuser&uuid={{userid}}">{{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 {{perm.expiredimages.delete.disabled}} id="expired-delete"
class="btn btn-danger pull-right" type="submit">
<span class="glyphicon glyphicon-trash"></span>
{{lang_delButton}}
</button>
</form>
<pre style="display:none" id="deloutput"></pre>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
{{lang_orphanedFilesHeading}}
</div>
<div class="panel-body">
<p>{{lang_orphanedFilesDesc}}</p>
<div id="orphan-ajax">
<button {{perm.orphaned.scan.disabled}} id="orphan-scan"
class="btn btn-default pull-right" type="button">
<span class="glyphicon glyphicon-search"></span>
{{lang_scanButton}}
</button>
</div>
</div>
</div>
<div class="hidden" id="confirm-orphan-delete">
{{lang_confirmDeleteOrphanedFiles}}
</div>
<script type="text/javascript"><!--
document.addEventListener("DOMContentLoaded", function () {
$('#del-all').click(function () {
if ($(this).is(':checked')) {
$('.del-check').prop('checked', true);
} else {
$('.del-check').prop('checked', false);
}
});
var slxChangeSingle = function () {
var ons = 0;
var offs = 0;
$('.del-check').each(function (idx, elem) {
if (elem.checked) {
ons++;
} else {
offs++;
}
});
// TODO indeterminate doesn't work with styled checkbox
$('#del-all').prop('checked', offs === 0).prop('indeterminate', ons > 0 && offs > 0);
};
$('.del-check').click(slxChangeSingle);
slxChangeSingle();
// Handler for delete expired images button
var delform = $('#delform');
delform.submit(function (e) {
e.preventDefault();
$('#expired-delete').prop('disabled', true);
$.post('?do=dozmod', delform.serialize()).done(function (data) {
$('#deloutput').text(data).css('display', '');
}).fail(function () {
$('#deloutput').text('ERROR').css('display', '');
});
});
// Handler for scanning/deleting orphaned files
var slxOrphans = function (del) {
$.post('?do=dozmod', {
token: TOKEN, section: 'expiredimages', action: 'orphaned', delete: del
}).done(function (data) {
$('#orphan-ajax').html(data).find('#orphan-delete')
.click(slxModalConfirmHandler)
.click(function () {
slxOrphans(1);
});
}).fail(function () {
$('#orphan-ajax').text('ERROR');
});
};
// Handler for scanning for orphaned files
$('#orphan-scan').click(function () {
$('#orphan-scan').prop('disabled', true);
slxOrphans(0);
});
window.addEventListener('unload', function () {
// Do something here that forces browsers to throw away any JS state on nav.back
$('input[type=checkbox]').prop('checked', false);
});
}, false);
//--> </script>
|