Skip to content

Configuration options

pavel edited this page Mar 17, 2017 · 31 revisions

Since v2.0.0 RichFilemanager configuration options divided into two files: client-side and server-side. The separation was done for the security reasons and also to provide an ability to setup client-side code as a standalone application, making it independent of the location of server-side connector scripts. According to this approach you could move connector scripts outside web folder or even keep the client-side application and connector scripts on different servers. To make it possible you have to setup the api section of the client-side configuration file.

Server-side configuration

SERVER-side configuration file is specific for each connector and expected to be located at:

[path to FileManager]/connectors/[language extension]/config.[language extension]

The configuration file for PHP connector is quite extensive, each option is well commented. You could find that some configuration options duplicate client-side ones, but affect only server-side scripts. To avoid confusion you have to keep such duplicated options consistent in both configuration files. To make it more flexible PHP connector provides a way to override client-side configuration options which have counterparts at the server-side. Set "overrideClientConfig" option to true in order to server-side configuration options take precedence in the application.

For more information on RichFilemanager setup, see also Specify user folder, configuration cases

Client-side configuration

RichFilemanager is a jQuery plugin. Some configuration options and callbacks should be passed as plugin parameters in the index file. See example:

$(function() {
    $('.fm-container').richFilemanager({
        baseUrl: '.',
        callbacks: {
            beforeCreateImageUrl: function (resourceObject, url) {
                return url += 'modified=ImageUrl';
            },
            beforeCreatePreviewUrl: function (resourceObject, url) {
                return url += '&modified=previewUrl';
            },
            beforeSelectItem: function (resourceObject, url) {
                return url += '&modified=selectItem';
            },
            afterSelectItem: function (resourceObject, url) {
                // example on how to set url into target input and close bootstrap modal window
                // assumes that filemanager is opened via iframe, which is at the same domain as parent
                // https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
                $('#target-input', parent.document).val(url);
                $('#modal', parent.document).find('.close').click();
            }
        }
    });
});

Plugin parameters

baseUrl - Default value ".". Base URL (relative or absolute) to access the plugin folder. You may have to change default value if you use server-side framework which performs "publishing" of the plugin folder from secured location to some "dynamic" folder.

callbacks.beforeCreateImageUrl - Callback function. Provides an ability to modify URL of each image file previewed in the application.

callbacks.beforeCreatePreviewUrl - Callback function. Provides an ability to modify URL of each non-image file previewed in the application. It also will be called together with beforeSelectItem callback.

callbacks.beforeSelectItem - Callback function. Provides an ability to modify URL of file upon selecting it for WYSIWYG editor.

callbacks.afterSelectItem - Callback function. Provides an ability to perform actions after URL was passed to WYSIWYG editor.

CONFIGURATION FILE

Client-side configuration file is a JSON file which is organized in sections. All options defined in the default configuration file affect the client-side application solely and detailed below.

The options section

culture - Default value "en". Set culture to display localized messages. Available languages are listed in languages folder.

theme - Default value "flat-dark". 4 themes are available in the package: default, flat-dark, flat-turquoise and flat-oil. You can create your own theme, simply by following instructions.

defaultViewMode - Default value "grid". Set default view mode : 'grid' or 'list'

localizeGUI - Default value true. Append localized text in GUI. Set to false if you want to set values manually into the HTML file.

showFullPath - Default value false. Display full path or not.

showTitleAttr - Default value false. Display title attributes on mouse hover (main panel only).

showConfirmation - Default value true. Do show a confirmation message after running actions.

browseOnly - Default value false. Allow users to browse only. Prevent upload/dowload and others interactions.

clipboard - Default value true. Enable clipboard feature. Displayed at the header and inside context menu. Visibility is based on "copy" and "move" capabilities.

searchBox - Default value true. Display search box on the bottom (left) to let user filter results on special files.

fileSorting - Default value "NAME_ASC". Sorting files criteria. See specific page for available values.

folderPosition - Default value "bottom". Position of folders in files/folders list. Takes value "bottom" or "top".

quickSelect - Default value false. Select file on main listing - avoid an extra click.

charsLatinOnly - Default value false. Deny non-latin characters in file/folder names.

logger - Default value false. If set to true the application will log some workflow actions to the browser debug console.

capabilities - Take an array as value. By default, all capabilities handled by the application are available : ["select", "upload", "download", "rename", "copy", "move", "replace", "delete"]. You can restrict it by suppressing some of them.

The filetree section

enabled - Default value true. Enable filetree (left-sided) panel.

foldersOnly - Default value false. Display files along with folders in the filetree panel. If set to true, only folders will be displayed.

reloadOnClick - Default value true. Reload folder content from server in the right panel when filetree item is clicked. If set to false, the click action just expanding/collapsing folder without reloading folder content from server.

expandSpeed - Default value 200. Duration in milliseconds, determining how long the expand/collapse animation will run.

showLine - Default value true. Display line that adjoins to the filetree items.

width - Default value 200. Default filetree panel width in pixels.

minWidth - Default value 200. Minimum filetree panel width in pixels.

The manager section

dblClickOpen - Default value false. Takes double mouse click event to open files and folders. By default single click is used.

selection.enabled - Default value true. Enable files selection with mouse click and dragging.

selection.useCtrlKey - Default value true. Enable selection with holding down Ctrl key and mouse clicking in addition to mouse dragging.

renderer.position - Default value false. The position of panel which display an index file content for the loaded folder (similar to how GitHub display the content of readme.md file). Possible positions: "bottom" and "top". The false value means the panel is disabled.

