Merge branch 'seeddms-4.3.2' into develop

This commit is contained in:
Uwe Steinmann 2013-11-24 18:20:36 +01:00
commit cf867792b2
8 changed files with 160 additions and 33 deletions

View File

@ -2291,7 +2291,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
/** /**
* Get the current review status of the document content * Get the current review status of the document content
* The review status is a list of reviewers and its current status * The review status is a list of reviews and its current status
* *
* @param integer $limit the number of recent status changes per reviewer * @param integer $limit the number of recent status changes per reviewer
* @return array list of review status * @return array list of review status
@ -2303,7 +2303,9 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// Retrieve the current status of each assigned reviewer for the content // Retrieve the current status of each assigned reviewer for the content
// represented by this object. // represented by this object.
if (!isset($this->_reviewStatus)) { // FIXME: caching was turned off to make list of review log in ViewDocument
// possible
if (1 || !isset($this->_reviewStatus)) {
/* First get a list of all reviews for this document content */ /* First get a list of all reviews for this document content */
$queryStr= $queryStr=
"SELECT reviewID FROM tblDocumentReviewers WHERE `version`='".$this->_version "SELECT reviewID FROM tblDocumentReviewers WHERE `version`='".$this->_version
@ -2337,6 +2339,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return $this->_reviewStatus; return $this->_reviewStatus;
} /* }}} */ } /* }}} */
/**
* Get the current approval status of the document content
* The approval status is a list of approvals and its current status
*
* @param integer $limit the number of recent status changes per approver
* @return array list of approval status
*/
function getApprovalStatus($limit=1) { /* {{{ */ function getApprovalStatus($limit=1) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->_dms->getDB();
@ -2344,7 +2353,9 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// Retrieve the current status of each assigned approver for the content // Retrieve the current status of each assigned approver for the content
// represented by this object. // represented by this object.
if (!isset($this->_approvalStatus)) { // FIXME: caching was turned off to make list of approval log in ViewDocument
// possible
if (1 || !isset($this->_approvalStatus)) {
/* First get a list of all approvals for this document content */ /* First get a list of all approvals for this document content */
$queryStr= $queryStr=
"SELECT approveID FROM tblDocumentApprovers WHERE `version`='".$this->_version "SELECT approveID FROM tblDocumentApprovers WHERE `version`='".$this->_version
@ -2512,7 +2523,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* reviewers. In that case -4 will be returned. * reviewers. In that case -4 will be returned.
* If the given review status has been set by the user before, it cannot * If the given review status has been set by the user before, it cannot
* be set again and 0 will be returned. Іf the review could be succesfully * be set again and 0 will be returned. Іf the review could be succesfully
* added the review log id will be returned. * added, the review log id will be returned.
* *
* @see SeedDMS_Core_DocumentContent::setApprovalByInd() * @see SeedDMS_Core_DocumentContent::setApprovalByInd()
* @param object $user user doing the review * @param object $user user doing the review
@ -2731,10 +2742,10 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
/** /**
* Sets approval status of a document content for a user * Sets approval status of a document content for a user
*
* This function can be used to approve or reject a document content, or * This function can be used to approve or reject a document content, or
* to reset its approval state. The user initiating the approval may * to reset its approval state. In most cases this function will be
* not be the user filled in as an approver of the document content. * called by an user, but an admin may set the approval for
* In most cases this will be but an admin may set the approval for
* somebody else. * somebody else.
* It is first checked if the user is in the list of approvers at all. * It is first checked if the user is in the list of approvers at all.
* Then it is check if the approval status is already -2. In both cases * Then it is check if the approval status is already -2. In both cases

View File

@ -862,10 +862,10 @@ class Settings { /* {{{ */
* @return string path where file was found * @return string path where file was found
*/ */
function findInIncPath($file) { /* {{{ */ function findInIncPath($file) { /* {{{ */
$incarr = explode(':', ini_get('include_path')); $incarr = explode(PATH_SEPARATOR, ini_get('include_path'));
$found = ''; $found = '';
foreach($incarr as $path) { foreach($incarr as $path) {
if(file_exists($path.'/'.$file)) { if(file_exists($path.DIRECTORY_SEPARATOR.$file)) {
$found = $path; $found = $path;
} }
} }

View File

@ -71,15 +71,27 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
else else
$keywords = ''; $keywords = '';
$reqversion = (int)$_POST["reqversion"]; if(isset($_POST["reqversion"])) {
if ($reqversion<1) $reqversion=1; $reqversion = (int)$_POST["reqversion"];
if ($reqversion<1) $reqversion=1;
} else {
$reqversion = 1;
}
$sequence = $_POST["sequence"]; if(isset($_POST['sequence'])) {
if (!is_numeric($sequence)) { $sequence = $_POST["sequence"];
if (!is_numeric($sequence)) {
$sequence = 1;
}
} else {
$sequence = 1; $sequence = 1;
} }
$expires = ($_POST["expires"] == "true") ? mktime(0,0,0, intval($_POST["expmonth"]), intval($_POST["expday"]), intval($_POST["expyear"])) : false; if(isset($_POST["expires"])) {
$expires = ($_POST["expires"] == "true") ? mktime(0,0,0, intval($_POST["expmonth"]), intval($_POST["expday"]), intval($_POST["expyear"])) : false;
} else {
$expires = false;
}
// Get the list of reviewers and approvers for this document. // Get the list of reviewers and approvers for this document.
$reviewers = array(); $reviewers = array();
@ -162,17 +174,19 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
if (is_bool($lastDotIndex) && !$lastDotIndex) $fileType = "."; if (is_bool($lastDotIndex) && !$lastDotIndex) $fileType = ".";
else $fileType = substr($userfilename, $lastDotIndex); else $fileType = substr($userfilename, $lastDotIndex);
if($_POST["name"] != "") if(isset($_POST["name"]) && $_POST["name"] != "")
$name = $_POST["name"]; $name = $_POST["name"];
else else
$name = basename($userfilename); $name = basename($userfilename);
$categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]);
$cats = array(); $cats = array();
if($categories) { if(isset($_POST["categoryids"])) {
$catids = explode(',', $categories); $categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]);
foreach($catids as $catid) { if($categories) {
$cats[] = $dms->getDocumentCategory($catid); $catids = explode(',', $categories);
foreach($catids as $catid) {
$cats[] = $dms->getDocumentCategory($catid);
}
} }
} }
$res = $folder->addDocument($name, $comment, $expires, $user, $keywords, $res = $folder->addDocument($name, $comment, $expires, $user, $keywords,

View File

@ -231,7 +231,7 @@ if ($_POST["approvalStatus"]==-1){
// count of the approvals required for this document. // count of the approvals required for this document.
if ($approvalCT == $approvalTotal) { if ($approvalCT == $approvalTotal) {
// Change the status to released. // Change the status to released.
$newStatus=2; $newStatus=S_RELEASED;
if($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) { if($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) {
// Send notification to subscribers. // Send notification to subscribers.
if($notifier) { if($notifier) {

View File

@ -63,7 +63,6 @@ if($settings->_enableFullSearch) {
function removeFromIndex($index, $document) { function removeFromIndex($index, $document) {
if($hits = $index->find('document_id:'.$document->getId())) { if($hits = $index->find('document_id:'.$document->getId())) {
$hit = $hits[0]; $hit = $hits[0];
echo $hit->id;
$index->delete($hit->id); $index->delete($hit->id);
$index->commit(); $index->commit();
} }

View File

@ -256,11 +256,11 @@ if ($_POST["reviewStatus"]==-1){
// If the approvals received is less than the approvals total, then // If the approvals received is less than the approvals total, then
// change status to pending approval. // change status to pending approval.
if ($approvalCT<$approvalTotal) { if ($approvalCT<$approvalTotal) {
$newStatus=1; $newStatus=S_DRAFT_APP;
} }
else { else {
// Otherwise, change the status to released. // Otherwise, change the status to released.
$newStatus=2; $newStatus=S_RELEASED;
} }
if ($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) { if ($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) {
// Send notification to subscribers. // Send notification to subscribers.

View File

@ -200,10 +200,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} }
echo " </ul>\n"; echo " </ul>\n";
echo " </li>\n"; echo " </li>\n";
if($this->params['user']->isAdmin())
echo " <li><a href=\"../out/out.SubstituteUser.php\">".getMLText("substitute_user")."</a></li>\n";
echo " <li class=\"divider\"></li>\n";
} }
if($this->params['user']->isAdmin())
echo " <li><a href=\"../out/out.SubstituteUser.php\">".getMLText("substitute_user")."</a></li>\n";
echo " <li class=\"divider\"></li>\n";
if($this->params['session']->getSu()) { if($this->params['session']->getSu()) {
echo " <li><a href=\"../op/op.ResetSu.php\">".getMLText("sign_out_user")."</a></li>\n"; echo " <li><a href=\"../op/op.ResetSu.php\">".getMLText("sign_out_user")."</a></li>\n";
} else { } else {
@ -1228,8 +1228,8 @@ mayscript>
/** /**
* applet initialized notification * applet initialized notification
*/ */
function appletInitialized( ) { function appletInitialized(applet) {
var uploader = document.jumpLoaderApplet.getUploader(); var uploader = applet.getUploader();
var attrSet = uploader.getAttributeSet(); var attrSet = uploader.getAttributeSet();
var attr; var attr;
<?php <?php

View File

@ -126,8 +126,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
$reviewStatus = $latestContent->getReviewStatus(); $reviewStatus = $latestContent->getReviewStatus();
$approvalStatus = $latestContent->getApprovalStatus(); $approvalStatus = $latestContent->getApprovalStatus(10);
?> ?>
<div class="row-fluid"> <div class="row-fluid">
@ -553,7 +552,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
else { else {
$reqName = "<i>".htmlspecialchars($required->getName())."</i>"; $reqName = "<i>".htmlspecialchars($required->getName())."</i>";
} }
if($required->isMember($user) && ($user->getId() != $owner->getId())) if($required->isMember($user) && ($user->getId() != $owner->getId() || $enableownerrevapp == 1))
$is_approver = true; $is_approver = true;
break; break;
} }
@ -582,8 +581,112 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
} }
print "</table>\n"; print "</table>\n";
$this->contentContainerEnd(); if($user->isAdmin()) {
$this->contentContainerEnd();
?> ?>
<div class="row-fluid">
<div class="span6">
<table class="table condensed">
<tr><th><?php printMLText('name'); ?></th><th><?php printMLText('last_update'); ?>/<?php printMLText('comment'); ?></th><th><?php printMLText('status'); ?></th></tr>
<?php
$reviewStatusList = $latestContent->getReviewStatus(10);
foreach($reviewStatusList as $rec) {
echo "<tr>";
echo "<td>";
switch ($rec["type"]) {
case 0: // Approver is an individual.
$required = $dms->getUser($rec["required"]);
if (!is_object($required)) {
$reqName = getMLText("unknown_user")." '".$rec["required"]."'";
}
else {
$reqName = htmlspecialchars($required->getFullName()." (".$required->getLogin().")");
}
break;
case 1: // Approver is a group.
$required = $dms->getGroup($rec["required"]);
if (!is_object($required)) {
$reqName = getMLText("unknown_group")." '".$rec["required"]."'";
}
else {
$reqName = "<i>".htmlspecialchars($required->getName())."</i>";
}
break;
}
echo $reqName;
echo "</td>";
echo "<td>";
echo "<i style=\"font-size: 80%;\">".$rec['date']." - ";
$updateuser = $dms->getUser($rec["userID"]);
if(!is_object($required))
echo getMLText("unknown_user");
else
echo htmlspecialchars($updateuser->getFullName()." (".$updateuser->getLogin().")");
echo "</i>";
if($rec['comment'])
echo "<br />".htmlspecialchars($rec['comment']);
echo "</td>";
echo "<td>";
echo getApprovalStatusText($rec["status"]);
echo "</td>";
echo "</tr>";
}
?>
</table>
</div>
<div class="span6">
<table class="table condensed">
<tr><th><?php printMLText('name'); ?></th><th><?php printMLText('last_update'); ?>/<?php printMLText('comment'); ?></th><th><?php printMLText('status'); ?></th></tr>
<?php
$approvalStatusList = $latestContent->getApprovalStatus(10);
foreach($approvalStatusList as $rec) {
echo "<tr>";
echo "<td>";
switch ($rec["type"]) {
case 0: // Approver is an individual.
$required = $dms->getUser($rec["required"]);
if (!is_object($required)) {
$reqName = getMLText("unknown_user")." '".$rec["required"]."'";
}
else {
$reqName = htmlspecialchars($required->getFullName()." (".$required->getLogin().")");
}
break;
case 1: // Approver is a group.
$required = $dms->getGroup($rec["required"]);
if (!is_object($required)) {
$reqName = getMLText("unknown_group")." '".$rec["required"]."'";
}
else {
$reqName = "<i>".htmlspecialchars($required->getName())."</i>";
}
break;
}
echo $reqName;
echo "</td>";
echo "<td>";
echo "<i style=\"font-size: 80%;\">".$rec['date']." - ";
$updateuser = $dms->getUser($rec["userID"]);
if(!is_object($required))
echo getMLText("unknown_user");
else
echo htmlspecialchars($updateuser->getFullName()." (".$updateuser->getLogin().")");
echo "</i>";
if($rec['comment'])
echo "<br />".htmlspecialchars($rec['comment']);
echo "</td>";
echo "<td>";
echo getApprovalStatusText($rec["status"]);
echo "</td>";
echo "</tr>";
}
?>
</table>
</div>
<?php
}
?>
</div>
</div> </div>
<?php <?php
} }