[Web] Implement table size to quarantine, implements #3325
This commit is contained in:
parent
6adeab072d
commit
26e2a1230a
@ -48,7 +48,7 @@ $(document).ready(function() {
|
|||||||
$(this.$domain).closest("select").selectpicker();
|
$(this.$domain).closest("select").selectpicker();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// todo
|
// Set paging
|
||||||
$('[data-page-size]').on('click', function(e){
|
$('[data-page-size]').on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var new_size = $(this).data('page-size');
|
var new_size = $(this).data('page-size');
|
||||||
|
@ -7,7 +7,43 @@ jQuery(function($){
|
|||||||
var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};
|
var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};
|
||||||
function escapeHtml(n){return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}
|
function escapeHtml(n){return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}
|
||||||
function humanFileSize(i){if(Math.abs(i)<1024)return i+" B";var B=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=-1;do{i/=1024,++e}while(Math.abs(i)>=1024&&e<B.length-1);return i.toFixed(1)+" "+B[e]}
|
function humanFileSize(i){if(Math.abs(i)<1024)return i+" B";var B=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=-1;do{i/=1024,++e}while(Math.abs(i)>=1024&&e<B.length-1);return i.toFixed(1)+" "+B[e]}
|
||||||
|
// Set paging
|
||||||
|
$('[data-page-size]').on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var new_size = $(this).data('page-size');
|
||||||
|
var parent_ul = $(this).closest('ul');
|
||||||
|
var table_id = $(parent_ul).data('table-id');
|
||||||
|
FooTable.get('#' + table_id).pageSize(new_size);
|
||||||
|
//$(this).parent().addClass('active').siblings().removeClass('active')
|
||||||
|
heading = $(this).parents('.panel').find('.panel-heading')
|
||||||
|
var n_results = $(heading).children('.table-lines').text().split(' / ')[1];
|
||||||
|
$(heading).children('.table-lines').text(function(){
|
||||||
|
if (new_size > n_results) {
|
||||||
|
new_size = n_results;
|
||||||
|
}
|
||||||
|
return new_size + ' / ' + n_results;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
$(".refresh_table").on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var table_name = $(this).data('table');
|
||||||
|
$('#' + table_name).find("tr.footable-empty").remove();
|
||||||
|
draw_table = $(this).data('draw');
|
||||||
|
eval(draw_table + '()');
|
||||||
|
});
|
||||||
|
function table_quarantine_ready(ft, name) {
|
||||||
|
$('.refresh_table').prop("disabled", false);
|
||||||
|
heading = ft.$el.parents('.panel').find('.panel-heading')
|
||||||
|
var ft_paging = ft.use(FooTable.Paging)
|
||||||
|
$(heading).children('.table-lines').text(function(){
|
||||||
|
var total_rows = ft_paging.totalRows;
|
||||||
|
var size = ft_paging.size;
|
||||||
|
if (size > total_rows) {
|
||||||
|
size = total_rows;
|
||||||
|
}
|
||||||
|
return size + ' / ' + total_rows;
|
||||||
|
})
|
||||||
|
}
|
||||||
function draw_quarantine_table() {
|
function draw_quarantine_table() {
|
||||||
ft_quarantinetable = FooTable.init('#quarantinetable', {
|
ft_quarantinetable = FooTable.init('#quarantinetable', {
|
||||||
"columns": [
|
"columns": [
|
||||||
@ -69,7 +105,18 @@ jQuery(function($){
|
|||||||
"paging": {"enabled": true,"limit": 5,"size": pagination_size},
|
"paging": {"enabled": true,"limit": 5,"size": pagination_size},
|
||||||
"sorting": {"enabled": true},
|
"sorting": {"enabled": true},
|
||||||
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
|
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
|
||||||
"toggleSelector": "table tbody span.footable-toggle"
|
"toggleSelector": "table tbody span.footable-toggle",
|
||||||
|
"on": {
|
||||||
|
"destroy.ft.table": function(e, ft){
|
||||||
|
$('.refresh_table').attr('disabled', 'true');
|
||||||
|
},
|
||||||
|
"ready.ft.table": function(e, ft){
|
||||||
|
table_quarantine_ready(ft, 'quarantinetable');
|
||||||
|
},
|
||||||
|
"after.ft.filtering": function(e, ft){
|
||||||
|
table_quarantine_ready(ft, 'quarantinetable');
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,6 +524,9 @@
|
|||||||
"help": "Hilfe ein-/ausblenden"
|
"help": "Hilfe ein-/ausblenden"
|
||||||
},
|
},
|
||||||
"quarantine": {
|
"quarantine": {
|
||||||
|
"refresh": "Neu laden",
|
||||||
|
"table_size": "Tabellengröße",
|
||||||
|
"table_size_show_n": "Zeige %s Einträge",
|
||||||
"disabled_by_config": "Die derzeitige Konfiguration deaktiviert die Funktion des Quarantäne-Systems.",
|
"disabled_by_config": "Die derzeitige Konfiguration deaktiviert die Funktion des Quarantäne-Systems.",
|
||||||
"learn_spam_delete": "Als Spam lernen und löschen",
|
"learn_spam_delete": "Als Spam lernen und löschen",
|
||||||
"quarantine": "Quarantäne",
|
"quarantine": "Quarantäne",
|
||||||
|
@ -523,6 +523,9 @@
|
|||||||
"help": "Show/Hide help panel"
|
"help": "Show/Hide help panel"
|
||||||
},
|
},
|
||||||
"quarantine": {
|
"quarantine": {
|
||||||
|
"refresh": "Refresh",
|
||||||
|
"table_size": "Table size",
|
||||||
|
"table_size_show_n": "Show %s items",
|
||||||
"disabled_by_config": "The current system configuration disables the quarantine functionality.",
|
"disabled_by_config": "The current system configuration disables the quarantine functionality.",
|
||||||
"quarantine": "Quarantine",
|
"quarantine": "Quarantine",
|
||||||
"learn_spam_delete": "Learn as spam and delete",
|
"learn_spam_delete": "Learn as spam and delete",
|
||||||
|
@ -521,6 +521,7 @@
|
|||||||
"help": "Toon/verberg hulppaneel"
|
"help": "Toon/verberg hulppaneel"
|
||||||
},
|
},
|
||||||
"quarantine": {
|
"quarantine": {
|
||||||
|
"refresh": "Ververs",
|
||||||
"disabled_by_config": "De huidige systeemconfiguratie deactiveert de quarantainefunctionaliteit.",
|
"disabled_by_config": "De huidige systeemconfiguratie deactiveert de quarantainefunctionaliteit.",
|
||||||
"quarantine": "Quarantaine",
|
"quarantine": "Quarantaine",
|
||||||
"learn_spam_delete": "Markeer als spam en verwijder",
|
"learn_spam_delete": "Markeer als spam en verwijder",
|
||||||
|
@ -678,6 +678,9 @@
|
|||||||
"scope_ask_permission": "Приложение запросило доступ к"
|
"scope_ask_permission": "Приложение запросило доступ к"
|
||||||
},
|
},
|
||||||
"quarantine": {
|
"quarantine": {
|
||||||
|
"refresh": "Обновить",
|
||||||
|
"table_size": "Размер таблицы",
|
||||||
|
"table_size_show_n": "Отображать %s полей",
|
||||||
"action": "Действия",
|
"action": "Действия",
|
||||||
"atts": "Вложения",
|
"atts": "Вложения",
|
||||||
"check_hash": "Поиск по хешу файла на @ VT",
|
"check_hash": "Поиск по хешу файла на @ VT",
|
||||||
|
@ -11,7 +11,21 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><?=$lang['quarantine']['quarantine'];?></h3>
|
<?=$lang['quarantine']['quarantine'];?> <span class="badge badge-info table-lines"></span>
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<button class="btn btn-xs btn-default refresh_table" data-draw="draw_quarantine_table" data-table="quarantinetable"><?=$lang['quarantine']['refresh'];?></button>
|
||||||
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown"><?=$lang['quarantine']['table_size'];?>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu" data-table-id="quarantinetable" role="menu">
|
||||||
|
<li><a href="#" data-page-size="10"><?=sprintf($lang['quarantine']['table_size_show_n'], 10);?></a></li>
|
||||||
|
<li><a href="#" data-page-size="20"><?=sprintf($lang['quarantine']['table_size_show_n'], 20);?></a></li>
|
||||||
|
<li><a href="#" data-page-size="50"><?=sprintf($lang['quarantine']['table_size_show_n'], 50);?></a></li>
|
||||||
|
<li><a href="#" data-page-size="100"><?=sprintf($lang['quarantine']['table_size_show_n'], 100);?></a></li>
|
||||||
|
<li><a href="#" data-page-size="200"><?=sprintf($lang['quarantine']['table_size_show_n'], 200);?></a></li>
|
||||||
|
<li><a href="#" data-page-size="500"><?=sprintf($lang['quarantine']['table_size_show_n'], 500);?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p style="margin:10px" class="help-block"><?=$lang['quarantine']['qinfo'];?></p>
|
<p style="margin:10px" class="help-block"><?=$lang['quarantine']['qinfo'];?></p>
|
||||||
<p style="margin:10px">
|
<p style="margin:10px">
|
||||||
|
Loading…
Reference in New Issue
Block a user