mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 07:22:11 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
bb779c678c
|
@ -7,4 +7,3 @@ $__lang['en_GB'] = array(
|
|||
'folder_contents' => 'This used to be "Folder contents". Was changed by sample Extension.',
|
||||
'task_example_example_email' => 'Email',
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -33,13 +33,13 @@ function formatted_size($size_bytes) { /* {{{ */
|
|||
* dd for %d
|
||||
* This functions returns the converted format
|
||||
*/
|
||||
function getConvertDateFormat() {
|
||||
function getConvertDateFormat() { /* {{{ */
|
||||
global $settings;
|
||||
if($settings->_dateformat) {
|
||||
return str_replace(['y', 'Y', 'm', 'M', 'F', 'd', 'l', 'D'], ['yy', 'yyyy', 'mm', 'M', 'MM', 'dd', 'DD', 'D'], $settings->_dateformat);
|
||||
} else
|
||||
return 'yyyy-mm-dd';
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
function getReadableDate($timestamp=0) { /* {{{ */
|
||||
global $settings;
|
||||
|
@ -436,24 +436,24 @@ function _add_log_line($msg="") { /* {{{ */
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
function getFolderPathHTML($folder, $tagAll=false, $document=null) { /* {{{ */
|
||||
$path = $folder->getPath();
|
||||
$txtpath = "";
|
||||
for ($i = 0; $i < count($path); $i++) {
|
||||
if ($i +1 < count($path)) {
|
||||
$txtpath .= "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
|
||||
htmlspecialchars($path[$i]->getName())."</a> / ";
|
||||
}
|
||||
else {
|
||||
$txtpath .= ($tagAll ? "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
|
||||
htmlspecialchars($path[$i]->getName())."</a>" : htmlspecialchars($path[$i]->getName()));
|
||||
}
|
||||
function getFolderPathHTML($folder, $tagAll=false, $document=null) { /* {{{ */
|
||||
$path = $folder->getPath();
|
||||
$txtpath = "";
|
||||
for ($i = 0; $i < count($path); $i++) {
|
||||
if ($i +1 < count($path)) {
|
||||
$txtpath .= "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
|
||||
htmlspecialchars($path[$i]->getName())."</a> / ";
|
||||
}
|
||||
if($document)
|
||||
$txtpath .= " / <a href=\"../out/out.ViewDocument.php?documentid=".$document->getId()."\">".htmlspecialchars($document->getName())."</a>";
|
||||
else {
|
||||
$txtpath .= ($tagAll ? "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
|
||||
htmlspecialchars($path[$i]->getName())."</a>" : htmlspecialchars($path[$i]->getName()));
|
||||
}
|
||||
}
|
||||
if($document)
|
||||
$txtpath .= " / <a href=\"../out/out.ViewDocument.php?documentid=".$document->getId()."\">".htmlspecialchars($document->getName())."</a>";
|
||||
|
||||
return $txtpath;
|
||||
} /* }}} */
|
||||
return $txtpath;
|
||||
} /* }}} */
|
||||
|
||||
function showtree() { /* {{{ */
|
||||
global $settings;
|
||||
|
@ -806,6 +806,82 @@ function createNonce() { /* {{{ */
|
|||
return base64_encode($bytes);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns the mandatory reviewers
|
||||
*
|
||||
* This function checks if the reviewers have at least read access
|
||||
* on the folder containing the document.
|
||||
*
|
||||
* @param $folder folder where document is located
|
||||
* @param $user user creating the new version or document
|
||||
* @return array
|
||||
*/
|
||||
function getMandatoryReviewers($folder, $user) { /* {{{ */
|
||||
global $settings;
|
||||
|
||||
/* Get a list of all users and groups with read access on the folder.
|
||||
* Only those users and groups will be added as reviewers
|
||||
*/
|
||||
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||
$res=$user->getMandatoryReviewers();
|
||||
$reviewers = array('i'=>[], 'g'=>[]);
|
||||
foreach ($res as $r){
|
||||
if ($r['reviewerUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['reviewerUserID']){
|
||||
$reviewers["i"][] = $r['reviewerUserID'];
|
||||
break;
|
||||
}
|
||||
} elseif ($r['reviewerGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['reviewerGroupID']){
|
||||
$reviewers["g"][] = $r['reviewerGroupID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $reviewers;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns the mandatory approvers
|
||||
*
|
||||
* This function checks if the approvers have at least read access
|
||||
* on the folder containing the document.
|
||||
*
|
||||
* @param $folder folder where document is located
|
||||
* @param $user user creating the new version or document
|
||||
* @return array
|
||||
*/
|
||||
function getMandatoryApprovers($folder, $user) { /* {{{ */
|
||||
global $settings;
|
||||
|
||||
/* Get a list of all users and groups with read access on the folder.
|
||||
* Only those users and groups will be added as approvers
|
||||
*/
|
||||
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||
$res=$user->getMandatoryApprovers();
|
||||
$approvers = array('i'=>[], 'g'=>[]);
|
||||
foreach ($res as $r){
|
||||
|
||||
if ($r['approverUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['approverUserID']){
|
||||
$approvers["i"][] = $r['approverUserID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ($r['approverGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['approverGroupID']){
|
||||
$approvers["g"][] = $r['approverGroupID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $approvers;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Class for creating encrypted api keys
|
||||
*
|
||||
|
|
|
@ -226,45 +226,15 @@ if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'tra
|
|||
}
|
||||
|
||||
// add mandatory reviewers/approvers
|
||||
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$res=$user->getMandatoryReviewers();
|
||||
foreach ($res as $r){
|
||||
|
||||
if ($r['reviewerUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['reviewerUserID']){
|
||||
$reviewers["i"][] = $r['reviewerUserID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ($r['reviewerGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['reviewerGroupID']){
|
||||
$reviewers["g"][] = $r['reviewerGroupID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$mreviewers = getMandatoryReviewers($folder, $user);
|
||||
if($mreviewers['i'])
|
||||
$reviewers['i'] = array_merge($reviewers['i'], $mreviewers['i']);
|
||||
}
|
||||
$res=$user->getMandatoryApprovers();
|
||||
foreach ($res as $r){
|
||||
$mapprovers = getMandatoryApprovers($folder, $user);
|
||||
if($mapprovers['i'])
|
||||
$approvers['i'] = array_merge($approvers['i'], $mapprovers['i']);
|
||||
|
||||
if ($r['approverUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['approverUserID']){
|
||||
$approvers["i"][] = $r['approverUserID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ($r['approverGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['approverGroupID']){
|
||||
$approvers["g"][] = $r['approverGroupID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($settings->_workflowMode == 'traditional' && !$settings->_allowReviewerOnly) {
|
||||
/* Check if reviewers are send but no approvers */
|
||||
if(($reviewers["i"] || $reviewers["g"]) && !$approvers["i"] && !$approvers["g"]) {
|
||||
|
|
|
@ -233,45 +233,15 @@ default:
|
|||
}
|
||||
|
||||
// add mandatory reviewers/approvers
|
||||
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$res=$user->getMandatoryReviewers();
|
||||
foreach ($res as $r){
|
||||
|
||||
if ($r['reviewerUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['reviewerUserID']){
|
||||
$reviewers["i"][] = $r['reviewerUserID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ($r['reviewerGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['reviewerGroupID']){
|
||||
$reviewers["g"][] = $r['reviewerGroupID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$mreviewers = getMandatoryReviewers($folder, $user);
|
||||
if($mreviewers['i'])
|
||||
$reviewers['i'] = array_merge($reviewers['i'], $mreviewers['i']);
|
||||
}
|
||||
$res=$user->getMandatoryApprovers();
|
||||
foreach ($res as $r){
|
||||
$mapprovers = getMandatoryApprovers($folder, $user);
|
||||
if($mapprovers['i'])
|
||||
$approvers['i'] = array_merge($approvers['i'], $mapprovers['i']);
|
||||
|
||||
if ($r['approverUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['approverUserID']){
|
||||
$approvers["i"][] = $r['approverUserID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ($r['approverGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['approverGroupID']){
|
||||
$approvers["g"][] = $r['approverGroupID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($settings->_workflowMode == 'traditional' && !$settings->_allowReviewerOnly) {
|
||||
/* Check if reviewers are send but no approvers */
|
||||
if(($reviewers["i"] || $reviewers["g"]) && !$approvers["i"] && !$approvers["g"]) {
|
||||
|
|
|
@ -716,6 +716,20 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
if($this->logger)
|
||||
$this->logger->log('PUT: adding new version', PEAR_LOG_INFO);
|
||||
|
||||
$reviewers = array('i'=>[], 'g'=>[]);
|
||||
$approvers = array('i'=>[], 'g'=>[]);
|
||||
$workflow = null;
|
||||
if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'traditional_only_approval') {
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$reviewers = getMandatoryReviewers($document->getFolder(), $this->user);
|
||||
}
|
||||
$approvers = getMandatoryApprovers($document->getFolder(), $this->user);
|
||||
} elseif($settings->_workflowMode == 'advanced') {
|
||||
if($workflows = $user->getMandatoryWorkflows()) {
|
||||
$workflow = array_shift($workflows);
|
||||
}
|
||||
}
|
||||
|
||||
$controller = Controller::factory('UpdateDocument');
|
||||
$controller->setParam('dms', $this->dms);
|
||||
$controller->setParam('user', $this->user);
|
||||
|
@ -728,10 +742,10 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
$controller->setParam('userfilename', $name);
|
||||
$controller->setParam('filetype', $fileType);
|
||||
$controller->setParam('userfiletype', $mimetype);
|
||||
$controller->setParam('reviewers', array());
|
||||
$controller->setParam('approvers', array());
|
||||
$controller->setParam('reviewers', $reviewers);
|
||||
$controller->setParam('approvers', $approvers);
|
||||
$controller->setParam('attributes', array());
|
||||
$controller->setParam('workflow', null);
|
||||
$controller->setParam('workflow', $workflow);
|
||||
|
||||
if(!$content = $controller->run()) {
|
||||
// if(!$document->addContent('', $this->user, $tmpFile, $name, $fileType, $mimetype, array(), array(), 0)) {
|
||||
|
@ -784,6 +798,20 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
}
|
||||
*/
|
||||
|
||||
$reviewers = array('i'=>[], 'g'=>[]);
|
||||
$approvers = array('i'=>[], 'g'=>[]);
|
||||
$workflow = null;
|
||||
if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'traditional_only_approval') {
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$reviewers = getMandatoryReviewers($folder, $this->user);
|
||||
}
|
||||
$approvers = getMandatoryApprovers($folder, $this->user);
|
||||
} elseif($settings->_workflowMode == 'advanced') {
|
||||
if($workflows = $user->getMandatoryWorkflows()) {
|
||||
$workflow = array_shift($workflows);
|
||||
}
|
||||
}
|
||||
|
||||
$controller = Controller::factory('AddDocument');
|
||||
$controller->setParam('dms', $this->dms);
|
||||
$controller->setParam('user', $this->user);
|
||||
|
@ -805,13 +833,13 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
$controller->setParam('sequence', $minmax['min'] - 1);
|
||||
else
|
||||
$controller->setParam('sequence', $minmax['max'] + 1);
|
||||
$controller->setParam('reviewers', array());
|
||||
$controller->setParam('approvers', array());
|
||||
$controller->setParam('reviewers', $reviewers);
|
||||
$controller->setParam('approvers', $approvers);
|
||||
$controller->setParam('reqversion', 0);
|
||||
$controller->setParam('versioncomment', '');
|
||||
$controller->setParam('attributes', array());
|
||||
$controller->setParam('attributesversion', array());
|
||||
$controller->setParam('workflow', null);
|
||||
$controller->setParam('workflow', $workflow);
|
||||
$controller->setParam('notificationgroups', array());
|
||||
$controller->setParam('notificationusers', array());
|
||||
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
|
||||
|
@ -1343,7 +1371,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
return "204 No Content";
|
||||
} elseif(get_class($objdest) == $this->dms->getClassname('folder')) {
|
||||
if($this->logger)
|
||||
$this->logger->log('COPY: copy \''.$objdest->getName().'\' to folder '.$objdest->getName().'', PEAR_LOG_INFO);
|
||||
$this->logger->log('COPY: copy \''.$objsource->getName().'\' to folder '.$objdest->getName().'', PEAR_LOG_INFO);
|
||||
|
||||
/* Currently no support for copying folders */
|
||||
if(get_class($objsource) == $this->dms->getClassname('folder')) {
|
||||
|
@ -1365,6 +1393,20 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
}
|
||||
*/
|
||||
|
||||
$reviewers = array('i'=>[], 'g'=>[]);
|
||||
$approvers = array('i'=>[], 'g'=>[]);
|
||||
$workflow = null;
|
||||
if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'traditional_only_approval') {
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$reviewers = getMandatoryReviewers($objdest, $this->user);
|
||||
}
|
||||
$approvers = getMandatoryApprovers($objdest, $this->user);
|
||||
} elseif($settings->_workflowMode == 'advanced') {
|
||||
if($workflows = $user->getMandatoryWorkflows()) {
|
||||
$workflow = array_shift($workflows);
|
||||
}
|
||||
}
|
||||
|
||||
/* get the latest content of the source object */
|
||||
$content = $objsource->getLatestContent();
|
||||
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
||||
|
@ -1390,13 +1432,13 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
$controller->setParam('sequence', $minmax['min'] - 1);
|
||||
else
|
||||
$controller->setParam('sequence', $minmax['max'] + 1);
|
||||
$controller->setParam('reviewers', array());
|
||||
$controller->setParam('approvers', array());
|
||||
$controller->setParam('reviewers', $reviewers);
|
||||
$controller->setParam('approvers', $approvers);
|
||||
$controller->setParam('reqversion', 0);
|
||||
$controller->setParam('versioncomment', '');
|
||||
$controller->setParam('attributes', array());
|
||||
$controller->setParam('attributesversion', array());
|
||||
$controller->setParam('workflow', null);
|
||||
$controller->setParam('workflow', $workflow);
|
||||
$controller->setParam('notificationgroups', array());
|
||||
$controller->setParam('notificationusers', array());
|
||||
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
|
||||
|
|
Loading…
Reference in New Issue
Block a user