Confirm deletion, some other fixes to quick actions, added language strings

master
andryyy 2017-04-27 11:58:20 +02:00
parent 68e67ba9b7
commit 2c2441eaf0
6 changed files with 72 additions and 22 deletions

View File

@ -16,6 +16,7 @@ table.footable>tbody>tr.footable-empty>td {
font-style: italic;
display:block;
padding: 10px;
background: #F5F5F5;
}
.mass-each-action {
padding: 0 3px 0 3px;
@ -23,7 +24,7 @@ table.footable>tbody>tr.footable-empty>td {
}
.mass-actions {
user-select: none;
margin-top:-5px;
padding:10px;
}
.mass-select-all {
cursor:pointer;

View File

@ -19,6 +19,23 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi
</div>
</div>
</div>
<div id="ConfirmDeleteModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"><?=$lang['footer']['confirm_delete'];?></h4>
</div>
<div class="modal-body">
<p><?=$lang['footer']['delete_these_items'];?></p>
<ul id="ItemsToDelete"></ul>
<hr />
<button class="btn btn-sm btn-danger" id="IsConfirmed"><?=$lang['footer']['delete_now'];?></button>
<button class="btn btn-sm btn-default" id="isCanceled"><?=$lang['footer']['cancel'];?></button>
</div>
</div>
</div>
</div>
<?php
endif;
?>

View File

@ -237,7 +237,6 @@ $(document).ready(function() {
$.each(data, function (i, item) {
item.action = '<div class="btn-group">' +
'<a href="/edit.php?alias=' + encodeURI(item.address) + '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span> ' + lang.edit + '</a>' +
'<a href="/delete.php?alias=' + encodeURI(item.address) + '" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> ' + lang.remove + '</a>' +
'</div>';
item.chkbox = '<input type="checkbox" class="alias_item" name="sel_aliases" value="' + item.address + '" />';
if (item.is_catch_all == 1) {
@ -279,7 +278,6 @@ $(document).ready(function() {
if (e.target.type == "checkbox") {
e.stopPropagation();
} else {
var $checkbox = $(this).find(':checkbox');
var checkbox = $(this).find(':checkbox');
checkbox.trigger('click');
}
@ -333,16 +331,32 @@ $(document).ready(function() {
$(document).on('click', '#delete_selected_alias', function(e) {
e.preventDefault();
if (Object.keys(selected_aliases).length !== 0) {
$.ajax({
type: "POST",
dataType: "json",
data: { "address": JSON.stringify(selected_aliases) },
url: '/api/v1/delete/alias/post',
jsonp: false,
complete: function (data) {
location.reload();
$(document).on('show.bs.modal','#ConfirmDeleteModal', function () {
$("#ItemsToDelete").empty();
for (var i in selected_aliases) {
$("#ItemsToDelete").append("<li>" + selected_aliases[i] + "</li>");
}
});
})
$('#ConfirmDeleteModal').modal({
backdrop: 'static',
keyboard: false
})
.one('click', '#IsConfirmed', function(e) {
$.ajax({
type: "POST",
dataType: "json",
data: { "address": JSON.stringify(selected_aliases) },
url: '/api/v1/delete/alias/post',
jsonp: false,
complete: function (data) {
location.reload();
}
});
})
.one('click', '#isCanceled', function(e) {
$('#ConfirmDeleteModal').modal('hide');
});;
}
});

View File

@ -9,6 +9,12 @@ $lang['header']['restart_sogo'] = 'SOGo neustarten';
$lang['footer']['restart_sogo'] = 'SOGo neustarten';
$lang['footer']['restart_now'] = 'Jetzt neustarten';
$lang['footer']['restart_sogo_info'] = 'Einige Änderungen an Domains benötigen einen Neustart SOGos. Hier können Sie SOGo neustarten.<br /><br /><b>Wichtig:</b> Ein korrekter Neustart SOGos kann eine Weile in Anspruch nehmen, bitte warten Sie, bis der Prozess vollständig beendet wurde.';
$lang['footer']['confirm_delete'] = 'Löschen bestätigen';
$lang['footer']['delete_these_items'] = 'Sind Sie sicher, dass die folgenden Elemente entfernt werden sollen?';
$lang['footer']['delete_now'] = 'Jetzt löschen';
$lang['footer']['cancel'] = 'Abbrechen';
$lang['dkim']['confirm'] = 'Sind Sie sicher?';
$lang['danger']['dkim_not_found'] = 'DKIM-Key nicht gefunden';
$lang['danger']['dkim_remove_failed'] = 'Kann DKIM-Key nicht entfernen';
@ -249,9 +255,12 @@ $lang['mailbox']['add_mailbox'] = 'Mailbox hinzufügen';
$lang['mailbox']['add_resource'] = 'Ressource hinzufügen';
$lang['mailbox']['add_alias'] = 'Alias hinzufügen';
$lang['mailbox']['empty'] = 'Keine Einträge vorhanden';
$lang['mailbox']['toggle_all'] = 'Alle';
$lang['mailbox']['quick_actions'] = 'Aktionen';
$lang['mailbox']['activate'] = 'Aktivieren';
$lang['mailbox']['deactivate'] = 'Deaktivieren';
$lang['info']['no_action'] = 'Keine Aktion anwendbar';
$lang['delete']['title'] = 'Objekt entfernen';
$lang['delete']['remove_domain_warning'] = '<b>Warnung:</b> Sie entfernen die Domain <b>%s</b>!';
$lang['delete']['remove_domainalias_warning'] = '<b>Warnung:</b> Sie entfernen die Alias-Domain <b>%s</b>!';

View File

@ -9,6 +9,12 @@ $lang['header']['restart_sogo'] = 'Restart SOGo';
$lang['footer']['restart_sogo'] = 'Restart SOGo';
$lang['footer']['restart_now'] = 'Restart now';
$lang['footer']['restart_sogo_info'] = 'Some tasks, e.g. adding a domain, require you to restart SOGo to catch changes made in the mailcow UI.<br /><br /><b>Important:</b> A graceful restart may take a while to complete, please wait for it to finish.';
$lang['footer']['confirm_delete'] = 'Confirm deletion';
$lang['footer']['delete_these_items'] = 'Are you sure you want to delete the following items?';
$lang['footer']['delete_now'] = 'Delete now';
$lang['footer']['cancel'] = 'Cancel';
$lang['dkim']['confirm'] = "Are you sure?";
$lang['danger']['dkim_not_found'] = "DKIM key not found";
$lang['danger']['dkim_remove_failed'] = "Cannot remove selected DKIM key";
@ -252,6 +258,10 @@ $lang['mailbox']['add_resource'] = 'Add resource';
$lang['mailbox']['add_alias'] = 'Add alias';
$lang['mailbox']['add_domain_record_first'] = 'Please add a domain first';
$lang['mailbox']['empty'] = 'No results';
$lang['mailbox']['toggle_all'] = 'Toggle all';
$lang['mailbox']['quick_actions'] = 'Quick actions';
$lang['mailbox']['activate'] = 'Activate';
$lang['mailbox']['deactivate'] = 'Deactivate';
$lang['info']['no_action'] = 'No action applicable';

View File

@ -101,17 +101,16 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
<div class="table-responsive">
<table id="alias_table" class="table table-striped"></table>
</div>
<div class="mass-actions">
<span id="select_all_aliases" class="mass-select-all"><?=$lang['mailbox']['toggle_all'];?></span>
<span>&ndash; <?=$lang['mailbox']['quick_actions'];?>:
<a id="delete_selected_alias" href="#" class="mass-each-action"><?=$lang['mailbox']['remove'];?></a> |
<a id="activate_selected_alias" href="#" class="mass-each-action"><?=$lang['mailbox']['activate'];?></a> |
<a id="deactivate_selected_alias" href="#" class="mass-each-action"><?=$lang['mailbox']['deactivate'];?></a>
</span>
</div>
<span class="footer-add-item"><a href="/add.php?alias"><?=$lang['mailbox']['add_alias'];?></a></span>
</div>
<hr>
<div class="mass-actions">
<span id="select_all_aliases" class="mass-select-all">Toggle all</span>
<span>&ndash; Quick actions:
<a id="delete_selected_alias" href="#" class="mass-each-action">delete</a> |
<a id="activate_selected_alias" href="#" class="mass-each-action">activate</a> |
<a id="deactivate_selected_alias" href="#" class="mass-each-action">deactivate</a>
</span>
</div>
</div>
</div> <!-- /tab-content -->