mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +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
|
- fix output of help text for config vars in extension
|
||||||
- configuring a user id in the settings uses a list of existing users
|
- configuring a user id in the settings uses a list of existing users
|
||||||
- form elements can have a help text
|
- 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
|
Changes in version 5.1.18
|
||||||
|
|
|
@ -63,6 +63,8 @@ if (!is_object($version)) {
|
||||||
|
|
||||||
require_once("SeedDMS/Preview.php");
|
require_once("SeedDMS/Preview.php");
|
||||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
$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) {
|
if (count($document->getContent())==1) {
|
||||||
$previewer->deleteDocumentPreviews($document);
|
$previewer->deleteDocumentPreviews($document);
|
||||||
$nl = $document->getNotifyList();
|
$nl = $document->getNotifyList();
|
||||||
|
@ -70,6 +72,7 @@ if (count($document->getContent())==1) {
|
||||||
if (!$document->remove()) {
|
if (!$document->remove()) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||||
} else {
|
} else {
|
||||||
|
$nexturl = "../out/out.ViewFolder.php?folderid=".$folder->getId();
|
||||||
/* Remove the document from the fulltext index */
|
/* Remove the document from the fulltext index */
|
||||||
if($settings->_enableFullSearch) {
|
if($settings->_enableFullSearch) {
|
||||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||||
|
@ -127,9 +130,17 @@ else {
|
||||||
|
|
||||||
$previewer->deletePreview($version, $settings->_previewWidthDetail);
|
$previewer->deletePreview($version, $settings->_previewWidthDetail);
|
||||||
$previewer->deletePreview($version, $settings->_previewWidthList);
|
$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)) {
|
if (!$document->removeContent($version)) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||||
} else {
|
} 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 */
|
/* Remove the document from the fulltext index and reindex latest version */
|
||||||
if($settings->_enableFullSearch) {
|
if($settings->_enableFullSearch) {
|
||||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||||
|
@ -183,6 +194,6 @@ else {
|
||||||
|
|
||||||
add_log_line("?documentid=".$documentid."&version".$version_num);
|
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