pandorafms/pandora_console/include/javascript/massive_operations.js

97 lines
1.9 KiB
JavaScript
Raw Normal View History

2021-02-12 11:28:13 +01:00
/** global $ */
function massiveOperationValidation(contents, totalCount, limit, thisForm) {
var output = false;
// If the amount of changes exceed the limit, the operation stops.
if (totalCount > limit) {
2021-03-04 11:33:21 +01:00
showMassiveModal(contents);
2021-02-12 11:28:13 +01:00
return false;
} else {
confirmDialog({
title: contents.title,
message: contents.question,
ok: contents.ok,
cancel: contents.cancel,
onAccept: function() {
showSpinner();
output = true;
$("#" + thisForm).submit();
},
onDeny: function() {
hideSpinner();
return false;
}
});
}
return output;
}
2021-03-04 11:33:21 +01:00
function showMassiveModal(contents) {
$("#massive_modal")
.empty()
.html(contents.html);
// Set the title.
$("#massive_modal").prop("title", contents.title);
// Build the dialog for show the mesage.
$("#massive_modal").dialog({
resizable: true,
draggable: true,
modal: true,
width: 800,
buttons: [
{
text: "OK",
click: function() {
hideSpinner();
$(this).dialog("close");
return false;
}
}
],
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
}
});
}
2021-02-12 11:28:13 +01:00
/*
function showMassiveOperationMessage(message) {
$("#massive_modal")
.empty()
.html(message);
$("#massive_modal").prop("title", "Massive operations");
$("#massive_modal").dialog({
resizable: true,
draggable: true,
modal: true,
width: 800,
buttons: [
{
text: "OK",
click: function() {
$(this).dialog("close");
hideSpinner();
}
}
],
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
}
});
}
*/