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
670597ea5f
|
@ -6,6 +6,10 @@ RewriteRule ^favicon.ico$ styles/bootstrap/favicon.ico [L]
|
||||||
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
|
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
|
||||||
RewriteRule ^.*$ - [E=CWD:%2]
|
RewriteRule ^.*$ - [E=CWD:%2]
|
||||||
|
|
||||||
|
# Do not allow access on the other directories in www
|
||||||
|
RewriteRule "^utils/.*$" "" [F]
|
||||||
|
RewriteRule "^doc/.*$" "" [F]
|
||||||
|
|
||||||
# Anything below the following dirs will never be rewritten
|
# Anything below the following dirs will never be rewritten
|
||||||
RewriteRule "^pdfviewer/.*$" "-" [L]
|
RewriteRule "^pdfviewer/.*$" "-" [L]
|
||||||
RewriteRule "^views/bootstrap/images.*$" "-" [L]
|
RewriteRule "^views/bootstrap/images.*$" "-" [L]
|
||||||
|
|
|
@ -26,6 +26,11 @@ else
|
||||||
*/
|
*/
|
||||||
require_once('Core/inc.ClassDMS.php');
|
require_once('Core/inc.ClassDMS.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @uses SeedDMS_Decorator
|
||||||
|
*/
|
||||||
|
require_once('Core/inc.ClassDecorator.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @uses SeedDMS_Object
|
* @uses SeedDMS_Object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -87,6 +87,13 @@ class SeedDMS_Core_DMS {
|
||||||
*/
|
*/
|
||||||
protected $classnames;
|
protected $classnames;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array $decorators list of decorators for objects being instanciate
|
||||||
|
* by the dms
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
protected $decorators;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SeedDMS_Core_User $user reference to currently logged in user. This must be
|
* @var SeedDMS_Core_User $user reference to currently logged in user. This must be
|
||||||
* an instance of {@link SeedDMS_Core_User}. This variable is currently not
|
* an instance of {@link SeedDMS_Core_User}. This variable is currently not
|
||||||
|
@ -456,16 +463,16 @@ class SeedDMS_Core_DMS {
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return class name of instantiated objects
|
* Return class name of classes instanciated by SeedDMS_Core
|
||||||
*
|
*
|
||||||
* This method returns the class name of those objects being instantiated
|
* This method returns the class name of those objects being instantiated
|
||||||
* by the dms. Each class has an internal place holder, which must be
|
* by the dms. Each class has an internal place holder, which must be
|
||||||
* passed to function.
|
* passed to function.
|
||||||
*
|
*
|
||||||
* @param string $objectname placeholder (can be one of 'folder', 'document',
|
* @param string $objectname placeholder (can be one of 'folder', 'document',
|
||||||
* 'documentcontent', 'user', 'group'
|
* 'documentcontent', 'user', 'group')
|
||||||
*
|
*
|
||||||
* @return string/boolean name of class or false if placeholder is invalid
|
* @return string/boolean name of class or false if object name is invalid
|
||||||
*/
|
*/
|
||||||
function getClassname($objectname) { /* {{{ */
|
function getClassname($objectname) { /* {{{ */
|
||||||
if(isset($this->classnames[$objectname]))
|
if(isset($this->classnames[$objectname]))
|
||||||
|
@ -497,6 +504,44 @@ class SeedDMS_Core_DMS {
|
||||||
return $oldclass;
|
return $oldclass;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of decorators
|
||||||
|
*
|
||||||
|
* This method returns the list of decorator class names of those objects
|
||||||
|
* being instantiated
|
||||||
|
* by the dms. Each class has an internal place holder, which must be
|
||||||
|
* passed to function.
|
||||||
|
*
|
||||||
|
* @param string $objectname placeholder (can be one of 'folder', 'document',
|
||||||
|
* 'documentcontent', 'user', 'group')
|
||||||
|
*
|
||||||
|
* @return array/boolean list of class names or false if object name is invalid
|
||||||
|
*/
|
||||||
|
function getDecorators($objectname) { /* {{{ */
|
||||||
|
if(isset($this->decorators[$objectname]))
|
||||||
|
return $this->decorators[$objectname];
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a decorator
|
||||||
|
*
|
||||||
|
* This method adds a single decorator class name to the list of decorators
|
||||||
|
* of those objects being instantiated
|
||||||
|
* by the dms. Each class has an internal place holder, which must be
|
||||||
|
* passed to function.
|
||||||
|
*
|
||||||
|
* @param string $objectname placeholder (can be one of 'folder', 'document',
|
||||||
|
* 'documentcontent', 'user', 'group')
|
||||||
|
*
|
||||||
|
* @return boolean true if decorator could be added, otherwise false
|
||||||
|
*/
|
||||||
|
function addDecorator($objectname, $decorator) { /* {{{ */
|
||||||
|
$this->decorators[$objectname][] = $decorator;
|
||||||
|
return true;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return database where meta data is stored
|
* Return database where meta data is stored
|
||||||
*
|
*
|
||||||
|
|
42
SeedDMS_Core/Core/inc.ClassDecorator.php
Normal file
42
SeedDMS_Core/Core/inc.ClassDecorator.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of the decorator pattern
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS_Core
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2010, Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class which implements a simple decorator pattern
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS_Core
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2010, Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_Core_Decorator {
|
||||||
|
protected $o;
|
||||||
|
|
||||||
|
public function __construct($object) {
|
||||||
|
$this->o = $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($method, $args)
|
||||||
|
{
|
||||||
|
if (!method_exists($this->o, $method)) {
|
||||||
|
throw new Exception("Undefined method $method attempt.");
|
||||||
|
}
|
||||||
|
/* In case the called method returns the object itself, then return this object */
|
||||||
|
$result = call_user_func_array(array($this->o, $method), $args);
|
||||||
|
return $result === $this->o ? $this : $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -249,6 +249,15 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$this->_content = null;
|
$this->_content = null;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this object is of type 'document'.
|
||||||
|
*
|
||||||
|
* @param string $type type of object
|
||||||
|
*/
|
||||||
|
public function isType($type) { /* {{{ */
|
||||||
|
return $type == 'document';
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of database fields which used for searching
|
* Return an array of database fields which used for searching
|
||||||
* a term entered in the database search form
|
* a term entered in the database search form
|
||||||
|
@ -318,9 +327,27 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
/** @var SeedDMS_Core_Document $document */
|
/** @var SeedDMS_Core_Document $document */
|
||||||
$document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]);
|
$document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]);
|
||||||
$document->setDMS($dms);
|
$document->setDMS($dms);
|
||||||
|
$document = $document->applyDecorators();
|
||||||
return $document;
|
return $document;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply decorators
|
||||||
|
*
|
||||||
|
* @return object final object after all decorators has been applied
|
||||||
|
*/
|
||||||
|
function applyDecorators() { /* {{{ */
|
||||||
|
if($decorators = $this->_dms->getDecorators('document')) {
|
||||||
|
$s = $this;
|
||||||
|
foreach($decorators as $decorator) {
|
||||||
|
$s = new $decorator($s);
|
||||||
|
}
|
||||||
|
return $s;
|
||||||
|
} else {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the directory of the document in the file system relativ
|
* Return the directory of the document in the file system relativ
|
||||||
* to the contentDir
|
* to the contentDir
|
||||||
|
@ -468,7 +495,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
if(!$this->_categories)
|
if(!$this->_categories)
|
||||||
self::getCategories();
|
$this->getCategories();
|
||||||
|
|
||||||
$catids = array();
|
$catids = array();
|
||||||
foreach($this->_categories as $cat)
|
foreach($this->_categories as $cat)
|
||||||
|
@ -570,7 +597,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
* @return SeedDMS_Core_Folder parent folder
|
* @return SeedDMS_Core_Folder parent folder
|
||||||
*/
|
*/
|
||||||
function getParent() { /* {{{ */
|
function getParent() { /* {{{ */
|
||||||
return self::getFolder();
|
return $this->getFolder();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function getFolder() { /* {{{ */
|
function getFolder() { /* {{{ */
|
||||||
|
@ -699,7 +726,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$this->_defaultAccess = $mode;
|
$this->_defaultAccess = $mode;
|
||||||
|
|
||||||
if(!$noclean)
|
if(!$noclean)
|
||||||
self::cleanNotifyList();
|
$this->cleanNotifyList();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -733,7 +760,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$this->_inheritAccess = ($inheritAccess ? "1" : "0");
|
$this->_inheritAccess = ($inheritAccess ? "1" : "0");
|
||||||
|
|
||||||
if(!$noclean)
|
if(!$noclean)
|
||||||
self::cleanNotifyList();
|
$this->cleanNotifyList();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -1182,7 +1209,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
unset($this->_accessList);
|
unset($this->_accessList);
|
||||||
|
|
||||||
if(!$noclean)
|
if(!$noclean)
|
||||||
self::cleanNotifyList();
|
$this->cleanNotifyList();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -3229,7 +3256,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$this->_orgFileName = $orgFileName;
|
$this->_orgFileName = $orgFileName;
|
||||||
$this->_fileType = $fileType;
|
$this->_fileType = $fileType;
|
||||||
$this->_mimeType = $mimeType;
|
$this->_mimeType = $mimeType;
|
||||||
$this->_dms = $document->_dms;
|
$this->_dms = $document->getDMS();
|
||||||
if(!$fileSize) {
|
if(!$fileSize) {
|
||||||
$this->_fileSize = SeedDMS_Core_File::fileSize($this->_dms->contentDir . $this->getPath());
|
$this->_fileSize = SeedDMS_Core_File::fileSize($this->_dms->contentDir . $this->getPath());
|
||||||
} else {
|
} else {
|
||||||
|
@ -3275,6 +3302,15 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return null;
|
return null;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this object is of type 'documentcontent'.
|
||||||
|
*
|
||||||
|
* @param string $type type of object
|
||||||
|
*/
|
||||||
|
public function isType($type) { /* {{{ */
|
||||||
|
return $type == 'documentcontent';
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function getVersion() { return $this->_version; }
|
function getVersion() { return $this->_version; }
|
||||||
function getComment() { return $this->_comment; }
|
function getComment() { return $this->_comment; }
|
||||||
function getDate() { return $this->_date; }
|
function getDate() { return $this->_date; }
|
||||||
|
@ -6343,11 +6379,11 @@ class SeedDMS_Core_DocumentLink { /* {{{ */
|
||||||
* @return int either M_NONE or M_READ
|
* @return int either M_NONE or M_READ
|
||||||
*/
|
*/
|
||||||
function getAccessMode($u, $source, $target) { /* {{{ */
|
function getAccessMode($u, $source, $target) { /* {{{ */
|
||||||
$dms = $this->_document->_dms;
|
$dms = $this->_document->getDMS();
|
||||||
|
|
||||||
/* Check if 'onCheckAccessDocumentLink' callback is set */
|
/* Check if 'onCheckAccessDocumentLink' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onCheckAccessDocumentLink'])) {
|
if(isset($dms->callbacks['onCheckAccessDocumentLink'])) {
|
||||||
foreach($this->_dms->callbacks['onCheckAccessDocumentLink'] as $callback) {
|
foreach($dms->callbacks['onCheckAccessDocumentLink'] as $callback) {
|
||||||
if(($ret = call_user_func($callback[0], $callback[1], $this, $u, $source, $target)) > 0) {
|
if(($ret = call_user_func($callback[0], $callback[1], $this, $u, $source, $target)) > 0) {
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,15 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
$this->_notifyList = array();
|
$this->_notifyList = array();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this object is of type 'folder'.
|
||||||
|
*
|
||||||
|
* @param string $type type of object
|
||||||
|
*/
|
||||||
|
public function isType($type) { /* {{{ */
|
||||||
|
return $type == 'folder';
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of database fields which used for searching
|
* Return an array of database fields which used for searching
|
||||||
* a term entered in the database search form
|
* a term entered in the database search form
|
||||||
|
@ -191,9 +200,27 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
/** @var SeedDMS_Core_Folder $folder */
|
/** @var SeedDMS_Core_Folder $folder */
|
||||||
$folder = new $classname($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
|
$folder = new $classname($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
|
||||||
$folder->setDMS($dms);
|
$folder->setDMS($dms);
|
||||||
|
$folder = $folder->applyDecorators();
|
||||||
return $folder;
|
return $folder;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply decorators
|
||||||
|
*
|
||||||
|
* @return object final object after all decorators has been applied
|
||||||
|
*/
|
||||||
|
function applyDecorators() { /* {{{ */
|
||||||
|
if($decorators = $this->_dms->getDecorators('folder')) {
|
||||||
|
$s = $this;
|
||||||
|
foreach($decorators as $decorator) {
|
||||||
|
$s = new $decorator($s);
|
||||||
|
}
|
||||||
|
return $s;
|
||||||
|
} else {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the folder.
|
* Get the name of the folder.
|
||||||
*
|
*
|
||||||
|
@ -448,7 +475,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
$this->_defaultAccess = $mode;
|
$this->_defaultAccess = $mode;
|
||||||
|
|
||||||
if(!$noclean)
|
if(!$noclean)
|
||||||
self::cleanNotifyList();
|
$this->cleanNotifyList();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -481,7 +508,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
$this->_inheritAccess = $inheritAccess;
|
$this->_inheritAccess = $inheritAccess;
|
||||||
|
|
||||||
if(!$noclean)
|
if(!$noclean)
|
||||||
self::cleanNotifyList();
|
$this->cleanNotifyList();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -1229,7 +1256,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
unset($this->_accessList);
|
unset($this->_accessList);
|
||||||
|
|
||||||
if(!$noclean)
|
if(!$noclean)
|
||||||
self::cleanNotifyList();
|
$this->cleanNotifyList();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
|
@ -47,6 +47,15 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
$this->_dms = null;
|
$this->_dms = null;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this object is of a given type.
|
||||||
|
*
|
||||||
|
* This method must be implemened in the child class
|
||||||
|
*
|
||||||
|
* @param string $type type of object
|
||||||
|
*/
|
||||||
|
public function isType($type) {return false;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set dms this object belongs to.
|
* Set dms this object belongs to.
|
||||||
*
|
*
|
||||||
|
@ -57,23 +66,27 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
*
|
*
|
||||||
* @param SeedDMS_Core_DMS $dms reference to dms
|
* @param SeedDMS_Core_DMS $dms reference to dms
|
||||||
*/
|
*/
|
||||||
function setDMS($dms) { /* {{{ */
|
public function setDMS($dms) { /* {{{ */
|
||||||
$this->_dms = $dms;
|
$this->_dms = $dms;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
public function getDMS() { /* {{{ */
|
||||||
|
return $this->_dms;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the internal id of the document
|
* Return the internal id of the document
|
||||||
*
|
*
|
||||||
* @return integer id of document
|
* @return integer id of document
|
||||||
*/
|
*/
|
||||||
function getID() { return $this->_id; }
|
public function getID() { return $this->_id; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all attributes set for the object
|
* Returns all attributes set for the object
|
||||||
*
|
*
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
*/
|
*/
|
||||||
function getAttributes() { /* {{{ */
|
public function getAttributes() { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
|
@ -113,7 +126,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
* @return array|string value of attritbute or false. The value is an array
|
* @return array|string value of attritbute or false. The value is an array
|
||||||
* if the attribute is defined as multi value
|
* if the attribute is defined as multi value
|
||||||
*/
|
*/
|
||||||
function getAttribute($attrdef) { /* {{{ */
|
public function getAttribute($attrdef) { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +146,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
* @return array|string value of attritbute or false. The value is an array
|
* @return array|string value of attritbute or false. The value is an array
|
||||||
* if the attribute is defined as multi value
|
* if the attribute is defined as multi value
|
||||||
*/
|
*/
|
||||||
function getAttributeValue($attrdef) { /* {{{ */
|
public function getAttributeValue($attrdef) { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
}
|
}
|
||||||
|
@ -171,7 +184,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
* even if the attribute is not defined as multi value
|
* even if the attribute is not defined as multi value
|
||||||
*/
|
*/
|
||||||
function getAttributeValueAsArray($attrdef) { /* {{{ */
|
public function getAttributeValueAsArray($attrdef) { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
}
|
}
|
||||||
|
@ -194,7 +207,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
* @return string value of attritbute or false. The value is always a string
|
* @return string value of attritbute or false. The value is always a string
|
||||||
* even if the attribute is defined as multi value
|
* even if the attribute is defined as multi value
|
||||||
*/
|
*/
|
||||||
function getAttributeValueAsString($attrdef) { /* {{{ */
|
public function getAttributeValueAsString($attrdef) { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
}
|
}
|
||||||
|
@ -214,7 +227,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
* must be an array
|
* must be an array
|
||||||
* @return boolean true if operation was successful, otherwise false
|
* @return boolean true if operation was successful, otherwise false
|
||||||
*/
|
*/
|
||||||
function setAttributeValue($attrdef, $value) { /* {{{ */
|
public function setAttributeValue($attrdef, $value) { /* {{{ */
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
|
@ -265,7 +278,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
* @param SeedDMS_Core_AttributeDefinition $attrdef
|
* @param SeedDMS_Core_AttributeDefinition $attrdef
|
||||||
* @return boolean true if operation was successful, otherwise false
|
* @return boolean true if operation was successful, otherwise false
|
||||||
*/
|
*/
|
||||||
function removeAttribute($attrdef) { /* {{{ */
|
public function removeAttribute($attrdef) { /* {{{ */
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
|
|
|
@ -25,50 +25,50 @@
|
||||||
* @version Release: @package_version@
|
* @version Release: @package_version@
|
||||||
*/
|
*/
|
||||||
class SeedDMS_Core_File {
|
class SeedDMS_Core_File {
|
||||||
/**
|
/**
|
||||||
* @param $old
|
* @param $old
|
||||||
* @param $new
|
* @param $new
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function renameFile($old, $new) { /* {{{ */
|
static function renameFile($old, $new) { /* {{{ */
|
||||||
return @rename($old, $new);
|
return @rename($old, $new);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function removeFile($file) { /* {{{ */
|
static function removeFile($file) { /* {{{ */
|
||||||
return @unlink($file);
|
return @unlink($file);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param $target
|
* @param $target
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function copyFile($source, $target) { /* {{{ */
|
static function copyFile($source, $target) { /* {{{ */
|
||||||
return @copy($source, $target);
|
return @copy($source, $target);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param $target
|
* @param $target
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function moveFile($source, $target) { /* {{{ */
|
static function moveFile($source, $target) { /* {{{ */
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
if (!@copyFile($source, $target))
|
if (!@copyFile($source, $target))
|
||||||
return false;
|
return false;
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
return @removeFile($source);
|
return @removeFile($source);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
static function fileSize($file) { /* {{{ */
|
static function fileSize($file) { /* {{{ */
|
||||||
if(!$a = fopen($file, 'r'))
|
if(!$a = fopen($file, 'r'))
|
||||||
return false;
|
return false;
|
||||||
fseek($a, 0, SEEK_END);
|
fseek($a, 0, SEEK_END);
|
||||||
|
@ -77,22 +77,22 @@ class SeedDMS_Core_File {
|
||||||
return $filesize;
|
return $filesize;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $size
|
* @param $size
|
||||||
* @param array $sizes
|
* @param array $sizes
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||||
if ($size == 0) return('0 Bytes');
|
if ($size == 0) return('0 Bytes');
|
||||||
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
||||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $str
|
* @param $str
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
static function parse_filesize($str) { /* {{{ */
|
static function parse_filesize($str) { /* {{{ */
|
||||||
preg_replace('/\s\s+/', ' ', $str);
|
preg_replace('/\s\s+/', ' ', $str);
|
||||||
if(strtoupper(substr($str, -1)) == 'B') {
|
if(strtoupper(substr($str, -1)) == 'B') {
|
||||||
$value = (int) substr($str, 0, -2);
|
$value = (int) substr($str, 0, -2);
|
||||||
|
@ -115,32 +115,32 @@ class SeedDMS_Core_File {
|
||||||
return $value;
|
return $value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/** @noinspection PhpUnreachableStatementInspection */
|
/** @noinspection PhpUnreachableStatementInspection */
|
||||||
return false;
|
return false;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function checksum($file) { /* {{{ */
|
static function checksum($file) { /* {{{ */
|
||||||
return md5_file($file);
|
return md5_file($file);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $old
|
* @param $old
|
||||||
* @param $new
|
* @param $new
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function renameDir($old, $new) { /* {{{ */
|
static function renameDir($old, $new) { /* {{{ */
|
||||||
return @rename($old, $new);
|
return @rename($old, $new);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $path
|
* @param $path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function makeDir($path) { /* {{{ */
|
static function makeDir($path) { /* {{{ */
|
||||||
|
|
||||||
if( !is_dir( $path ) ){
|
if( !is_dir( $path ) ){
|
||||||
$res=@mkdir( $path , 0777, true);
|
$res=@mkdir( $path , 0777, true);
|
||||||
|
@ -195,11 +195,11 @@ class SeedDMS_Core_File {
|
||||||
*/
|
*/
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $path
|
* @param $path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function removeDir($path) { /* {{{ */
|
static function removeDir($path) { /* {{{ */
|
||||||
$handle = @opendir($path);
|
$handle = @opendir($path);
|
||||||
while ($entry = @readdir($handle) )
|
while ($entry = @readdir($handle) )
|
||||||
{
|
{
|
||||||
|
@ -220,12 +220,12 @@ class SeedDMS_Core_File {
|
||||||
return @rmdir($path);
|
return @rmdir($path);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $sourcePath
|
* @param $sourcePath
|
||||||
* @param $targetPath
|
* @param $targetPath
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function copyDir($sourcePath, $targetPath) { /* {{{ */
|
static function copyDir($sourcePath, $targetPath) { /* {{{ */
|
||||||
if (mkdir($targetPath, 0777)) {
|
if (mkdir($targetPath, 0777)) {
|
||||||
$handle = @opendir($sourcePath);
|
$handle = @opendir($sourcePath);
|
||||||
while ($entry = @readdir($handle) ) {
|
while ($entry = @readdir($handle) ) {
|
||||||
|
@ -247,26 +247,26 @@ class SeedDMS_Core_File {
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $sourcePath
|
* @param $sourcePath
|
||||||
* @param $targetPath
|
* @param $targetPath
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function moveDir($sourcePath, $targetPath) { /* {{{ */
|
static function moveDir($sourcePath, $targetPath) { /* {{{ */
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
if (!copyDir($sourcePath, $targetPath))
|
if (!copyDir($sourcePath, $targetPath))
|
||||||
return false;
|
return false;
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
return removeDir($sourcePath);
|
return removeDir($sourcePath);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
// code by Kioob (php.net manual)
|
// code by Kioob (php.net manual)
|
||||||
/**
|
/**
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param bool $level
|
* @param bool $level
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
static function gzcompressfile($source, $level=false) { /* {{{ */
|
static function gzcompressfile($source, $level=false) { /* {{{ */
|
||||||
$dest=$source.'.gz';
|
$dest=$source.'.gz';
|
||||||
$mode='wb'.$level;
|
$mode='wb'.$level;
|
||||||
$error=false;
|
$error=false;
|
||||||
|
|
|
@ -80,7 +80,11 @@ a revision can also be started if some revisors have already reviewed the docume
|
||||||
<file name="inc.ClassWorkflow.php" role="php">
|
<file name="inc.ClassWorkflow.php" role="php">
|
||||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||||
</file>
|
</file>
|
||||||
|
<<<<<<< HEAD
|
||||||
<file name="inc.ClassTransmittal.php" role="php">
|
<file name="inc.ClassTransmittal.php" role="php">
|
||||||
|
=======
|
||||||
|
<file name="inc.ClassDecorator.php" role="php">
|
||||||
|
>>>>>>> seeddms-5.1.x
|
||||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||||
</file>
|
</file>
|
||||||
</dir> <!-- /DTD -->
|
</dir> <!-- /DTD -->
|
||||||
|
@ -1695,6 +1699,23 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
||||||
- add new method SeedDMS_Core_Folder::empty()
|
- add new method SeedDMS_Core_Folder::empty()
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
|
<release>
|
||||||
|
<date>2019-09-06</date>
|
||||||
|
<time>07:31:17</time>
|
||||||
|
<version>
|
||||||
|
<release>5.1.13</release>
|
||||||
|
<api>5.1.13</api>
|
||||||
|
</version>
|
||||||
|
<stability>
|
||||||
|
<release>stable</release>
|
||||||
|
<api>stable</api>
|
||||||
|
</stability>
|
||||||
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
|
<notes>
|
||||||
|
- add decorators
|
||||||
|
- add new methods SeedDMS_Core_Document::isType(), SeedDMS_Core_Folder::isType(), SeedDMS_Core_DocumentContent::isType(). Use them instead of checking the class name.
|
||||||
|
</notes>
|
||||||
|
</release>
|
||||||
<release>
|
<release>
|
||||||
<date>2017-02-28</date>
|
<date>2017-02-28</date>
|
||||||
<time>06:34:50</time>
|
<time>06:34:50</time>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
||||||
|
|
||||||
public function run() {
|
public function run() {
|
||||||
|
global $theme;
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$type = $this->params['type'];
|
$type = $this->params['type'];
|
||||||
$settings = $this->params['settings'];
|
$settings = $this->params['settings'];
|
||||||
|
@ -57,7 +58,9 @@ class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
||||||
$previewer->setConverters($settings->_converters['preview']);
|
$previewer->setConverters($settings->_converters['preview']);
|
||||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||||
if(!$previewer->hasPreview($content)) {
|
if(!$previewer->hasPreview($content)) {
|
||||||
|
add_log_line("");
|
||||||
if(!$previewer->createPreview($content)) {
|
if(!$previewer->createPreview($content)) {
|
||||||
|
add_log_line("", PEAR_LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$previewer->hasPreview($content)) {
|
if(!$previewer->hasPreview($content)) {
|
||||||
|
|
|
@ -1,5 +1,33 @@
|
||||||
Conversion to pdf
|
Conversion to text for fulltext search
|
||||||
=================
|
=======================================
|
||||||
|
|
||||||
|
text/plain
|
||||||
|
text/csv
|
||||||
|
cat '%s'
|
||||||
|
|
||||||
|
application/pdf
|
||||||
|
pdftotext -nopgbrk %s - | sed -e 's/ [a-zA-Z0-9.]\{1\} / /g' -e 's/[0-9.]//g'
|
||||||
|
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||||
|
docx2txt '%s' -
|
||||||
|
|
||||||
|
application/msword
|
||||||
|
catdoc %s
|
||||||
|
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||||
|
xlsx2csv %s
|
||||||
|
|
||||||
|
application/vnd.ms-excel
|
||||||
|
xls2csv %s
|
||||||
|
|
||||||
|
text/html
|
||||||
|
html2text %s
|
||||||
|
|
||||||
|
Many office formats
|
||||||
|
unoconv -d document -f txt --stdout '%s'
|
||||||
|
|
||||||
|
Conversion to pdf for pdf preview
|
||||||
|
==================================
|
||||||
|
|
||||||
text/plain
|
text/plain
|
||||||
text/csv
|
text/csv
|
||||||
|
@ -22,8 +50,16 @@ application/vnd.ms-excel
|
||||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||||
unoconv -d spreadsheet -f pdf --stdout -v '%f' > '%o'
|
unoconv -d spreadsheet -f pdf --stdout -v '%f' > '%o'
|
||||||
|
|
||||||
Preview
|
Conversion to png for preview images
|
||||||
========
|
=====================================
|
||||||
|
|
||||||
|
If you have problems running convert on PDF documents then read this page
|
||||||
|
https://askubuntu.com/questions/1081895/trouble-with-batch-conversion-of-png-to-pdf-using-convert
|
||||||
|
It basically instructs you to comment out the line
|
||||||
|
|
||||||
|
<policy domain="coder" rights="none" pattern="PDF" />
|
||||||
|
|
||||||
|
in /etc/ImageMagick-6/policy.xml
|
||||||
|
|
||||||
image/jpg
|
image/jpg
|
||||||
image/jpeg
|
image/jpeg
|
||||||
|
@ -46,5 +82,5 @@ application/rtf
|
||||||
application/vnd.ms-powerpoint
|
application/vnd.ms-powerpoint
|
||||||
text/csv
|
text/csv
|
||||||
application/vnd.wordperfect
|
application/vnd.wordperfect
|
||||||
/usr/bin/unoconv -d document -e PageRange=1 -f pdf --stdout -v '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72x72 -sOutputFile=- -dFirstPage=1 -dLastPage=1 -q - | convert -resize %wx png:- '%o'
|
unoconv -d document -e PageRange=1 -f pdf --stdout -v '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72x72 -sOutputFile=- -dFirstPage=1 -dLastPage=1 -q - | convert -resize %wx png:- '%o'
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,17 @@ IndexIgnore *
|
||||||
</ifModule>
|
</ifModule>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Securing the configuration file
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
The configuration can be fully controlled by any administrator of SeedDMS. This
|
||||||
|
can be crucial for those configuration options where external commands are
|
||||||
|
being configured, e.g. for the full text engine or creating preview images.
|
||||||
|
As a hoster you may not want this configuration options being set by a SeedDMS
|
||||||
|
administrator. For now you need to make the configuration file `settings.xml`
|
||||||
|
unwritable for the web server.
|
||||||
|
|
||||||
|
|
||||||
UPDATING FROM A PREVIOUS VERSION OR SEEDDMS
|
UPDATING FROM A PREVIOUS VERSION OR SEEDDMS
|
||||||
=============================================
|
=============================================
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class SeedDMS_AccessOperation {
|
||||||
* even if is disallowed in the settings.
|
* even if is disallowed in the settings.
|
||||||
*/
|
*/
|
||||||
function mayEditVersion($document, $vno=0) { /* {{{ */
|
function mayEditVersion($document, $vno=0) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($vno)
|
if($vno)
|
||||||
$version = $document->getContentByVersion($vno);
|
$version = $document->getContentByVersion($vno);
|
||||||
else
|
else
|
||||||
|
@ -87,7 +87,7 @@ class SeedDMS_AccessOperation {
|
||||||
* even if is disallowed in the settings.
|
* even if is disallowed in the settings.
|
||||||
*/
|
*/
|
||||||
function mayRemoveVersion($document) { /* {{{ */
|
function mayRemoveVersion($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
$versions = $document->getContent();
|
$versions = $document->getContent();
|
||||||
if ((($this->settings->_enableVersionDeletion && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin() ) && (count($versions) > 1)) {
|
if ((($this->settings->_enableVersionDeletion && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin() ) && (count($versions) > 1)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -107,7 +107,7 @@ class SeedDMS_AccessOperation {
|
||||||
* even if is disallowed in the settings.
|
* even if is disallowed in the settings.
|
||||||
*/
|
*/
|
||||||
function mayOverrideStatus($document) { /* {{{ */
|
function mayOverrideStatus($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_DRAFT || $status["status"]==S_RELEASED || $status["status"]==S_REJECTED || $status["status"]==S_OBSOLETE || $status["status"]==S_NEEDS_CORRECTION)) {
|
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_DRAFT || $status["status"]==S_RELEASED || $status["status"]==S_REJECTED || $status["status"]==S_OBSOLETE || $status["status"]==S_NEEDS_CORRECTION)) {
|
||||||
|
@ -130,7 +130,7 @@ class SeedDMS_AccessOperation {
|
||||||
* explicitly allows it.
|
* explicitly allows it.
|
||||||
*/
|
*/
|
||||||
function maySetReviewersApprovers($document) { /* {{{ */
|
function maySetReviewersApprovers($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
$reviewstatus = $latestContent->getReviewStatus();
|
$reviewstatus = $latestContent->getReviewStatus();
|
||||||
|
@ -163,7 +163,7 @@ class SeedDMS_AccessOperation {
|
||||||
* settings.
|
* settings.
|
||||||
*/
|
*/
|
||||||
function maySetRecipients($document) { /* {{{ */
|
function maySetRecipients($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if (($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) {
|
if (($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) {
|
||||||
|
@ -184,7 +184,7 @@ class SeedDMS_AccessOperation {
|
||||||
* settings.
|
* settings.
|
||||||
*/
|
*/
|
||||||
function maySetRevisors($document) { /* {{{ */
|
function maySetRevisors($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) && ($status["status"]==S_RELEASED || $status["status"]==S_IN_REVISION)) {
|
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) && ($status["status"]==S_RELEASED || $status["status"]==S_IN_REVISION)) {
|
||||||
|
@ -205,7 +205,7 @@ class SeedDMS_AccessOperation {
|
||||||
* settings.
|
* settings.
|
||||||
*/
|
*/
|
||||||
function maySetWorkflow($document) { /* {{{ */
|
function maySetWorkflow($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$workflow = $latestContent->getWorkflow();
|
$workflow = $latestContent->getWorkflow();
|
||||||
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflow->getInitState()->getID() == $latestContent->getWorkflowState()->getID()))) {
|
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflow->getInitState()->getID() == $latestContent->getWorkflowState()->getID()))) {
|
||||||
|
@ -223,7 +223,7 @@ class SeedDMS_AccessOperation {
|
||||||
* expiration date is only allowed if the document has not been obsoleted.
|
* expiration date is only allowed if the document has not been obsoleted.
|
||||||
*/
|
*/
|
||||||
function maySetExpires($document) { /* {{{ */
|
function maySetExpires($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if ((($document->getAccessMode($this->user) >= M_READWRITE) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) {
|
if ((($document->getAccessMode($this->user) >= M_READWRITE) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) {
|
||||||
|
@ -244,7 +244,7 @@ class SeedDMS_AccessOperation {
|
||||||
* disallowed in the settings.
|
* disallowed in the settings.
|
||||||
*/
|
*/
|
||||||
function mayEditComment($document) { /* {{{ */
|
function mayEditComment($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($document->isLocked()) {
|
if($document->isLocked()) {
|
||||||
$lockingUser = $document->getLockingUser();
|
$lockingUser = $document->getLockingUser();
|
||||||
if (($lockingUser->getID() != $this->user->getID()) && ($document->getAccessMode($this->user) != M_ALL)) {
|
if (($lockingUser->getID() != $this->user->getID()) && ($document->getAccessMode($this->user) != M_ALL)) {
|
||||||
|
@ -271,7 +271,7 @@ class SeedDMS_AccessOperation {
|
||||||
* disallowed in the settings.
|
* disallowed in the settings.
|
||||||
*/
|
*/
|
||||||
function mayEditAttributes($document) { /* {{{ */
|
function mayEditAttributes($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
$workflow = $latestContent->getWorkflow();
|
$workflow = $latestContent->getWorkflow();
|
||||||
|
@ -291,7 +291,7 @@ class SeedDMS_AccessOperation {
|
||||||
* account here.
|
* account here.
|
||||||
*/
|
*/
|
||||||
function mayReview($document) { /* {{{ */
|
function mayReview($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_DRAFT_REV) {
|
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_DRAFT_REV) {
|
||||||
|
@ -309,7 +309,7 @@ class SeedDMS_AccessOperation {
|
||||||
* review and if it is allowed in the settings
|
* review and if it is allowed in the settings
|
||||||
*/
|
*/
|
||||||
function mayUpdateReview($document, $updateUser) { /* {{{ */
|
function mayUpdateReview($document, $updateUser) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
|
if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ class SeedDMS_AccessOperation {
|
||||||
* approval and if it is allowed in the settings
|
* approval and if it is allowed in the settings
|
||||||
*/
|
*/
|
||||||
function mayUpdateApproval($document, $updateUser) { /* {{{ */
|
function mayUpdateApproval($document, $updateUser) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
|
if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ class SeedDMS_AccessOperation {
|
||||||
* account here.
|
* account here.
|
||||||
*/
|
*/
|
||||||
function mayApprove($document) { /* {{{ */
|
function mayApprove($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_DRAFT_APP) {
|
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_DRAFT_APP) {
|
||||||
|
@ -361,7 +361,7 @@ class SeedDMS_AccessOperation {
|
||||||
* account here.
|
* account here.
|
||||||
*/
|
*/
|
||||||
function mayReceipt($document) { /* {{{ */
|
function mayReceipt($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_RELEASED) {
|
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_RELEASED) {
|
||||||
|
@ -379,7 +379,7 @@ class SeedDMS_AccessOperation {
|
||||||
* review and if it is allowed in the settings
|
* review and if it is allowed in the settings
|
||||||
*/
|
*/
|
||||||
function mayUpdateReceipt($document, $updateUser) { /* {{{ */
|
function mayUpdateReceipt($document, $updateUser) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($this->settings->_enableUpdateReceipt && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
|
if($this->settings->_enableUpdateReceipt && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ class SeedDMS_AccessOperation {
|
||||||
* account here.
|
* account here.
|
||||||
*/
|
*/
|
||||||
function mayRevise($document) { /* {{{ */
|
function mayRevise($document) { /* {{{ */
|
||||||
if($this->obj->isType('document')) {
|
if($document->isType('document')) {
|
||||||
if($latestContent = $document->getLatestContent()) {
|
if($latestContent = $document->getLatestContent()) {
|
||||||
$status = $latestContent->getStatus();
|
$status = $latestContent->getStatus();
|
||||||
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]!=S_OBSOLETE) {
|
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]!=S_OBSOLETE) {
|
||||||
|
|
|
@ -54,6 +54,7 @@ class SeedDMS_Controller_Common {
|
||||||
* @return mixed return value of called method
|
* @return mixed return value of called method
|
||||||
*/
|
*/
|
||||||
function __invoke($get=array()) {
|
function __invoke($get=array()) {
|
||||||
|
$this->callHook('preRun', isset($get['action']) ? $get['action'] : 'run');
|
||||||
if(isset($get['action']) && $get['action']) {
|
if(isset($get['action']) && $get['action']) {
|
||||||
if(method_exists($this, $get['action'])) {
|
if(method_exists($this, $get['action'])) {
|
||||||
return $this->{$get['action']}();
|
return $this->{$get['action']}();
|
||||||
|
@ -63,6 +64,7 @@ class SeedDMS_Controller_Common {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return $this->run();
|
return $this->run();
|
||||||
|
$this->callHook('postRun', isset($get['action']) ? $get['action'] : 'run');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setParams($params) {
|
function setParams($params) {
|
||||||
|
@ -188,10 +190,17 @@ class SeedDMS_Controller_Common {
|
||||||
* null if no hook was called
|
* null if no hook was called
|
||||||
*/
|
*/
|
||||||
function callHook($hook) { /* {{{ */
|
function callHook($hook) { /* {{{ */
|
||||||
|
$tmps = array();
|
||||||
$tmp = explode('_', get_class($this));
|
$tmp = explode('_', get_class($this));
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) {
|
$tmps[] = $tmp[2];
|
||||||
|
$tmp = explode('_', get_parent_class($this));
|
||||||
|
$tmps[] = $tmp[2];
|
||||||
|
/* Run array_unique() in case the parent class has the same suffix */
|
||||||
|
$tmps = array_unique($tmps);
|
||||||
|
foreach($tmps as $tmp)
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)])) {
|
||||||
$this->lasthookresult = null;
|
$this->lasthookresult = null;
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) {
|
foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)] as $hookObj) {
|
||||||
if (method_exists($hookObj, $hook)) {
|
if (method_exists($hookObj, $hook)) {
|
||||||
switch(func_num_args()) {
|
switch(func_num_args()) {
|
||||||
case 3:
|
case 3:
|
||||||
|
|
|
@ -295,10 +295,10 @@ class SeedDMS_Session {
|
||||||
/* id is only set if load() was called before */
|
/* id is only set if load() was called before */
|
||||||
if($this->id) {
|
if($this->id) {
|
||||||
$dms = $object->_dms;
|
$dms = $object->_dms;
|
||||||
if(get_class($object) == $dms->getClassname('document')) {
|
if($object->isType('document')) {
|
||||||
if(!in_array($object->getID(), $this->data['clipboard']['docs']))
|
if(!in_array($object->getID(), $this->data['clipboard']['docs']))
|
||||||
array_push($this->data['clipboard']['docs'], $object->getID());
|
array_push($this->data['clipboard']['docs'], $object->getID());
|
||||||
} elseif(get_class($object) == $dms->getClassname('folder')) {
|
} elseif($object->isType('folder')) {
|
||||||
if(!in_array($object->getID(), $this->data['clipboard']['folders']))
|
if(!in_array($object->getID(), $this->data['clipboard']['folders']))
|
||||||
array_push($this->data['clipboard']['folders'], $object->getID());
|
array_push($this->data['clipboard']['folders'], $object->getID());
|
||||||
}
|
}
|
||||||
|
@ -318,11 +318,11 @@ class SeedDMS_Session {
|
||||||
/* id is only set if load() was called before */
|
/* id is only set if load() was called before */
|
||||||
if($this->id) {
|
if($this->id) {
|
||||||
$dms = $object->_dms;
|
$dms = $object->_dms;
|
||||||
if(get_class($object) == $dms->getClassname('document')) {
|
if($object->isType('document')) {
|
||||||
$key = array_search($object->getID(), $this->data['clipboard']['docs']);
|
$key = array_search($object->getID(), $this->data['clipboard']['docs']);
|
||||||
if($key !== false)
|
if($key !== false)
|
||||||
unset($this->data['clipboard']['docs'][$key]);
|
unset($this->data['clipboard']['docs'][$key]);
|
||||||
} elseif(get_class($object) == $dms->getClassname('folder')) {
|
} elseif($object->isType('folder')) {
|
||||||
$key = array_search($object->getID(), $this->data['clipboard']['folders']);
|
$key = array_search($object->getID(), $this->data['clipboard']['folders']);
|
||||||
if($key !== false)
|
if($key !== false)
|
||||||
unset($this->data['clipboard']['folders'][$key]);
|
unset($this->data['clipboard']['folders'][$key]);
|
||||||
|
|
|
@ -52,27 +52,49 @@ class UI extends UI_Default {
|
||||||
} else {
|
} else {
|
||||||
$classname = "SeedDMS_View_".$class;
|
$classname = "SeedDMS_View_".$class;
|
||||||
}
|
}
|
||||||
|
/* Collect all decorators */
|
||||||
|
$decorators = array();
|
||||||
|
foreach($EXT_CONF as $extname=>$extconf) {
|
||||||
|
if(!isset($extconf['disable']) || $extconf['disable'] == false) {
|
||||||
|
if(isset($extconf['decorators'][$class])) {
|
||||||
|
$filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$extconf['decorators'][$class]['file'];
|
||||||
|
if(file_exists($filename)) {
|
||||||
|
$classname = $extconf['decorators'][$class]['name'];
|
||||||
|
$decorators[$extname] = $extconf['decorators'][$class];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Do not check for class file anymore but include it relative
|
/* Do not check for class file anymore but include it relative
|
||||||
* to rootDir or an extension dir if it has set the include path
|
* to rootDir or an extension dir if it has been set the include path
|
||||||
*/
|
*/
|
||||||
$filename = '';
|
$filename = '';
|
||||||
$httpbasedir = '';
|
$httpbasedir = '';
|
||||||
foreach($EXT_CONF as $extname=>$extconf) {
|
foreach($EXT_CONF as $extname=>$extconf) {
|
||||||
if(!isset($extconf['disable']) || $extconf['disable'] == false) {
|
if(!isset($extconf['disable']) || $extconf['disable'] == false) {
|
||||||
|
/* Setting the 'views' element in the configuration can be used to
|
||||||
|
* replace an existing view in views/bootstrap/, e.g. class.ViewFolder.php
|
||||||
|
* without providing an out/out.ViewFolder.php. In that case $httpbasedir
|
||||||
|
* will not be set because out/out.xxx.php is still used.
|
||||||
|
*/
|
||||||
|
if(isset($extconf['views'][$class])) {
|
||||||
|
$filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/".$extconf['views'][$class]['file'];
|
||||||
|
if(file_exists($filename)) {
|
||||||
|
// $httpbasedir = 'ext/'.$extname.'/';
|
||||||
|
$classname = $extconf['views'][$class]['name'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* New views are added by creating a file out/out.xx.php and
|
||||||
|
* views/bootstrap/class.xx.php, without setting the 'views' element
|
||||||
|
* in the configuration
|
||||||
|
*/
|
||||||
$filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/class.".$class.".php";
|
$filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/class.".$class.".php";
|
||||||
if(file_exists($filename)) {
|
if(file_exists($filename)) {
|
||||||
$httpbasedir = 'ext/'.$extname.'/';
|
$httpbasedir = 'ext/'.$extname.'/';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$filename = '';
|
$filename = '';
|
||||||
if(isset($extconf['views'][$class])) {
|
|
||||||
$filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/".$extconf['views'][$class]['file'];
|
|
||||||
if(file_exists($filename)) {
|
|
||||||
$httpbasedir = 'ext/'.$extname.'/';
|
|
||||||
$classname = $extconf['views'][$class]['name'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$filename)
|
if(!$filename)
|
||||||
|
@ -116,6 +138,11 @@ class UI extends UI_Default {
|
||||||
$view->setParam('showmissingtranslations', $settings->_showMissingTranslations);
|
$view->setParam('showmissingtranslations', $settings->_showMissingTranslations);
|
||||||
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
|
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
|
||||||
$view->setParam('cachedir', $settings->_cacheDir);
|
$view->setParam('cachedir', $settings->_cacheDir);
|
||||||
|
foreach($decorators as $extname=>$decorator) {
|
||||||
|
$filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$decorator['file'];
|
||||||
|
require($filename);
|
||||||
|
$view = new $decorator['name']($view);
|
||||||
|
}
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -157,6 +157,7 @@ switch($command) {
|
||||||
}
|
}
|
||||||
break; /* }}} */
|
break; /* }}} */
|
||||||
|
|
||||||
|
/* The subtree command is deprecated. It has been moved into view */
|
||||||
case 'subtree': /* {{{ */
|
case 'subtree': /* {{{ */
|
||||||
if($user) {
|
if($user) {
|
||||||
if(empty($_GET['node']))
|
if(empty($_GET['node']))
|
||||||
|
|
|
@ -48,6 +48,43 @@ if(strpos($dirname, realpath($settings->_dropFolderDir.'/'.$user->getLogin().'/'
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_dropfolder_folder"));
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_dropfolder_folder"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$metadata = array();
|
||||||
|
if(!empty($_GET["dropfolderfileform2"])) {
|
||||||
|
$metadatafile = realpath($settings->_dropFolderDir.'/'.$user->getLogin()."/".$_GET["dropfolderfileform2"]);
|
||||||
|
$csvdelim = ';';
|
||||||
|
$csvencl = '"';
|
||||||
|
if($fp = fopen($metadatafile, 'r')) {
|
||||||
|
$colmap = array();
|
||||||
|
if($header = fgetcsv($fp, 0, $csvdelim, $csvencl)) {
|
||||||
|
print_r($header);
|
||||||
|
foreach($header as $i=>$colname) {
|
||||||
|
if(in_array($colname, array('filename', 'category'))) {
|
||||||
|
$colmap[$colname] = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($colmap) > 1) {
|
||||||
|
$nameprefix = dirname($dirname).'/';
|
||||||
|
$allcats = $dms->getDocumentCategories();
|
||||||
|
$catids = array();
|
||||||
|
foreach($allcats as $cat)
|
||||||
|
$catids[$cat->getName()] = $cat;
|
||||||
|
while(!feof($fp)) {
|
||||||
|
if($data = fgetcsv($fp, 0, $csvdelim, $csvencl)) {
|
||||||
|
$metadata[$nameprefix.$data[$colmap['filename']]] = array('category'=>array());
|
||||||
|
if($data[$colmap['category']]) {
|
||||||
|
$kk = explode(',', $data[$colmap['category']]);
|
||||||
|
foreach($kk as $k) {
|
||||||
|
if(isset($catids[$k]))
|
||||||
|
$metadata[$nameprefix.$data[$colmap['filename']]]['category'][] = $catids[$k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$setfiledate = false;
|
$setfiledate = false;
|
||||||
if(isset($_GET['setfiledate']) && $_GET["setfiledate"]) {
|
if(isset($_GET['setfiledate']) && $_GET["setfiledate"]) {
|
||||||
$setfiledate = true;
|
$setfiledate = true;
|
||||||
|
@ -58,7 +95,7 @@ if(isset($_GET['setfolderdate']) && $_GET["setfolderdate"]) {
|
||||||
$setfolderdate = true;
|
$setfolderdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_folder($dirname, $folder, $setfiledate, $setfolderdate) { /* {{{ */
|
function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadata) { /* {{{ */
|
||||||
global $user, $doccount, $foldercount;
|
global $user, $doccount, $foldercount;
|
||||||
|
|
||||||
$d = dir($dirname);
|
$d = dir($dirname);
|
||||||
|
@ -81,13 +118,13 @@ function import_folder($dirname, $folder, $setfiledate, $setfolderdate) { /* {{{
|
||||||
|
|
||||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
$mimetype = finfo_file($finfo, $path);
|
$mimetype = finfo_file($finfo, $path);
|
||||||
$lastDotIndex = strrpos($path, ".");
|
$lastDotIndex = strrpos($name, ".");
|
||||||
if (is_bool($lastDotIndex) && !$lastDotIndex) $filetype = ".";
|
if (is_bool($lastDotIndex) && !$lastDotIndex) $filetype = ".";
|
||||||
else $filetype = substr($path, $lastDotIndex);
|
else $filetype = substr($name, $lastDotIndex);
|
||||||
|
|
||||||
// echo $mimetype." - ".$filetype." - ".$path."\n";
|
// echo $mimetype." - ".$filetype." - ".$path."\n";
|
||||||
if($res = $folder->addDocument($name, $comment, $expires, $user, $keywords,
|
if($res = $folder->addDocument($name, $comment, $expires, $user, $keywords,
|
||||||
$categories, $filetmp, $name,
|
$metadata[$path]['category'], $filetmp, $name,
|
||||||
$filetype, $mimetype, $sequence, $reviewers,
|
$filetype, $mimetype, $sequence, $reviewers,
|
||||||
$approvers, $reqversion, $version_comment)) {
|
$approvers, $reqversion, $version_comment)) {
|
||||||
$doccount++;
|
$doccount++;
|
||||||
|
@ -108,7 +145,7 @@ function import_folder($dirname, $folder, $setfiledate, $setfolderdate) { /* {{{
|
||||||
if($setfolderdate) {
|
if($setfolderdate) {
|
||||||
$newfolder->setDate(filemtime($path));
|
$newfolder->setDate(filemtime($path));
|
||||||
}
|
}
|
||||||
if(!import_folder($path, $newfolder, $setfiledate, $setfolderdate))
|
if(!import_folder($path, $newfolder, $setfiledate, $setfolderdate, $metadata))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,7 +162,7 @@ if($newfolder = $folder->addSubFolder($_GET["dropfolderfileform1"], '', $user, 1
|
||||||
if($setfolderdate) {
|
if($setfolderdate) {
|
||||||
$newfolder->setDate(filemtime($dirname));
|
$newfolder->setDate(filemtime($dirname));
|
||||||
}
|
}
|
||||||
if(!import_folder($dirname, $newfolder, $setfiledate, $setfolderdate))
|
if(!import_folder($dirname, $newfolder, $setfiledate, $setfolderdate, $metadata))
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
||||||
else {
|
else {
|
||||||
if(isset($_GET['remove']) && $_GET["remove"]) {
|
if(isset($_GET['remove']) && $_GET["remove"]) {
|
||||||
|
|
|
@ -93,8 +93,8 @@ if ($folder->setParent($targetFolder)) {
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params);
|
$notifier->toGroup($user, $grp, $subject, $message, $params);
|
||||||
}
|
}
|
||||||
// if user is not owner send notification to owner
|
// if user is not owner send notification to owner
|
||||||
if ($user->getID() != $folder->getOwner()->getID())
|
//if ($user->getID() != $folder->getOwner()->getID())
|
||||||
$notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params);
|
// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -65,7 +65,8 @@ if (!isset($_POST["overrideStatus"]) || !is_numeric($_POST["overrideStatus"]) ||
|
||||||
|
|
||||||
$overallStatus = $content->getStatus();
|
$overallStatus = $content->getStatus();
|
||||||
|
|
||||||
// status change control
|
// status change control, setting a status to obsolete is alwasy allowed
|
||||||
|
if(intval($_POST["overrideStatus"]) != S_OBSOLETE)
|
||||||
if ($overallStatus["status"] == S_REJECTED || $overallStatus["status"] == S_EXPIRED || $overallStatus["status"] == S_DRAFT_REV || $overallStatus["status"] == S_DRAFT_APP || $overallStatus["status"] == S_IN_WORKFLOW) {
|
if ($overallStatus["status"] == S_REJECTED || $overallStatus["status"] == S_EXPIRED || $overallStatus["status"] == S_DRAFT_REV || $overallStatus["status"] == S_DRAFT_APP || $overallStatus["status"] == S_IN_WORKFLOW) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("cannot_change_final_states"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("cannot_change_final_states"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ else
|
||||||
$previewer->setConverters($settings->_converters['preview']);
|
$previewer->setConverters($settings->_converters['preview']);
|
||||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||||
if(!$previewer->hasPreview($object)) {
|
if(!$previewer->hasPreview($object)) {
|
||||||
|
add_log_line("");
|
||||||
if(!$previewer->createPreview($object)) {
|
if(!$previewer->createPreview($object)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,11 @@ if(!checkFormKey('removearchive')) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_POST["arkname"]) || !file_exists($settings->_contentDir.$_POST["arkname"]) ) {
|
if (!isset($_POST["arkname"]) || !file_exists(addDirSep($settings->_backupDir).$_POST["arkname"]) ) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SeedDMS_Core_File::removeFile($settings->_contentDir.$_POST["arkname"])) {
|
if (!SeedDMS_Core_File::removeFile(addDirSep($settings->_backupDir).$_POST["arkname"])) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,7 @@ if ($notifier){
|
||||||
$params['username'] = $user->getFullName();
|
$params['username'] = $user->getFullName();
|
||||||
$params['sitename'] = $settings->_siteName;
|
$params['sitename'] = $settings->_siteName;
|
||||||
$params['http_root'] = $settings->_httpRoot;
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
|
||||||
$notifier->toList($user, $nl["users"], $subject, $message, $params);
|
$notifier->toList($user, $nl["users"], $subject, $message, $params);
|
||||||
foreach ($nl["groups"] as $grp) {
|
foreach ($nl["groups"] as $grp) {
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params);
|
$notifier->toGroup($user, $grp, $subject, $message, $params);
|
||||||
|
|
|
@ -35,11 +35,11 @@ if(!checkFormKey('removedump')) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_POST["dumpname"]) || !file_exists($settings->_contentDir.$_POST["dumpname"]) ) {
|
if (!isset($_POST["dumpname"]) || !file_exists(addDirSep($settings->_backupDir).$_POST["dumpname"]) ) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SeedDMS_Core_File::removeFile($settings->_contentDir.$_POST["dumpname"])) {
|
if (!SeedDMS_Core_File::removeFile($settings->_backupDir.$_POST["dumpname"])) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ else {
|
||||||
* be informed about the removal.
|
* be informed about the removal.
|
||||||
*/
|
*/
|
||||||
$emailUserList = array();
|
$emailUserList = array();
|
||||||
$emailUserList[] = $version->_userID;
|
$emailUserList[] = $version->getUser()->getID();
|
||||||
$emailGroupList = array();
|
$emailGroupList = array();
|
||||||
$status = $version->getReviewStatus();
|
$status = $version->getReviewStatus();
|
||||||
foreach ($status as $st) {
|
foreach ($status as $st) {
|
||||||
|
@ -150,12 +150,12 @@ else {
|
||||||
$nl=$document->getNotifyList();
|
$nl=$document->getNotifyList();
|
||||||
$userrecipients = array();
|
$userrecipients = array();
|
||||||
foreach ($emailUserList as $eID) {
|
foreach ($emailUserList as $eID) {
|
||||||
$eU = $version->_document->_dms->getUser($eID);
|
$eU = $version->getDMS()->getUser($eID);
|
||||||
$userrecipients[] = $eU;
|
$userrecipients[] = $eU;
|
||||||
}
|
}
|
||||||
$grouprecipients = array();
|
$grouprecipients = array();
|
||||||
foreach ($emailGroupList as $eID) {
|
foreach ($emailGroupList as $eID) {
|
||||||
$eU = $version->_document->_dms->getGroup($eID);
|
$eU = $version->getDMS()->getGroup($eID);
|
||||||
$grouprecipients[] = $eU;
|
$grouprecipients[] = $eU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,5 +30,5 @@ include("../inc/inc.Authentication.php");
|
||||||
|
|
||||||
$session->setLanguage($_GET['lang']);
|
$session->setLanguage($_GET['lang']);
|
||||||
|
|
||||||
header("Location: ".$_GET['referer']);
|
header("Location: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$_GET['referer']);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -28,13 +28,34 @@ require_once("inc/inc.DBInit.php");
|
||||||
require_once("inc/inc.ClassUI.php");
|
require_once("inc/inc.ClassUI.php");
|
||||||
require_once("inc/inc.Authentication.php");
|
require_once("inc/inc.Authentication.php");
|
||||||
|
|
||||||
$form = preg_replace('/[^A-Za-z0-9_]+/', '', $_GET["form"]);
|
if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
|
||||||
$mode = intval($_GET["mode"]);
|
if (isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) {
|
||||||
$exclude = intval($_GET["exclude"]);
|
$nodeid = $settings->_rootFolderID;
|
||||||
|
} else {
|
||||||
|
$nodeid = intval($_GET["node"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$node = $dms->getFolder($nodeid);
|
||||||
|
if (!is_object($node)) {
|
||||||
|
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$form = preg_replace('/[^A-Za-z0-9_]+/', '', $_GET["form"]);
|
||||||
|
$mode = intval($_GET["mode"]);
|
||||||
|
$exclude = intval($_GET["exclude"]);
|
||||||
|
}
|
||||||
|
|
||||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'rootfolderid'=>$settings->_rootFolderID, 'form'=>$form, 'mode'=>$mode, 'exclude'=>$exclude));
|
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'rootfolderid'=>$settings->_rootFolderID));
|
||||||
if($view) {
|
if($view) {
|
||||||
|
if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
|
||||||
|
$view->setParam('node', $node);
|
||||||
|
$view->setParam('orderby', $settings->_sortFoldersDefault);
|
||||||
|
} else {
|
||||||
|
$view->setParam('form', $form);
|
||||||
|
$view->setParam('mode', $mode);
|
||||||
|
$view->setParam('exclude', $exclude);
|
||||||
|
}
|
||||||
$view($_GET);
|
$view($_GET);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
/
|
|
||||||
if(!isset($settings))
|
if(!isset($settings))
|
||||||
require_once("../inc/inc.Settings.php");
|
require_once("../inc/inc.Settings.php");
|
||||||
require_once("inc/inc.LogInit.php");
|
require_once("inc/inc.LogInit.php");
|
||||||
|
@ -34,7 +34,7 @@ if (!$accessop->check_view_access($view, $_GET)) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_GET["arkname"]) || !file_exists($settings->_contentDir.$_GET["arkname"]) ) {
|
if (!isset($_GET["arkname"]) || !file_exists(addDirSep($settings->_backupDir).$_GET["arkname"]) ) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ if (!$accessop->check_view_access($view, $_GET)) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_GET["dumpname"]) || !file_exists($settings->_contentDir.$_GET["dumpname"]) ) {
|
if (!isset($_GET["dumpname"]) || !file_exists(addDirSep($settings->_backupDir).$_GET["dumpname"]) ) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -444,53 +444,64 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
|
|
||||||
// -------------- Output results --------------------------------------------
|
// -------------- Output results --------------------------------------------
|
||||||
|
|
||||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
if($settings->_showSingleSearchHit && count($entries) == 1) {
|
||||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
$entry = $entries[0];
|
||||||
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
|
if($entry->isType('document')) {
|
||||||
if($view) {
|
header('Location: ../out/out.ViewDocument.php?documentid='.$entry->getID());
|
||||||
$view->setParam('accessobject', $accessop);
|
exit;
|
||||||
$view->setParam('query', $query);
|
} elseif($entry->isType('folder')) {
|
||||||
$view->setParam('searchhits', $entries);
|
header('Location: ../out/out.ViewFolder.php?folderid='.$entry->getID());
|
||||||
$view->setParam('totalpages', $totalPages);
|
exit;
|
||||||
$view->setParam('pagenumber', $pageNumber);
|
}
|
||||||
$view->setParam('limit', $limit);
|
} else {
|
||||||
$view->setParam('searchtime', $searchTime);
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
$view->setParam('urlparams', $_GET);
|
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||||
$view->setParam('cachedir', $settings->_cacheDir);
|
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
|
||||||
$view->setParam('totaldocs', $dcount /*resArr['totalDocs']*/);
|
if($view) {
|
||||||
$view->setParam('totalfolders', $fcount /*resArr['totalFolders']*/);
|
$view->setParam('accessobject', $accessop);
|
||||||
$view->setParam('fullsearch', (isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSearch) ? true : false);
|
$view->setParam('query', $query);
|
||||||
$view->setParam('mode', isset($mode) ? $mode : '');
|
$view->setParam('searchhits', $entries);
|
||||||
$view->setParam('orderby', isset($orderby) ? $orderby : '');
|
$view->setParam('totalpages', $totalPages);
|
||||||
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
|
$view->setParam('pagenumber', $pageNumber);
|
||||||
$view->setParam('resultmode', isset($resultmode) ? $resultmode : '');
|
$view->setParam('limit', $limit);
|
||||||
$view->setParam('searchin', isset($searchin) ? $searchin : array());
|
$view->setParam('searchtime', $searchTime);
|
||||||
$view->setParam('startfolder', isset($startFolder) ? $startFolder : null);
|
$view->setParam('urlparams', $_GET);
|
||||||
$view->setParam('owner', $owner);
|
$view->setParam('cachedir', $settings->_cacheDir);
|
||||||
$view->setParam('startdate', isset($startdate) ? $startdate : array());
|
$view->setParam('totaldocs', $dcount /*resArr['totalDocs']*/);
|
||||||
$view->setParam('stopdate', isset($stopdate) ? $stopdate : array());
|
$view->setParam('totalfolders', $fcount /*resArr['totalFolders']*/);
|
||||||
$view->setParam('expstartdate', isset($expstartdate) ? $expstartdate : array());
|
$view->setParam('fullsearch', (isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSearch) ? true : false);
|
||||||
$view->setParam('expstopdate', isset($expstopdate) ? $expstopdate : array());
|
$view->setParam('mode', isset($mode) ? $mode : '');
|
||||||
$view->setParam('creationdate', isset($creationdate) ? $creationdate : '');
|
$view->setParam('orderby', isset($orderby) ? $orderby : '');
|
||||||
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
|
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
|
||||||
$view->setParam('status', isset($status) ? $status : array());
|
$view->setParam('resultmode', isset($resultmode) ? $resultmode : '');
|
||||||
$view->setParam('categories', isset($categories) ? $categories : '');
|
$view->setParam('searchin', isset($searchin) ? $searchin : array());
|
||||||
$view->setParam('attributes', isset($attributes) ? $attributes : '');
|
$view->setParam('startfolder', isset($startFolder) ? $startFolder : null);
|
||||||
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));
|
$view->setParam('owner', $owner);
|
||||||
$view->setParam('attrdefs', $attrdefs);
|
$view->setParam('startdate', isset($startdate) ? $startdate : array());
|
||||||
$allCats = $dms->getDocumentCategories();
|
$view->setParam('stopdate', isset($stopdate) ? $stopdate : array());
|
||||||
$view->setParam('allcategories', $allCats);
|
$view->setParam('expstartdate', isset($expstartdate) ? $expstartdate : array());
|
||||||
$allUsers = $dms->getAllUsers($settings->_sortUsersInList);
|
$view->setParam('expstopdate', isset($expstopdate) ? $expstopdate : array());
|
||||||
$view->setParam('allusers', $allUsers);
|
$view->setParam('creationdate', isset($creationdate) ? $creationdate : '');
|
||||||
$view->setParam('workflowmode', $settings->_workflowMode);
|
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
|
||||||
$view->setParam('enablefullsearch', $settings->_enableFullSearch);
|
$view->setParam('status', isset($status) ? $status : array());
|
||||||
$view->setParam('previewWidthList', $settings->_previewWidthList);
|
$view->setParam('categories', isset($categories) ? $categories : '');
|
||||||
$view->setParam('previewconverters', $settings->_converters['preview']);
|
$view->setParam('attributes', isset($attributes) ? $attributes : '');
|
||||||
$view->setParam('timeout', $settings->_cmdTimeout);
|
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));
|
||||||
$view->setParam('xsendfile', $settings->_enableXsendfile);
|
$view->setParam('attrdefs', $attrdefs);
|
||||||
$view->setParam('reception', $reception);
|
$allCats = $dms->getDocumentCategories();
|
||||||
$view->setParam('showsinglesearchhit', $settings->_showSingleSearchHit);
|
$view->setParam('allcategories', $allCats);
|
||||||
$view($_GET);
|
$allUsers = $dms->getAllUsers($settings->_sortUsersInList);
|
||||||
exit;
|
$view->setParam('allusers', $allUsers);
|
||||||
|
$view->setParam('workflowmode', $settings->_workflowMode);
|
||||||
|
$view->setParam('enablefullsearch', $settings->_enableFullSearch);
|
||||||
|
$view->setParam('previewWidthList', $settings->_previewWidthList);
|
||||||
|
$view->setParam('previewconverters', $settings->_converters['preview']);
|
||||||
|
$view->setParam('timeout', $settings->_cmdTimeout);
|
||||||
|
$view->setParam('xsendfile', $settings->_enableXsendfile);
|
||||||
|
$view->setParam('reception', $reception);
|
||||||
|
$view->setParam('showsinglesearchhit', $settings->_showSingleSearchHit);
|
||||||
|
$view($_GET);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -46,6 +46,19 @@ if (!is_object($folder)) {
|
||||||
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
|
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
|
||||||
|
if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) {
|
||||||
|
$nodeid = $settings->_rootFolderID;
|
||||||
|
} else {
|
||||||
|
$nodeid = intval($_GET["node"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$node = $dms->getFolder($nodeid);
|
||||||
|
if (!is_object($node)) {
|
||||||
|
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET["orderby"]) && strlen($_GET["orderby"])>0 ) {
|
if (isset($_GET["orderby"]) && strlen($_GET["orderby"])>0 ) {
|
||||||
$orderby=$_GET["orderby"];
|
$orderby=$_GET["orderby"];
|
||||||
} else $orderby=$settings->_sortFoldersDefault;
|
} else $orderby=$settings->_sortFoldersDefault;
|
||||||
|
@ -63,6 +76,8 @@ if ($folder->getAccessMode($user) < M_READ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($view) {
|
if($view) {
|
||||||
|
if(isset($_GET['action']) && $_GET['action'] == 'subtree')
|
||||||
|
$view->setParam('node', $node);
|
||||||
$view->setParam('folder', $folder);
|
$view->setParam('folder', $folder);
|
||||||
$view->setParam('orderby', $orderby);
|
$view->setParam('orderby', $orderby);
|
||||||
$view->setParam('enableFolderTree', $settings->_enableFolderTree);
|
$view->setParam('enableFolderTree', $settings->_enableFolderTree);
|
||||||
|
|
|
@ -405,7 +405,8 @@ $(document).ready( function() {
|
||||||
} else {
|
} else {
|
||||||
url += "&"+param1;
|
url += "&"+param1;
|
||||||
}
|
}
|
||||||
element.prepend('<div style="position: absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: '+element.height()+'px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>');
|
if(!element.data('no-spinner'))
|
||||||
|
element.prepend('<div style="position: absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: '+element.height()+'px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>');
|
||||||
$.get(url, function(data) {
|
$.get(url, function(data) {
|
||||||
element.html(data);
|
element.html(data);
|
||||||
$(".chzn-select").select2({
|
$(".chzn-select").select2({
|
||||||
|
@ -571,7 +572,7 @@ function onAddClipboard(ev) { /* {{{ */
|
||||||
processData: false,
|
processData: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
data: formData,
|
data: formData,
|
||||||
success: function(data){
|
success: function(data, textStatus) {
|
||||||
status.setProgress(100);
|
status.setProgress(100);
|
||||||
if(data.success) {
|
if(data.success) {
|
||||||
noty({
|
noty({
|
||||||
|
@ -707,26 +708,25 @@ function onAddClipboard(ev) { /* {{{ */
|
||||||
}( window.SeedDMSUpload = window.SeedDMSUpload || {}, jQuery )); /* }}} */
|
}( window.SeedDMSUpload = window.SeedDMSUpload || {}, jQuery )); /* }}} */
|
||||||
|
|
||||||
$(document).ready(function() { /* {{{ */
|
$(document).ready(function() { /* {{{ */
|
||||||
var obj = $("#dragandrophandler");
|
$(document).on('dragenter', "#dragandrophandler", function (e) {
|
||||||
obj.on('dragenter', function (e) {
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).css('border', '2px dashed #0B85A1');
|
$(this).css('border', '2px dashed #0B85A1');
|
||||||
});
|
});
|
||||||
obj.on('dragleave', function (e) {
|
$(document).on('dragleave', "#dragandrophandler", function (e) {
|
||||||
$(this).css('border', '0px solid white');
|
$(this).css('border', '0px solid white');
|
||||||
});
|
});
|
||||||
obj.on('dragover', function (e) {
|
$(document).on('dragover', "#dragandrophandler", function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
obj.on('drop', function (e) {
|
$(document).on('drop', "#dragandrophandler", function (e) {
|
||||||
$(this).css('border', '0px dotted #0B85A1');
|
$(this).css('border', '0px dotted #0B85A1');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var files = e.originalEvent.dataTransfer.files;
|
var files = e.originalEvent.dataTransfer.files;
|
||||||
|
|
||||||
//We need to send dropped files to Server
|
//We need to send dropped files to Server
|
||||||
SeedDMSUpload.handleFileUpload(files,obj, obj);
|
SeedDMSUpload.handleFileUpload(files, $(this), $(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('dragenter', '.droptarget', function (e) {
|
$(document).on('dragenter', '.droptarget', function (e) {
|
||||||
|
@ -1153,3 +1153,9 @@ $(document).ready(function() { /* {{{ */
|
||||||
timeOutId = setTimeout(checkTasks, 60000);
|
timeOutId = setTimeout(checkTasks, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var updateDropFolder = function() {
|
||||||
|
$('#menu-dropfolder > div.ajax').trigger('update', {folderid: seeddms_folder});
|
||||||
|
console.log(seeddms_folder);
|
||||||
|
timeOutId = setTimeout(updateDropFolder, 60000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,15 @@
|
||||||
Order allow,deny
|
# line below if for Apache 2.4
|
||||||
Deny from all
|
<ifModule mod_authz_core.c>
|
||||||
|
Require all denied
|
||||||
|
</ifModule>
|
||||||
|
|
||||||
|
# line below if for Apache 2.2
|
||||||
|
<ifModule !mod_authz_core.c>
|
||||||
|
deny from all
|
||||||
|
Satisfy All
|
||||||
|
</ifModule>
|
||||||
|
|
||||||
|
# section for Apache 2.2 and 2.4
|
||||||
|
<ifModule mod_autoindex.c>
|
||||||
|
IndexIgnore *
|
||||||
|
</ifModule>
|
||||||
|
|
|
@ -209,7 +209,7 @@ $(document).ready(function() {
|
||||||
'type'=>'text',
|
'type'=>'text',
|
||||||
'id'=>'name',
|
'id'=>'name',
|
||||||
'name'=>'name',
|
'name'=>'name',
|
||||||
'required'=>true
|
'required'=>false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->formField(
|
$this->formField(
|
||||||
|
@ -321,7 +321,7 @@ $(document).ready(function() {
|
||||||
);
|
);
|
||||||
$this->formField(
|
$this->formField(
|
||||||
getMLText("local_file"),
|
getMLText("local_file"),
|
||||||
$enablelargefileupload ? $this->getFineUploaderHtml() : $this->getFileChooserHtml('userfile[]', false).($enablemultiupload ? '<a class="" id="new-file"><?php printMLtext("add_multiple_files") ?></a>' : '')
|
$enablelargefileupload ? $this->getFineUploaderHtml() : $this->getFileChooserHtml('userfile[]', $enablemultiupload).($enablemultiupload ? '<a class="" id="new-file"><?php printMLtext("add_multiple_files") ?></a>' : '')
|
||||||
);
|
);
|
||||||
if($dropfolderdir) {
|
if($dropfolderdir) {
|
||||||
$this->formField(
|
$this->formField(
|
||||||
|
|
|
@ -1801,7 +1801,7 @@ $(document).ready(function() {
|
||||||
$node['load_on_demand'] = true;
|
$node['load_on_demand'] = true;
|
||||||
$node['children'] = array();
|
$node['children'] = array();
|
||||||
} else {
|
} else {
|
||||||
$node['children'] = jqtree($this, $path, $folder, $this->params['user'], $accessmode, $showdocs, $expandtree, $orderby, 0);
|
$node['children'] = jqtree($this, $path, $folder, $this->params['user'], $accessmode, $showdocs, 0 /*$expandtree*/, $orderby, 0);
|
||||||
if($showdocs) {
|
if($showdocs) {
|
||||||
$documents = $folder->getDocuments(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
|
$documents = $folder->getDocuments(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
|
||||||
$documents = SeedDMS_Core_DMS::filterAccess($documents, $this->params['user'], $accessmode);
|
$documents = SeedDMS_Core_DMS::filterAccess($documents, $this->params['user'], $accessmode);
|
||||||
|
|
60
views/bootstrap/class.Decorator.php
Normal file
60
views/bootstrap/class.Decorator.php
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of the decorator pattern
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS_Core
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2010, Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class which implements a simple decorator pattern
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS_Core
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2010, Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_View_Decorator {
|
||||||
|
protected $o;
|
||||||
|
|
||||||
|
public function __construct($object) {
|
||||||
|
$this->o = $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($method, $args)
|
||||||
|
{
|
||||||
|
if (!method_exists($this->o, $method)) {
|
||||||
|
throw new Exception("Undefined method $method attempt.");
|
||||||
|
}
|
||||||
|
/* In case the called method returns the object itself, then return this object */
|
||||||
|
$result = call_user_func_array(array($this->o, $method), $args);
|
||||||
|
return $result === $this->o ? $this : $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Must have its own invoke
|
||||||
|
*/
|
||||||
|
public function __invoke($get=array()) {
|
||||||
|
$this->callHook('preRun', isset($get['action']) ? $get['action'] : 'show');
|
||||||
|
if(isset($get['action']) && $get['action']) {
|
||||||
|
if(method_exists($this->o, $get['action'])) {
|
||||||
|
$this->o->{$get['action']}();
|
||||||
|
} else {
|
||||||
|
echo "Missing action '".htmlspecialchars($get['action'])."'";
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
$this->show();
|
||||||
|
$this->callHook('postRun', isset($get['action']) ? $get['action'] : 'show');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,14 @@ require_once("class.Bootstrap.php");
|
||||||
*/
|
*/
|
||||||
class SeedDMS_View_DocumentChooser extends SeedDMS_Bootstrap_Style {
|
class SeedDMS_View_DocumentChooser extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
|
public function subtree() { /* {{{ */
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$node = $this->params['node'];
|
||||||
|
$orderby = $this->params['orderby'];
|
||||||
|
|
||||||
|
$this->printNewTreeNavigationSubtree($node->getID(), 1, $orderby);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function js() { /* {{{ */
|
function js() { /* {{{ */
|
||||||
$folder = $this->params['folder'];
|
$folder = $this->params['folder'];
|
||||||
$form = $this->params['form'];
|
$form = $this->params['form'];
|
||||||
|
|
|
@ -40,12 +40,14 @@ class SeedDMS_View_DropFolderChooser extends SeedDMS_Bootstrap_Style {
|
||||||
header('Content-Type: application/javascript');
|
header('Content-Type: application/javascript');
|
||||||
?>
|
?>
|
||||||
$('.fileselect').click(function(ev) {
|
$('.fileselect').click(function(ev) {
|
||||||
attr_filename = $(ev.currentTarget).attr('filename');
|
attr_filename = $(ev.currentTarget).data('filename');
|
||||||
fileSelected(attr_filename);
|
attr_form = $(ev.currentTarget).data('form');
|
||||||
|
fileSelected(attr_filename, attr_form);
|
||||||
});
|
});
|
||||||
$('.folderselect').click(function(ev) {
|
$('.folderselect').click(function(ev) {
|
||||||
attr_foldername = $(ev.currentTarget).attr('foldername');
|
attr_foldername = $(ev.currentTarget).data('foldername');
|
||||||
folderSelected(attr_foldername);
|
attr_form = $(ev.currentTarget).data('form');
|
||||||
|
folderSelected(attr_foldername, attr_form);
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -144,13 +146,13 @@ $('.folderselect').click(function(ev) {
|
||||||
$previewer->createRawPreview($dir.'/'.$entry, 'dropfolder/', $mimetype);
|
$previewer->createRawPreview($dir.'/'.$entry, 'dropfolder/', $mimetype);
|
||||||
echo "<tr><td style=\"min-width: ".$previewwidth."px;\">";
|
echo "<tr><td style=\"min-width: ".$previewwidth."px;\">";
|
||||||
if($previewer->hasRawPreview($dir.'/'.$entry, 'dropfolder/')) {
|
if($previewer->hasRawPreview($dir.'/'.$entry, 'dropfolder/')) {
|
||||||
echo "<img style=\"cursor: pointer;\" class=\"fileselect mimeicon\" filename=\"".$entry."\" width=\"".$previewwidth."\" src=\"../op/op.DropFolderPreview.php?filename=".$entry."&width=".$previewwidth."\" title=\"".htmlspecialchars($mimetype)."\">";
|
echo "<img style=\"cursor: pointer;\" class=\"fileselect mimeicon\" data-filename=\"".$entry."\" data-form=\"".$form."\" width=\"".$previewwidth."\" src=\"../op/op.DropFolderPreview.php?filename=".$entry."&width=".$previewwidth."\" title=\"".htmlspecialchars($mimetype)."\">";
|
||||||
}
|
}
|
||||||
echo "</td><td><span style=\"cursor: pointer;\" class=\"fileselect\" filename=\"".$entry."\">".$entry."</span></td><td align=\"right\">".SeedDMS_Core_File::format_filesize(filesize($dir.'/'.$entry))."</td><td>".date('Y-m-d H:i:s', filectime($dir.'/'.$entry))."</td></tr>\n";
|
echo "</td><td><span style=\"cursor: pointer;\" class=\"fileselect\" data-filename=\"".$entry."\" data-form=\"".$form."\">".$entry."</span></td><td align=\"right\">".SeedDMS_Core_File::format_filesize(filesize($dir.'/'.$entry))."</td><td>".date('Y-m-d H:i:s', filectime($dir.'/'.$entry))."</td></tr>\n";
|
||||||
} elseif($showfolders && is_dir($dir.'/'.$entry)) {
|
} elseif($showfolders && is_dir($dir.'/'.$entry)) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td></td>";
|
echo "<td></td>";
|
||||||
echo "<td><span style=\"cursor: pointer;\" class=\"folderselect\" foldername=\"".$entry."\" >".$entry."</span></td><td align=\"right\"></td><td></td>";
|
echo "<td><span style=\"cursor: pointer;\" class=\"folderselect\" data-foldername=\"".$entry."\" data-form=\"".$form."\">".$entry."</span></td><td align=\"right\"></td><td></td>";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,14 @@ require_once("class.Bootstrap.php");
|
||||||
*/
|
*/
|
||||||
class SeedDMS_View_FolderChooser extends SeedDMS_Bootstrap_Style {
|
class SeedDMS_View_FolderChooser extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
|
public function subtree() { /* {{{ */
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$node = $this->params['node'];
|
||||||
|
$orderby = $this->params['orderby'];
|
||||||
|
|
||||||
|
$this->printNewTreeNavigationSubtree($node->getID(), 0, $orderby);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function js() { /* {{{ */
|
function js() { /* {{{ */
|
||||||
$rootfolderid = $this->params['rootfolderid'];
|
$rootfolderid = $this->params['rootfolderid'];
|
||||||
$form = $this->params['form'];
|
$form = $this->params['form'];
|
||||||
|
|
|
@ -79,7 +79,6 @@ $(document).ready(function() {
|
||||||
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
|
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
|
||||||
|
|
||||||
$this->contentHeading(getMLText("edit_existing_notify"));
|
$this->contentHeading(getMLText("edit_existing_notify"));
|
||||||
$this->contentContainerStart();
|
|
||||||
|
|
||||||
$userNotifyIDs = array();
|
$userNotifyIDs = array();
|
||||||
foreach ($notifyList["users"] as $userNotify) {
|
foreach ($notifyList["users"] as $userNotify) {
|
||||||
|
|
|
@ -59,6 +59,10 @@ class SeedDMS_View_ImportFS extends SeedDMS_Bootstrap_Style {
|
||||||
getMLText("dropfolder_folder"),
|
getMLText("dropfolder_folder"),
|
||||||
$this->getDropFolderChooserHtml("form1", "", 1)
|
$this->getDropFolderChooserHtml("form1", "", 1)
|
||||||
);
|
);
|
||||||
|
$this->formField(
|
||||||
|
getMLText("dropfolder_metadata"),
|
||||||
|
$this->getDropFolderChooserHtml("form2", "", 0)
|
||||||
|
);
|
||||||
$this->formField(
|
$this->formField(
|
||||||
getMLText("removeFolderFromDropFolder"),
|
getMLText("removeFolderFromDropFolder"),
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -549,9 +549,9 @@ $(document).ready( function() {
|
||||||
if($entries) {
|
if($entries) {
|
||||||
/*
|
/*
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if(get_class($entry) == $dms->getClassname('document')) {
|
if($entry->isType('document')) {
|
||||||
$doccount++;
|
$doccount++;
|
||||||
} elseif(get_class($entry) == $dms->getClassname('document')) {
|
} elseif($entry->isType('document')) {
|
||||||
$foldercount++;
|
$foldercount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ $(document).ready( function() {
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
$previewer->setConverters($previewconverters);
|
$previewer->setConverters($previewconverters);
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if(get_class($entry) == $dms->getClassname('document')) {
|
if($entry->isType('document')) {
|
||||||
$txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search');
|
$txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search');
|
||||||
if(is_string($txt))
|
if(is_string($txt))
|
||||||
echo $txt;
|
echo $txt;
|
||||||
|
@ -636,7 +636,7 @@ $(document).ready( function() {
|
||||||
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-default">'.getMLText('attributes').'</span>', $attrstr, true);
|
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-default">'.getMLText('attributes').'</span>', $attrstr, true);
|
||||||
print $this->documentListRow($document, $previewer, false, 0, $extracontent);
|
print $this->documentListRow($document, $previewer, false, 0, $extracontent);
|
||||||
}
|
}
|
||||||
} elseif(get_class($entry) == $dms->getClassname('folder')) {
|
} elseif($entry->isType('folder')) {
|
||||||
$folder = $entry;
|
$folder = $entry;
|
||||||
$owner = $folder->getOwner();
|
$owner = $folder->getOwner();
|
||||||
if (in_array(2, $searchin)) {
|
if (in_array(2, $searchin)) {
|
||||||
|
|
|
@ -83,7 +83,15 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function js() { /* {{{ */
|
public function subtree() { /* {{{ */
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$node = $this->params['node'];
|
||||||
|
$orderby = $this->params['orderby'];
|
||||||
|
|
||||||
|
$this->printNewTreeNavigationSubtree($node->getID(), 0, $orderby);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function js() { /* {{{ */
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
$folder = $this->params['folder'];
|
$folder = $this->params['folder'];
|
||||||
$orderby = $this->params['orderby'];
|
$orderby = $this->params['orderby'];
|
||||||
|
@ -96,8 +104,11 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
|
||||||
header('Content-Type: application/javascript; charset=UTF-8');
|
header('Content-Type: application/javascript; charset=UTF-8');
|
||||||
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
|
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
|
||||||
?>
|
?>
|
||||||
|
seeddms_folder = <?= $folder->getID() ?>;
|
||||||
function folderSelected(id, name) {
|
function folderSelected(id, name) {
|
||||||
window.location = '../out/out.ViewFolder.php?folderid=' + id;
|
// window.location = '../out/out.ViewFolder.php?folderid=' + id;
|
||||||
|
seeddms_folder = id;
|
||||||
|
$('div.ajax').trigger('update', {folderid: id, orderby: '<?= $orderby ?>'});
|
||||||
}
|
}
|
||||||
<?php if($maxItemsPerPage) { ?>
|
<?php if($maxItemsPerPage) { ?>
|
||||||
function loadMoreObjects(element, limit) {
|
function loadMoreObjects(element, limit) {
|
||||||
|
@ -134,7 +145,17 @@ $(window).scroll(function() {
|
||||||
$('#loadmore').click(function(e) {
|
$('#loadmore').click(function(e) {
|
||||||
loadMoreObjects($(this), $(this).data('all'));
|
loadMoreObjects($(this), $(this).data('all'));
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
/*
|
||||||
|
$('body').on('click', '[id^=\"table-row-folder\"]', function(ev) {
|
||||||
|
attr_id = $(ev.currentTarget).attr('id').split('-')[3];
|
||||||
|
folderSelected(attr_id, '');
|
||||||
|
$([document.documentElement, document.body]).animate({
|
||||||
|
scrollTop: 200
|
||||||
|
}, 200);
|
||||||
|
});
|
||||||
|
*/
|
||||||
<?php
|
<?php
|
||||||
if($showtree == 1)
|
if($showtree == 1)
|
||||||
$this->printNewTreeNavigationJs($folder->getID(), M_READ, 0, '', ($expandFolderTree == 1) ? -1 : 3, $orderby);
|
$this->printNewTreeNavigationJs($folder->getID(), M_READ, 0, '', ($expandFolderTree == 1) ? -1 : 3, $orderby);
|
||||||
|
@ -151,6 +172,222 @@ $('#loadmore').click(function(e) {
|
||||||
$this->printDeleteDocumentButtonJs();
|
$this->printDeleteDocumentButtonJs();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
function folderInfos() { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$folder = $this->params['folder'];
|
||||||
|
|
||||||
|
$txt = $this->callHook('folderInfo', $folder);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
else {
|
||||||
|
|
||||||
|
$owner = $folder->getOwner();
|
||||||
|
$this->contentHeading(getMLText("folder_infos"));
|
||||||
|
$this->contentContainerStart();
|
||||||
|
echo "<table class=\"table-condensed\">\n";
|
||||||
|
if($user->isAdmin()) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".getMLText("id").":</td>\n";
|
||||||
|
echo "<td>".htmlspecialchars($folder->getID())."</td>\n";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".getMLText("owner").":</td>\n";
|
||||||
|
echo "<td><a href=\"mailto:".htmlspecialchars($owner->getEmail())."\">".htmlspecialchars($owner->getFullName())."</a></td>\n";
|
||||||
|
echo "</tr>";
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".getMLText("creation_date").":</td>";
|
||||||
|
echo "<td>".getLongReadableDate($folder->getDate())."</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
if($folder->getComment()) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".getMLText("comment").":</td>\n";
|
||||||
|
echo "<td>".htmlspecialchars($folder->getComment())."</td>\n";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($user->isAdmin()) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".getMLText('default_access').":</td>";
|
||||||
|
echo "<td>".$this->getAccessModeText($folder->getDefaultAccess())."</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
if($folder->inheritsAccess()) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".getMLText("access_mode").":</td>\n";
|
||||||
|
echo "<td>";
|
||||||
|
echo getMLText("inherited")."<br />";
|
||||||
|
$this->printAccessList($folder);
|
||||||
|
echo "</tr>";
|
||||||
|
} else {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".getMLText('access_mode').":</td>";
|
||||||
|
echo "<td>";
|
||||||
|
$this->printAccessList($folder);
|
||||||
|
echo "</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$attributes = $folder->getAttributes();
|
||||||
|
if($attributes) {
|
||||||
|
foreach($attributes as $attribute) {
|
||||||
|
$arr = $this->callHook('showFolderAttribute', $folder, $attribute);
|
||||||
|
if(is_array($arr)) {
|
||||||
|
echo $txt;
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".$arr[0].":</td>";
|
||||||
|
echo "<td>".$arr[1].":</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
} else {
|
||||||
|
$attrdef = $attribute->getAttributeDefinition();
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||||
|
<td><?php echo htmlspecialchars(implode(', ', $attribute->getValueAsArray())); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "</table>\n";
|
||||||
|
$this->contentContainerEnd();
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
function folderList() { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$folder = $this->params['folder'];
|
||||||
|
$folderid = $folder->getId();
|
||||||
|
$orderby = $this->params['orderby'];
|
||||||
|
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||||
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
||||||
|
$incItemsPerPage = $this->params['incItemsPerPage'];
|
||||||
|
$previewwidth = $this->params['previewWidthList'];
|
||||||
|
$previewconverters = $this->params['previewConverters'];
|
||||||
|
$timeout = $this->params['timeout'];
|
||||||
|
$xsendfile = $this->params['xsendfile'];
|
||||||
|
|
||||||
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
|
$previewer->setConverters($previewconverters);
|
||||||
|
|
||||||
|
$txt = $this->callHook('listHeader', $folder);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
else
|
||||||
|
$this->contentHeading(getMLText("folder_contents"));
|
||||||
|
|
||||||
|
$subFolders = $this->callHook('folderGetSubFolders', $folder, $orderby[0], $orderdir);
|
||||||
|
if($subFolders === null)
|
||||||
|
$subFolders = $folder->getSubFolders($orderby[0], $orderdir);
|
||||||
|
$subFolders = SeedDMS_Core_DMS::filterAccess($subFolders, $user, M_READ);
|
||||||
|
$documents = $this->callHook('folderGetDocuments', $folder, $orderby[0], $orderdir);
|
||||||
|
if($documents === null)
|
||||||
|
$documents = $folder->getDocuments($orderby[0], $orderdir);
|
||||||
|
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
|
||||||
|
$parent = null; //$folder->getParent();
|
||||||
|
|
||||||
|
$txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
$i = 0;
|
||||||
|
if ((count($subFolders) > 0)||(count($documents) > 0)){
|
||||||
|
$txt = $this->callHook('folderListHeader', $folder, $orderby, $orderdir);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
else {
|
||||||
|
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-hover\">";
|
||||||
|
print "<thead>\n<tr>\n";
|
||||||
|
print "<th>".($parent ? '<button class="btn btn-mini btn-default" id="table-row-folder-'.$parent->getID().'"><i class="icon-arrow-up"></i></button>' : '')."</th>\n";
|
||||||
|
print "<th>".getMLText("name");
|
||||||
|
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="icon-sort-by-alphabet selected"></i>':($orderby=="nd"?' <i class="icon-sort-by-alphabet-alt selected"></i>':' <i class="icon-sort-by-alphabet"></i>'))."</a>";
|
||||||
|
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' <i class="icon-sort-by-order selected"></i>':($orderby=="sd"?' <i class="icon-sort-by-order-alt selected"></i>':' <i class="icon-sort-by-order"></i>'))."</a>";
|
||||||
|
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="icon-sort-by-attributes selected"></i>':($orderby=="dd"?' <i class="icon-sort-by-attributes-alt selected"></i>':' <i class="icon-sort-by-attributes"></i>'))."</a>";
|
||||||
|
print "</th>\n";
|
||||||
|
// print "<th>".getMLText("owner")."</th>\n";
|
||||||
|
print "<th>".getMLText("status")."</th>\n";
|
||||||
|
// print "<th>".getMLText("version")."</th>\n";
|
||||||
|
print "<th>".getMLText("action")."</th>\n";
|
||||||
|
print "</tr>\n</thead>\n<tbody>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($subFolders as $subFolder) {
|
||||||
|
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
|
||||||
|
$txt = $this->callHook('folderListItem', $subFolder, 'viewfolder');
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
else {
|
||||||
|
echo $this->folderListRow($subFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($subFolders && $documents) {
|
||||||
|
if(!$maxItemsPerPage || $maxItemsPerPage > count($subFolders)) {
|
||||||
|
$txt = $this->callHook('folderListSeparator', $folder);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($documents as $document) {
|
||||||
|
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
|
||||||
|
$document->verifyLastestContentExpriry();
|
||||||
|
$txt = $this->callHook('documentListItem', $document, $previewer, false, 'viewfolder');
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
else {
|
||||||
|
echo $this->documentListRow($document, $previewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$txt = $this->callHook('folderListFooter', $folder);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
else
|
||||||
|
echo "</tbody>\n</table>\n";
|
||||||
|
|
||||||
|
if($maxItemsPerPage && $i > $maxItemsPerPage)
|
||||||
|
echo "<button id=\"loadmore\" style=\"width: 100%; margin-bottom: 20px;\" class=\"btn btn-default\" data-folder=\"".$folder->getId()."\"data-offset=\"".$maxItemsPerPage."\" data-limit=\"".$incItemsPerPage."\" data-all=\"".($i-$maxItemsPerPage)."\">".getMLText('x_more_objects', array('number'=>($i-$maxItemsPerPage)))."</button>";
|
||||||
|
}
|
||||||
|
else printMLText("empty_folder_list");
|
||||||
|
|
||||||
|
$txt = $this->callHook('folderListPostContent', $folder, $subFolders, $documents);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
function navigation() { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$folder = $this->params['folder'];
|
||||||
|
|
||||||
|
$txt = $this->callHook('folderMenu', $folder);
|
||||||
|
if(is_string($txt))
|
||||||
|
echo $txt;
|
||||||
|
else {
|
||||||
|
$this->pageNavigation($this->getFolderPathHTML($folder), "view_folder", $folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $this->callHook('preContent');
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
function dropUpload() { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$folder = $this->params['folder'];
|
||||||
|
|
||||||
|
$this->contentHeading(getMLText("dropupload"), true);
|
||||||
|
?>
|
||||||
|
<div id="dragandrophandler" class="well alert" data-droptarget="folder_<?php echo $folder->getID(); ?>" data-target="<?php echo $folder->getID(); ?>" data-uploadformtoken="<?php echo createFormKey(''); ?>"><?php printMLText('drop_files_here'); ?></div>
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function entries() { /* {{{ */
|
function entries() { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
|
@ -246,25 +483,20 @@ $('#loadmore').click(function(e) {
|
||||||
$xsendfile = $this->params['xsendfile'];
|
$xsendfile = $this->params['xsendfile'];
|
||||||
|
|
||||||
$folderid = $folder->getId();
|
$folderid = $folder->getId();
|
||||||
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
|
$previewer->setConverters($previewconverters);
|
||||||
|
|
||||||
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
|
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
|
||||||
|
|
||||||
echo $this->callHook('startPage');
|
echo $this->callHook('startPage');
|
||||||
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
|
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
|
||||||
|
|
||||||
$this->globalNavigation($folder);
|
$this->globalNavigation($folder);
|
||||||
$this->contentStart();
|
$this->contentStart();
|
||||||
$txt = $this->callHook('folderMenu', $folder);
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
else {
|
|
||||||
$this->pageNavigation($this->getFolderPathHTML($folder), "view_folder", $folder);
|
|
||||||
}
|
|
||||||
|
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
// $this->navigation();
|
||||||
$previewer->setConverters($previewconverters);
|
?>
|
||||||
|
<div class="ajax" data-view="ViewFolder" data-action="navigation" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div>
|
||||||
echo $this->callHook('preContent');
|
<?php
|
||||||
|
|
||||||
echo "<div class=\"row-fluid\">\n";
|
echo "<div class=\"row-fluid\">\n";
|
||||||
|
|
||||||
|
@ -305,184 +537,27 @@ $('#loadmore').click(function(e) {
|
||||||
echo "<div class=\"row-fluid\">";
|
echo "<div class=\"row-fluid\">";
|
||||||
echo "<div class=\"span8\">";
|
echo "<div class=\"span8\">";
|
||||||
}
|
}
|
||||||
$txt = $this->callHook('folderInfo', $folder);
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
else {
|
|
||||||
|
|
||||||
$owner = $folder->getOwner();
|
// $this->folderInfos();
|
||||||
$this->contentHeading(getMLText("folder_infos"));
|
?>
|
||||||
$this->contentContainerStart();
|
<div class="ajax" data-view="ViewFolder" data-action="folderInfos" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div>
|
||||||
echo "<table class=\"table-condensed\">\n";
|
|
||||||
if($user->isAdmin()) {
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".getMLText("id").":</td>\n";
|
|
||||||
echo "<td>".htmlspecialchars($folder->getID())."</td>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".getMLText("owner").":</td>\n";
|
|
||||||
echo "<td><a href=\"mailto:".htmlspecialchars($owner->getEmail())."\">".htmlspecialchars($owner->getFullName())."</a></td>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".getMLText("creation_date").":</td>";
|
|
||||||
echo "<td>".getLongReadableDate($folder->getDate())."</td>";
|
|
||||||
echo "</tr>";
|
|
||||||
if($folder->getComment()) {
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".getMLText("comment").":</td>\n";
|
|
||||||
echo "<td>".htmlspecialchars($folder->getComment())."</td>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($user->isAdmin()) {
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".getMLText('default_access').":</td>";
|
|
||||||
echo "<td>".$this->getAccessModeText($folder->getDefaultAccess())."</td>";
|
|
||||||
echo "</tr>";
|
|
||||||
if($folder->inheritsAccess()) {
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".getMLText("access_mode").":</td>\n";
|
|
||||||
echo "<td>";
|
|
||||||
echo getMLText("inherited")."<br />";
|
|
||||||
$this->printAccessList($folder);
|
|
||||||
echo "</tr>";
|
|
||||||
} else {
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".getMLText('access_mode').":</td>";
|
|
||||||
echo "<td>";
|
|
||||||
$this->printAccessList($folder);
|
|
||||||
echo "</td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$attributes = $folder->getAttributes();
|
|
||||||
if($attributes) {
|
|
||||||
foreach($attributes as $attribute) {
|
|
||||||
$arr = $this->callHook('showFolderAttribute', $folder, $attribute);
|
|
||||||
if(is_array($arr)) {
|
|
||||||
echo $txt;
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>".$arr[0].":</td>";
|
|
||||||
echo "<td>".$arr[1].":</td>";
|
|
||||||
echo "</tr>";
|
|
||||||
} else {
|
|
||||||
$attrdef = $attribute->getAttributeDefinition();
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
|
||||||
<td><?php echo htmlspecialchars(implode(', ', $attribute->getValueAsArray())); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
<?php
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</table>\n";
|
|
||||||
$this->contentContainerEnd();
|
|
||||||
}
|
|
||||||
if ($enableDropUpload && $folder->getAccessMode($user) >= M_READWRITE) {
|
if ($enableDropUpload && $folder->getAccessMode($user) >= M_READWRITE) {
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "<div class=\"span4\">";
|
echo "<div class=\"span4\">";
|
||||||
$this->contentHeading(getMLText("dropupload"), true);
|
// $this->dropUpload();
|
||||||
// $this->addFooterJS("SeedDMSUpload.setUrl('../op/op.Ajax.php');");
|
|
||||||
// $this->addFooterJS("SeedDMSUpload.setAbortBtnLabel('".getMLText("cancel")."');");
|
|
||||||
// $this->addFooterJS("SeedDMSUpload.setEditBtnLabel('".getMLText("edit_document_props")."');");
|
|
||||||
// $this->addFooterJS("SeedDMSUpload.setMaxFileSize(".SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize")).");");
|
|
||||||
// $this->addFooterJS("SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');");
|
|
||||||
?>
|
?>
|
||||||
<div id="dragandrophandler" class="well alert" data-droptarget="folder_<?php echo $folder->getID(); ?>" data-target="<?php echo $folder->getID(); ?>" data-uploadformtoken="<?php echo createFormKey(''); ?>"><?php printMLText('drop_files_here'); ?></div>
|
<div class="ajax" data-view="ViewFolder" data-action="dropUpload" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$txt = $this->callHook('listHeader', $folder);
|
// $this->folderList();
|
||||||
if(is_string($txt))
|
?>
|
||||||
echo $txt;
|
<div class="ajax" data-view="ViewFolder" data-action="folderList" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."&orderby=".$orderby."\"" : "") ?>></div>
|
||||||
else
|
<?php
|
||||||
$this->contentHeading(getMLText("folder_contents"));
|
|
||||||
|
|
||||||
$subFolders = $this->callHook('folderGetSubFolders', $folder, $orderby[0], $orderdir);
|
|
||||||
if($subFolders === null)
|
|
||||||
$subFolders = $folder->getSubFolders($orderby[0], $orderdir);
|
|
||||||
$subFolders = SeedDMS_Core_DMS::filterAccess($subFolders, $user, M_READ);
|
|
||||||
$documents = $this->callHook('folderGetDocuments', $folder, $orderby[0], $orderdir);
|
|
||||||
if($documents === null)
|
|
||||||
$documents = $folder->getDocuments($orderby[0], $orderdir);
|
|
||||||
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
|
|
||||||
|
|
||||||
$txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents);
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
$i = 0;
|
|
||||||
if ((count($subFolders) > 0)||(count($documents) > 0)){
|
|
||||||
$txt = $this->callHook('folderListHeader', $folder, $orderby, $orderdir);
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
else {
|
|
||||||
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-hover\">";
|
|
||||||
print "<thead>\n<tr>\n";
|
|
||||||
print "<th></th>\n";
|
|
||||||
print "<th>".getMLText("name");
|
|
||||||
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="icon-sort-by-alphabet selected"></i>':($orderby=="nd"?' <i class="icon-sort-by-alphabet-alt selected"></i>':' <i class="icon-sort-by-alphabet"></i>'))."</a>";
|
|
||||||
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' <i class="icon-sort-by-order selected"></i>':($orderby=="sd"?' <i class="icon-sort-by-order-alt selected"></i>':' <i class="icon-sort-by-order"></i>'))."</a>";
|
|
||||||
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="icon-sort-by-attributes selected"></i>':($orderby=="dd"?' <i class="icon-sort-by-attributes-alt selected"></i>':' <i class="icon-sort-by-attributes"></i>'))."</a>";
|
|
||||||
print "</th>\n";
|
|
||||||
// print "<th>".getMLText("owner")."</th>\n";
|
|
||||||
print "<th>".getMLText("status")."</th>\n";
|
|
||||||
// print "<th>".getMLText("version")."</th>\n";
|
|
||||||
print "<th>".getMLText("action")."</th>\n";
|
|
||||||
print "</tr>\n</thead>\n<tbody>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($subFolders as $subFolder) {
|
|
||||||
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
|
|
||||||
$txt = $this->callHook('folderListItem', $subFolder, 'viewfolder');
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
else {
|
|
||||||
echo $this->folderListRow($subFolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($subFolders && $documents) {
|
|
||||||
if(!$maxItemsPerPage || $maxItemsPerPage > count($subFolders)) {
|
|
||||||
$txt = $this->callHook('folderListSeparator', $folder);
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($documents as $document) {
|
|
||||||
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
|
|
||||||
$document->verifyLastestContentExpriry();
|
|
||||||
$txt = $this->callHook('documentListItem', $document, $previewer, false, 'viewfolder');
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
else {
|
|
||||||
echo $this->documentListRow($document, $previewer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$txt = $this->callHook('folderListFooter', $folder);
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
else
|
|
||||||
echo "</tbody>\n</table>\n";
|
|
||||||
|
|
||||||
if($maxItemsPerPage && $i > $maxItemsPerPage)
|
|
||||||
echo "<button id=\"loadmore\" style=\"width: 100%; margin-bottom: 20px;\" class=\"btn btn-default\" data-folder=\"".$folder->getId()."\"data-offset=\"".$maxItemsPerPage."\" data-limit=\"".$incItemsPerPage."\" data-all=\"".($i-$maxItemsPerPage)."\">".getMLText('x_more_objects', array('number'=>($i-$maxItemsPerPage)))."</button>";
|
|
||||||
}
|
|
||||||
else printMLText("empty_folder_list");
|
|
||||||
|
|
||||||
$txt = $this->callHook('folderListPostContent', $folder, $subFolders, $documents);
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
|
|
||||||
echo "</div>\n"; // End of right column div
|
echo "</div>\n"; // End of right column div
|
||||||
echo "</div>\n"; // End of div around left and right column
|
echo "</div>\n"; // End of div around left and right column
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
include("../inc/inc.Settings.php");
|
include("../inc/inc.Settings.php");
|
||||||
|
//include("../inc/inc.LogInit.php");
|
||||||
|
include("../inc/inc.Language.php");
|
||||||
include("../inc/inc.Init.php");
|
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");
|
||||||
|
@ -8,6 +10,7 @@ include("../inc/inc.ClassEmailNotify.php");
|
||||||
include("../inc/inc.ClassController.php");
|
include("../inc/inc.ClassController.php");
|
||||||
include("Log.php");
|
include("Log.php");
|
||||||
|
|
||||||
|
// LogInit.php cannot be used, because of the different log file
|
||||||
if($settings->_logFileEnable) {
|
if($settings->_logFileEnable) {
|
||||||
if ($settings->_logFileRotation=="h") $logname=date("YmdH", time());
|
if ($settings->_logFileRotation=="h") $logname=date("YmdH", time());
|
||||||
else if ($settings->_logFileRotation=="d") $logname=date("Ymd", time());
|
else if ($settings->_logFileRotation=="d") $logname=date("Ymd", time());
|
||||||
|
@ -17,16 +20,38 @@ if($settings->_logFileEnable) {
|
||||||
@mkdir($settings->_contentDir.'log');
|
@mkdir($settings->_contentDir.'log');
|
||||||
if(file_exists($settings->_contentDir.'log') && is_dir($settings->_contentDir.'log')) {
|
if(file_exists($settings->_contentDir.'log') && is_dir($settings->_contentDir.'log')) {
|
||||||
$log = Log::factory('file', $logname);
|
$log = Log::factory('file', $logname);
|
||||||
$log->setMask(Log::MAX(PEAR_LOG_INFO));
|
$log->setMask(Log::MAX(PEAR_LOG_DEBUG));
|
||||||
} else
|
} else
|
||||||
$log = null;
|
$log = null;
|
||||||
} else {
|
} else {
|
||||||
$log = null;
|
$log = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$notifier = new SeedDMS_NotificationService();
|
||||||
|
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
||||||
|
if(method_exists($notificationObj, 'preAddService')) {
|
||||||
|
$notificationObj->preAddService($dms, $notifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($settings->_enableEmail) {
|
||||||
|
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
||||||
|
if(method_exists($notificationObj, 'postAddService')) {
|
||||||
|
$notificationObj->postAddService($dms, $notifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
include("webdav.php");
|
include("webdav.php");
|
||||||
$server = new HTTP_WebDAV_Server_SeedDMS();
|
$server = new HTTP_WebDAV_Server_SeedDMS();
|
||||||
$server->ServeRequest($dms, $log);
|
$server->ServeRequest($dms, $log, $notifier);
|
||||||
//$files = array();
|
//$files = array();
|
||||||
//$options = array('path'=>'/Test1/subdir', 'depth'=>1);
|
//$options = array('path'=>'/Test1/subdir', 'depth'=>1);
|
||||||
//echo $server->MKCOL(&$options);
|
//echo $server->MKCOL(&$options);
|
||||||
|
|
|
@ -31,6 +31,16 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
*/
|
*/
|
||||||
var $logger = null;
|
var $logger = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A reference to a notifier
|
||||||
|
*
|
||||||
|
* This is set by ServeRequest
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
var $notifier = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Currently logged in user
|
* Currently logged in user
|
||||||
*
|
*
|
||||||
|
@ -53,7 +63,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
* @access public
|
* @access public
|
||||||
* @param object $dms reference to DMS
|
* @param object $dms reference to DMS
|
||||||
*/
|
*/
|
||||||
function ServeRequest($dms = null, $logger = null) /* {{{ */
|
function ServeRequest($dms = null, $logger = null, $notifier = null) /* {{{ */
|
||||||
{
|
{
|
||||||
// set root directory, defaults to webserver document root if not set
|
// set root directory, defaults to webserver document root if not set
|
||||||
if ($dms) {
|
if ($dms) {
|
||||||
|
@ -65,6 +75,9 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
// set logger
|
// set logger
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
|
// set notifier
|
||||||
|
$this->notifier = $notifier;
|
||||||
|
|
||||||
// special treatment for litmus compliance test
|
// special treatment for litmus compliance test
|
||||||
// reply on its identifier header
|
// reply on its identifier header
|
||||||
// not needed for the test itself but eases debugging
|
// not needed for the test itself but eases debugging
|
||||||
|
@ -93,6 +106,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
if($this->logger) {
|
if($this->logger) {
|
||||||
switch($methode) {
|
switch($methode) {
|
||||||
case 'MOVE':
|
case 'MOVE':
|
||||||
|
case 'COPY':
|
||||||
$msg = $methode.': '.$options['path'].' -> '.$options['dest'];
|
$msg = $methode.': '.$options['path'].' -> '.$options['dest'];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -601,7 +615,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$document = $this->dms->getDocumentByName($name, $folder);
|
$document = $this->dms->getDocumentByName($name, $folder);
|
||||||
if($document) {
|
if($document) {
|
||||||
if($this->logger)
|
if($this->logger)
|
||||||
$this->logger->log('PUT: replacing document id='.$document->getID(), PEAR_LOG_INFO);
|
$this->logger->log('PUT: saving document id='.$document->getID(), PEAR_LOG_INFO);
|
||||||
if ($document->getAccessMode($this->user, 'updateDocument') < M_READWRITE) {
|
if ($document->getAccessMode($this->user, 'updateDocument') < M_READWRITE) {
|
||||||
if($this->logger)
|
if($this->logger)
|
||||||
$this->logger->log('PUT: no access on document', PEAR_LOG_ERR);
|
$this->logger->log('PUT: no access on document', PEAR_LOG_ERR);
|
||||||
|
@ -633,13 +647,63 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
} else {
|
} else {
|
||||||
if($this->logger)
|
if($this->logger)
|
||||||
$this->logger->log('PUT: adding new version', PEAR_LOG_INFO);
|
$this->logger->log('PUT: adding new version', PEAR_LOG_INFO);
|
||||||
if(!$document->addContent('', $this->user, $tmpFile, $name, $fileType, $mimetype, array(), array(), 0)) {
|
|
||||||
|
if($settings->_enableFullSearch) {
|
||||||
|
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||||
|
$indexconf['Indexer']::init($settings->_stopWordsFile);
|
||||||
|
} else {
|
||||||
|
$index = null;
|
||||||
|
$indexconf = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$controller = Controller::factory('UpdateDocument');
|
||||||
|
$controller->setParam('dms', $this->dms);
|
||||||
|
$controller->setParam('user', $this->user);
|
||||||
|
$controller->setParam('documentsource', 'webdav');
|
||||||
|
$controller->setParam('folder', $document->getFolder());
|
||||||
|
$controller->setParam('document', $document);
|
||||||
|
$controller->setParam('index', $index);
|
||||||
|
$controller->setParam('indexconf', $indexconf);
|
||||||
|
$controller->setParam('comment', '');
|
||||||
|
$controller->setParam('userfiletmp', $tmpFile);
|
||||||
|
$controller->setParam('userfilename', $name);
|
||||||
|
$controller->setParam('filetype', $fileType);
|
||||||
|
$controller->setParam('userfiletype', $mimetype);
|
||||||
|
$controller->setParam('reviewers', array());
|
||||||
|
$controller->setParam('approvers', array());
|
||||||
|
$controller->setParam('attributes', array());
|
||||||
|
$controller->setParam('workflow', null);
|
||||||
|
|
||||||
|
if(!$content = $controller->run()) {
|
||||||
|
// if(!$document->addContent('', $this->user, $tmpFile, $name, $fileType, $mimetype, array(), array(), 0)) {
|
||||||
if($this->logger)
|
if($this->logger)
|
||||||
$this->logger->log('PUT: error adding new version', PEAR_LOG_ERR);
|
$this->logger->log('PUT: error adding new version', PEAR_LOG_ERR);
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
return "409 Conflict";
|
return "409 Conflict";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($this->notifier) {
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('PUT: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
|
||||||
|
$subject = "document_updated_email_subject";
|
||||||
|
$message = "document_updated_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['comment'] = $document->getComment();
|
||||||
|
$params['version_comment'] = $content->getComment();
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$this->notifier->toList($this->user, $notifyList["users"], $subject, $message, $params);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -651,6 +715,16 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
return "403 Forbidden";
|
return "403 Forbidden";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if name already exists in the folder */
|
||||||
|
/*
|
||||||
|
if(!$settings->_enableDuplicateDocNames) {
|
||||||
|
if($folder->hasDocumentByName($name)) {
|
||||||
|
return "403 Forbidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if($settings->_enableFullSearch) {
|
if($settings->_enableFullSearch) {
|
||||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||||
$indexconf['Indexer']::init($settings->_stopWordsFile);
|
$indexconf['Indexer']::init($settings->_stopWordsFile);
|
||||||
|
@ -699,6 +773,33 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$this->logger->log('PUT: error adding object: '.$controller->getErrorMsg(), PEAR_LOG_ERR);
|
$this->logger->log('PUT: error adding object: '.$controller->getErrorMsg(), PEAR_LOG_ERR);
|
||||||
return "409 Conflict ".$controller->getErrorMsg();
|
return "409 Conflict ".$controller->getErrorMsg();
|
||||||
}
|
}
|
||||||
|
if($this->notifier) {
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('PUT: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$fnl = $folder->getNotifyList();
|
||||||
|
$dnl = $document->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
|
||||||
|
$subject = "new_document_email_subject";
|
||||||
|
$message = "new_document_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $name;
|
||||||
|
$params['folder_name'] = $folder->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['comment'] = '';
|
||||||
|
$params['version_comment'] = '';
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
|
@ -713,7 +814,9 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
* @return bool true on success
|
* @return bool true on success
|
||||||
*/
|
*/
|
||||||
function MKCOL($options) /* {{{ */
|
function MKCOL($options) /* {{{ */
|
||||||
{
|
{
|
||||||
|
global $settings;
|
||||||
|
|
||||||
$this->log_options('MKCOL', $options);
|
$this->log_options('MKCOL', $options);
|
||||||
|
|
||||||
$path = $options["path"];
|
$path = $options["path"];
|
||||||
|
@ -774,6 +877,33 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
return "409 Conflict ".$controller->getErrorMsg();
|
return "409 Conflict ".$controller->getErrorMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->notifier) {
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('MKCOL: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$fnl = $folder->getNotifyList();
|
||||||
|
$snl = $subFolder->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($snl['users'], $fnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($snl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
|
||||||
|
$subject = "new_subfolder_email_subject";
|
||||||
|
$message = "new_subfolder_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $subFolder->getName();
|
||||||
|
$params['folder_name'] = $folder->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['comment'] = '';
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$subFolder->getID();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ("201 Created");
|
return ("201 Created");
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -820,6 +950,16 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$this->logger->log('DELETE: cannot delete, folder has children', PEAR_LOG_ERR);
|
$this->logger->log('DELETE: cannot delete, folder has children', PEAR_LOG_ERR);
|
||||||
return "409 Conflict";
|
return "409 Conflict";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parent = $obj->getParent();
|
||||||
|
$fnl = $obj->getNotifyList();
|
||||||
|
$pnl = $parent->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($fnl['users'], $pnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($fnl['groups'], $pnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
$foldername = $obj->getName();
|
||||||
|
|
||||||
$controller = Controller::factory('RemoveFolder');
|
$controller = Controller::factory('RemoveFolder');
|
||||||
$controller->setParam('dms', $this->dms);
|
$controller->setParam('dms', $this->dms);
|
||||||
$controller->setParam('user', $this->user);
|
$controller->setParam('user', $this->user);
|
||||||
|
@ -827,10 +967,39 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$controller->setParam('index', $index);
|
$controller->setParam('index', $index);
|
||||||
$controller->setParam('indexconf', $indexconf);
|
$controller->setParam('indexconf', $indexconf);
|
||||||
if(!$controller->run()) {
|
if(!$controller->run()) {
|
||||||
// if(!$obj->remove()) {
|
|
||||||
return "409 Conflict ".$controller->getErrorMsg();
|
return "409 Conflict ".$controller->getErrorMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->notifier) {
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('DELETE: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$subject = "folder_deleted_email_subject";
|
||||||
|
$message = "folder_deleted_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $foldername;
|
||||||
|
$params['folder_path'] = $parent->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$parent->getID();
|
||||||
|
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* Get the notify list before removing the document
|
||||||
|
* Also inform the users/groups of the parent folder
|
||||||
|
*/
|
||||||
|
$folder = $obj->getFolder();
|
||||||
|
$dnl = $obj->getNotifyList();
|
||||||
|
$fnl = $folder->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
$docname = $obj->getName();
|
||||||
|
|
||||||
$controller = Controller::factory('RemoveDocument');
|
$controller = Controller::factory('RemoveDocument');
|
||||||
$controller->setParam('dms', $this->dms);
|
$controller->setParam('dms', $this->dms);
|
||||||
$controller->setParam('user', $this->user);
|
$controller->setParam('user', $this->user);
|
||||||
|
@ -838,9 +1007,26 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$controller->setParam('index', $index);
|
$controller->setParam('index', $index);
|
||||||
$controller->setParam('indexconf', $indexconf);
|
$controller->setParam('indexconf', $indexconf);
|
||||||
if(!$controller->run()) {
|
if(!$controller->run()) {
|
||||||
// if(!$obj->remove()) {
|
|
||||||
return "409 Conflict ".$controller->getErrorMsg();
|
return "409 Conflict ".$controller->getErrorMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->notifier){
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('DELETE: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$subject = "document_deleted_email_subject";
|
||||||
|
$message = "document_deleted_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $docname;
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
|
||||||
|
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "204 No Content";
|
return "204 No Content";
|
||||||
|
@ -855,6 +1041,8 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
*/
|
*/
|
||||||
function MOVE($options) /* {{{ */
|
function MOVE($options) /* {{{ */
|
||||||
{
|
{
|
||||||
|
global $settings;
|
||||||
|
|
||||||
$this->log_options('MOVE', $options);
|
$this->log_options('MOVE', $options);
|
||||||
|
|
||||||
// no copying to different WebDAV Servers yet
|
// no copying to different WebDAV Servers yet
|
||||||
|
@ -908,13 +1096,13 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
||||||
|
|
||||||
/* save the content as a new version in the destination document */
|
/* save the content as a new version in the destination document */
|
||||||
if(!$objdest->addContent('', $this->user, $fspath, $content->getOriginalFileName(), $content->getFileType(), $content->getMimeType, array(), array(), 0)) {
|
if(!$objdest->addContent('', $this->user, $fspath, $content->getOriginalFileName(), $content->getFileType(), $content->getMimeType(), array(), array(), 0)) {
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
return "409 Conflict";
|
return "409 Conflict";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* change the name of the destination object */
|
/* change the name of the destination object */
|
||||||
$objdest->setName($objsource->getName());
|
// $objdest->setName($objsource->getName());
|
||||||
|
|
||||||
/* delete the source object */
|
/* delete the source object */
|
||||||
$objsource->remove();
|
$objsource->remove();
|
||||||
|
@ -922,11 +1110,84 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
return "204 No Content";
|
return "204 No Content";
|
||||||
} elseif(get_class($objdest) == $this->dms->getClassname('folder')) {
|
} elseif(get_class($objdest) == $this->dms->getClassname('folder')) {
|
||||||
/* Set the new Folder of the source object */
|
/* Set the new Folder of the source object */
|
||||||
if(get_class($objsource) == $this->dms->getClassname('document'))
|
if(get_class($objsource) == $this->dms->getClassname('document')) {
|
||||||
$objsource->setFolder($objdest);
|
/* Check if name already exists in the folder */
|
||||||
elseif(get_class($objsource) == $this->dms->getClassname('folder'))
|
/*
|
||||||
$objsource->setParent($objdest);
|
if(!$settings->_enableDuplicateDocNames) {
|
||||||
else
|
if($objdest->hasDocumentByName($objsource->getName())) {
|
||||||
|
return "403 Forbidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
$oldFolder = $objsource->getFolder();
|
||||||
|
if($objsource->setFolder($objdest)) {
|
||||||
|
if($this->notifier) {
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('MOVE: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$nl1 = $oldFolder->getNotifyList();
|
||||||
|
$nl2 = $objsource->getNotifyList();
|
||||||
|
$nl3 = $objdest->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
$subject = "document_moved_email_subject";
|
||||||
|
$message = "document_moved_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $objsource->getName();
|
||||||
|
$params['old_folder_path'] = $oldFolder->getFolderPathPlain();
|
||||||
|
$params['new_folder_path'] = $objdest->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$objsource->getID();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return "500 Internal server error";
|
||||||
|
}
|
||||||
|
} elseif(get_class($objsource) == $this->dms->getClassname('folder')) {
|
||||||
|
/* Check if name already exists in the folder */
|
||||||
|
if(!$settings->_enableDuplicateSubFolderNames) {
|
||||||
|
if($objdest->hasSubFolderByName($objsource->getName())) {
|
||||||
|
return "403 Forbidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$oldFolder = $objsource->getParent();
|
||||||
|
if($objsource->setParent($objdest)) {
|
||||||
|
if($this->notifier) {
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('MOVE: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$nl1 = $oldFolder->getNotifyList();
|
||||||
|
$nl2 = $objsource->getNotifyList();
|
||||||
|
$nl3 = $objdest->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
$subject = "folder_moved_email_subject";
|
||||||
|
$message = "folder_moved_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $objsource->getName();
|
||||||
|
$params['old_folder_path'] = $oldFolder->getFolderPathPlain();
|
||||||
|
$params['new_folder_path'] = $objdest->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return "500 Internal server error";
|
||||||
|
}
|
||||||
|
} else
|
||||||
return "500 Internal server error";
|
return "500 Internal server error";
|
||||||
if($newdocname)
|
if($newdocname)
|
||||||
$objsource->setName($newdocname);
|
$objsource->setName($newdocname);
|
||||||
|
@ -940,12 +1201,11 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
* @param array general parameter passing array
|
* @param array general parameter passing array
|
||||||
* @return bool true on success
|
* @return bool true on success
|
||||||
*/
|
*/
|
||||||
function COPY($options, $del=false) /* {{{ */
|
function COPY($options) /* {{{ */
|
||||||
{
|
{
|
||||||
global $settings, $indexconf;
|
global $settings, $indexconf;
|
||||||
|
|
||||||
if(!$del)
|
$this->log_options('COPY', $options);
|
||||||
$this->log_options('COPY', $options);
|
|
||||||
|
|
||||||
// TODO Property updates still broken (Litmus should detect this?)
|
// TODO Property updates still broken (Litmus should detect this?)
|
||||||
|
|
||||||
|
@ -974,6 +1234,8 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
// get dest folder or document
|
// get dest folder or document
|
||||||
$objdest = $this->reverseLookup($options["dest"]);
|
$objdest = $this->reverseLookup($options["dest"]);
|
||||||
|
|
||||||
|
// If the destination doesn't exists, then check if the parent folder exists
|
||||||
|
// and set $newdocname, which is later used to create a new document
|
||||||
$newdocname = '';
|
$newdocname = '';
|
||||||
if(!$objdest) {
|
if(!$objdest) {
|
||||||
/* check if at least the dest directory exists */
|
/* check if at least the dest directory exists */
|
||||||
|
@ -995,7 +1257,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
return "403 Forbidden";
|
return "403 Forbidden";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If destination object is a document it must be overwritten */
|
/* If destination object is a document the source document will create a new version */
|
||||||
if(get_class($objdest) == $this->dms->getClassname('document')) {
|
if(get_class($objdest) == $this->dms->getClassname('document')) {
|
||||||
if (!$options["overwrite"]) {
|
if (!$options["overwrite"]) {
|
||||||
return "412 precondition failed";
|
return "412 precondition failed";
|
||||||
|
@ -1009,13 +1271,19 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$content = $objsource->getLatestContent();
|
$content = $objsource->getLatestContent();
|
||||||
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
||||||
|
|
||||||
|
/* If the checksum of source and destination are equal, then do not copy */
|
||||||
|
if($content->getChecksum() == $objdest->getLatestContent()->getChecksum()) {
|
||||||
|
return "204 No Content";
|
||||||
|
}
|
||||||
|
|
||||||
/* save the content as a new version in the destination document */
|
/* save the content as a new version in the destination document */
|
||||||
if(!$objdest->addContent('', $this->user, $fspath, $content->getOriginalFileName(), $content->getFileType(), $content->getMimeType, array(), array(), 0)) {
|
if(!$objdest->addContent('', $this->user, $fspath, $content->getOriginalFileName(), $content->getFileType(), $content->getMimeType(), array(), array(), 0)) {
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
return "409 Conflict";
|
return "409 Conflict";
|
||||||
}
|
}
|
||||||
|
|
||||||
$objdest->setName($objsource->getName());
|
/* Since 5.1.13 do not overwrite the name anymore
|
||||||
|
$objdest->setName($objsource->getName()); */
|
||||||
|
|
||||||
return "204 No Content";
|
return "204 No Content";
|
||||||
} elseif(get_class($objdest) == $this->dms->getClassname('folder')) {
|
} elseif(get_class($objdest) == $this->dms->getClassname('folder')) {
|
||||||
|
@ -1033,6 +1301,15 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
if(!$newdocname)
|
if(!$newdocname)
|
||||||
$newdocname = $objsource->getName();
|
$newdocname = $objsource->getName();
|
||||||
|
|
||||||
|
/* Check if name already exists in the folder */
|
||||||
|
/*
|
||||||
|
if(!$settings->_enableDuplicateDocNames) {
|
||||||
|
if($objdest->hasDocumentByName($newdocname)) {
|
||||||
|
return "403 Forbidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* get the latest content of the source object */
|
/* get the latest content of the source object */
|
||||||
$content = $objsource->getLatestContent();
|
$content = $objsource->getLatestContent();
|
||||||
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
||||||
|
@ -1084,6 +1361,34 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$this->logger->log('COPY: error copying object', PEAR_LOG_ERR);
|
$this->logger->log('COPY: error copying object', PEAR_LOG_ERR);
|
||||||
return "409 Conflict";
|
return "409 Conflict";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->notifier) {
|
||||||
|
if($this->logger)
|
||||||
|
$this->logger->log('COPY: Sending Notifications', PEAR_LOG_INFO);
|
||||||
|
$fnl = $objdest->getNotifyList();
|
||||||
|
$dnl = $document->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
|
||||||
|
$subject = "new_document_email_subject";
|
||||||
|
$message = "new_document_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $name;
|
||||||
|
$params['folder_name'] = $objdest->getName();
|
||||||
|
$params['folder_path'] = $objdest->getFolderPathPlain();
|
||||||
|
$params['username'] = $this->user->getFullName();
|
||||||
|
$params['comment'] = '';
|
||||||
|
$params['version_comment'] = '';
|
||||||
|
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$objdest->getID();
|
||||||
|
$params['sitename'] = $settings->_siteName;
|
||||||
|
$params['http_root'] = $settings->_httpRoot;
|
||||||
|
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$this->notifier->toGroup($this->user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
return "201 Created";
|
return "201 Created";
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user