MoxieManager API
Javascript API
Here are some of the basic Javascript API integration methods.
| Method | Description |
|---|---|
Displays the file browser view. |
|
Displays the upload view. |
|
Displays the edit view. |
|
Displays the gallery view. |
|
Displays the create directory view. |
|
Displays the create document view. |
If you are configuring this from in a TinyMCE init config you need to check out the API here.
If you are using MoxieManager Stand-alone, first include this script.
<script src="<yourpath>/moxiemanager/js/moxman.loader.min.js"></script>
Then you can use these snipplets, either on buttons or wherever you like.
browse
This method allows you to browse for files in the MoxieManager and insert these into form fields or to a custom callback function.
Parameters
| Name | Description |
|---|---|
|
Public file system path to display by default. For example: In order to configure a different start path from the rootpath, the first part of the path needs to be the last part of the rootpath. So if your rootpath is |
|
Public file system path to use as the root. This option needs to be within the configured backend |
|
Comma separated list of field ID’s to populate with selected file url. If you are using oninsert you can not use fields option and the other way around. |
|
Default view to open. Defaults to |
|
Boolean option that allows you to disable the insert functionallity. Can be used when the moxiemanager is used in standalone mode. |
|
Initial filter to apply to file selection. This option will fill the filter input field with the value specified. |
|
Comma separated list of file extensions to display for. |
|
Regexp pattern that the files need to match inorder to be displayed. |
|
Regexp pattern that will be excluded from file list if it matches. |
|
Regexp pattern that the directories need to mathc inorder to be displayed. |
|
Regexp pattern that will be exluded from file list if it matches. |
|
Comma separated list of tools to disable. |
|
Comma separated list of tools to hide. |
|
Url of input file. If this is specified the MoxieManager will try to resolve the URL into a local file system path and the open the parent directory of that file and select the file. |
|
If this option is set to true, all URLs returned from the MoxieManager will be relative from the specified document_base_url. This option is set to false by default. |
|
Document base URL defaults to the current page. This is the point relative URLs will be relative to. |
|
Enables you to remove scheme/protocol and host name from urls produced. |
|
Boolean value, enable inserting multiple files or not, default true. |
|
Set the default width of the window, note that a to small value may break the UI. Should be a number pixel value only, example: width: 600 |
|
Set the default height of the window, note that a to small value may break the UI. Should be a number pixel value only, example: height: 400 |
|
Boolean value, set to true to open in fullscreen, default false. |
|
Sets the title of the main screen, replaces "MoxieManager" default title. |
|
Boolean value, display or hide the left filesystems panel, true by default. |
Callback that gets executed when files are selected and inserted. This callback allows you to alter the JSON data before it gets inserted into a form field or passed to the oninsert callback. |
|
|
Enables you to set a custom skin to be used. |
Enables you to control what to display in the main toolbar of the filelist browse dialog. |
|
Enables you to control what to display in the utils toolbar of the filelist browse dialog. |
|
Enables you to configure what to display in the manage button menu. |
|
Enables you to configure what to display in the context menu. |
|
Enables you to configure what to display in the insert/cancel toolbar. |
|
Enables you to control what to display in the main toolbar of the edit image dialog. |
|
Enables you to control what to display in the zoom toobar of the edit image dialog. |
|
Enables you to control what to display in the actions toolbar/pabel of the edit image dialog. |
|
|
Space separated list of fields to display currently "path" and "url". |
When enabled the MoxieManager will remember the last path the user was in when a file was selected. |
|
Changes the default sort by column for file listings. |
|
Changed the default sort order asc/desc. |
|
|
Lets you specify an event to insert on can be click, dblclick or none. |
Events
In version 2.0 of MoxieManager, some events where removed and added by requestion from the users, this is a list of these events.
| Name | Description |
|---|---|
|
Event triggered when opening. |
|
Event triggered when closing. |
|
Event triggered when an upload is completed. |
|
Event triggered when a text file or image is edited. |
Event triggered when file is inserted. |
|
|
Event triggered when folder is created. |
Examples
Custom oninsert callback function
moxman.browse({
oninsert: function(args) {
console.log(args.focusedFile);
}
});
moxman.browse({
   oncreate: function(args) {
       console.log(args);
   }
});
moxman.createDir({path: '/files', oncreate: alert('File created')});
oninsert callback
This callback function gets executed when users select files to be inserted. The callback has one argument with some properties.
upload
This method allows you to upload files directly to the specified path. It also enables you to get the path and urls to those uploaded files.
Parameters
| Name | Description |
|---|---|
|
Public file system path to upload files to. |
|
Fires after the dialog has been opened. Can be used to produce a custom throbber. |
Callback that gets executed when files are uploaded. |
|
|
If this option is set to true, all URLs returned from the MoxieManager will be relative from the specified document_base_url. This option is set to false by default. |
|
Document base URL defaults to the current page. This is the point relative URLs will be relative to. |
|
Enables you to remove scheme/protocol and host name from urls produced. |
|
Automatically closes the upload dialog if all files where successfully uploaded. Disabled by default. |
edit
This method enables you to edit images or text files directly by passing in a public path to a file.
Parameters
| Name | Description |
|---|---|
|
Public path to the file to edit. For example: |
|
Fires after the dialog has been opened. Can be used to produce a custom throbber. |
Callback that gets executed when an image or text file is saved. |
view
createDir
This method enables you to create a directory in the specified path.
Parameters
| Name | Description |
|---|---|
|
Public file system path where the dir should be created. |
Callback that gets executed when the directory is created. |
|
|
Fires after the dialog has been opened. Can be used to produce a custom throbber. |
createDoc
This method enables you to create a document in the specified path.
Parameters
| Name | Description |
|---|---|
|
Public file system path where the document should be created. |
Callback that gets executed when the document is created. |
|
|
Fires after the dialog has been opened. Can be used to produce a custom throbber. |