diff --git a/core/Api/FileAPI.class.php b/core/Api/FileAPI.class.php index 6498e44..3c65f4a 100644 --- a/core/Api/FileAPI.class.php +++ b/core/Api/FileAPI.class.php @@ -237,7 +237,7 @@ namespace Api\File { "maxFiles" => ($maxFiles <= 0 ? $this->getMaxFiles() : min($this->getMaxFiles(), $maxFiles)), "maxSize" => ($maxSize <= 0 ? $this->getMaxFileSizePHP() : min($this->getMaxFileSizePHP(), $maxSize)), "extensions" => $row["extensions"] ?? "", - "parentId" => $row["parentId"] ?? 0 + // "parentId" => $row["parentId"] ?? 0 // not sure, why we need to tell the parentId? ); } } @@ -261,7 +261,8 @@ namespace Api\File { $this->result["restrictions"] = array( "maxFiles" => $this->getMaxFiles(), - "maxSize" => $this->getMaxFileSizePHP() + "maxSize" => $this->getMaxFileSizePHP(), + "extensions" => "" ); return true; diff --git a/fileControlPanel/src/api.js b/fileControlPanel/src/api.js index b7033ab..90e5475 100644 --- a/fileControlPanel/src/api.js +++ b/fileControlPanel/src/api.js @@ -69,6 +69,10 @@ export default class API { return this.apiCall("file/createDirectory", { name: name, parentId: parentId }); } + getRestrictions() { + return this.apiCall("file/getRestrictions"); + } + async upload(files, token = null, parentId = null) { const csrf_token = this.csrfToken(); diff --git a/fileControlPanel/src/elements/file-browser.css b/fileControlPanel/src/elements/file-browser.css index 3b14acf..4dee31a 100644 --- a/fileControlPanel/src/elements/file-browser.css +++ b/fileControlPanel/src/elements/file-browser.css @@ -61,4 +61,9 @@ .file-table td:nth-child(n+3), .file-table th:nth-child(n+3) { text-align: center; +} + +.file-browser-restrictions { + display: grid; + grid-template-columns: repeat(4, auto); } \ No newline at end of file diff --git a/fileControlPanel/src/elements/file-browser.js b/fileControlPanel/src/elements/file-browser.js index eda56e6..27cbcdf 100644 --- a/fileControlPanel/src/elements/file-browser.js +++ b/fileControlPanel/src/elements/file-browser.js @@ -13,13 +13,13 @@ export function FileBrowser(props) { let tokenObj = props.token || { valid: false }; let onSelectFile = props.onSelectFile || function() { }; let onFetchFiles = props.onFetchFiles || function() { }; - let directories = props.directories || {}; + let directories = props.directories || {}; + let restrictions = props.restrictions || { maxFiles: 0, maxSize: 0, extensions: "" }; let [popup, setPopup] = useState({ visible: false, directoryName: "", directory: 0, type: "upload" }); let [alerts, setAlerts] = useState( []); let [filesToUpload, setFilesToUpload] = useState([]); - function svgMiddle(scale=1.0) { let width = 48 * scale; let height = 64 * scale; @@ -323,6 +323,12 @@ export function FileBrowser(props) { } { uploadZone } +