mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 05:31:42 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
19502debea
|
@ -173,6 +173,11 @@
|
||||||
- sort versions of extension in extension manager propperly
|
- sort versions of extension in extension manager propperly
|
||||||
- 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
|
||||||
|
- 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
|
||||||
|
|
|
@ -999,7 +999,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
<<<<<<< HEAD
|
|
||||||
* Check if document is checked out
|
* Check if document is checked out
|
||||||
*
|
*
|
||||||
* @return boolean true if checked out otherwise false
|
* @return boolean true if checked out otherwise false
|
||||||
|
@ -1219,10 +1218,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
|
||||||
=======
|
|
||||||
* @return float
|
* @return float
|
||||||
>>>>>>> seeddms-5.1.x
|
|
||||||
*/
|
*/
|
||||||
function getSequence() { return $this->_sequence; }
|
function getSequence() { return $this->_sequence; }
|
||||||
|
|
||||||
|
@ -2081,6 +2077,10 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
foreach ($resArr as $row) {
|
foreach ($resArr as $row) {
|
||||||
/** @var SeedDMS_Core_DocumentContent $content */
|
/** @var SeedDMS_Core_DocumentContent $content */
|
||||||
$content = new $classname($row["id"], $this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"], $row['fileSize'], $row['checksum'], $row['revisiondate']);
|
$content = new $classname($row["id"], $this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"], $row['fileSize'], $row['checksum'], $row['revisiondate']);
|
||||||
|
/* TODO: Better use content id as key in $this->_content. This
|
||||||
|
* would allow to remove a single content object in removeContent().
|
||||||
|
* Currently removeContent() must clear $this->_content completely
|
||||||
|
*/
|
||||||
if($user) {
|
if($user) {
|
||||||
if($content->getAccessMode($user) >= M_READ)
|
if($content->getAccessMode($user) >= M_READ)
|
||||||
array_push($this->_content, $content);
|
array_push($this->_content, $content);
|
||||||
|
@ -2138,6 +2138,17 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a given version is the latest version of the document
|
||||||
|
*
|
||||||
|
* @param integer $version version number of content element
|
||||||
|
* @return SeedDMS_Core_DocumentContent|boolean object of class {@link SeedDMS_Core_DocumentContent}
|
||||||
|
* or false
|
||||||
|
*/
|
||||||
|
function isLatestContent($version) { /* {{{ */
|
||||||
|
return $this->getLatestContent()->getVersion() == $version;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool|null|SeedDMS_Core_DocumentContent
|
* @return bool|null|SeedDMS_Core_DocumentContent
|
||||||
*/
|
*/
|
||||||
|
@ -2421,6 +2432,13 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Invalidate the content list and the latest content of this document,
|
||||||
|
* otherwise getContent() and getLatestContent()
|
||||||
|
* will still return the content just deleted.
|
||||||
|
*/
|
||||||
|
$this->_latestContent = null;
|
||||||
|
$this->_content = null;
|
||||||
|
|
||||||
/* Check if 'onPostRemoveDocument' callback is set */
|
/* Check if 'onPostRemoveDocument' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostRemoveContent'])) {
|
if(isset($this->_dms->callbacks['onPostRemoveContent'])) {
|
||||||
foreach($this->_dms->callbacks['onPostRemoveContent'] as $callback) {
|
foreach($this->_dms->callbacks['onPostRemoveContent'] as $callback) {
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
<notes>
|
<notes>
|
||||||
- add method SeedDMS_Core_Document::setParent() as an alias for setFolder()
|
- add method SeedDMS_Core_Document::setParent() as an alias for setFolder()
|
||||||
|
- clear the save content list and latest content in SeedDMS_Core_Document after
|
||||||
|
a version has been deleted.
|
||||||
|
- new method SeedDMS_Core_Document::isLatestVersion()
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="SeedDMS" name="/">
|
<dir baseinstalldir="SeedDMS" name="/">
|
||||||
|
|
51
controllers/class.ClearCache.php
Normal file
51
controllers/class.ClearCache.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of ClearCache controller
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class which does the busines logic for clearing the cache
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_Controller_ClearCache extends SeedDMS_Controller_Common {
|
||||||
|
|
||||||
|
public function run() {
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$settings = $this->params['settings'];
|
||||||
|
$post = $this->params['post'];
|
||||||
|
|
||||||
|
$ret = '';
|
||||||
|
if(!empty($post['preview'])) {
|
||||||
|
$cmd = 'rm -rf '.$settings->_cacheDir.'/[1-9]*';
|
||||||
|
system($cmd, $ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($post['js'])) {
|
||||||
|
$cmd = 'rm -rf '.$settings->_cacheDir.'/js/*';
|
||||||
|
system($cmd, $ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(false === $this->callHook('clear', $post)) {
|
||||||
|
if(empty($this->errormsg))
|
||||||
|
$this->errormsg = 'hook_clear_failed';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -24,8 +24,12 @@ include("../inc/inc.Init.php");
|
||||||
include("../inc/inc.Extension.php");
|
include("../inc/inc.Extension.php");
|
||||||
include("../inc/inc.DBInit.php");
|
include("../inc/inc.DBInit.php");
|
||||||
include("../inc/inc.ClassUI.php");
|
include("../inc/inc.ClassUI.php");
|
||||||
|
include("../inc/inc.ClassController.php");
|
||||||
include("../inc/inc.Authentication.php");
|
include("../inc/inc.Authentication.php");
|
||||||
|
|
||||||
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
|
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||||
|
|
||||||
/* Check if the form data comes from a trusted request */
|
/* Check if the form data comes from a trusted request */
|
||||||
if(!checkFormKey('clearcache')) {
|
if(!checkFormKey('clearcache')) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
||||||
|
@ -38,19 +42,8 @@ if(!is_dir($settings->_cacheDir)) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("error_cleared_cache"));
|
UI::exitError(getMLText("admin_tools"),getMLText("error_cleared_cache"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($_POST['preview'])) {
|
$controller->setParam('post', $_POST);
|
||||||
$cmd = 'rm -rf '.$settings->_cacheDir.'/[1-9]*';
|
if(!$controller->run())
|
||||||
$ret = null;
|
|
||||||
system($cmd, $ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($_POST['js'])) {
|
|
||||||
$cmd = 'rm -rf '.$settings->_cacheDir.'/js/*';
|
|
||||||
$ret = null;
|
|
||||||
system($cmd, $ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($ret)
|
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_cleared_cache')));
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_cleared_cache')));
|
||||||
else
|
else
|
||||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_cleared_cache')));
|
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_cleared_cache')));
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -54,6 +54,13 @@ class SeedDMS_View_ClearCache extends SeedDMS_Bootstrap_Style {
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input type="checkbox" name="js" value="1" checked> <?php printMLText('temp_jscode'); ?>
|
<input type="checkbox" name="js" value="1" checked> <?php printMLText('temp_jscode'); ?>
|
||||||
|
<?php
|
||||||
|
$addcache = array();
|
||||||
|
if($addcache = $this->callHook('additionalCache')) {
|
||||||
|
foreach($addcache as $c)
|
||||||
|
echo "<p><input type=\"checkbox\" name=\"".$c[0]."\" value=\"1\" checked> ".$c[1]."</p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
<p><button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("clear_cache");?></button></p>
|
<p><button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("clear_cache");?></button></p>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue
Block a user