dav.js
Displays a WebDav Browser window for file picking/opening/saving.
Functions
Creates WebDav Browser window and sets various configuration options, if needed. All possible options:
- user - username
- pass - username
- path - path which should be opened
- file - default preselected file name
- extension - ID of default file type extension to be selected
- pathFallback - this is a failsafe path which will be offered when http errors prohibit changing to requested path
- imagePath - path to images, with trailing slash
- imageExt - image files extension
- isDav - whether the server is DAV. For non-DAV http servers, a minimalistic 'prompt' will be used instead of full Browser
Opens the Browser in file browse mode. User can select a file, which will be passed back to application.
All options passed to init
can be used here. Additional specific options:
- callback - function to be executed when user selects a file. This will be called with 3 argumens: path, filename and contents.
- extensionFilters - array of file type extensions. Each item consists of 4 values: arbitrary uniqe ID, extension, description and optional content type
Opens the Browser in file save mode. User can select a new/existing file, the Browser will then save specified data to that file.
All options passed to init
can be used here. Additional specific options:
- callback - same as in
openDialog
- extensionFilters - same as in
openDialog
- confirmOverwrite - bool, should we ask for a confirmation when overwriting existing file?
- dataCallback - function which provides data to be saved. Will be executed with two arguments: selected file name and used extension ID.
You can set dataCallback to
false
: if you do so, nothing will be saved.
var options = {
user:"demo",
pass:"demo",
path:"/DAV/home/demo/",
isDav:true,
extensionFilters:[
["all", "*", "All files", "text/plain"],
["xmldoc", "xml", "XML Documents", "text/xml"],
["xmltemplate", "xml", "XML Templates", "application/xml"]
]
}
OAT.WebDav.init(options);
function showContents(path, file, data) {
alert(path+file+' contains:\n\n'+data);
}
OAT.WebDav.openDialog({callback:showContents});