mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
go to right url after deleting a document version
This commit is contained in:
parent
990621ae99
commit
ad8a501506
|
@ -10,6 +10,10 @@
|
|||
- fix output of help text for config vars in extension
|
||||
- configuring a user id in the settings uses a list of existing users
|
||||
- form elements can have a help text
|
||||
- open the right page or tab after a document version has been removed
|
||||
(go to folder page if the whole document was removed, go to previous tab
|
||||
if an old version was removed and there are other older version, otherwise
|
||||
to to current tab)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.18
|
||||
|
|
|
@ -63,6 +63,8 @@ if (!is_object($version)) {
|
|||
|
||||
require_once("SeedDMS/Preview.php");
|
||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
||||
$folder = $document->getFolder();
|
||||
/* Check if there is just one version. In that case remove the document */
|
||||
if (count($document->getContent())==1) {
|
||||
$previewer->deleteDocumentPreviews($document);
|
||||
$nl = $document->getNotifyList();
|
||||
|
@ -70,6 +72,7 @@ if (count($document->getContent())==1) {
|
|||
if (!$document->remove()) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||
} else {
|
||||
$nexturl = "../out/out.ViewFolder.php?folderid=".$folder->getId();
|
||||
/* Remove the document from the fulltext index */
|
||||
if($settings->_enableFullSearch) {
|
||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||
|
@ -127,9 +130,17 @@ else {
|
|||
|
||||
$previewer->deletePreview($version, $settings->_previewWidthDetail);
|
||||
$previewer->deletePreview($version, $settings->_previewWidthList);
|
||||
/* Check if the version to be delete is the latest version. This is
|
||||
* later used to set the redirect url.
|
||||
*/
|
||||
$islatest = $version->getVersion() == $document->getLatestContent()->getVersion();
|
||||
if (!$document->removeContent($version)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||
} else {
|
||||
if($islatest || count($document->getContent()) == 1)
|
||||
$nexturl = "../out/out.ViewDocument.php?documentid=".$documentid;
|
||||
else
|
||||
$nexturl = "../out/out.ViewDocument.php?documentid=".$documentid."¤ttab=previous";
|
||||
/* Remove the document from the fulltext index and reindex latest version */
|
||||
if($settings->_enableFullSearch) {
|
||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||
|
@ -183,6 +194,6 @@ else {
|
|||
|
||||
add_log_line("?documentid=".$documentid."&version".$version_num);
|
||||
|
||||
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."¤ttab=previous");
|
||||
header("Location:".$nexturl);
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user