mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
count workflows to trigger if workflowmode='advanced'
This commit is contained in:
parent
f594d1ef62
commit
d017726984
|
@ -32,6 +32,7 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
|||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
|
||||
if($view) {
|
||||
$view->setParam('workflowmode', $settings->_workflowMode);
|
||||
$view->setParam('previewWidthList', $settings->_previewWidthList);
|
||||
$view->setParam('timeout', $settings->_cmdTimeout);
|
||||
$view($_GET);
|
||||
|
|
|
@ -1003,7 +1003,7 @@ $(document).ready(function() { /* {{{ */
|
|||
});
|
||||
}); /* }}} */
|
||||
|
||||
var approval_count, review_count, receipt_count, revision_count;
|
||||
var approval_count, review_count, workflow_count;
|
||||
var checkTasks = function() {
|
||||
$.ajax({url: '../out/out.Tasks.php',
|
||||
type: 'GET',
|
||||
|
@ -1011,11 +1011,13 @@ $(document).ready(function() { /* {{{ */
|
|||
data: {action: 'mytasks'},
|
||||
success: function(data) {
|
||||
if(data) {
|
||||
if(approval_count != data.data.approval.length ||
|
||||
review_count != data.data.review.length) {
|
||||
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)) {
|
||||
$("#menu-tasks > ul > li").html('Loading').hide().load('../out/out.Tasks.php?action=menutasks').fadeIn('500')
|
||||
approval_count = data.data.approval.length;
|
||||
review_count = data.data.review.length;
|
||||
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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -39,25 +39,42 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
private function __myTasks() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$tasks['review'] = array();
|
||||
$tasks['approval'] = array();
|
||||
$tasks['receipt'] = array();
|
||||
$tasks['revision'] = array();
|
||||
$resArr = $dms->getDocumentList('ApproveByMe', $user);
|
||||
if($resArr) {
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$tasks['approval'][] = array('id'=>$res['id'], 'name'=>$res['name']);
|
||||
$workflowmode = $this->params['workflowmode'];
|
||||
if($workflowmode == 'traditional')
|
||||
$tasks['review'] = array();
|
||||
elseif($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval')
|
||||
$tasks['approval'] = array();
|
||||
elseif($workflowmode == 'advanced')
|
||||
$tasks['workflow'] = array();
|
||||
|
||||
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
||||
$resArr = $dms->getDocumentList('ApproveByMe', $user);
|
||||
if($resArr) {
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$tasks['approval'][] = array('id'=>$res['id'], 'name'=>$res['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$resArr = $dms->getDocumentList('ReviewByMe', $user);
|
||||
if($resArr) {
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$tasks['review'][] = array('id'=>$res['id'], 'name'=>$res['name']);
|
||||
} elseif($workflowmode == 'traditional') {
|
||||
$resArr = $dms->getDocumentList('ReviewByMe', $user);
|
||||
if($resArr) {
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$tasks['review'][] = array('id'=>$res['id'], 'name'=>$res['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif($workflowmode == 'advanced') {
|
||||
$resArr = $dms->getDocumentList('WorkflowByMe', $user);
|
||||
if($resArr) {
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$tasks['workflow'][] = array('id'=>$res['id'], 'name'=>$res['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,11 +121,20 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$content = '';
|
||||
// $content .= " <ul id=\"main-menu-tasks\" class=\"nav pull-right\">\n";
|
||||
// $content .= " <li class=\"dropdown\">\n";
|
||||
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText('tasks')." (".count($tasks['review'])."/".count($tasks['approval']).")";
|
||||
if($tasks['review'] || $tasks['approval']) {
|
||||
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText('tasks')." (";
|
||||
$ct = array();
|
||||
if(isset($tasks['review']))
|
||||
$ct[] = count($tasks['review']);
|
||||
if(isset($tasks['approval']))
|
||||
$ct[] = count($tasks['approval']);
|
||||
if(isset($tasks['workflow']))
|
||||
$ct[] = count($tasks['workflow']);
|
||||
$content .= implode('/', $ct);
|
||||
$content .= ")";
|
||||
if(!empty($tasks['review']) || !empty($tasks['approval']) || !empty($tasks['workflow'])) {
|
||||
$content .= " <i class=\"icon-caret-down\"></i></a>\n";
|
||||
$content .= " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||
if($tasks['review']) {
|
||||
if(!empty($tasks['review'])) {
|
||||
$content .= " <li class=\"dropdown-submenu\">\n";
|
||||
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("documents_to_review")."</a>\n";
|
||||
$content .= " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||
|
@ -119,7 +145,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$content .= " </ul>\n";
|
||||
$content .= " </li>\n";
|
||||
}
|
||||
if($tasks['approval']) {
|
||||
if(!empty($tasks['approval'])) {
|
||||
$content .= " <li class=\"dropdown-submenu\">\n";
|
||||
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("documents_to_approve")."</a>\n";
|
||||
$content .= " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||
|
@ -130,6 +156,17 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$content .= " </ul>\n";
|
||||
$content .= " </li>\n";
|
||||
}
|
||||
if(!empty($tasks['workflow'])) {
|
||||
$content .= " <li class=\"dropdown-submenu\">\n";
|
||||
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("documents_to_trigger_workflow")."</a>\n";
|
||||
$content .= " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||
foreach($tasks['workflow'] as $t) {
|
||||
$doc = $dms->getDocument($t['id']);
|
||||
$content .= " <li><a href=\"../out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=workflow\">".$doc->getName()."</a></li>";
|
||||
}
|
||||
$content .= " </ul>\n";
|
||||
$content .= " </li>\n";
|
||||
}
|
||||
$content .= " <li class=\"divider\"></li>\n";
|
||||
$content .= " <li><a href=\"../out/out.MyDocuments.php\">".getMLText("my_documents")."</a></li>\n";
|
||||
$content .= " </ul>\n";
|
||||
|
|
Loading…
Reference in New Issue
Block a user