diff options
Diffstat (limited to 'modules-available/dozmod/templates')
-rw-r--r-- | modules-available/dozmod/templates/images-delete.html | 172 | ||||
-rw-r--r-- | modules-available/dozmod/templates/images-orphaned.html | 25 |
2 files changed, 134 insertions, 63 deletions
diff --git a/modules-available/dozmod/templates/images-delete.html b/modules-available/dozmod/templates/images-delete.html index 78690426..9d61559f 100644 --- a/modules-available/dozmod/templates/images-delete.html +++ b/modules-available/dozmod/templates/images-delete.html @@ -2,96 +2,142 @@ <div class="panel panel-default"> <div class="panel-heading"> - {{lang_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" onsubmit="return slxPostdel()"> + <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" onclick="slxChangeAll()"> - <label for="del-all"></label> - <span class="glyphicon glyphicon-trash" title="{{lang_delete}}"></span> - </div> - </th> - </tr> + <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="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}} + {{#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> + <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> -<script type="text/javascript"><!-- +<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> -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; -} +<div class="hidden" id="confirm-orphan-delete"> + {{lang_confirmDeleteOrphanedFiles}} +</div> -function slxChangeAll() -{ - if ($('#del-all').is(':checked')) { - $('.del-check').prop('checked', true); - } else { - $('.del-check').prop('checked', false); - } -} +<script type="text/javascript"><!-- -function slxChangeSingle() -{ - var ons = 0; - var offs = 0; - $('.del-check').each(function(idx, elem) { - if (elem.checked) { - ons++; +document.addEventListener("DOMContentLoaded", function () { + $('#del-all').click(function () { + if ($(this).is(':checked')) { + $('.del-check').prop('checked', true); } else { - offs++; + $('.del-check').prop('checked', false); } }); - $('#del-all').prop('checked', offs === 0).prop('indeterminate', ons > 0 && offs > 0); -} - -document.addEventListener("DOMContentLoaded", function() { + 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> diff --git a/modules-available/dozmod/templates/images-orphaned.html b/modules-available/dozmod/templates/images-orphaned.html new file mode 100644 index 00000000..d1b74a42 --- /dev/null +++ b/modules-available/dozmod/templates/images-orphaned.html @@ -0,0 +1,25 @@ +<table class="table"> + <thead> + <tr> + <th>{{lang_fileName}}</th> + <th>{{lang_status}}</th> + </tr> + </thead> + <tbody> + {{#files}} + <tr> + <td>{{file}}</td> + <td>{{status}}</td> + </tr> + {{/files}} + </tbody> +</table> + +{{#show_delete}} +<button {{perm.orphaned.delete.disabled}} id="orphan-delete" + class="btn btn-danger pull-right" type="button" + data-confirm="#confirm-orphan-delete"> + <span class="glyphicon glyphicon-search"></span> + {{lang_orphanDeleteButton}} +</button> +{{/show_delete}}
\ No newline at end of file |