CKFinder.Models.Folder
Hierarchy
Backbone.ModelCKFinder.Models.FolderSubclasses
Represents the folder model. A folder model extends Backbone.Model.
To access its attributes, use the get( "attributeName" )
method.
Properties
Folder's ACL definition.
if ( folder.get( 'acl' ).fileDelete ) {
// Files in this folder can be deleted
}
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
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: ''
Optional attribute with the folder's URL. Note: Not always available, use CKFinder.Models.Folder.getUrl to always get the correct folder's URL.
Methods
Instance methods getHash( ) : StringReturns a hash associated with the folder or with the parent folder. ...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
getPath( [data] ) : stringReturns the folder path. ...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.
Returns
- string
Returns the resource type to which the folder belongs to (the top root folder). ...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
getUrl( ) : String|BooleanReturns the folder URL. ...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.
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.