Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-01-10 08:26:39 +01:00
commit 9461f2c24d
8 changed files with 96 additions and 78 deletions

View File

@ -252,6 +252,9 @@
- introduce authentication service - introduce authentication service
- new hook in restapi to add middleware - new hook in restapi to add middleware
- previews for png, txt, pdf in different directories - previews for png, txt, pdf in different directories
- various improvements of fulltext service
- show number of documents per category in category manager
- show number of keywords per category in keyword manager
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.28 Changes in version 5.1.28

View File

@ -8,7 +8,7 @@
* @version @version@ * @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx> * @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal, 2006-2008 Malcolm Cowe, * @copyright Copyright (C) 2002-2005 Markus Westphal, 2006-2008 Malcolm Cowe,
* 2010 Uwe Steinmann * 2010-2023 Uwe Steinmann
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
@ -19,7 +19,7 @@
* @package SeedDMS_Core * @package SeedDMS_Core
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx> * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal, 2006-2008 Malcolm Cowe, * @copyright Copyright (C) 2002-2005 Markus Westphal, 2006-2008 Malcolm Cowe,
* 2010 Uwe Steinmann * 2010-2023 Uwe Steinmann
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
class SeedDMS_Core_KeywordCategory { class SeedDMS_Core_KeywordCategory {
@ -47,53 +47,53 @@ class SeedDMS_Core_KeywordCategory {
*/ */
protected $_dms; protected $_dms;
/** /**
* SeedDMS_Core_KeywordCategory constructor. * SeedDMS_Core_KeywordCategory constructor.
* @param $id * @param $id
* @param $ownerID * @param $ownerID
* @param $name * @param $name
*/ */
function __construct($id, $ownerID, $name) { function __construct($id, $ownerID, $name) { /* {{{ */
$this->_id = $id; $this->_id = $id;
$this->_name = $name; $this->_name = $name;
$this->_ownerID = $ownerID; $this->_ownerID = $ownerID;
$this->_dms = null; $this->_dms = null;
} } /* }}} */
/** /**
* @param SeedDMS_Core_DMS $dms * @param SeedDMS_Core_DMS $dms
*/ */
function setDMS($dms) { function setDMS($dms) { /* {{{ */
$this->_dms = $dms; $this->_dms = $dms;
} } /* }}} */
/** /**
* @return int * @return int
*/ */
function getID() { return $this->_id; } function getID() { return $this->_id; }
/** /**
* @return string * @return string
*/ */
function getName() { return $this->_name; } function getName() { return $this->_name; }
/** /**
* @return bool|SeedDMS_Core_User * @return bool|SeedDMS_Core_User
*/ */
function getOwner() { function getOwner() { /* {{{ */
if (!isset($this->_owner)) if (!isset($this->_owner))
$this->_owner = $this->_dms->getUser($this->_ownerID); $this->_owner = $this->_dms->getUser($this->_ownerID);
return $this->_owner; return $this->_owner;
} } /* }}} */
/** /**
* @param $newName * @param $newName
* @return bool * @return bool
*/ */
function setName($newName) { function setName($newName) { /* {{{ */
$newName = trim($newName); $newName = trim($newName);
if(!$newName) if(!$newName)
return false; return false;
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
@ -103,75 +103,89 @@ class SeedDMS_Core_KeywordCategory {
$this->_name = $newName; $this->_name = $newName;
return true; return true;
} } /* }}} */
/** /**
* @param SeedDMS_Core_User $user * @param SeedDMS_Core_User $user
* @return bool * @return bool
*/ */
function setOwner($user) { function setOwner($user) { /* {{{ */
if(!$user || !$user->isType('user')) if(!$user || !$user->isType('user'))
return false; return false;
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$queryStr = "UPDATE `tblKeywordCategories` SET `owner` = " . $user->getID() . " WHERE `id` = " . $this->_id; $queryStr = "UPDATE `tblKeywordCategories` SET `owner` = " . $user->getID() . " WHERE `id` = " . $this->_id;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
return false; return false;
$this->_ownerID = $user->getID(); $this->_ownerID = $user->getID();
$this->_owner = $user; $this->_owner = $user;
return true; return true;
} } /* }}} */
/** /**
* @return array * @return array keywords in this list
*/ */
function getKeywordLists() { function getKeywordLists() { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblKeywords` WHERE `category` = " . $this->_id . " order by `keywords`"; $queryStr = "SELECT * FROM `tblKeywords` WHERE `category` = " . $this->_id . " order by `keywords`";
return $db->getResultArray($queryStr); return $db->getResultArray($queryStr);
} }
/** /**
* @param $listID * @return integer number of keywords in this list
* @param $keywords */
* @return bool function countKeywordLists() { /* {{{ */
*/ $db = $this->_dms->getDB();
function editKeywordList($listID, $keywords) {
$queryStr = "SELECT COUNT(*) as `c` FROM `tblKeywords` where `category`=".$this->_id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$resArr)
return false;
return $resArr[0]['c'];
} /* }}} */
/**
* @param $listID
* @param $keywords
* @return bool
*/
function editKeywordList($listID, $keywords) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$queryStr = "UPDATE `tblKeywords` SET `keywords` = ".$db->qstr($keywords)." WHERE `id` = $listID"; $queryStr = "UPDATE `tblKeywords` SET `keywords` = ".$db->qstr($keywords)." WHERE `id` = $listID";
return $db->getResult($queryStr); return $db->getResult($queryStr);
} } /* }}} */
/** /**
* @param $keywords * @param $keywords
* @return bool * @return bool
*/ */
function addKeywordList($keywords) { function addKeywordList($keywords) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$queryStr = "INSERT INTO `tblKeywords` (`category`, `keywords`) VALUES (" . $this->_id . ", ".$db->qstr($keywords).")"; $queryStr = "INSERT INTO `tblKeywords` (`category`, `keywords`) VALUES (" . $this->_id . ", ".$db->qstr($keywords).")";
return $db->getResult($queryStr); return $db->getResult($queryStr);
} } /* }}} */
/** /**
* @param $listID * @param $listID
* @return bool * @return bool
*/ */
function removeKeywordList($listID) { function removeKeywordList($listID) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$queryStr = "DELETE FROM `tblKeywords` WHERE `id` = $listID"; $queryStr = "DELETE FROM `tblKeywords` WHERE `id` = $listID";
return $db->getResult($queryStr); return $db->getResult($queryStr);
} } /* }}} */
/** /**
* @return bool * @return bool
*/ */
function remove() { function remove() { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$db->startTransaction(); $db->startTransaction();
@ -189,5 +203,5 @@ class SeedDMS_Core_KeywordCategory {
$db->commitTransaction(); $db->commitTransaction();
return true; return true;
} } /* }}} */
} }

View File

@ -2049,8 +2049,8 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
<notes> <notes>
- SeedDMS_Core_Folder::addDocument() does rollback transaction propperly when setting document categories fail - SeedDMS_Core_Folder::addDocument() does rollback transaction propperly when setting document categories fail
- add $skiproot and $sep parameter to SeedDMS_Core_Folder::getFolderPathPlain() - add $skiproot and $sep parameter to SeedDMS_Core_Folder::getFolderPathPlain()
- turn off auto commit for mysql
- add class name for 'documentfile' - add class name for 'documentfile'
- add method SeedDMS_Core_KeywordCategory::countKeywordLists()
</notes> </notes>
</release> </release>
<release> <release>

View File

@ -11,7 +11,7 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2023-01-03</date> <date>2023-01-09</date>
<time>08:55:43</time> <time>08:55:43</time>
<version> <version>
<release>1.1.18</release> <release>1.1.18</release>
@ -24,6 +24,7 @@
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
- IndexedDocument() accepts a callable for conversion to text - IndexedDocument() accepts a callable for conversion to text
- SeedDMS_Lucene_Search::open and create return itself but Zend_Search_Lucene
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">

View File

@ -11,7 +11,7 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2023-01-02</date> <date>2023-01-09</date>
<time>09:49:39</time> <time>09:49:39</time>
<version> <version>
<release>1.5.0</release> <release>1.5.0</release>

View File

@ -11,7 +11,7 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2023-01-03</date> <date>2023-01-09</date>
<time>08:57:44</time> <time>08:57:44</time>
<version> <version>
<release>1.0.18</release> <release>1.0.18</release>

View File

@ -155,7 +155,7 @@ $(document).ready( function() {
$options[] = array("-1", getMLText("choose_category")); $options[] = array("-1", getMLText("choose_category"));
$options[] = array("0", getMLText("new_document_category")); $options[] = array("0", getMLText("new_document_category"));
foreach ($categories as $category) { foreach ($categories as $category) {
$options[] = array($category->getID(), htmlspecialchars($category->getName()), $selcat && $category->getID()==$selcat->getID()); $options[] = array($category->getID(), htmlspecialchars($category->getName()), $selcat && $category->getID()==$selcat->getID(), array(array('data-subtitle', $category->countDocumentsByCategory().' '.getMLText('documents'))));
} }
$this->formField( $this->formField(
null, //getMLText("selection"), null, //getMLText("selection"),

View File

@ -221,7 +221,7 @@ $(document).ready( function() {
foreach ($categories as $category) { foreach ($categories as $category) {
$owner = $category->getOwner(); $owner = $category->getOwner();
if ($user->isAdmin() || ($owner->getID() == $user->getID())) if ($user->isAdmin() || ($owner->getID() == $user->getID()))
$options[] = array($category->getID(), htmlspecialchars($category->getName()), $selcategory && $category->getID()==$selcategory->getID()); $options[] = array($category->getID(), htmlspecialchars($category->getName()), $selcategory && $category->getID()==$selcategory->getID(), array(array('data-subtitle', $category->countKeywordLists().' '.getMLText('keywords'))));
} }
$this->formField( $this->formField(
null, //getMLText("selection"), null, //getMLText("selection"),