mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-05-08 13:31:24 +00:00
number of files listed in drop folder can be configured
This commit is contained in:
parent
a7b845c64f
commit
5f281a1e99
|
|
@ -347,6 +347,10 @@ class Settings { /* {{{ */
|
|||
var $_maxItemsPerPage = 0;
|
||||
// number of documents/folders fetched when scrolling to bottom of ViewFolder page
|
||||
var $_incItemsPerPage = 0;
|
||||
// maximum number of documents/folders in drop folder menu
|
||||
var $_maxItemsInDropFolderMenu = 10;
|
||||
// maximum number of documents/folders in drop folder list
|
||||
var $_maxItemsInDropFolderList = 30;
|
||||
// parse comments of folders and documents as markdown
|
||||
var $_markdownComments = false;
|
||||
// show dropdown menu for actions on folders/documents
|
||||
|
|
@ -569,6 +573,10 @@ class Settings { /* {{{ */
|
|||
$this->_maxItemsPerPage = intval($tab["maxItemsPerPage"]);
|
||||
if(isset($tab["incItemsPerPage"]))
|
||||
$this->_incItemsPerPage = intval($tab["incItemsPerPage"]);
|
||||
if(isset($tab["maxItemsInDropFolderMenu"]))
|
||||
$this->_maxItemsInDropFolderMenu = intval($tab["maxItemsInDropFolderMenu"]);
|
||||
if(isset($tab["maxItemsInDropFolderList"]))
|
||||
$this->_maxItemsInDropFolderList = intval($tab["maxItemsInDropFolderList"]);
|
||||
$this->_markdownComments = Settings::boolVal($tab["markdownComments"]);
|
||||
$this->_actiondropdown = Settings::boolVal($tab["actiondropdown"]);
|
||||
|
||||
|
|
@ -995,6 +1003,8 @@ class Settings { /* {{{ */
|
|||
$this->setXMLAttributValue($node, "convertToPdf", $this->_convertToPdf);
|
||||
$this->setXMLAttributValue($node, "maxItemsPerPage", $this->_maxItemsPerPage);
|
||||
$this->setXMLAttributValue($node, "incItemsPerPage", $this->_incItemsPerPage);
|
||||
$this->setXMLAttributValue($node, "maxItemsInDropFolderMenu", $this->_maxItemsInDropFolderMenu);
|
||||
$this->setXMLAttributValue($node, "maxItemsInDropFolderList", $this->_maxItemsInDropFolderList);
|
||||
$this->setXMLAttributValue($node, "markdownComments", $this->_markdownComments);
|
||||
$this->setXMLAttributValue($node, "actiondropdown", $this->_actiondropdown);
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ if ($action == "saveSettings")
|
|||
setBoolValue('convertToPdf');
|
||||
setIntValue('maxItemsPerPage');
|
||||
setIntValue('incItemsPerPage');
|
||||
setIntValue('maxItemsInDropFolderMenu');
|
||||
setIntValue('maxItemsInDropFolderList');
|
||||
setBoolValue('markdownComments');
|
||||
setBoolValue('actiondropdown');
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ if($view) {
|
|||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
$view->setParam('previewWidthMenuList', $settings->_previewWidthMenuList);
|
||||
$view->setParam('previewWidthList', $settings->_previewWidthDropFolderList);
|
||||
$view->setParam('maxItemsInDropFolderMenu', $settings->_maxItemsInDropFolderMenu);
|
||||
$view->setParam('maxItemsInDropFolderList', $settings->_maxItemsInDropFolderList);
|
||||
$view->setParam('convertToPdf', $settings->_convertToPdf);
|
||||
$view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array());
|
||||
$view->setParam('timeout', $settings->_cmdTimeout);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ $('.folderselect').click(function(ev) {
|
|||
<?php
|
||||
} /* }}} */
|
||||
|
||||
private function getFiles($path, $recursive=false) {
|
||||
private function getFiles($path, $recursive=false, $maxfiles=20) {
|
||||
if($recursive)
|
||||
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
|
||||
else
|
||||
|
|
@ -55,16 +55,19 @@ $('.folderselect').click(function(ev) {
|
|||
|
||||
$files = array();
|
||||
foreach ($rii as $file) {
|
||||
if (!$file->isDir())
|
||||
$files[] = [substr($file->getPath(), strlen($path)+1), $file->getFilename()];
|
||||
if(count($files) > 20)
|
||||
if (!$file->isDir()) {
|
||||
$filesize = filesize($file->getPath().DIRECTORY_SEPARATOR.$file->getFilename());
|
||||
$filedate = filectime($file->getPath().DIRECTORY_SEPARATOR.$file->getFilename());
|
||||
$files[] = [substr($file->getPath(), strlen($path)+1), $file->getFilename(), $filesize, $filedate];
|
||||
}
|
||||
if(count($files) > ($maxfiles-1))
|
||||
return $files;
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
private function getFolders($path, $recursive=false) {
|
||||
private function getFolders($path, $recursive=false, $maxfiles=20) {
|
||||
if($recursive)
|
||||
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
|
||||
else
|
||||
|
|
@ -76,7 +79,7 @@ $('.folderselect').click(function(ev) {
|
|||
if(($t = substr($file->getPath(), strlen($path)+1)) && ($file->getFilename() == '.'))
|
||||
$files[] = $t;
|
||||
}
|
||||
if(count($files) > 20)
|
||||
if(count($files) > ($maxfiles-1))
|
||||
return $files;
|
||||
}
|
||||
|
||||
|
|
@ -93,6 +96,7 @@ $('.folderselect').click(function(ev) {
|
|||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewwidth = $this->params['previewWidthMenuList'];
|
||||
$maxItemsInDropFolderMenu = $this->params['maxItemsInDropFolderMenu'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
$xsendfile = $this->params['xsendfile'];
|
||||
|
|
@ -113,8 +117,10 @@ $('.folderselect').click(function(ev) {
|
|||
*/
|
||||
if(dirname($dir) == $dropfolderdir) {
|
||||
if(is_dir($dir)) {
|
||||
$files = $this->getFiles($dir, $recursive);
|
||||
|
||||
$files = $this->getFiles($dir, $recursive, $maxItemsInDropFolderMenu);
|
||||
usort($files, function($a, $b) {
|
||||
return $a[3] < $b[3];
|
||||
});
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
foreach($files as $file) {
|
||||
$entry = $file[1];
|
||||
|
|
@ -130,7 +136,7 @@ $('.folderselect').click(function(ev) {
|
|||
$subitem['label'] .= "<div class=\"dropfolder-menu-img\" style=\"display: none; overflow:hidden; position: absolute; left:-".($previewwidth+10)."px; border: 1px solid #888;background: white;\"><img filename=\"".htmlspecialchars($entry)."\" width=\"".$previewwidth."\" src=\"".$settings->_httpRoot."op/op.DropFolderPreview.php?filename=".urlencode($path.DIRECTORY_SEPARATOR.$entry)."&width=".$previewwidth."\" title=\"".htmlspecialchars($mimetype)."\"></div>";
|
||||
}
|
||||
}
|
||||
$subitem['label'] .= "<div class=\"dropfolder-menu-text\" style=\"margin-left:10px; margin-right: 10px; display:inline-block;\">".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."<br /><span style=\"font-size: 85%;\">".SeedDMS_Core_File::format_filesize(filesize($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry)).", ".date('Y-m-d H:i:s', filectime($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry))."</span></div>";
|
||||
$subitem['label'] .= "<div class=\"dropfolder-menu-text\" style=\"margin-left:10px; margin-right: 10px; display:inline-block;\">".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."<br /><span style=\"font-size: 85%;\">".SeedDMS_Core_File::format_filesize($file[2]).", ".getLongReadableDate($file[3])."</span></div>";
|
||||
$menuitems['dropfolder']['children'][] = $subitem;
|
||||
}
|
||||
}
|
||||
|
|
@ -150,6 +156,7 @@ $('.folderselect').click(function(ev) {
|
|||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewwidth = $this->params['previewWidthList'];
|
||||
$maxItemsInDropFolderList = $this->params['maxItemsInDropFolderList'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
$xsendfile = $this->params['xsendfile'];
|
||||
|
|
@ -168,9 +175,13 @@ $('.folderselect').click(function(ev) {
|
|||
*/
|
||||
if(dirname($dir) == $dropfolderdir) {
|
||||
if(is_dir($dir)) {
|
||||
echo "<table class=\"table table-condensed\">\n";
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<thead>\n";
|
||||
echo "<tr><th></th><th>".getMLText('name')."</th><th align=\"right\">".getMLText('filesize')."</th><th>".getMLText('date')."</th></tr>\n";
|
||||
echo "<tr>";
|
||||
if($previewwidth) {
|
||||
echo "<th></th>";
|
||||
}
|
||||
echo "<th>".getMLText('name')."</th><th align=\"right\">".getMLText('filesize')."</th><th>".getMLText('date')."</th></tr>\n";
|
||||
echo "</thead>\n";
|
||||
echo "<tbody>\n";
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
|
|
@ -178,24 +189,34 @@ $('.folderselect').click(function(ev) {
|
|||
$folders = $this->getFolders($dir, $recursive);
|
||||
foreach($folders as $entry) {
|
||||
echo "<tr>";
|
||||
echo '<td><img draggable="false" src="/views/bootstrap4/images/folder.svg" width="24" height="24" border="0"></td>';
|
||||
if($previewwidth) {
|
||||
echo '<td><img draggable="false" src="/views/bootstrap4/images/folder.svg" width="24" height="24" border="0"></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";
|
||||
}
|
||||
} else {
|
||||
$files = $this->getFiles($dir, $recursive);
|
||||
$files = $this->getFiles($dir, $recursive, $maxItemsInDropFolderList);
|
||||
usort($files, function($a, $b) {
|
||||
return $a[3] < $b[3];
|
||||
});
|
||||
foreach($files as $file) {
|
||||
$entry = $file[1];
|
||||
$path = $file[0];
|
||||
$mimetype = finfo_file($finfo, $dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry);
|
||||
echo "<tr>";
|
||||
if($previewwidth) {
|
||||
$previewer->createRawPreview($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry, 'dropfolder'.DIRECTORY_SEPARATOR, $mimetype);
|
||||
echo "<tr><td style=\"min-width: ".$previewwidth."px;\">";
|
||||
if($previewer->hasRawPreview($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry, 'dropfolder'.DIRECTORY_SEPARATOR)) {
|
||||
echo "<img style=\"cursor: pointer;\" class=\"fileselect mimeicon\" data-filename=\"".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."\" data-form=\"".$form."\" width=\"".$previewwidth."\" src=\"../op/op.DropFolderPreview.php?filename=".urlencode($path.DIRECTORY_SEPARATOR.$entry)."&width=".$previewwidth."\" title=\"".htmlspecialchars($mimetype)."\">";
|
||||
}
|
||||
echo "</td><td><span style=\"cursor: pointer;\" class=\"fileselect\" data-filename=\"".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."\" data-form=\"".$form."\">".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."</span></td><td align=\"right\">".SeedDMS_Core_File::format_filesize(filesize($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry))."</td><td>".date('Y-m-d H:i:s', filectime($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry))."</td></tr>\n";
|
||||
$previewer->createRawPreview($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry, 'dropfolder'.DIRECTORY_SEPARATOR, $mimetype);
|
||||
echo "<td style=\"min-width: ".$previewwidth."px;\">";
|
||||
if($previewer->hasRawPreview($dir.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$entry, 'dropfolder'.DIRECTORY_SEPARATOR)) {
|
||||
echo "<img style=\"cursor: pointer;\" class=\"fileselect mimeicon\" data-filename=\"".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."\" data-form=\"".$form."\" width=\"".$previewwidth."\" src=\"../op/op.DropFolderPreview.php?filename=".urlencode($path.DIRECTORY_SEPARATOR.$entry)."&width=".$previewwidth."\" title=\"".htmlspecialchars($mimetype)."\">";
|
||||
echo "</td>";
|
||||
}
|
||||
}
|
||||
echo "<td><span style=\"cursor: pointer;\" class=\"fileselect\" data-filename=\"".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."\" data-form=\"".$form."\">".htmlspecialchars($path.DIRECTORY_SEPARATOR.$entry)."</span></td>";
|
||||
echo "<td align=\"right\">".SeedDMS_Core_File::format_filesize($file[2])."</td>";
|
||||
echo "<td>".getLongReadableDate($file[3])."</td>";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
echo "</tbody>\n";
|
||||
|
|
|
|||
|
|
@ -652,6 +652,8 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
|
|||
<?php $this->showConfigCheckbox('settings_convertToPdf', 'convertToPdf'); ?>
|
||||
<?php $this->showConfigText('settings_maxItemsPerPage', 'maxItemsPerPage'); ?>
|
||||
<?php $this->showConfigText('settings_incItemsPerPage', 'incItemsPerPage'); ?>
|
||||
<?php $this->showConfigText('settings_maxItemsInDropFolderMenu', 'maxItemsInDropFolderMenu'); ?>
|
||||
<?php $this->showConfigText('settings_maxItemsInDropFolderList', 'maxItemsInDropFolderList'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_markdownComments', 'markdownComments'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_actiondropdown', 'actiondropdown'); ?>
|
||||
|
||||
|
|
@ -737,7 +739,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
|
|||
-->
|
||||
<?php $this->showConfigHeadline('settings_Server'); ?>
|
||||
<?php $this->showConfigText('settings_rootDir', 'rootDir'); ?>
|
||||
<?php $this->showConfigText('settings_baseUrl', 'baseUrl', '', getBaseUrl()); ?>
|
||||
<?php $this->showConfigText('settings_baseUrl', 'baseUrl', '', $settings->getBaseUrl()); ?>
|
||||
<?php $this->showConfigText('settings_httpRoot', 'httpRoot'); ?>
|
||||
<?php $this->showConfigText('settings_contentDir', 'contentDir'); ?>
|
||||
<?php $this->showConfigText('settings_backupDir', 'backupDir'); ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user