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
* 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
* @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
// 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 */
$queryStr=
"SELECT reviewID FROM tblDocumentReviewers WHERE `version`='".$this->_version
@ -2337,6 +2339,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
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) { /* {{{ */
$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
// 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 */
$queryStr=
"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.
* 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
* added the review log id will be returned.
* added, the review log id will be returned.
*
* @see SeedDMS_Core_DocumentContent::setApprovalByInd()
* @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
*
* This function can be used to approve or reject a document content, or
* to reset its approval state. The user initiating the approval may
* not be the user filled in as an approver of the document content.
* In most cases this will be but an admin may set the approval for
* to reset its approval state. In most cases this function will be
* called by an user, but an admin may set the approval for
* somebody else.
* 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

View File

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

View File

@ -71,15 +71,27 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
else
$keywords = '';
$reqversion = (int)$_POST["reqversion"];
if ($reqversion<1) $reqversion=1;
if(isset($_POST["reqversion"])) {
$reqversion = (int)$_POST["reqversion"];
if ($reqversion<1) $reqversion=1;
} else {
$reqversion = 1;
}
$sequence = $_POST["sequence"];
if (!is_numeric($sequence)) {
if(isset($_POST['sequence'])) {
$sequence = $_POST["sequence"];
if (!is_numeric($sequence)) {
$sequence = 1;
}
} else {
$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.
$reviewers = array();
@ -162,17 +174,19 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
if (is_bool($lastDotIndex) && !$lastDotIndex) $fileType = ".";
else $fileType = substr($userfilename, $lastDotIndex);
if($_POST["name"] != "")
if(isset($_POST["name"]) && $_POST["name"] != "")
$name = $_POST["name"];
else
$name = basename($userfilename);
$categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]);
$cats = array();
if($categories) {
$catids = explode(',', $categories);
foreach($catids as $catid) {
$cats[] = $dms->getDocumentCategory($catid);
if(isset($_POST["categoryids"])) {
$categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]);
if($categories) {
$catids = explode(',', $categories);
foreach($catids as $catid) {
$cats[] = $dms->getDocumentCategory($catid);
}
}
}
$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.
if ($approvalCT == $approvalTotal) {
// Change the status to released.
$newStatus=2;
$newStatus=S_RELEASED;
if($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) {
// Send notification to subscribers.
if($notifier) {

View File

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

View File

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

View File

@ -200,10 +200,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
}
echo " </ul>\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()) {
echo " <li><a href=\"../op/op.ResetSu.php\">".getMLText("sign_out_user")."</a></li>\n";
} else {
@ -1228,8 +1228,8 @@ mayscript>
/**
* applet initialized notification
*/
function appletInitialized( ) {
var uploader = document.jumpLoaderApplet.getUploader();
function appletInitialized(applet) {
var uploader = applet.getUploader();
var attrSet = uploader.getAttributeSet();
var attr;
<?php

View File

@ -126,8 +126,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$status = $latestContent->getStatus();
$reviewStatus = $latestContent->getReviewStatus();
$approvalStatus = $latestContent->getApprovalStatus();
$approvalStatus = $latestContent->getApprovalStatus(10);
?>
<div class="row-fluid">
@ -553,7 +552,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
else {
$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;
break;
}
@ -582,8 +581,112 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
}
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>
<?php
}