%META:TOPICPARENT{name="OATDOCIndex"}%
---+ dav.js

Displays a WebDavBrowser window for file picking/opening/saving. Optionally prompts for auth credentials.

%TOC%

---++ Functions

---+++ OAT.WebDav.init(options)

Creates WebDAVBrowser window and sets various configurationoptions, if needed. All possible options:

   * <b>user</b> - username
   * <b>pass</b> - username
   * <b>path</b> - path which should be opened
   * <b>file</b> - default preselected file name
   * <b>silentStart</b> - do not display connection setup dialog on WebDAVinitialization
   * <b>extension</b> - ID of default file type extension to be selected
   * <b>pathFallback</b> - this is a failsafe path which will be offered when HTTP errors prohibit changing to requested path
   * <b>imagePath</b> - path to images, with trailing slash
   * <b>imageExt</b> - image files extension
   * <b>isDav</b> - 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 silent Setupis 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:

   * <b>callback</b> - function to be executed when user selects a file. This will be called with 3 arguments:path,file name and contents.
   * <b>extensionFilters</b> - 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:
   * <b>callback</b> - same as inOAT.WebDav.openDialog
   * <b>extensionFilters</b> - same as inOAT.WebDav.openDialog
   * <b>confirmOverwrite</b> - bool, should we ask for a confirmation when overwriting existing file?
   * <b>dataCallback</b> - 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

<verbatim>
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});
</verbatim>

CategoryDocumentation CategoryOAT CategoryOpenSource