dav.js
Displays a WebDav Browser window for file
picking/opening/saving. Optionally prompts for auth
credentials.
Functions
OAT.WebDav.init(options)
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
-
silentStart
- do not display
connection setup dialog on WebDAV initialization
-
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 minimal 'prompt' will be
used instead of full Browser
When no user/pass is passed in options or
silentSetup is set to false, user will be prompted
for credentials through connection settings dialog.
OAT.WebDav.openDialog(options)
Opens the Browser in file browse mode. User can select a
file, which will be passed back to application. All
options passed to OAT.WebDav.init can be used
here. Additional specific options:
-
callback
- function to be
executed when user selects a file. This will be called with 3
arguments: path , filename and
contents .
-
extensionFilters
- array of
file type extensions. Each item consists of 4 values:
arbitrary unique ID , extension ,
description , and optional content
type
OAT.WebDav.saveDialog(options)
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
OAT.WebDav.init can be used here. Additional specific
options:
-
callback
- same as in
OAT.WebDav.openDialog
-
extensionFilters
- same as in
OAT.WebDav.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 . If set to false , nothing will be
saved.
Examples
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});