Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2020-09-25 08:53:55 +02:00
commit e38e16bf69
2 changed files with 45 additions and 34 deletions

View File

@ -1227,38 +1227,49 @@ $(document).ready(function() { /* {{{ */
}); });
}); /* }}} */ }); /* }}} */
var approval_count, review_count, receipt_count, revision_count, workflow_count, needscorrection_count; (function( SeedDMSTask, $, undefined ) { /* {{{ */
var checkTasks = function() { var approval_count, review_count, workflow_count;
$.ajax({url: '../out/out.Tasks.php', var timeout = 1000;
type: 'GET', var counter = 0;
dataType: "json", var tasks = Array(
data: {action: 'counttasks'}, {name: 'checktasks', interval: 15, func:
success: function(data) { checkTasks = function() {
if(data) { $.ajax({url: '../out/out.Tasks.php',
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval.length) || type: 'GET',
(typeof data.data.review != 'undefined' && review_count != data.data.review.length) || dataType: "json",
(typeof data.data.receipt != 'undefined' && receipt_count != data.data.receipt.length) || data: {action: 'mytasks'},
(typeof data.data.revision != 'undefined' && revision_count != data.data.revision.length) || success: function(data) {
(typeof data.data.needscorrection != 'undefined' && needscorrection_count != data.data.needscorrection.length) || if(data) {
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow.length)) { if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval.length) ||
// $("#menu-tasks").html('Loading').hide().load('../out/out.Tasks.php?action=menutasks').fadeIn('500') (typeof data.data.review != 'undefined' && review_count != data.data.review.length) ||
$('#menu-tasks > div.ajax').trigger('update', {folderid: seeddms_folder}); (typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow.length)) {
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval.length : 0; // $("#menu-tasks").html('Loading').hide().load('../out/out.Tasks.php?action=menutasks').fadeIn('500')
review_count = typeof data.data.review != 'undefined' ? data.data.review.length : 0; $('#menu-tasks > div.ajax').trigger('update', {folderid: seeddms_folder});
receipt_count = typeof data.data.receipt != 'undefined' ? data.data.receipt.length : 0; approval_count = typeof data.data.approval != 'undefined' ? data.data.approval.length : 0;
revision_count = typeof data.data.revision != 'undefined' ? data.data.revision.length : 0; review_count = typeof data.data.review != 'undefined' ? data.data.review.length : 0;
needscorrection_count = typeof data.data.needscorrection != 'undefined' ? data.data.needscorrection.length : 0; workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow.length : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow.length : 0; }
} }
} },
}, timeout: 3000
timeout: 10000 });
}); }
timeOutId = setTimeout(checkTasks, 60000); }
);
SeedDMSTask.add = function(task) {
tasks.push(task);
} }
var updateDropFolder = function() { SeedDMSTask.run = function() {
$('#menu-dropfolder > div.ajax').trigger('update', {folderid: seeddms_folder}); for(let task of tasks) {
timeOutId = setTimeout(updateDropFolder, 60000); if(counter % task.interval == 0) {
// console.log("Running task '" + task.name + "'");
task.func();
}
}
//console.log(counter);
counter++;
timeOutId = setTimeout(SeedDMSTask.run, timeout);
} }
}( window.SeedDMSTask = window.SeedDMSTask || {}, jQuery )); /* }}} */

View File

@ -184,10 +184,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo '<script src="'.$this->params['absbaseprefix'].'out/out.'.$this->params['class'].'.php?'.http_build_query($tmp).'"></script>'."\n"; echo '<script src="'.$this->params['absbaseprefix'].'out/out.'.$this->params['class'].'.php?'.http_build_query($tmp).'"></script>'."\n";
echo '<script src="../styles/'.$this->theme.'/application.js"></script>'."\n"; echo '<script src="../styles/'.$this->theme.'/application.js"></script>'."\n";
if($this->params['enablemenutasks'] && isset($this->params['user']) && $this->params['user']) { if($this->params['enablemenutasks'] && isset($this->params['user']) && $this->params['user']) {
$this->addFooterJS('checkTasks();'); $this->addFooterJS('SeedDMSTask.run();');
} }
if($this->params['enabledropfolderlist'] && isset($this->params['user']) && $this->params['user']) { if($this->params['enabledropfolderlist'] && isset($this->params['user']) && $this->params['user']) {
$this->addFooterJS('updateDropFolder();'); $this->addFooterJS("SeedDMSTask.add({name: 'dropfolder', interval: 15, func: function(){\$('#menu-dropfolder > div.ajax').trigger('update', {folderid: seeddms_folder});}});");
} }
if($this->footerjs) { if($this->footerjs) {
$jscode = "$(document).ready(function () {\n"; $jscode = "$(document).ready(function () {\n";