add access checks for summaries, add Revision summary

This commit is contained in:
Uwe Steinmann 2019-11-25 20:48:11 +01:00
parent ac570b09e9
commit 293e26c747
3 changed files with 238 additions and 0 deletions

View File

@ -0,0 +1,56 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
if(!isset($settings))
require_once("../inc/inc.Settings.php");
require_once("inc/inc.LogInit.php");
require_once("inc/inc.Language.php");
require_once("inc/inc.Init.php");
require_once("inc/inc.Extension.php");
require_once("inc/inc.DBInit.php");
require_once("inc/inc.ClassUI.php");
require_once("inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!$accessop->check_view_access($view, $_GET)) {
UI::exitError(getMLText("my_documents"),getMLText("access_denied"));
}
if ($user->isGuest()) {
UI::exitError(getMLText("my_documents"),getMLText("access_denied"));
}
if($view) {
$view->setParam('showtree', showtree());
$view->setParam('cachedir', $settings->_cacheDir);
$view->setParam('previewWidthList', $settings->_previewWidthList);
$view->setParam('previewconverters', $settings->_converters['preview']);
$view->setParam('timeout', $settings->_cmdTimeout);
$view->setParam('accessobject', $accessop);
$view->setParam('xsendfile', $settings->_enableXsendfile);
$view->setParam('onepage', $settings->_onePageMode); // do most navigation by reloading areas of pages with ajax
$view($_GET);
exit;
}
?>

View File

@ -757,12 +757,18 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['inprocess'] = array('link'=>"../out/out.MyDocuments.php?inProcess=1", 'label'=>'documents_in_process');
$menuitems['all_documents'] = array('link'=>"../out/out.MyDocuments.php", 'label'=>'all_documents');
if($this->params['workflowmode'] == 'traditional' || $this->params['workflowmode'] == 'traditional_only_approval') {
if ($accessobject->check_view_access('ReviewSummary'))
$menuitems['review_summary'] = array('link'=>"../out/out.ReviewSummary.php", 'label'=>'review_summary');
if ($accessobject->check_view_access('ApprovalSummary'))
$menuitems['approval_summary'] = array('link'=>"../out/out.ApprovalSummary.php", 'label'=>'approval_summary');
} else {
if ($accessobject->check_view_access('WorkflowSummary'))
$menuitems['workflow_summary'] = array('link'=>"../out/out.WorkflowSummary.php", 'label'=>'workflow_summary');
}
if ($accessobject->check_view_access('ReceiptSummary'))
$menuitems['receipt_summary'] = array('link'=>"../out/out.ReceiptSummary.php", 'label'=>'receipt_summary');
if ($accessobject->check_view_access('RevisionSummary'))
$menuitems['revision_summary'] = array('link'=>"../out/out.RevisionSummary.php", 'label'=>'revision_summary');
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('mydocumentsNavigationBar'))

View File

@ -0,0 +1,176 @@
<?php
/**
* Implementation of ReviewSummary view
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
require_once("class.Bootstrap.php");
/**
* Include class to preview documents
*/
require_once("SeedDMS/Preview.php");
/**
* Class which outputs the html page for ReviewSummary view
*
* @category DMS
* @package SeedDMS
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_RevisionSummary extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
$this->printDeleteDocumentButtonJs();
$this->printClickDocumentJs();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
$previewer->setConverters($previewconverters);
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("my_documents"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("my_documents"), "my_documents");
echo "<div class=\"row-fluid\">\n";
echo "<div class=\"span6\">\n";
$this->contentHeading(getMLText("revision_summary"));
// $this->contentContainerStart();
// TODO: verificare scadenza
// Get document list for the current user.
$revisionStatus = $user->getRevisionStatus();
// reverse order
$revisionStatus["indstatus"]=array_reverse($revisionStatus["indstatus"],true);
$revisionStatus["grpstatus"]=array_reverse($revisionStatus["grpstatus"],true);
$printheader=true;
$iRev = array();
foreach ($revisionStatus["indstatus"] as $st) {
$document = $dms->getDocument($st['documentID']);
$version = $document->getContentByVersion($st['version']);
$moduser = $dms->getUser($st['required']);
if ($document && $version) {
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("next_revision_abbr")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
$sammel[] = array($document->getID(), $version->getVersion);
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
$class = $st['status'] == 1 ? ' success' : ($st['status'] == -1 ? ' error' : ( $st['status'] == -2 ? ' info' : ''));
echo $this->documentListRowStart($document, $class);
echo $this->documentListRow($document, $previewer, true, $st['version']);
print "<td><small>".getRevisionStatusText($st['status'])."<br />".$st["date"]."<br />". htmlspecialchars($moduser->getFullName()) ."</small></td>";
print "<td><small>".$version->getRevisionDate()."</small></td>";
echo $this->documentListRowEnd($document);
}
}
if ($st["status"]!=-2) {
$iRev[] = $st["documentID"];
}
}
if (!$printheader) {
echo "</tbody>\n</table>";
} else {
printMLText("no_revision_needed");
}
// $this->contentContainerEnd();
echo "</div>\n";
echo "<div class=\"span6\">\n";
$this->contentHeading(getMLText("group_revision_summary"));
// $this->contentContainerStart();
$printheader=true;
foreach ($revisionStatus["grpstatus"] as $st) {
$document = $dms->getDocument($st['documentID']);
$version = $document->getContentByVersion($st['version']);
$modgroup = $dms->getGroup($st['required']);
if (!in_array($st["documentID"], $iRev) && $document && $version) {
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
$class = $st['status'] == 1 ? ' success' : ($st['status'] == -1 ? ' error' : ( $st['status'] == -2 ? ' info' : ''));
// print "<tr id=\"table-row-document-".$st['documentID']."\" class=\"table-row-document".$class."\" rel=\"document_".$st['documentID']."\" formtoken=\"".createFormKey('movedocument')."\" draggable=\"true\">";
echo $this->documentListRowStart($document, $class);
echo $this->documentListRow($document, $previewer, true, $st['version']);
print "<td><small>".getReviewStatusText($st['status'])."<br />".$st["date"]."<br />". htmlspecialchars($modgroup->getName()) ."</small></td>";
print "</tr>\n";
}
}
}
if (!$printheader) {
echo "</tbody>\n</table>";
}else{
printMLText("no_revision_needed");
}
// $this->contentContainerEnd();
echo "</div>\n";
echo "</div>\n";
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */
}
?>