Class LABKEY.FileSystem.AbstractFileSystem
LABKEY.FileSystem.AbstractFileSystem
Defined in: FileSystem.js.
Constructor Attributes | Constructor Name and Description |
---|---|
This is a base class that is extended by LABKEY.FileSystem.WebdavFileSystem and others.
|
Field Attributes | Field Name and Description |
---|---|
The Ext.Record type used to store files in the fileSystem
The file record should contain the following fields:
|
|
ready
Set to true if the fileSystem has loaded.
|
Method Attributes | Method Name and Description |
---|---|
checkForNameConflict(config)
A helper to test if a file of the same name exists at a given path.
|
|
concatPaths(a, b)
A utility method to concatenate 2 strings into a normalized filepath
|
|
directoryFromCache(path)
For a supplied path, returns an array corresponding Ext Record from the cache
|
|
getFileName(p)
A utility method to extract the filename from a file path.
|
|
A utility method to extract the parent path from a file or folder path
|
|
isChild(a, b)
A utility to test if a path is a direct child of another path
|
|
listFiles(config)
Will list all the contents of the supplied path.
|
|
recordFromCache(path)
For a supplied path, returns the corresponding Ext Record from the cache
|
Event Attributes | Event Name and Description |
---|---|
fileschanged(fileSystem, path)
Fires when the a path has been changed.
|
|
filesremoved(fileSystem, records)
Fires when one or more files or folders have been removed, either by a delete or move action.
|
|
ready(fileSystem)
Fires when the file system has loaded.
|
Class Detail
LABKEY.FileSystem.AbstractFileSystem(config)
This is a base class that is extended by LABKEY.FileSystem.WebdavFileSystem and others. It is not intended to be used directly.
- Parameters:
- config
- Configuration properties.
Field Detail
FileRecord
The Ext.Record type used to store files in the fileSystem
The file record should contain the following fields:
uri (string, urlencoded)
path (string, not encoded)
name (string)
file (bool)
created (date)
modified (date)
size (int)
createdBy(string, optional)
modifiedBy(string, optional)
iconHref(string, optional)
actionHref(string, optional)
contentType(string, optional)
absolutePath(string, optional)
{Boolean}
ready
Set to true if the fileSystem has loaded.
Method Detail
checkForNameConflict(config)
A helper to test if a file of the same name exists at a given path. If this path has not already been loaded, the local cache will be used unless forceReload is true.
- Parameters:
- config
- Configuration properties.
- {String} config.name
- The name to test. This can either be a filename or a full path. If the latter is supplied, getFileName() will be used to extract the filename
- {String} config.path
- The path to check
- {Function} config.success
- Success callback function. It will be called with the following arguments:
- Filesystem: A reference to the filesystem
- Name: The name to be tested
- Path: The path to be checked
- Record: If a record of the same name exists, the record object will be returned. Null indicates no name conflict exists
- {Function} config.failure Optional
- Error callback function. It will be called with the following arguments:
- Response: The XMLHttpRequest object containing the response data.
- Options: The parameter to the request call.
- {Object} config.scope Optional
- The scope for the callback function. Defaults to 'this'
- {Boolean} config.forceReload Optional
- If true, the cache will be reloaded prior to performing the check
{String}
concatPaths(a, b)
A utility method to concatenate 2 strings into a normalized filepath
- Parameters:
- {String} a
- The first path
- {String} b
- The first path
- Returns:
- {String} The concatenated path
{Ext.Record[]}
directoryFromCache(path)
For a supplied path, returns an array corresponding Ext Record from the cache
- Parameters:
- {String} path
- The path of the directory
- Returns:
- {Ext.Record[]} An array of Ext.Records representing the contents of the directory. Returns null if the directory is not in the cache.
{String}
getFileName(p)
A utility method to extract the filename from a file path.
- Parameters:
- {String} p
- The path to the file or directory
- Returns:
- {String} The file name
{String}
getParentPath(p)
A utility method to extract the parent path from a file or folder path
- Parameters:
- {String} p
- The path to the file or directory
- Returns:
- {String} The parent path
{Boolean}
isChild(a, b)
A utility to test if a path is a direct child of another path
- Parameters:
- {String} a
- The first path to test
- {String} b
- The second path to test
- Returns:
- {Boolean} Returns true if the first path is a direct child of the second
listFiles(config)
Will list all the contents of the supplied path. If this path has already been loaded, the local cache will be used.
- Parameters:
- config
- Configuration properties.
- {String} config.path
- The path to load
- {Function} config.success
- Success callback function. It will be called with the following arguments:
- Filesystem: A reference to the filesystem
- Path: The path that was loaded
- Records: An array of record objects
- {Function} config.failure Optional
- Error callback function. It will be called with the following arguments:
- Response: The XMLHttpRequest object containing the response data.
- Options: The parameter to the request call.
- {Object} config.scope Optional
- The scope for the callback functions
- {Boolean} config.forceReload Optional
- If true, the path will always be reloaded instead of relying on the cache
{Ext.Record}
recordFromCache(path)
For a supplied path, returns the corresponding Ext Record from the cache
- Parameters:
- {String} path
- The path of the file or directory
- Returns:
- {Ext.Record} The Ext.Record for this file. Returns null if the file is not found.
Event Detail
fileschanged(fileSystem, path)
Fires when the a path has been changed.
- Parameters:
- {FileSystem} fileSystem Optional
- A reference to the fileSystem.
- {String} path Optional
- The path that was changed.
filesremoved(fileSystem, records)
Fires when one or more files or folders have been removed, either by a delete or move action. It is not fired when files are uncached for other reasons.
- Parameters:
- {FileSystem} fileSystem Optional
- A reference to the fileSystem.
- {Record[]} records Optional
- An array of Ext.Record objects representing the files that were removed. These can be files and/or directories.
ready(fileSystem)
Fires when the file system has loaded.
- Parameters:
- {Filesystem} fileSystem
- A reference to the fileSystem