fix deletion of task when using bootstrap4 theme

This commit is contained in:
Uwe Steinmann 2022-05-31 14:25:23 +02:00
parent c6470efc6f
commit 7ba81f50e3

View File

@ -28,6 +28,7 @@
class SeedDMS_View_SchedulerTaskMgr extends SeedDMS_Theme_Style {
function js() { /* {{{ */
$theme = $this->params['theme'];
header('Content-Type: application/javascript');
?>
$(document).ready( function() {
@ -53,6 +54,7 @@ $(document).ready( function() {
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
msg = $(ev.currentTarget).attr('msg');
formtoken = '<?= createFormKey('removetask') ?>';
<?php if($theme == 'bootstrap'): ?>
bootbox.dialog(confirmmsg, [{
"label" : "<i class='fa fa-remove'></i> <?= getMLText("rm_task") ?>",
"class" : "btn-danger",
@ -90,6 +92,51 @@ $(document).ready( function() {
"callback": function() {
}
}]);
<?php else: ?>
bootbox.confirm({
"message": confirmmsg,
"buttons": {
"confirm": {
"label" : "<i class='fa fa-remove'></i> <?= getMLText("rm_task") ?>",
"className" : "btn-danger",
},
"cancel": {
"label" : "<?= getMLText("cancel") ?>",
"className" : "btn-secondary",
}
},
"callback": function(result) {
if(result) {
$.post('../op/op.SchedulerTaskMgr.php',
{ action: 'removetask', taskid: id, formtoken: formtoken },
function(data) {
if(data.success) {
$('#table-row-task-'+id).hide('slow');
noty({
text: msg,
type: 'success',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
} else {
noty({
text: data.message,
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 3500,
});
}
},
'json'
);
}
}
});
<?php endif ?>
});
});
<?php
@ -469,8 +516,6 @@ $(document).ready( function() {
$extname = $this->params['extname'];
$taskname = $this->params['taskname'];
$scheduler = $this->params['scheduler'];
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();