renderer.indexFile - Default value "readme.md". The name of file whose content is supposed to be rendered into renderer panel.

The api section

lang - Default value "php". Set this to the server side language you wish to use. Available values: php, jsp, lasso, asp, cfm, ashx, asp, pl.

connectorUrl - Default value false. Url to server-side connector script. By default the application will determine it based on lang option. For PHP language it would be: "{FM_base_url}/connectors/php/filemanager.php". Can be overwritten with an absolute url.

requestParams - Default value []. Parameters which will be passed with each request to the connector.

The security section

allowFolderDownload - Default value is true. Allow users to download a Zip archive of a specific folder and contents (including subfolders).

allowChangeExtensions - Default value is false. Allow users to change extension when renaming files.

allowNoExtension - Default value is false. If set to true, allow users to upload file with no extension.

normalizeFilename - Default value is true. Sanitize file/folder name, replaces gaps and some other special chars. Implemented on both client-side (javascript) and server-side (PHP connector). Important: client-side implementation doesn't impact while file uploading, so consider it as an extra layer of protection, but rely on server-side implementation.

The upload section

multiple - Default value true. Do enable multiple uploads, rely on jQuery-File-Upload.

maxNumberOfFiles - Default value 5. Maximum number of files to be processed per each multiple upload process. Only used when multiple is set to true. See details.

paramName - Default value "files". The parameter name for the file form data (the request argument name). See details.

chunkSize - Default value false. To upload large files in smaller chunks, set this option to a preferred chunk size (in Bytes). If set to false, files will be uploaded as a whole. See details.

fileSizeLimit - Default value 16000000 (16 MB). The maximum allowed file size (in Bytes). If set to false, no size limitations applied. See details.

policy - Default value "DISALLOW_ALL". Takes value "ALLOW_ALL" / "DISALLOW_ALL". If is set to "DISALLOW_ALL", only files with extensions contained in restrictions array will be allowed. If is set to "ALLOW_ALL", all files will be accepted for upload except for files with extensions contained in restrictions.

restrictions - Array of files extensions. Restrictions list to check on upload and rename actions.

The viewer section

absolutePath - Default value true. Use absolute path to preview images and media files. If set to false files will be previewed utilizing the connector path. Helpful when files aren't reachable by direct URL.

previewUrl - Default value false. URL to access storage folder of user files. Used along with absolutePath set to true. Can be specified explicitly in case the application unable to determine the URL itself.

viewer.image - options for "image" viewer.

image.enabled - Default value true. Enable viewer to preview full size image.

image.showThumbs - Default value true. Show image previews in grid/list views.

image.extensions - Array of accepted images extensions (default are jpg, jpe, jpeg, gif, png, svg).

viewer.video - options for "video" viewer.

video.enabled - Default value true. Enable viewer to preview media files via video player.

video.extensions - Array of accepted video files extensions (default are ogv, mp4, webm, m4v).

video.playerWidth - Default value 400. Video player width in pixels.

video.playerHeight - Default value 222. Video player height in pixels.

viewer.audio - options for "audio" viewer.

audio.enabled - Default value true. Enable viewer to preview media files via audio player.

audio.extensions - Array of accepted audio files extensions (default are ogg, mp3, wav).

viewer.opendoc - options for "opendoc" viewer.

opendoc.enabled - Default value true. Enable viewer to preview pdf and OpenOffice files.

opendoc.extensions - Array of accepted files extensions (default are pdf, odt, odp, ods).

opendoc.readerWidth - Default value 640. Viewer width in pixels.

opendoc.readerHeight - Default value 480. Viewer height in pixels.

viewer.google - options for "google" viewer.

google.enabled - Default value true. Enable viewer to preview files accepted by Google Docs Viewer.

google.extensions - Array of accepted files extensions (default are doc, docx, xls, xlsx, ppt, pptx).

google.readerWidth - Default value 640. Viewer width in pixels.

google.readerHeight - Default value 480. Viewer height in pixels.

viewer.codeMirrorRenderer - options for CodeMirror renderer.

codeMirrorRenderer.enabled - Default value true. Enable renderer to display content of files accepted by CodeMirror text editor.

codeMirrorRenderer.extensions - Array of accepted files extensions (default are txt, csv).

viewer.markdownRenderer - options for Markdown renderer.

markdownRenderer.enabled - Default value true. Enable renderer to display content of files accepted by Markdown-it parser.

markdownRenderer.extensions - Array of accepted files extensions (default are md).

viewer.editable - options for CodeMirror editor.

editable.enabled - Default value true. Enable to edit files accepted by CodeMirror text editor.

editable.theme - Default value "default". Set the editor theme. Available themes are listed here (do not include css extension).

editable.lineNumbers - Default value true. Display line numbers into the editor

editable.lineWrapping - Default value true. Enable wrapping into the editor

editable.codeHighlight - Default value true. Enable code highlighter. This feature may slow-down the application.

editable.matchBrackets - Default value true. Causes matching brackets to be highlighted whenever the cursor is next to them.

editable.extensions - Array of files extensions for online edition (default are txt, csv, md).

The customScrollbar section

You can enable the jquery custom scrollbar plugin to enhance UI. Notice, that this will decrease FM loading speed.

enabled - Default value false. Enable it by passing the value true.

theme - Default value "inset-2-dark". Specify the scrollbar theme you want to use. See available options.

button - Default value true. Add buttons to scrollbars (takes value true or false).

The extras section

extra_js - Default empty array. Array of javascript files to load. For example use this to load tiny_mce_popup.js

extra_js_async - Default value true. Specify if request is asynchronous or not (takes value true or false).