CKFinder.Models.ResourceType
Hierarchy
Backbone.ModelCKFinder.Models.FolderCKFinder.Models.ResourceType
Represents the resource type (root folder) model.
Properties
Folder's ACL definition.
if ( folder.get( 'acl' ).fileDelete ) {
// Files in this folder can be deleted
}
The list of file extensions that can be uploaded to the resource type.
var currentFolder = finder.request( 'folder:getActive' );
var resourceType = currentFolder.getResourceType();
// 'gif,jpg,png'
var allowedExtensions = resourceType.get( 'allowedExtensions' );
The list of file extensions that cannot be uploaded to the resource type.
var currentFolder = finder.request( 'folder:getActive' );
var resourceType = currentFolder.getResourceType();
// Usually not set as whitelisting is safe, while blacklisting isn't.
var deniedExtensions = resourceType.get( 'deniedExtensions' );
Whether the folder contains subfolders.
if ( folder.get( 'hasChildren' ) ) {
// This folder has folders inside
}
Defaults to: false
Indicates that the folder has not been fully loaded yet, i.e. its ACL is not known.
folder.get( 'isPending' );
Defaults to: false
Indicates that a folder is a root element (a resource type).
folder.get( 'isRoot' );
Defaults to: false
The maximum size of the file (in bytes) that can be uploaded to the resource type.
var currentFolder = finder.request( 'folder:getActive' );
var resourceType = currentFolder.getResourceType();
var maxSize = resourceType.get( 'maxSize' );
A folder's name.
var currentFolder = finder.request( 'folder:getActive' );
if ( confirm( 'Delete ' + currentFolder.get( 'name' ) + '?')) {
// Delete...
}
Defaults to: ''
The name of the resource type this folder belongs to.
// E.g. 'Files' or 'Images'
folder.get( 'resourceType' );
Defaults to: ''
An optional attribute with the folder's URL. Note: Not always available, use CKFinder.Models.Folder.getUrl to always get the correct folder's URL.
Overrides: CKFinder.Models.Folder.url
Methods
Returns a hash associated with the folder or with the parent folder. Hashes are used in Ajax requests to ensure that the browser does not return cached results for requests which must return the current value.
Returns
- String
Returns the folder path. A path is a virtual description of a folder location within a resource type.
// The path to "foo->bar" will be '/foo/bar/'.
var path = folder.getPath();
// The same path will now also contain the name of the resource type at the beginning (e.g. 'Files').
// The path is now 'Files:/foo/bar/'.
var path = folder.getPath( { full:true } );
Parameters
- data : Object (optional)
- full : Boolean
Gets the path with the resource type.
- full : Boolean
Returns
- string
Returns the resource type to which the folder belongs to (the top root folder).
var currentFolder = finder.request( 'folder:getActive' );
var resourceType = currentFolder.getResourceType();
Returns
Returns the folder URL. Returns {CKFinder.Models.Folder.url} if available, if not then the URL is calculated using the names of the parent folders.
Returns
- String|Boolean
The URL to a folder. If the folder is not accessible through a public URL,
false
is returned instead.
Checks if an extension is allowed for this resource type. Note: This check transforms the extension to lower case before comparison.
Parameters
- extension : String
The file extension.
Returns
- Boolean
true if an extension is allowed for this resource type.
Checks if an operation with a given name should be tracked for this resource type.
Parameters
- operationName : String
Operation name.
Returns
- Boolean
true if operation progress should ba tracked.