diff --git a/CHANGELOG b/CHANGELOG index e8a474a16..4ef1f9723 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -314,6 +314,8 @@ - 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 +- add searching for file size (fulltext search) -------------------------------------------------------------------------------- Changes in version 5.1.35 diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 76e5594d5..33d6bcd02 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -1169,10 +1169,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; } } diff --git a/out/out.Indexer.php b/out/out.Indexer.php index 698d175d9..20d1f0774 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/out/out.Search.php b/out/out.Search.php index 2858384c1..a99790d5b 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; @@ -680,6 +695,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, @@ -793,6 +810,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.BackupTools.php b/views/bootstrap/class.BackupTools.php index 3e4117beb..3d3dbc299 100644 --- a/views/bootstrap/class.BackupTools.php +++ b/views/bootstrap/class.BackupTools.php @@ -108,7 +108,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"; @@ -170,7 +170,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.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index ce7213173..ec3fa85ec 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1644,6 +1644,7 @@ function getOverallStatusIcon($status) { /* {{{ */ } /* }}} */ function printFileChooserJs() { /* {{{ */ + $maxfilesize = $this->getParam('maxfilesize'); ?> $(document).ready(function() { /* Triggered after the file has been selected */ @@ -1651,6 +1652,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/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); diff --git a/views/bootstrap/class.Indexer.php b/views/bootstrap/class.Indexer.php index 05b959fc5..a6461edcb 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 diff --git a/views/bootstrap/class.LogManagement.php b/views/bootstrap/class.LogManagement.php index 92554a015..fd4ec4ad7 100644 --- a/views/bootstrap/class.LogManagement.php +++ b/views/bootstrap/class.LogManagement.php @@ -43,7 +43,7 @@ class SeedDMS_View_LogManagement extends SeedDMS_Theme_Style { print "\n"; print "\n"; print "\n"; - print "\n"; + print "\n"; print "\n"; print "\n\n\n"; $print_header=false; diff --git a/views/bootstrap/class.ManageNotify.php b/views/bootstrap/class.ManageNotify.php index fa77b8083..ce6349bea 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 "
".getMLText('name')."".getMLText('file_size')."".getMLText('date')."
".getMLText('name')."".getMLText('filesize')."".getMLText('date')."
".getMLText("name")."".getMLText("creation_date")."".getMLText("file_size")."".getMLText("filesize")."
"; if ($deleteaction) print " ".getMLText("delete").""; @@ -113,7 +115,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").""; diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 6ebf8b171..d8f9f63ab 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -480,6 +480,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']; @@ -907,6 +908,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) { @@ -1028,7 +1047,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) { @@ -1041,7 +1060,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( @@ -1258,6 +1277,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; @@ -1390,6 +1417,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 diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 93e93b747..9481b9bd2 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -1564,6 +1564,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 @@ -1579,6 +1580,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/webdav/webdav.php b/webdav/webdav.php index f6f950755..122c25482 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) {