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

This commit is contained in:
Uwe Steinmann 2024-11-11 09:29:51 +01:00
commit ca79b730ff
5 changed files with 71 additions and 22 deletions

View File

@ -304,6 +304,7 @@
--------------------------------------------------------------------------------
Changes in version 5.1.37
--------------------------------------------------------------------------------
- do not show chart by category if there are no categories
--------------------------------------------------------------------------------
Changes in version 5.1.36

View File

@ -13,11 +13,6 @@
* @version Release: @package_version@
*/
/**
* Include parent class
*/
//require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for Charts view
*
@ -229,8 +224,28 @@ $(document).ready( function() {
}
} /* }}} */
function show() { /* {{{ */
$this->dms = $this->params['dms'];
/**
* Check if it makes sense to show the chart
*
* e.g. it doesn't make sense to show the documents by category if
* there are no categories.
*
* @param string $type
* @return boolean
*/
private function showChart($type) { /* {{{ */
$dms = $this->params['dms'];
if($type == 'docspercategory') {
if($cats = $dms->getDocumentCategories())
return true;
else
return false;
}
return true;
} /* }}} */
public function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$data = $this->params['data'];
$type = $this->params['type'];
@ -251,7 +266,8 @@ $(document).ready( function() {
$this->contentHeading(getMLText("chart_selection"));
$this->contentContainerStart();
foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'sizepermonth','docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) {
echo "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
if($this->showChart($atype))
echo "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
}
$this->contentContainerEnd();
$this->columnEnd();

View File

@ -195,6 +195,38 @@ class SeedDMS_View_Tasks extends SeedDMS_Theme_Style {
return $tasks;
} /* }}} */
/**
* Returns the number of tasks
*
* @return array list of tasks an its number
*/
function countTasks() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
$enablerevisionworkflow = $this->params['enablerevisionworkflow'];
$workflowmode = $this->params['workflowmode'];
$tasksinmenu = $this->params['tasksinmenu'];
$startts = microtime(true);
$tasks = array();
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval')
if(!$tasksinmenu || in_array('approval', $tasksinmenu)) {
$tasks['approval'] = $dms->countTasks('ApproveByMe', $user);
}
if($workflowmode == 'traditional')
if(!$tasksinmenu || in_array('review', $tasksinmenu)) {
$tasks['review'] = $dms->countTasks('ReviewByMe', $user);
}
if($workflowmode == 'advanced')
if(!$tasksinmenu || in_array('workflow', $tasksinmenu)) {
$tasks['workflow'] = $dms->countTasks('WorkflowByMe', $user);
}
header('Content-Type: application/json');
echo json_encode(array('error'=>0, 'data'=>$tasks, 'processing_time'=>microtime(true)-$startts));
} /* }}} */
/**
* Returns the html needed for the task list in the menu
*

View File

@ -1618,17 +1618,17 @@ $(document).ready(function() { /* {{{ */
$.ajax({url: seeddms_webroot+'out/out.Tasks.php',
type: 'GET',
dataType: "json",
data: {action: 'mytasks'},
data: {action: 'counttasks'},
success: function(data) {
if(data) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval.length) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review.length) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow.length)) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow)) {
// $("#menu-tasks").html('Loading').hide().load('../out/out.Tasks.php?action=menutasks').fadeIn('500')
$('#menu-tasks > div.ajax').trigger('update', {folderid: seeddms_folder});
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval.length : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review.length : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow.length : 0;
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow : 0;
}
}
},

View File

@ -1697,17 +1697,17 @@ $(document).ready(function() { /* {{{ */
$.ajax({url: seeddms_webroot+'out/out.Tasks.php',
type: 'GET',
dataType: "json",
data: {action: 'mytasks'},
data: {action: 'counttasks'},
success: function(data) {
if(data) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval.length) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review.length) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow.length)) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow)) {
// $("#menu-tasks").html('Loading').hide().load('../out/out.Tasks.php?action=menutasks').fadeIn('500')
$('#menu-tasks > div.ajax').trigger('update', {folderid: seeddms_folder});
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval.length : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review.length : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow.length : 0;
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow : 0;
}
}
},