mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 17:44:56 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
50fb928988
|
@ -158,7 +158,9 @@
|
|||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.18
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
- various minor improvements of indexer.php script
|
||||
- minor fix for better behaviour of folder tree ('plus' signs appears if folder
|
||||
has children)
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.17
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
@ -245,7 +245,7 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
|||
*/
|
||||
function validate() { /* {{{ */
|
||||
/** @var SeedDMS_Core_AttributeDefinition $attrdef */
|
||||
$attrdef = $this->_attrdef(); /** @todo check this out, this method is not existing */
|
||||
$attrdef = $this->_attrdef;
|
||||
$result = $attrdef->validate($this->_value);
|
||||
$this->_validation_error = $attrdef->getValidationError();
|
||||
return $result;
|
||||
|
@ -1128,11 +1128,6 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
if(!$success)
|
||||
$this->_validation_error = 3;
|
||||
break;
|
||||
case self::type_boolean: /** @todo: Same case in LINE 966 */
|
||||
foreach($values as $value) {
|
||||
$success &= preg_match('/^[01]$/', $value);
|
||||
}
|
||||
break;
|
||||
case self::type_email:
|
||||
foreach($values as $value) {
|
||||
$success &= preg_match('/^[a-z0-9._-]+@+[a-z0-9._-]+\.+[a-z]{2,4}$/i', $value);
|
||||
|
|
|
@ -1580,7 +1580,7 @@ class SeedDMS_Core_DMS {
|
|||
$orderdir = 'ASC';
|
||||
/** @noinspection PhpUndefinedConstantInspection */
|
||||
$queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' ".
|
||||
"AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_IN_REVISION.") "; /** @todo S_IN_REVISION is not defined */
|
||||
"AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") ";
|
||||
if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
|
||||
else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`";
|
||||
else if ($orderby=='s') $queryStr .= "ORDER BY `status`";
|
||||
|
|
|
@ -1821,7 +1821,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if ((int)$version<1) {
|
||||
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res)
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$version = $resArr[0]['m']+1;
|
||||
|
@ -1892,7 +1892,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
// a document be rejected.
|
||||
$pendingReview=false;
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$reviewRes = array(); /** @todo unused variable */
|
||||
foreach (array("i", "g") as $i){
|
||||
if (isset($reviewers[$i])) {
|
||||
foreach ($reviewers[$i] as $reviewerID) {
|
||||
|
@ -1911,7 +1910,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
// and make a recommendation on its release as an approved version.
|
||||
$pendingApproval=false;
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$approveRes = array(); /** @todo unused variable */
|
||||
foreach (array("i", "g") as $i){
|
||||
if (isset($approvers[$i])) {
|
||||
foreach ($approvers[$i] as $approverID) {
|
||||
|
@ -1953,7 +1951,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
}
|
||||
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
$docResultSet->setStatus($status,$comment,$user); /** @todo parameter count wrong */
|
||||
$docResultSet->setStatus($status);
|
||||
|
||||
$db->commitTransaction();
|
||||
return $docResultSet;
|
||||
|
@ -1991,7 +1989,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if ((int) $version<1) {
|
||||
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res) /** @todo undefined variable */
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$version = $resArr[0]['m'];
|
||||
|
@ -2057,7 +2055,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if (!isset($this->_content)) {
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version`";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res) /** @todo undefined variable */
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$this->_content = array();
|
||||
|
@ -2103,7 +2101,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$db = $this->_dms->getDB();
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." AND `version` = " . (int) $version;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res) /** @todo undefined variable */
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
if (count($resArr) != 1)
|
||||
return false;
|
||||
|
@ -2161,7 +2159,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$db = $this->_dms->getDB();
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version` DESC";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res) /** @todo: $res not defined */
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$classname = $this->_dms->getClassname('documentcontent');
|
||||
|
|
|
@ -555,7 +555,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
$db = $this->_dms->getDB();
|
||||
if (isset($this->_subFolders)) {
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
return count($this->subFolders); /** @todo not $this->_subFolders? */
|
||||
return count($this->_subFolders);
|
||||
}
|
||||
$queryStr = "SELECT count(*) as c FROM `tblFolders` WHERE `parent` = " . $this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
|
@ -757,7 +757,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
$db = $this->_dms->getDB();
|
||||
if (isset($this->_documents)) {
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
return count($this->documents); /** @todo not $this->_documents? */
|
||||
return count($this->_documents);
|
||||
}
|
||||
$queryStr = "SELECT count(*) as c FROM `tblDocuments` WHERE `folder` = " . $this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
|
|
|
@ -1784,6 +1784,22 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
|||
- add parameters $orderdir, $orderby, $update to SeedDMS_Core::getExpiredDocuments()
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<date>2020-06-05</date>
|
||||
<time>09:43:12</time>
|
||||
<version>
|
||||
<release>5.1.18</release>
|
||||
<api>5.1.18</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
- fixed remaining todos
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<date>2017-02-28</date>
|
||||
<time>06:34:50</time>
|
||||
|
|
|
@ -78,7 +78,7 @@ $db->connect() or die ("Could not connect to db-server \"" . $settings->_dbHostn
|
|||
//$db->_conn->debug = 1;
|
||||
|
||||
$dms = new SeedDMS_Core_DMS($db, $settings->_contentDir.$settings->_contentOffsetDir);
|
||||
if(!$dms->checkVersion()) {
|
||||
if(!$settings->_doNotCheckDBVersion && !$dms->checkVersion()) {
|
||||
echo "Database update needed.";
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -4,20 +4,19 @@ if(isset($_SERVER['SEEDDMS_HOME'])) {
|
|||
} else {
|
||||
require_once("../inc/inc.ClassSettings.php");
|
||||
}
|
||||
require("Log.php");
|
||||
|
||||
function usage() { /* {{{ */
|
||||
echo "Usage:\n";
|
||||
echo " seeddms-indexer [-h] [-v] [--config <file>]\n";
|
||||
echo "\n";
|
||||
echo "Description:\n";
|
||||
echo " This program recreates the full text index of SeedDMS.\n";
|
||||
echo "\n";
|
||||
echo "Options:\n";
|
||||
echo " -h, --help: print usage information and exit.\n";
|
||||
echo " -v, --version: print version and exit.\n";
|
||||
echo " -c: recreate index.\n";
|
||||
echo " --config: set alternative config file.\n";
|
||||
echo "Usage:".PHP_EOL;
|
||||
echo " seeddms-indexer [-h] [-v] [--config <file>]".PHP_EOL;
|
||||
echo "".PHP_EOL;
|
||||
echo "Description:".PHP_EOL;
|
||||
echo " This program recreates the full text index of SeedDMS.".PHP_EOL;
|
||||
echo "".PHP_EOL;
|
||||
echo "Options:".PHP_EOL;
|
||||
echo " -h, --help: print usage information and exit.".PHP_EOL;
|
||||
echo " -v, --version: print version and exit.".PHP_EOL;
|
||||
echo " -c: recreate index.".PHP_EOL;
|
||||
echo " --config: set alternative config file.".PHP_EOL;
|
||||
} /* }}} */
|
||||
|
||||
$version = "0.0.2";
|
||||
|
@ -36,7 +35,7 @@ if(isset($options['h']) || isset($options['help'])) {
|
|||
|
||||
/* Print version and exit */
|
||||
if(isset($options['v']) || isset($options['verѕion'])) {
|
||||
echo $version."\n";
|
||||
echo $version."".PHP_EOL;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -60,6 +59,7 @@ if(isset($settings->_extraPath))
|
|||
require_once("inc/inc.Init.php");
|
||||
require_once("inc/inc.Extension.php");
|
||||
require_once("inc/inc.DBInit.php");
|
||||
require "vendor/autoload.php";
|
||||
|
||||
if($settings->_fullSearchEngine == 'sqlitefts') {
|
||||
$indexconf = array(
|
||||
|
@ -80,8 +80,8 @@ if($settings->_fullSearchEngine == 'sqlitefts') {
|
|||
}
|
||||
|
||||
function tree($dms, $index, $indexconf, $folder, $indent='') { /* {{{ */
|
||||
global $settings;
|
||||
echo $indent."D ".$folder->getName()."\n";
|
||||
global $settings, $themes;
|
||||
echo $themes->black($indent."D ".$folder->getName()).PHP_EOL;
|
||||
$subfolders = $folder->getSubFolders();
|
||||
foreach($subfolders as $subfolder) {
|
||||
tree($dms, $index, $indexconf, $subfolder, $indent.' ');
|
||||
|
@ -101,9 +101,9 @@ function tree($dms, $index, $indexconf, $folder, $indent='') { /* {{{ */
|
|||
}
|
||||
}
|
||||
$index->addDocument($idoc);
|
||||
echo " (Document added)\n";
|
||||
echo $themes->green(" (Document added)").PHP_EOL;
|
||||
} catch(Exception $e) {
|
||||
echo " (Timeout)\n";
|
||||
echo $themes->error(" (Timeout)").PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
@ -113,7 +113,7 @@ function tree($dms, $index, $indexconf, $folder, $indent='') { /* {{{ */
|
|||
}
|
||||
$content = $document->getLatestContent();
|
||||
if($created > $content->getDate()) {
|
||||
echo " (Document unchanged)\n";
|
||||
echo $themes->italic(" (Document unchanged)").PHP_EOL;
|
||||
} else {
|
||||
$index->delete($hit->id);
|
||||
try {
|
||||
|
@ -126,21 +126,23 @@ function tree($dms, $index, $indexconf, $folder, $indent='') { /* {{{ */
|
|||
}
|
||||
}
|
||||
$index->addDocument($idoc);
|
||||
echo " (Document updated)\n";
|
||||
echo $themes->green(" (Document updated)").PHP_EOL;
|
||||
} catch(Exception $e) {
|
||||
echo " (Timeout)\n";
|
||||
echo $themes->error(" (Timeout)").PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
$themes = new \AlecRabbit\ConsoleColour\Themes();
|
||||
|
||||
$db = new SeedDMS_Core_DatabaseAccess($settings->_dbDriver, $settings->_dbHostname, $settings->_dbUser, $settings->_dbPass, $settings->_dbDatabase);
|
||||
$db->connect() or die ("Could not connect to db-server \"" . $settings->_dbHostname . "\"");
|
||||
|
||||
$dms = new SeedDMS_Core_DMS($db, $settings->_contentDir.$settings->_contentOffsetDir);
|
||||
if(!$dms->checkVersion()) {
|
||||
echo "Database update needed.\n";
|
||||
if(!$settings->_doNotCheckDBVersion && !$dms->checkVersion()) {
|
||||
echo "Database update needed.".PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -151,7 +153,7 @@ if($recreate)
|
|||
else
|
||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||
if(!$index) {
|
||||
echo "Could not create index.\n";
|
||||
echo "Could not create index.".PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "${SEEDDMS_HOME}" ]; then
|
||||
echo 'Please set $SEEDDMS_HOME before running this script'
|
||||
exit 1
|
||||
parentdir=$(dirname "$0")
|
||||
export SEEDDMS_HOME=$(dirname "$parentdir")
|
||||
fi
|
||||
|
||||
exec php -f "${SEEDDMS_HOME}/utils/indexer.php" -- "${@}"
|
||||
|
|
|
@ -1872,7 +1872,7 @@ $(document).ready(function() {
|
|||
* @param boolean $partialtree set to true if the given folder is the start folder
|
||||
*/
|
||||
function printNewTreeNavigationJs($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='', $partialtree=false) { /* {{{ */
|
||||
function jqtree($obj, $path, $folder, $user, $accessmode, $showdocs=1, $expandtree=0, $orderby='', $level=0) {
|
||||
function jqtree($obj, $path, $folder, $user, $accessmode, $showdocs=1, $expandtree=0, $orderby='', $level=0) { /* {{{ */
|
||||
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||
if($path/* || $expandtree>=$level*/) {
|
||||
if($path)
|
||||
|
@ -1885,7 +1885,7 @@ $(document).ready(function() {
|
|||
$subfolders = array($pathfolder);
|
||||
}
|
||||
foreach($subfolders as $subfolder) {
|
||||
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>(0 && ($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs))) ? true : false, 'is_folder'=>true);
|
||||
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>(1 && ($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs))) ? true : false, 'is_folder'=>true);
|
||||
if(/*$expandtree>=$level ||*/ $pathfolder->getID() == $subfolder->getID()) {
|
||||
$node['children'] = jqtree($obj, $path, $subfolder, $user, $accessmode, $showdocs, $expandtree, $orderby, $level+1);
|
||||
if($showdocs) {
|
||||
|
@ -1913,7 +1913,7 @@ $(document).ready(function() {
|
|||
return $children;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||
if($folderid) {
|
||||
|
@ -1957,7 +1957,7 @@ var data = <?php echo json_encode($tree); ?>;
|
|||
$(function() {
|
||||
const $tree = $('#jqtree<?php echo $formid ?>');
|
||||
$tree.tree({
|
||||
// saveState: true,
|
||||
// saveState: false,
|
||||
selectable: true,
|
||||
data: data,
|
||||
saveState: 'jqtree<?php echo $formid; ?>',
|
||||
|
@ -1980,7 +1980,7 @@ $(function() {
|
|||
}
|
||||
});
|
||||
// Unfold node for currently selected folder
|
||||
$('#jqtree<?php echo $formid ?>').tree('selectNode', $('#jqtree<?php echo $formid ?>').tree('getNodeById', <?php echo $folderid ?>), false);
|
||||
$('#jqtree<?php echo $formid ?>').tree('selectNode', $('#jqtree<?php echo $formid ?>').tree('getNodeById', <?php echo $folderid ?>), false, true);
|
||||
$('#jqtree<?php echo $formid ?>').on(
|
||||
'tree.click',
|
||||
function(event) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user