mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
919f4cb39c
|
@ -1615,7 +1615,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/* $attribute can be a string or an array */
|
||||
if($attribute)
|
||||
if(!$content->setAttributeValue($this->_dms->getAttributeDefinition($attrdefid), $attribute)) {
|
||||
$this->removeContent($content);
|
||||
$this->_removeContent($content);
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
@ -1629,7 +1629,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$queryStr = "INSERT INTO `tblDocumentStatus` (`documentID`, `version`) ".
|
||||
"VALUES (". $this->_id .", ". (int) $version .")";
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$this->removeContent($content);
|
||||
$this->_removeContent($content);
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
@ -1924,11 +1924,12 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Remove a certain version
|
||||
* Remove version of document
|
||||
*
|
||||
* @param integer $version version number
|
||||
* @param interger $version version number of content
|
||||
* @return boolean true if successful, otherwise false
|
||||
*/
|
||||
function removeContent($version) { /* {{{ */
|
||||
private function _removeContent($version) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if (file_exists( $this->_dms->contentDir.$version->getPath() ))
|
||||
|
@ -2103,6 +2104,36 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Call callback onPreRemoveDocument before deleting content
|
||||
*
|
||||
* @param integer $version version number of content
|
||||
*/
|
||||
function removeContent($version) { /* {{{ */
|
||||
/* Check if 'onPreRemoveDocument' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPreRemoveContent'])) {
|
||||
foreach($this->_dms->callbacks['onPreRemoveContent'] as $callback) {
|
||||
$ret = call_user_func($callback[0], $callback[1], $this, $version);
|
||||
if(is_bool($ret))
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
if(false === ($ret = self::_removeContent($version))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check if 'onPostRemoveDocument' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostRemoveContent'])) {
|
||||
foreach($this->_dms->callbacks['onPostRemoveContent'] as $callback) {
|
||||
if(!call_user_func($callback[0], $callback[1], $version)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return a certain document link
|
||||
*
|
||||
|
@ -2354,7 +2385,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
// remove content of document
|
||||
foreach ($this->_content as $version) {
|
||||
if (!$this->removeContent($version)) {
|
||||
if (!$this->_removeContent($version)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1429,6 +1429,7 @@ if the owner tries to access them
|
|||
- Check return value of onPreRemove[Document|Folder], return from calling method if bool
|
||||
- Add SeedDMS_Core_DMS::getDocumentList()
|
||||
- Limit number of duplicate files to 1000
|
||||
- Add hook on(Pre|Post)RemoveContent
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
|
|
|
@ -35,6 +35,8 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
|
|||
return null;
|
||||
}
|
||||
|
||||
$name = $this->getParam('name');
|
||||
$comment = $this->getParam('comment');
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$document = $this->params['document'];
|
||||
|
|
|
@ -83,7 +83,8 @@ class SeedDMS_View_Common {
|
|||
* a list of hook objects with getHookObjects() and call the hooks yourself.
|
||||
*
|
||||
* @params string $hook name of hook
|
||||
* @return string concatenated string of whatever the hook function returns
|
||||
* @return string concatenated string, merged arrays or whatever the hook
|
||||
* function returns
|
||||
*/
|
||||
function callHook($hook) { /* {{{ */
|
||||
$tmp = explode('_', get_class($this));
|
||||
|
|
|
@ -158,23 +158,6 @@ else {
|
|||
$eU = $version->_document->_dms->getGroup($eID);
|
||||
$grouprecipients[] = $eU;
|
||||
}
|
||||
/*
|
||||
$subject = "###SITENAME###: ".$document->getName().", v.".$version->_version." - ".getMLText("version_deleted_email");
|
||||
$message = getMLText("version_deleted_email")."\r\n";
|
||||
$message .=
|
||||
getMLText("document").": "User.$document->getName()."\r\n".
|
||||
getMLText("version").": ".$version->_version."\r\n".
|
||||
getMLText("comment").": ".$version->getComment()."\r\n".
|
||||
getMLText("user").": ".$user->getFullName()." <". $user->getEmail() ."> ";
|
||||
|
||||
$notifier->toList($user, $recipients, $subject, $message);
|
||||
|
||||
// Send notification to subscribers.
|
||||
$notifier->toList($user, $nl["users"], $subject, $message);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message);
|
||||
}
|
||||
*/
|
||||
|
||||
$subject = "version_deleted_email_subject";
|
||||
$message = "version_deleted_email_body";
|
||||
|
|
|
@ -362,11 +362,14 @@ $(document).ready( function() {
|
|||
var element = $(this);
|
||||
var url = '';
|
||||
var href = element.data('href');
|
||||
var base = element.data('base');
|
||||
if(typeof base == 'undefined')
|
||||
base = '';
|
||||
var view = element.data('view');
|
||||
var action = element.data('action');
|
||||
var query = element.data('query');
|
||||
if(view && action) {
|
||||
url = seeddms_webroot+"out/out."+view+".php?action="+action;
|
||||
url = seeddms_webroot+base+"out/out."+view+".php?action="+action;
|
||||
if(query) {
|
||||
url += "&"+query;
|
||||
}
|
||||
|
@ -396,10 +399,13 @@ $(document).ready( function() {
|
|||
var element = $(this);
|
||||
var url = '';
|
||||
var href = element.data('href');
|
||||
var base = element.data('base');
|
||||
if(typeof base == 'undefined')
|
||||
base = '';
|
||||
var view = element.data('view');
|
||||
var action = element.data('action');
|
||||
if(view && action)
|
||||
url = "out."+view+".php?action="+action;
|
||||
url = seeddms_webroot+base+"out/out."+view+".php?action="+action;
|
||||
else
|
||||
url = href;
|
||||
if(typeof param1 === 'object') {
|
||||
|
|
|
@ -349,7 +349,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
|
|||
return;
|
||||
|
||||
$accessop = $this->params['accessobject'];
|
||||
if($accessop->check_controller_access('Download', array('action'=>'version'))) {
|
||||
if($accessop->check_controller_access('ViewOnline', array('action'=>'version'))) {
|
||||
$latestContent = $document->getLatestContent();
|
||||
$txt = $this->callHook('preDocumentPreview', $latestContent);
|
||||
if(is_string($txt))
|
||||
|
@ -366,20 +366,20 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
|
|||
$this->contentHeading(getMLText("preview"));
|
||||
?>
|
||||
<audio controls style="width: 100%;">
|
||||
<source src="../op/op.Download.php?documentid=<?php echo $document->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" type="audio/mpeg">
|
||||
<source src="../op/op.ViewOnline.php?documentid=<?php echo $document->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" type="audio/mpeg">
|
||||
</audio>
|
||||
<?php
|
||||
break;
|
||||
case 'application/pdf':
|
||||
$this->contentHeading(getMLText("preview"));
|
||||
?>
|
||||
<iframe src="../pdfviewer/web/viewer.html?file=<?php echo urlencode('../../op/op.Download.php?documentid='.$document->getID().'&version='.$latestContent->getVersion()); ?>" width="100%" height="700px"></iframe>
|
||||
<iframe src="../pdfviewer/web/viewer.html?file=<?php echo urlencode('../../op/op.ViewOnline.php?documentid='.$document->getID().'&version='.$latestContent->getVersion()); ?>" width="100%" height="700px"></iframe>
|
||||
<?php
|
||||
break;
|
||||
case 'image/svg+xml':
|
||||
$this->contentHeading(getMLText("preview"));
|
||||
?>
|
||||
<img src="../op/op.Download.php?documentid=<?php echo $document->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" width="100%">
|
||||
<img src="../op/op.ViewOnline.php?documentid=<?php echo $document->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" width="100%">
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue
Block a user