From c1940fd97c167f68bc7f5cc711065117080a47a3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 25 Sep 2024 17:25:58 +0200 Subject: [PATCH 1/9] just a comment --- webdav/webdav.php | 1 + 1 file changed, 1 insertion(+) diff --git a/webdav/webdav.php b/webdav/webdav.php index 113310f9d..84102ecfa 100644 --- a/webdav/webdav.php +++ b/webdav/webdav.php @@ -207,6 +207,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server $this->logger->log('check_auth: type='.$type.', user='.$user.' authenticated', PEAR_LOG_INFO); $this->user = $controller->getUser(); + /* Get diskspace and quota for later PROPFIND calls */ $this->diskspace = $this->user->getUsedDiskSpace(); $this->quota = $this->user->getQuota(); if(!$this->user) { From 8a217a92546458bdb85f33b773b76873de956791 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 25 Sep 2024 19:12:43 +0200 Subject: [PATCH 2/9] add path of parent folder in list elements --- views/bootstrap/class.ManageNotify.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.ManageNotify.php b/views/bootstrap/class.ManageNotify.php index 72af7a5a2..f1908e43d 100644 --- a/views/bootstrap/class.ManageNotify.php +++ b/views/bootstrap/class.ManageNotify.php @@ -74,7 +74,9 @@ class SeedDMS_View_ManageNotify extends SeedDMS_Theme_Style { if(is_string($txt)) echo $txt; else { - echo $this->folderListRow($fld, true); + $extracontent = array(); + $extracontent['below_title'] = $this->getListRowPath($fld); + echo $this->folderListRow($fld, true, $extracontent); } print ""; if ($deleteaction) print " ".getMLText("delete").""; @@ -112,7 +114,9 @@ class SeedDMS_View_ManageNotify extends SeedDMS_Theme_Style { if(is_string($txt)) echo $txt; else { - echo $this->documentListRow($doc, $previewer, true); + $extracontent = array(); + $extracontent['below_title'] = $this->getListRowPath($doc); + echo $this->documentListRow($doc, $previewer, true, 0, $extracontent); } print ""; if ($deleteaction) print " ".getMLText("delete").""; From 8bcf76ca8c0031a7436bc3892374fe199b2359d6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sun, 29 Sep 2024 07:17:31 +0200 Subject: [PATCH 3/9] propperly check for duplicate folder names in op/op.Ajax.php --- CHANGELOG | 1 + op/op.Ajax.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 75d387021..bdc4fb000 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -17,6 +17,7 @@ - clearing cache of js files works for a large number of files - WebDAV returns `quota-used-bytes` and `quota-available-bytes` - fix settings SeedDMS attributes in WebDAV server +- propperly check for duplicate folder names in op/op.Ajax.php -------------------------------------------------------------------------------- Changes in version 5.1.35 diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 183908d31..4f72cb46d 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -1090,10 +1090,10 @@ switch($command) { $name = utf8_basename($userfilename); /* Check if name already exists in the folder */ - if(!$settings->_enableDuplicateDocNames) { - if($folder->hasDocumentByName($name)) { + if(!$settings->_enableDuplicateSubFolderNames) { + if($folder->hasSubFolderByName($name)) { header('Content-Type: application/json'); - echo json_encode(array('success'=>false, 'message'=>getMLText("document_duplicate_name"))); + echo json_encode(array('success'=>false, 'message'=>getMLText("subfolder_duplicate_name"))); exit; } } From 9a972c2c44a3e5d16369d76e2eb7539bdea237a8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Oct 2024 14:56:25 +0200 Subject: [PATCH 4/9] add support for searching for filesize --- out/out.Search.php | 22 +++++++++++++++- views/bootstrap/class.Search.php | 43 ++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/out/out.Search.php b/out/out.Search.php index e4ecb4ec9..349799bd5 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -126,6 +126,21 @@ if(!empty($_GET["modified"]["to"])) { } /* }}} */ +/* Filesize {{{ */ +$filesizestart = 0; +$filesizeend = 0; +$filesize['from'] = null; +$filesize['to'] = null; +if(!empty($_GET["filesize"]["from"])) { + $filesizestart = $_GET["filesize"]["from"]; + $filesize['from'] = $_GET["filesize"]["from"]; +} +if(!empty($_GET["filesize"]["to"])) { + $filesizeend = $_GET["filesize"]["to"]; + $filesize['to'] = $_GET["filesize"]["to"]; +} +/* }}} */ + // Check to see if the search has been restricted to a particular // document owner. // $_GET['owner'] can be a name of an array of names or ids {{{ @@ -358,7 +373,7 @@ if($fullsearch) { $terms = $index->terms($lastterm, $settings->_suggestTerms); } $lucenesearch = $fulltextservice->Search(); - $searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder, 'created_start'=>$createstartts, 'created_end'=>$createendts, 'modified_start'=>$modifystartts, 'modified_end'=>$modifyendts, 'attributes'=>$attributes), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))), $order); + $searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder, 'created_start'=>$createstartts, 'created_end'=>$createendts, 'modified_start'=>$modifystartts, 'modified_end'=>$modifyendts, 'filesize_start'=>$filesizestart, 'filesize_end'=>$filesizeend, 'attributes'=>$attributes), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))), $order); if($searchresult === false) { $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm'))); $dcount = 0; @@ -646,6 +661,8 @@ if($fullsearch) { 'creationenddate'=>$created['to'], //$createenddate ? $createenddate : array(), 'modificationstartdate'=>$modified['from'], 'modificationenddate'=>$modified['to'], + 'filesizestart'=>$filesize['from'], + 'filesizeend'=>$filesize['to'], 'categories'=>$categories, 'attributes'=>$attributes, 'mode'=>$resultmode, @@ -754,6 +771,9 @@ if($settings->_showSingleSearchHit && count($entries) == 1) { $view->setParam('modifystartdate', $modifystartts); $view->setParam('modifyenddate', $modifyendts); $view->setParam('modified', $modified); + $view->setParam('filesizestart', $filesizestart); + $view->setParam('filesizeend', $filesizeend); + $view->setParam('filesize', $filesize); $view->setParam('expstartdate', !empty($expstartdate) ? getReadableDate($expstartts) : ''); $view->setParam('expenddate', !empty($expenddate) ? getReadableDate($expendts) : ''); $view->setParam('statusstartdate', !empty($statusstartdate) ? getReadableDate($statusstartts) : ''); diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index e62c30266..e602de15d 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -479,6 +479,7 @@ $(document).ready(function() { $modifystartdate = $this->params['modifystartdate']; $modifyenddate = $this->params['modifyenddate']; $modified = $this->params['modified']; + $filesize = $this->params['filesize']; $expstartdate = $this->params['expstartdate']; $expenddate = $this->params['expenddate']; $statusstartdate = $this->params['statusstartdate']; @@ -888,6 +889,24 @@ $(document).ready(function() { getMLText("modification_date")." (".getMLText('to').")", $this->getDateChooser(!empty($modified['to']) ? getReadableDate($modified['to']) : null, "modified[to]", $this->params['session']->getLanguage()) ); + $this->formField( + getMLText("filesize")." (".getMLText('from').")", + array( + 'element'=>'input', + 'type'=>'number', + 'name'=>'filesize[from]', + 'value'=>$filesize['from'] + ) + ); + $this->formField( + getMLText("filesize")." (".getMLText('to').")", + array( + 'element'=>'input', + 'type'=>'number', + 'name'=>'filesize[to]', + 'value'=>$filesize['to'] + ) + ); if(!isset($facets['owner'])) { $options = array(); foreach ($allUsers as $currUser) { @@ -1009,7 +1028,7 @@ $(document).ready(function() { $option[] = array(array('data-subtitle', $c.' ×')); $options[] = $option; } - } elseif(substr($facetname, 0, 5) == 'attr_' || $facetname == 'created' || $facetname == 'modified') { + } elseif(substr($facetname, 0, 5) == 'attr_' || $facetname == 'created' || $facetname == 'modified' || $facetname == 'filesize') { /* Do not even create a list of options, because it isn't used */ } else { foreach($values as $v=>$c) { @@ -1022,7 +1041,7 @@ $(document).ready(function() { $options[] = $option; } } - if(substr($facetname, 0, 5) != 'attr_' && $facetname != 'created' && $facetname != 'modified') { + if(substr($facetname, 0, 5) != 'attr_' && $facetname != 'created' && $facetname != 'modified' && $facetname != 'filesize') { $this->formField( getMLText($facetname), array( @@ -1239,6 +1258,14 @@ $(document).ready(function() { $oldvalue = null; } break; + case 'filesize': + if(!empty($allparams[$facetname]['from']) || !empty($allparams[$facetname]['to'])) { + $oldvalue = $allparams[$facetname]; + $oldtransval = $oldvalue; //$oldvalue['from'].' TO '.$oldvalue['to']; + } else { + $oldvalue = null; + } + break; default: $oldvalue = is_array($allparams[$facetname]) ? $allparams[$facetname] : [$allparams[$facetname]]; $oldtransval = $oldvalue; @@ -1371,6 +1398,18 @@ $(document).ready(function() { $this->printAccordion(getMLText('modification_date'), $content); } } + } elseif($facetname == 'filesize') { + if(empty($allparams[$facetname]['from']) && empty($allparams[$facetname]['to'])) { + $tt = array_keys($values); + $content = '
'; + $content .= ' from '; + $content .= ''; + $content .= ' to '; + $content .= ''; + $content .= ''; + $content .= '
'; + $this->printAccordion(getMLText('filesize'), $content); + } } else { /* Further filter makes only sense if the facet has more than 1 value * or in case of 1 value, if that value has a count < $total. That second From e9372be430a2e546311982b00a077f42699fd34a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Oct 2024 14:57:15 +0200 Subject: [PATCH 5/9] rename file_size to filesize --- views/bootstrap/class.BackupTools.php | 4 ++-- views/bootstrap/class.LogManagement.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/views/bootstrap/class.BackupTools.php b/views/bootstrap/class.BackupTools.php index 005c58d86..207768ccb 100644 --- a/views/bootstrap/class.BackupTools.php +++ b/views/bootstrap/class.BackupTools.php @@ -105,7 +105,7 @@ class SeedDMS_View_BackupTools extends SeedDMS_Theme_Style { print "\n"; print "".getMLText("folder")."\n"; print "".getMLText("creation_date")."\n"; - print "".getMLText("file_size")."\n"; + print "".getMLText("filesize")."\n"; print "\n"; print "\n\n\n"; @@ -159,7 +159,7 @@ class SeedDMS_View_BackupTools extends SeedDMS_Theme_Style { print "\n\n"; print "\n"; print "".getMLText("creation_date")."\n"; - print "".getMLText("file_size")."\n"; + print "".getMLText("filesize")."\n"; print "\n"; print "\n\n\n"; diff --git a/views/bootstrap/class.LogManagement.php b/views/bootstrap/class.LogManagement.php index 6d2f542d6..d730db8c1 100644 --- a/views/bootstrap/class.LogManagement.php +++ b/views/bootstrap/class.LogManagement.php @@ -42,7 +42,7 @@ class SeedDMS_View_LogManagement extends SeedDMS_Theme_Style { print "\n"; print "".getMLText("name")."\n"; print "".getMLText("creation_date")."\n"; - print "".getMLText("file_size")."\n"; + print "".getMLText("filesize")."\n"; print "\n"; print "\n\n\n"; $print_header=false; From 12fc5c1185cf182b52fac7f74ec3dcfa4ff67c0b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Oct 2024 14:57:43 +0200 Subject: [PATCH 6/9] rename file_size to filesize --- views/bootstrap/class.DropFolderChooser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.DropFolderChooser.php b/views/bootstrap/class.DropFolderChooser.php index 554abb5bf..84f279ee7 100644 --- a/views/bootstrap/class.DropFolderChooser.php +++ b/views/bootstrap/class.DropFolderChooser.php @@ -170,7 +170,7 @@ $('.folderselect').click(function(ev) { if(is_dir($dir)) { echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; $finfo = finfo_open(FILEINFO_MIME_TYPE); From ccab32bb421cdeed8b5a558f6ab6cff1c035ea84 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Oct 2024 14:58:43 +0200 Subject: [PATCH 7/9] issue error if file drop on drop area is > maxfilesize --- views/bootstrap/class.Bootstrap.php | 14 ++++++++++++++ views/bootstrap4/class.Bootstrap4.php | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 659724051..c8e60973c 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1518,6 +1518,7 @@ function getOverallStatusIcon($status) { /* {{{ */ } /* }}} */ function printFileChooserJs() { /* {{{ */ + $maxfilesize = $this->getParam('maxfilesize'); ?> $(document).ready(function() { /* Triggered after the file has been selected */ @@ -1525,6 +1526,19 @@ $(document).ready(function() { var input = $(this), numFiles = input.get(0).files ? input.get(0).files.length : 1, label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); + + if(input.get(0).files[0].size > ) { + noty({ + text: "", + type: 'error', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 1500, + }); + return; + } + input.trigger('fileselect', [numFiles, label]); }); diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 78b26c177..7d3b8bf87 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -1510,6 +1510,7 @@ function getOverallStatusIcon($status) { /* {{{ */ } /* }}} */ function printFileChooserJs() { /* {{{ */ + $maxfilesize = $this->getParam('maxfilesize'); ?> $(document).ready(function() { /* do not use bootstrap4 custom form element because it is difficult to localize @@ -1525,6 +1526,19 @@ $(document).ready(function() { var input = $(this), numFiles = input.get(0).files ? input.get(0).files.length : 1, label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); + + if(input.get(0).files[0].size > ) { + noty({ + text: "", + type: 'error', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 1500, + }); + return; + } + input.trigger('fileselect', [numFiles, label]); }); From 5275a50d6d1f3f448d0cb13dfcb7bff063d91924 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Oct 2024 14:59:40 +0200 Subject: [PATCH 8/9] initial code to set the number of parallel requests when indexing --- out/out.Indexer.php | 1 + views/bootstrap/class.Indexer.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/out/out.Indexer.php b/out/out.Indexer.php index c0b12ad37..31272021d 100644 --- a/out/out.Indexer.php +++ b/out/out.Indexer.php @@ -81,6 +81,7 @@ if($view) { $view->setParam('folder', $folder); $view->setParam('converters', $settings->_converters['fulltext']); $view->setParam('timeout', $settings->_cmdTimeout); + $view->setParam('maxrequests', 1); // not yet used $view->setParam('accessobject', $accessop); $view($_GET); exit; diff --git a/views/bootstrap/class.Indexer.php b/views/bootstrap/class.Indexer.php index ffd3fafad..66fd84f72 100644 --- a/views/bootstrap/class.Indexer.php +++ b/views/bootstrap/class.Indexer.php @@ -110,12 +110,13 @@ class SeedDMS_View_Indexer extends SeedDMS_Theme_Style { function js() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; + $maxrequests = 5; header('Content-Type: application/javascript; charset=UTF-8'); ?> var queue_count = 0; // Number of functions being called var funcArray = []; // Array of functions waiting -var MAX_REQUESTS = 5; // Max requests +var MAX_REQUESTS = ; // Max requests var CALL_WAIT = 20; // 100ms var docstoindex = 0; // total number of docs to index From 8097340d885f4d51f9c696f4e9d757d14e73081c Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sun, 6 Oct 2024 17:08:51 +0200 Subject: [PATCH 9/9] add changes of 5.1.36 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index bdc4fb000..09962b3c8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ - WebDAV returns `quota-used-bytes` and `quota-available-bytes` - fix settings SeedDMS attributes in WebDAV server - propperly check for duplicate folder names in op/op.Ajax.php +- add searching for file size (fulltext search) -------------------------------------------------------------------------------- Changes in version 5.1.35
".getMLText('name')."".getMLText('file_size')."".getMLText('date')."
".getMLText('name')."".getMLText('filesize')."".getMLText('date')."