Class LABKEY.FileSystem.WebdavFileSystem
Extends
LABKEY.FileSystem.AbstractFileSystem.
LABKEY.FileSystem.WebdavFileSystem
Defined in: FileSystem.js.
Constructor Attributes | Constructor Name and Description |
---|---|
This class enables interaction with WebDav filesystems, such as the one exposed through LabKey Server.
|
Config Attributes | Config Name and Description |
---|---|
Rather than supplying a containerPath and filePath, you can supply the entire baseUrl to use as the root of the webdav tree (ie.
|
|
The path to the container to load (ie.
|
|
An array of extra Ext.data.Field config objects that will be appended to the FileRecord.
|
|
A folder name that is appended after the container and filePath.
|
|
The file path, relative to the containerPath (ie.
|
|
The display name for the root (ie.
|
- Fields borrowed from class LABKEY.FileSystem.AbstractFileSystem:
- FileRecord
Method Attributes | Method Name and Description |
---|---|
canDelete(record)
Returns true if the current user can delete the passed file.
|
|
canMkdir(record)
Returns true if the current user can create a folder in the passed location
In order to obtain the record for the desired file, recordFromCache() is normally used.
|
|
canMove(record)
Returns true if the current user can move or rename the passed file
In order to obtain the record for the desired file, recordFromCache() is normally used.
|
|
canRead(record)
Returns true if the current user can read the passed file
In order to obtain the record for the desired file, recordFromCache() is normally used.
|
|
canWrite(record)
Returns true if the current user can write to the passed file or location
In order to obtain the record for the desired file, recordFromCache() is normally used.
|
|
createDirectory(config)
Will create a directory at the provided location.
|
|
deletePath(config)
Can be used to delete a file or folder.
|
|
getHistory(config)
Returns the history for the file or directory at the supplied path
|
|
movePath(config)
Can be used to move a file or folder from one location to another.
|
|
renamePath(config)
Can be used to rename a file or folder.
|
- Methods borrowed from class LABKEY.FileSystem.AbstractFileSystem:
- checkForNameConflict, concatPaths, directoryFromCache, getFileName, getParentPath, isChild, listFiles, recordFromCache
- Events borrowed from class LABKEY.FileSystem.AbstractFileSystem:
- fileschanged, filesremoved, ready
Class Detail
LABKEY.FileSystem.WebdavFileSystem(config)
This class enables interaction with WebDav filesystems, such as the one exposed through LabKey Server.
In addition to the properties and methods documented here, all methods from LABKEY.FileSystem.AbstractFileSystem are available.
<script type="text/javascript"> //this example loads files from: /_webdav/home/mySubfolder/@files var fileSystem = new LABKEY.FileSystem.WebdavFileSystem({ containerPath: '/home', filePath: '/mySubfolder' //optional. }); //this would be identical to the example above new LABKEY.FileSystem.WebdavFileSystem({ baseUrl: "/_webdav/home/mySubfolder/@files" }); //this creates the URL: /webdav/myProject/@pipeline new LABKEY.FileSystem.WebdavFileSystem({ containerPath: '/myProject', fileLink: '/@pipeline' }); fileSystem.on('ready', function(fileSystem){ fileSystem.listFiles({ path: '/mySubfolder', success: function(fileSystem, path, records){ alert('It worked!'); console.log(records); }, scope: this }, this); fileSystem.movePath({ source: '/myFile.xls', destination: '/foo/myFile.xls', isFile: true, success: function(fileSystem, path, records){ alert('It worked!'); }, failure: function(response, options){ alert('It didnt work. The error was ' + response.statusText); console.log(response); }, scope: this }); }, this); </script>
- Parameters:
- config
- Configuration properties.
Config Detail
{string}
config.baseUrl
Rather than supplying a containerPath and filePath, you can supply the entire baseUrl to use as the root of the webdav tree (ie. http://localhost:8080/labkey/_webdav/home/@files/), must be an ABSOLUTE URL ("/_webdav" NOT "_webdav"). If provided, this will be preferentially used instead of creating a baseUrl from containerPath, filePath and fileLink
{String}
config.containerPath
The path to the container to load (ie. '/home')
{array}
config.extraDataFields
An array of extra Ext.data.Field config objects that will be appended to the FileRecord. Optional.
{String}
config.fileLink
A folder name that is appended after the container and filePath. By default, LabKey stores files in a subfolder called '/@files'. If the pipeline root of your container differs from the file root, the files may be stored in '/@pipeline'. This defaults to '/@files'. To omit this, use 'fileLink: null'. For non-standard URLs, also see config.baseUrl.
{String}
config.filePath
The file path, relative to the containerPath (ie. '/mySubfolder'). Optional.
{string}
config.rootName
The display name for the root (ie. 'Fileset'). Optional.
Method Detail
canDelete(record)
Returns true if the current user can delete the passed file.
In order to obtain the record for the desired file, recordFromCache() is normally used.
- Parameters:
- {Ext.Record} record
- The Ext record associated with the file. See LABKEY.AbstractFileSystem.FileRecord for more information.
canMkdir(record)
Returns true if the current user can create a folder in the passed location
In order to obtain the record for the desired file, recordFromCache() is normally used.
- Parameters:
- {Ext.Record} record
- The Ext record associated with the file. See LABKEY.AbstractFileSystem.FileRecord for more information.
canMove(record)
Returns true if the current user can move or rename the passed file
In order to obtain the record for the desired file, recordFromCache() is normally used.
- Parameters:
- {Ext.Record} record
- The Ext record associated with the file. See LABKEY.AbstractFileSystem.FileRecord for more information.
canRead(record)
Returns true if the current user can read the passed file
In order to obtain the record for the desired file, recordFromCache() is normally used.
- Parameters:
- {Ext.Record} record
- The Ext record associated with the file. See LABKEY.AbstractFileSystem.FileRecord for more information.
canWrite(record)
Returns true if the current user can write to the passed file or location
In order to obtain the record for the desired file, recordFromCache() is normally used.
- Parameters:
- {Ext.Record} record
- The Ext record associated with the file. See LABKEY.AbstractFileSystem.FileRecord for more information.
createDirectory(config)
Will create a directory at the provided location. This does not perform permission checking, which can be done using canMkDir().
- Parameters:
- config
- Configuration properties.
- {String} config.path
- The path of the folder to create. This should be relative to the rootPath of the FileSystem. See constructor for examples.
- {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 created
- {Object} config.failure Optional
- Failure callback function. It will be called with the following arguments:
- Response: the response object
- Options: The parameter to the request call.
- {Object} config.scope Optional
- The scope of the callback functions.
deletePath(config)
Can be used to delete a file or folder.
- Parameters:
- config
- Configuration properties.
- {String} config.path
- The source file, which should be a URL relative to the fileSystem's rootPath
- {Boolean} config.isFile
- Set to true is this represent a file, as opposed to a folder
- {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
- {Object} config.failure Optional
- The 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 of the callback functions
getHistory(config)
Returns the history for the file or directory at the supplied path
- Parameters:
- config
- Configuration properties.
- {String} config.path
- Path to the file or directory
- {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
- History: An array of records representing the history
- {Function} config.failure Optional
- Error callback function. It will be called with the following arguments:
- Response: the response object
- {Object} config.scope Optional
- The scope of the callback function
movePath(config)
Can be used to move a file or folder from one location to another.
- Parameters:
- config
- Configuration properties.
- {String} config.path
- The source file, which should be a URL relative to the fileSystem's rootPath
- {String} config.destination
- The target path, which should be a URL relative to the fileSystem's rootPath
- {Boolean} config.isFile
- True if the file to move is a file, as opposed to a directory
- {Function} config.success
- Success callback function. It will be called with the following arguments:
- Filesystem: A reference to the filesystem
- SourcePath: The path that was loaded
- DestPath: The path that was loaded
- {Object} config.failure Optional
- The failure callback function. 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 of the callbacks
- {Boolean} config.overwrite Optional
- If true, files at the target location
renamePath(config)
Can be used to rename a file or folder. This is simply a convenience wrapper for movePath().
<script type="text/javascript"> var fileSystem = new new LABKEY.FileSystem.WebdavFileSystem({ containerPath: '/home', filePath: '/@files' //optional. this is the same as the default }); fileSystem.on('ready', function(fileSystem){ fileSystem.listFiles({ path: '/mySubfolder/', success: function(fileSystem, path, records){ alert('It worked!'); console.log(records); }, scope: this }, this); fileSystem.renamePath({ source: 'myFile.xls', destination: 'renamedFile.xls', isFile: true, scope: this }); //if you renamed a file in a subfolder, you can optionally supply the fileName only //this file will be renamed to: '/subfolder/renamedFile.xls' fileSystem.renamePath({ source: '/subfolder/myFile.xls', destination: 'renamedFile.xls', isFile: true, scope: this }); //or provide the entire path fileSystem.renamePath({ source: '/subfolder/myFile.xls', destination: '/subfolder/renamedFile.xls', isFile: true, scope: this }); }, this); </script>
- Parameters:
- config
- Configuration properties.
- {String} config.source
- The source file, which should be relative to the fileSystem's rootPath
- {String} config.destination
- The target path, which should be the full path for the new file, relative to the fileSystem's rootPath
- {Boolean} config.isFile
- Set to true if the path is a file, as opposed to a directory
- {Function} config.success
- Success callback function. It will be called with the following arguments:
- Filesystem: A reference to the filesystem
- SourcePath: The path to the file/folder to be renamed
- DestPath: The new path for the renamed file/folder
- {Object} config.failure Optional
- The failure callback function. 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 of the callback function
- {Boolean} config.overwrite Optional
- If true, files at the target location