mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
take over some changes from 5.1.x
This commit is contained in:
parent
37db957c41
commit
88168d005e
12
CHANGELOG
12
CHANGELOG
|
@ -116,6 +116,18 @@
|
||||||
- add document list which can be exported as an archive
|
- add document list which can be exported as an archive
|
||||||
- search results can be exported
|
- search results can be exported
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
Changes in version 5.1.13
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
- make use of backup dir, do not allow backup if backup dir is not set
|
||||||
|
- the referer parameter in op/op.Settings.php is turned into an url before used
|
||||||
|
for redirect
|
||||||
|
- Import from filesystem can read a file with metadata
|
||||||
|
- drop folder chooser can be put multiple times on a page
|
||||||
|
- add section in README.Install.md on how to secure the configuration
|
||||||
|
- fix php error when removing a version of a document
|
||||||
|
- major rework of ViewFolder page, most parts of the page are now loaded by ajax
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.1.12
|
Changes in version 5.1.12
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
|
@ -27,7 +27,7 @@ class SeedDMS_AccessOperation {
|
||||||
* @var object $dms reference to dms
|
* @var object $dms reference to dms
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $dms;
|
private $dms;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var object $user user requesting the access
|
* @var object $user user requesting the access
|
||||||
|
@ -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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == 'SeedDMS_Core_Document') {
|
if($this->obj->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(get_class($document) == 'SeedDMS_Core_Document') {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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(get_class($document) == 'SeedDMS_Core_Document') {
|
if($this->obj->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(get_class($document) == $this->dms->getClassname('document')) {
|
if($this->obj->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) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ class SeedDMS_View_Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __invoke($get=array()) {
|
public function __invoke($get=array()) {
|
||||||
|
$this->callHook('preRun', isset($get['action']) ? $get['action'] : 'show');
|
||||||
if(isset($get['action']) && $get['action']) {
|
if(isset($get['action']) && $get['action']) {
|
||||||
if(method_exists($this, $get['action'])) {
|
if(method_exists($this, $get['action'])) {
|
||||||
$this->{$get['action']}();
|
$this->{$get['action']}();
|
||||||
|
@ -51,6 +52,7 @@ class SeedDMS_View_Common {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
$this->show();
|
$this->show();
|
||||||
|
$this->callHook('postRun', isset($get['action']) ? $get['action'] : 'show');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setParams($params) {
|
public function setParams($params) {
|
||||||
|
@ -97,10 +99,17 @@ class SeedDMS_View_Common {
|
||||||
* function returns
|
* function returns
|
||||||
*/
|
*/
|
||||||
public function callHook($hook) { /* {{{ */
|
public function callHook($hook) { /* {{{ */
|
||||||
|
$tmps = array();
|
||||||
$tmp = explode('_', get_class($this));
|
$tmp = explode('_', get_class($this));
|
||||||
|
$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);
|
||||||
$ret = null;
|
$ret = null;
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) {
|
foreach($tmps as $tmp)
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])] as $hookObj) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp)])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp)] as $hookObj) {
|
||||||
if (method_exists($hookObj, $hook)) {
|
if (method_exists($hookObj, $hook)) {
|
||||||
switch(func_num_args()) {
|
switch(func_num_args()) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -252,12 +261,12 @@ class SeedDMS_View_Common {
|
||||||
return $tag;
|
return $tag;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
public function jsTranslations($keys) {
|
public function jsTranslations($keys) { /* {{{ */
|
||||||
echo "var trans = {\n";
|
echo "var trans = {\n";
|
||||||
foreach($keys as $key) {
|
foreach($keys as $key) {
|
||||||
echo " '".$key."': '".str_replace("'", "\\\'", getMLText($key))."',\n";
|
echo " '".$key."': '".str_replace("'", "\\\'", getMLText($key))."',\n";
|
||||||
}
|
}
|
||||||
echo "};\n";
|
echo "};\n";
|
||||||
}
|
} /* }}} */
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -32,6 +32,7 @@ foreach($EXT_CONF as $extname=>$extconf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!isset($extconf['disable']) || $extconf['disable'] == false) {
|
if(!isset($extconf['disable']) || $extconf['disable'] == false) {
|
||||||
|
if(isset($extconf['class']) && isset($extconf['class']['file']) && isset($extconf['class']['name'])) {
|
||||||
$classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file'];
|
$classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file'];
|
||||||
if(file_exists($classfile)) {
|
if(file_exists($classfile)) {
|
||||||
include($classfile);
|
include($classfile);
|
||||||
|
@ -39,6 +40,7 @@ foreach($EXT_CONF as $extname=>$extconf) {
|
||||||
if(method_exists($obj, 'init'))
|
if(method_exists($obj, 'init'))
|
||||||
$obj->init(isset($settings->_extensions[$extname]) ? $settings->_extensions[$extname] : null);
|
$obj->init(isset($settings->_extensions[$extname]) ? $settings->_extensions[$extname] : null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(isset($extconf['language']['file'])) {
|
if(isset($extconf['language']['file'])) {
|
||||||
$langfile = $settings->_rootDir."/ext/".$extname."/".$extconf['language']['file'];
|
$langfile = $settings->_rootDir."/ext/".$extname."/".$extconf['language']['file'];
|
||||||
if(file_exists($langfile)) {
|
if(file_exists($langfile)) {
|
||||||
|
|
|
@ -31,13 +31,12 @@ if (!$user->isAdmin()) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($settings->_backupDir && file_exists($settings->_backupDir))
|
if (!$settings->_backupDir) {
|
||||||
$basedir = $settings->_backupDir;
|
UI::exitError(getMLText("admin_tools"),getMLText("no_backup_dir"));
|
||||||
else
|
}
|
||||||
$basedir = $settings->_contentDir;
|
|
||||||
|
|
||||||
$v = new SeedDMS_Version;
|
$v = new SeedDMS_Version;
|
||||||
$dump_name = $basedir.date('Y-m-d\TH-i-s')."_".$v->_number.".sql";
|
$dump_name = addDirSep($settings->_backupDir).date('Y-m-d\TH-i-s')."_".$v->_number.".sql";
|
||||||
if(!$dms->createDump($dump_name))
|
if(!$dms->createDump($dump_name))
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
||||||
|
|
||||||
|
|
|
@ -167,14 +167,14 @@ if (!is_object($folder)) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
|
UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$settings->_backupDir) {
|
||||||
|
UI::exitError(getMLText("admin_tools"),getMLText("no_backup_dir"));
|
||||||
|
}
|
||||||
|
|
||||||
$human_readable = (isset($_GET["human_readable"]) && $_GET["human_readable"]==1 ? true : false);
|
$human_readable = (isset($_GET["human_readable"]) && $_GET["human_readable"]==1 ? true : false);
|
||||||
|
|
||||||
if($settings->_backupDir && file_exists($settings->_backupDir))
|
if ($human_readable)$ark_name = addDirSep($settings->_backupDir).time()."_".$folderid."_HR.tar";
|
||||||
$basedir = $settings->_backupDir;
|
else $ark_name = addDirSep($settings->_backupDir).time()."_".$folderid.".tar";
|
||||||
else
|
|
||||||
$basedir = $settings->_contentDir;
|
|
||||||
if ($human_readable)$ark_name = $basedir.time()."_".$folderid."_HR.tar";
|
|
||||||
else $ark_name = $basedir.time()."_".$folderid.".tar";
|
|
||||||
|
|
||||||
$ark = fopen($ark_name,"w");
|
$ark = fopen($ark_name,"w");
|
||||||
|
|
||||||
|
|
|
@ -119,16 +119,12 @@ elseif (isset($_GET["arkname"])) { /* {{{ */
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($settings->_backupDir && file_exists($settings->_backupDir))
|
$backupdir = addDirSep($settings->_backupDir);
|
||||||
$basedir = $settings->_backupDir;
|
if (!file_exists($backupdir.$filename) ) {
|
||||||
else
|
|
||||||
$basedir = $settings->_contentDir;
|
|
||||||
|
|
||||||
if (!file_exists($basedir.$filename) ) {
|
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("missing_file"));
|
UI::exitError(getMLText("admin_tools"),getMLText("missing_file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$controller->setParam('basedir', $basedir);
|
$controller->setParam('basedir', $backupdir);
|
||||||
$controller->setParam('file', $filename);
|
$controller->setParam('file', $filename);
|
||||||
$controller->archive();
|
$controller->archive();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -192,16 +188,16 @@ elseif (isset($_GET["dumpname"])) { /* {{{ */
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($settings->_backupDir && file_exists($settings->_backupDir))
|
$backupdir = addDirSep($settings->_backupDir);
|
||||||
$basedir = $settings->_backupDir;
|
if (!$backupdir) {
|
||||||
else
|
UI::exitError(getMLText("admin_tools"),getMLText("no_backup_dir"));
|
||||||
$basedir = $settings->_contentDir;
|
}
|
||||||
|
|
||||||
if (!file_exists($basedir.$filename) ) {
|
if (!file_exists($backupdir.$filename) ) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("missing_file"));
|
UI::exitError(getMLText("admin_tools"),getMLText("missing_file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$controller->setParam('basedir', $basedir);
|
$controller->setParam('basedir', $backupdir);
|
||||||
$controller->setParam('file', $filename);
|
$controller->setParam('file', $filename);
|
||||||
$controller->sqldump();
|
$controller->sqldump();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
|
@ -29,19 +29,33 @@ 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");
|
||||||
|
|
||||||
$folderid = intval($_GET["folderid"]);
|
if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
|
||||||
$form = preg_replace('/[^A-Za-z0-9_]+/', '', $_GET["form"]);
|
if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) {
|
||||||
|
$nodeid = $settings->_rootFolderID;
|
||||||
|
} else {
|
||||||
|
$nodeid = intval($_GET["node"]);
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_GET['partialtree'])) {
|
$node = $dms->getFolder($nodeid);
|
||||||
$partialtree = intval($_GET['partialtree']);
|
if (!is_object($node)) {
|
||||||
|
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$partialtree = 0;
|
$folderid = intval($_GET["folderid"]);
|
||||||
|
$folder = $dms->getFolder($folderid);
|
||||||
|
$form = preg_replace('/[^A-Za-z0-9_]+/', '', $_GET["form"]);
|
||||||
}
|
}
|
||||||
$folder = $dms->getFolder($folderid);
|
|
||||||
|
|
||||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'form'=>$form, 'partialtree'=>$partialtree));
|
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||||
if($view) {
|
if($view) {
|
||||||
|
if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
|
||||||
|
$view->setParam('node', $node);
|
||||||
|
$view->setParam('orderby', $settings->_sortFoldersDefault);
|
||||||
|
} else {
|
||||||
|
$view->setParam('folder', $folder);
|
||||||
|
$view->setParam('form', $form);
|
||||||
|
}
|
||||||
$view($_GET);
|
$view($_GET);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
// archive creation ////////////////////////////////////////////////////////////
|
// archive creation ////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if($this->params['hasbackupdir']) {
|
||||||
$this->contentHeading(getMLText("archive_creation"));
|
$this->contentHeading(getMLText("archive_creation"));
|
||||||
print "<p>".getMLText("archive_creation_warning")."</p>\n";
|
print "<p>".getMLText("archive_creation_warning")."</p>\n";
|
||||||
$this->contentContainerStart();
|
$this->contentContainerStart();
|
||||||
|
@ -193,6 +194,9 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->contentContainerEnd();
|
$this->contentContainerEnd();
|
||||||
|
} else {
|
||||||
|
$this->warningMsg(getMLText('no_backup_dir'));
|
||||||
|
}
|
||||||
|
|
||||||
// files deletion //////////////////////////////////////////////////////////////
|
// files deletion //////////////////////////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -168,6 +168,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
echo '<script src="../styles/'.$this->theme.'/application.js"></script>'."\n";
|
echo '<script src="../styles/'.$this->theme.'/application.js"></script>'."\n";
|
||||||
if($this->params['enablemenutasks'] && isset($this->params['user']) && $this->params['user']) {
|
if($this->params['enablemenutasks'] && isset($this->params['user']) && $this->params['user']) {
|
||||||
$this->addFooterJS('checkTasks();');
|
$this->addFooterJS('checkTasks();');
|
||||||
|
$this->addFooterJS('updateDropFolder();');
|
||||||
}
|
}
|
||||||
if($this->footerjs) {
|
if($this->footerjs) {
|
||||||
$jscode = "$(document).ready(function () {\n";
|
$jscode = "$(document).ready(function () {\n";
|
||||||
|
@ -198,6 +199,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
header('Content-Type: application/javascript');
|
header('Content-Type: application/javascript');
|
||||||
echo "var seeddms_absbaseprefix=\"".$this->params['absbaseprefix']."\";\n";
|
echo "var seeddms_absbaseprefix=\"".$this->params['absbaseprefix']."\";\n";
|
||||||
echo "var seeddms_webroot=\"".$this->params['settings']->_httpRoot."\";\n";
|
echo "var seeddms_webroot=\"".$this->params['settings']->_httpRoot."\";\n";
|
||||||
|
echo "var seeddms_folder=1;\n";
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function footerjs() { /* {{{ */
|
function footerjs() { /* {{{ */
|
||||||
|
@ -431,7 +433,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
if($this->params['dropfolderdir'] && $this->params['enabledropfolderlist']) {
|
if($this->params['dropfolderdir'] && $this->params['enabledropfolderlist']) {
|
||||||
echo " <div id=\"menu-dropfolder\">";
|
echo " <div id=\"menu-dropfolder\">";
|
||||||
echo " <div class=\"ajax\" data-no-spinner=\"true\" data-view=\"DropFolderChooser\" data-action=\"menuList\"";
|
echo " <div class=\"ajax\" data-no-spinner=\"true\" data-view=\"DropFolderChooser\" data-action=\"menuList\"";
|
||||||
if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), $dms->getClassname('folder')))
|
if ($folder!=null && is_object($folder) && $folder->isType('folder'))
|
||||||
echo " data-query=\"folderid=".$folder->getID()."\"";
|
echo " data-query=\"folderid=".$folder->getID()."\"";
|
||||||
echo "></div>";
|
echo "></div>";
|
||||||
echo " </div>";
|
echo " </div>";
|
||||||
|
@ -458,7 +460,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
}
|
}
|
||||||
echo " </ul>\n";
|
echo " </ul>\n";
|
||||||
echo " <form action=\"../out/out.Search.php\" class=\"form-inline navbar-search pull-left\" autocomplete=\"off\">";
|
echo " <form action=\"../out/out.Search.php\" class=\"form-inline navbar-search pull-left\" autocomplete=\"off\">";
|
||||||
if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), $dms->getClassname('folder'))) {
|
if ($folder!=null && is_object($folder) && $folder->isType('folder')) {
|
||||||
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
|
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
|
||||||
}
|
}
|
||||||
echo " <input type=\"hidden\" name=\"navBar\" value=\"1\" />";
|
echo " <input type=\"hidden\" name=\"navBar\" value=\"1\" />";
|
||||||
|
@ -563,7 +565,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
|
|
||||||
private function folderNavigationBar($folder) { /* {{{ */
|
private function folderNavigationBar($folder) { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
if (!is_object($folder) || strcasecmp(get_class($folder), $dms->getClassname('folder'))) {
|
if (!is_object($folder) || !$folder->isType('folder')) {
|
||||||
echo "<ul class=\"nav\">\n";
|
echo "<ul class=\"nav\">\n";
|
||||||
echo "</ul>\n";
|
echo "</ul>\n";
|
||||||
return;
|
return;
|
||||||
|
@ -1190,7 +1192,7 @@ $(document).ready(function() {
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<input type="text" class="form-control" readonly>
|
<input type="text" class="form-control" readonly>
|
||||||
<span class="btn btn-default btn-file">
|
<span class="btn btn-default btn-file">
|
||||||
'.getMLText("browse").'… <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").'">
|
'.getMLText("browse").'… <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").'>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1580,7 +1582,7 @@ $(document).ready(function() {
|
||||||
$content = "<div class=\"input-append\">\n";
|
$content = "<div class=\"input-append\">\n";
|
||||||
$content .= "<input readonly type=\"text\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".$dropfolderfile."\">";
|
$content .= "<input readonly type=\"text\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".$dropfolderfile."\">";
|
||||||
$content .= "<button type=\"button\" class=\"btn\" id=\"clearfilename".$formName."\"><i class=\"icon-remove\"></i></button>";
|
$content .= "<button type=\"button\" class=\"btn\" id=\"clearfilename".$formName."\"><i class=\"icon-remove\"></i></button>";
|
||||||
$content .= "<a data-target=\"#dropfolderChooser\" href=\"../out/out.DropFolderChooser.php?form=form1&dropfolderfile=".urlencode($dropfolderfile)."&showfolders=".$showfolders."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".($showfolders ? getMLText("choose_target_folder"): getMLText("choose_target_file"))."…</a>\n";
|
$content .= "<a data-target=\"#dropfolderChooser\" href=\"../out/out.DropFolderChooser.php?form=".$formName."&dropfolderfile=".urlencode($dropfolderfile)."&showfolders=".$showfolders."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".($showfolders ? getMLText("choose_target_folder"): getMLText("choose_target_file"))."…</a>\n";
|
||||||
$content .= "</div>\n";
|
$content .= "</div>\n";
|
||||||
$content .= '
|
$content .= '
|
||||||
<div class="modal hide" id="dropfolderChooser" tabindex="-1" role="dialog" aria-labelledby="dropfolderChooserLabel" aria-hidden="true">
|
<div class="modal hide" id="dropfolderChooser" tabindex="-1" role="dialog" aria-labelledby="dropfolderChooserLabel" aria-hidden="true">
|
||||||
|
@ -1603,13 +1605,15 @@ $(document).ready(function() {
|
||||||
?>
|
?>
|
||||||
/* Set up a callback which is called when a folder in the tree is selected */
|
/* Set up a callback which is called when a folder in the tree is selected */
|
||||||
modalDropfolderChooser = $('#dropfolderChooser');
|
modalDropfolderChooser = $('#dropfolderChooser');
|
||||||
function fileSelected(name) {
|
function fileSelected(name, form) {
|
||||||
$('#dropfolderfile<?php echo $formName ?>').val(name);
|
// $('#dropfolderfile<?php echo $formName ?>').val(name);
|
||||||
|
$('#dropfolderfile'+form).val(name);
|
||||||
modalDropfolderChooser.modal('hide');
|
modalDropfolderChooser.modal('hide');
|
||||||
}
|
}
|
||||||
<?php if($showfolders) { ?>
|
<?php if($showfolders) { ?>
|
||||||
function folderSelected(name) {
|
function folderSelected(name, form) {
|
||||||
$('#dropfolderfile<?php echo $formName ?>').val(name);
|
// $('#dropfolderfile<?php echo $formName ?>').val(name);
|
||||||
|
$('#dropfolderfile'+form).val(name);
|
||||||
modalDropfolderChooser.modal('hide');
|
modalDropfolderChooser.modal('hide');
|
||||||
}
|
}
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -1728,7 +1732,8 @@ $(document).ready(function() {
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function printNewTreeNavigationHtml($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='') { /* {{{ */
|
function printNewTreeNavigationHtml($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='') { /* {{{ */
|
||||||
echo "<div id=\"jqtree".$formid."\" style=\"margin-left: 10px;\" data-url=\"../op/op.Ajax.php?command=subtree&showdocs=".$showdocs."&orderby=".$orderby."\"></div>\n";
|
//echo "<div id=\"jqtree".$formid."\" style=\"margin-left: 10px;\" data-url=\"../op/op.Ajax.php?command=subtree&showdocs=".$showdocs."&orderby=".$orderby."\"></div>\n";
|
||||||
|
echo "<div id=\"jqtree".$formid."\" style=\"margin-left: 10px;\" data-url=\"".$_SERVER['SCRIPT_NAME']."?action=subtree\"></div>\n";
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1750,9 +1755,9 @@ $(document).ready(function() {
|
||||||
if($path || $expandtree>=$level) {
|
if($path || $expandtree>=$level) {
|
||||||
if($path)
|
if($path)
|
||||||
$pathfolder = array_shift($path);
|
$pathfolder = array_shift($path);
|
||||||
|
$children = array();
|
||||||
$subfolders = $folder->getSubFolders(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
|
$subfolders = $folder->getSubFolders(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
|
||||||
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode);
|
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode);
|
||||||
$children = array();
|
|
||||||
foreach($subfolders as $subfolder) {
|
foreach($subfolders as $subfolder) {
|
||||||
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? true : false, 'is_folder'=>true);
|
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? true : false, 'is_folder'=>true);
|
||||||
if($expandtree>=$level || $pathfolder->getID() == $subfolder->getID()) {
|
if($expandtree>=$level || $pathfolder->getID() == $subfolder->getID()) {
|
||||||
|
@ -1793,18 +1798,8 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
$node = array('label'=>$folder->getName(), 'id'=>$folder->getID(), 'load_on_demand'=>false, 'is_folder'=>true);
|
$node = array('label'=>$folder->getName(), 'id'=>$folder->getID(), 'load_on_demand'=>false, 'is_folder'=>true);
|
||||||
if(!$folder->hasSubFolders()) {
|
if(!$folder->hasSubFolders()) {
|
||||||
$node['load_on_demand'] = false;
|
$node['load_on_demand'] = true;
|
||||||
$node['children'] = array();
|
$node['children'] = array();
|
||||||
if($showdocs) {
|
|
||||||
$documents = $folder->getDocuments($orderby);
|
|
||||||
$documents = SeedDMS_Core_DMS::filterAccess($documents, $this->params['user'], $accessmode);
|
|
||||||
if($this->hasHook('filterTreeDocuments'))
|
|
||||||
$documents = $this->callHook('filterTreeDocuments', $folder, $documents);
|
|
||||||
foreach($documents as $document) {
|
|
||||||
$node2 = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false);
|
|
||||||
$node['children'][] = $node2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} 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, $expandtree, $orderby, 0);
|
||||||
if($showdocs) {
|
if($showdocs) {
|
||||||
|
@ -1828,14 +1823,15 @@ $(document).ready(function() {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$root = $this->params['dms']->getFolder($this->params['rootfolderid']);
|
$root = $this->params['dms']->getFolder($this->params['rootfolderid']);
|
||||||
$tree = array(array('label'=>$root->getName(), 'id'=>$root->getID(), 'load_on_demand'=>true, 'is_folder'=>true));
|
$tree = array(array('label'=>$root->getName(), 'id'=>$root->getID(), 'load_on_demand'=>false, 'is_folder'=>true));
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
var data = <?php echo json_encode($tree); ?>;
|
var data = <?php echo json_encode($tree); ?>;
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#jqtree<?php echo $formid ?>').tree({
|
const $tree = $('#jqtree<?php echo $formid ?>');
|
||||||
|
$tree.tree({
|
||||||
// saveState: true,
|
// saveState: true,
|
||||||
|
selectable: false,
|
||||||
data: data,
|
data: data,
|
||||||
saveState: 'jqtree<?php echo $formid; ?>',
|
saveState: 'jqtree<?php echo $formid; ?>',
|
||||||
openedIcon: $('<i class="icon-minus-sign"></i>'),
|
openedIcon: $('<i class="icon-minus-sign"></i>'),
|
||||||
|
@ -1859,17 +1855,19 @@ $(function() {
|
||||||
// Unfold node for currently selected folder
|
// Unfold node for currently selected folder
|
||||||
$('#jqtree<?php echo $formid ?>').tree('openNode', $('#jqtree<?php echo $formid ?>').tree('getNodeById', <?php echo $folderid ?>), false);
|
$('#jqtree<?php echo $formid ?>').tree('openNode', $('#jqtree<?php echo $formid ?>').tree('getNodeById', <?php echo $folderid ?>), false);
|
||||||
$('#jqtree<?php echo $formid ?>').on(
|
$('#jqtree<?php echo $formid ?>').on(
|
||||||
'tree.select',
|
'tree.click',
|
||||||
function(event) {
|
function(event) {
|
||||||
var node = event.node;
|
var node = event.node;
|
||||||
|
if(!node)
|
||||||
|
return;
|
||||||
$('#jqtree<?php echo $formid ?>').tree('openNode', node);
|
$('#jqtree<?php echo $formid ?>').tree('openNode', node);
|
||||||
// event.preventDefault();
|
// event.preventDefault();
|
||||||
if(node.is_folder) {
|
if(node.is_folder) {
|
||||||
if(typeof node.fetched == 'undefined') {
|
if(typeof node.fetched == 'undefined') {
|
||||||
node.fetched = true;
|
node.fetched = true;
|
||||||
$(this).tree('loadDataFromUrl', node, function () {
|
$(this).tree('loadDataFromUrl', node, function () {
|
||||||
$(this).tree('openNode', node);}
|
$(this).tree('openNode', node);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
folderSelected<?php echo $formid ?>(node.id, node.name);
|
folderSelected<?php echo $formid ?>(node.id, node.name);
|
||||||
} else
|
} else
|
||||||
|
@ -1904,6 +1902,39 @@ $(function() {
|
||||||
<?php
|
<?php
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return json data for sub tree of navigation tree
|
||||||
|
*/
|
||||||
|
function printNewTreeNavigationSubtree($folderid, $showdocs=0, $orderby='') { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$user = $this->params['user'];
|
||||||
|
|
||||||
|
$folder = $dms->getFolder($folderid);
|
||||||
|
if (!is_object($folder)) return '';
|
||||||
|
|
||||||
|
$subfolders = $folder->getSubFolders($orderby);
|
||||||
|
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, M_READ);
|
||||||
|
$tree = array();
|
||||||
|
foreach($subfolders as $subfolder) {
|
||||||
|
$loadondemand = $subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs);
|
||||||
|
$level = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>$loadondemand, 'is_folder'=>true);
|
||||||
|
if(!$subfolder->hasSubFolders())
|
||||||
|
$level['children'] = array();
|
||||||
|
$tree[] = $level;
|
||||||
|
}
|
||||||
|
if($showdocs) {
|
||||||
|
$documents = $folder->getDocuments($orderby);
|
||||||
|
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
|
||||||
|
foreach($documents as $document) {
|
||||||
|
$level = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false);
|
||||||
|
$tree[] = $level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($tree);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function printTreeNavigation($folderid, $showtree){ /* {{{ */
|
function printTreeNavigation($folderid, $showtree){ /* {{{ */
|
||||||
if ($showtree==1){
|
if ($showtree==1){
|
||||||
$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=0\"><i class=\"icon-minus-sign\"></i></a>", true);
|
$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=0\"><i class=\"icon-minus-sign\"></i></a>", true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user