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

This commit is contained in:
Uwe Steinmann 2021-05-01 12:55:57 +02:00
commit 6bb34b870a
6 changed files with 50 additions and 35 deletions

View File

@ -204,6 +204,9 @@
- output path of parent folder in many document/folder lists
- list affected documents when transfering processes to another user
- check for quota and duplicate content in restapi
- remove preview images before removing document
- fixed error due to multiple declared function when controller method
RemoveFolder::run was called more than once
--------------------------------------------------------------------------------
Changes in version 5.1.22

View File

@ -43,6 +43,9 @@ class SeedDMS_Controller_RemoveDocument extends SeedDMS_Controller_Common {
$result = $this->callHook('removeDocument', $document);
if($result === null) {
require_once("SeedDMS/Preview.php");
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
$previewer->deleteDocumentPreviews($document);
if (!$document->remove()) {
if($dms->lasterror)
$this->errormsg = $dms->lasterror;

View File

@ -22,7 +22,33 @@
*/
class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common {
public function run() {
/* Register a callback which removes each document from the fulltext index
* The callback must return null otherwise the removal will be canceled.
*/
static function removeFromIndex($arr, $document) { /* {{{ */
$fulltextservice = $arr[0];
$lucenesearch = $fulltextservice->Search();
$hit = null;
if($document->isType('document'))
$hit = $lucenesearch->getDocument($document->getID());
elseif($document->isType('folder'))
$hit = $lucenesearch->getFolder($document->getID());
if($hit) {
$index = $fulltextservice->Indexer();
$index->delete($hit->id);
$index->commit();
}
return null;
} /* }}} */
static function removePreviews($arr, $document) { /* {{{ */
$previewer = $arr[0];
$previewer->deleteDocumentPreviews($document);
return null;
} /* }}} */
public function run() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
@ -41,38 +67,19 @@ class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common {
$result = $this->callHook('removeFolder', $folder);
if($result === null) {
/* Register a callback which removes each document from the fulltext index
* The callback must return null other the removal will be canceled.
*/
function removeFromIndex($arr, $document) {
$fulltextservice = $arr[0];
$lucenesearch = $fulltextservice->Search();
$hit = null;
if($document->isType('document'))
$hit = $lucenesearch->getDocument($document->getID());
elseif($document->isType('folder'))
$hit = $lucenesearch->getFolder($document->getID());
if($hit) {
$index = $fulltextservice->Indexer();
$index->delete($hit->id);
$index->commit();
}
return null;
}
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
$dms->addCallback('onPreRemoveDocument', 'removeFromIndex', array($fulltextservice));
$dms->addCallback('onPreRemoveFolder', 'removeFromIndex', array($fulltextservice));
/* Register a callback which is called by SeedDMS_Core when a folder
* or document is removed. The second parameter passed to this callback
* is the document or folder to be removed.
*/
$dms->addCallback('onPreRemoveDocument', 'SeedDMS_Controller_RemoveFolder::removeFromIndex', array($fulltextservice));
$dms->addCallback('onPreRemoveFolder', 'SeedDMS_Controller_RemoveFolder::removeFromIndex', array($fulltextservice));
}
function removePreviews($arr, $document) {
$previewer = $arr[0];
$previewer->deleteDocumentPreviews($document);
return null;
}
/* Register another callback which removes the preview images of the document */
require_once("SeedDMS/Preview.php");
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
$dms->addCallback('onPreRemoveDocument', 'removePreviews', array($previewer));
$dms->addCallback('onPreRemoveDocument', 'SeedDMS_Controller_RemoveFolder::removePreviews', array($previewer));
if (!$folder->remove()) {
$this->errormsg = 'error_occured';
@ -88,5 +95,5 @@ class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common {
}
return true;
}
} /* }}} */
}

View File

@ -2966,7 +2966,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
$content .= "</td>";
$content .= "<td".($onepage ? ' style="cursor: pointer;"' : '').">";
$content .= "<td class=\"wordbreak\"".($onepage ? ' style="cursor: pointer;"' : '').">";
if($onepage)
$content .= "<b".($onepage ? ' title="Id:'.$document->getId().'"' : '').">".htmlspecialchars($document->getName()) . "</b>";
else
@ -3128,9 +3128,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $this->folderListRowStart($subFolder);
$content .= "<td><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"><img draggable=\"false\" src=\"".$this->getMimeIcon(".folder")."\" width=\"24\" height=\"24\" border=0></a></td>\n";
if($onepage)
$content .= "<td style=\"cursor: pointer;\">" . "<b title=\"Id:".$subFolder->getId()."\">".htmlspecialchars($subFolder->getName())."</b>";
$content .= "<td class=\"wordbreak\" style=\"cursor: pointer;\">" . "<b title=\"Id:".$subFolder->getId()."\">".htmlspecialchars($subFolder->getName())."</b>";
else
$content .= "<td><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>";
$content .= "<td class=\"wordbreak\"><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>";
if(isset($extracontent['below_title']))
$content .= $extracontent['below_title'];
$content .= "<br /><span style=\"font-size: 85%; font-style: italic; color: #666;\">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $subFolder->getDate())."</b></span>";

View File

@ -2932,7 +2932,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
$content .= "</td>";
$content .= "<td".($onepage ? ' style="cursor: pointer;"' : '').">";
$content .= "<td class=\"wordbreak\"".($onepage ? ' style="cursor: pointer;"' : '').">";
if($onepage)
$content .= "<b".($onepage ? ' title="Id:'.$document->getId().'"' : '').">".htmlspecialchars($document->getName()) . "</b>";
else
@ -3094,9 +3094,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $this->folderListRowStart($subFolder);
$content .= "<td><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"><img draggable=\"false\" src=\"".$this->getMimeIcon(".folder")."\" width=\"24\" height=\"24\" border=0></a></td>\n";
if($onepage)
$content .= "<td style=\"cursor: pointer;\">" . "<b title=\"Id:".$subFolder->getId()."\">".htmlspecialchars($subFolder->getName())."</b>";
$content .= "<td class=\"wordbreak\" style=\"cursor: pointer;\">" . "<b title=\"Id:".$subFolder->getId()."\">".htmlspecialchars($subFolder->getName())."</b>";
else
$content .= "<td><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>";
$content .= "<td class=\"wordbreak\"><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>";
if(isset($extracontent['below_title']))
$content .= $extracontent['below_title'];
$content .= "<br /><span style=\"font-size: 85%; font-style: italic; color: #666;\">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $subFolder->getDate())."</b></span>";

View File

@ -39,6 +39,8 @@ img.mimeicon {
border-style: solid;
border-width: 1px 2px 2px 1px;
background-color: white;
max-width: 100%;
min-width: 60px;
}
span.list-details {