new FileBrowsingDialog( [options])
Browsing dialog for files in a remote file repository.
The file repositories suitable to be browsed using this dialog contain files that can be identified by URLs. The
URLs should be composed of two parts:
- The file repository URL. E.g. the URL of a branch of a GitHub project, or an WebDAV server. When editing a file, browsing for external references link: images, content references, DITA Maps happens in the repository of the edited file. However, when trying to open or create a new file, the users should be allowed to change the file repository that they are using.
- The path to the file. In order to change the file path, users can navigate the hierarchical of the repository.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
options |
sync.api.FileBrowsingDialog.Options |
<optional> |
The options used to configure the File Browsing Dialog. |
Extends
Classes
Members
-
<static> DEFAULT_HEIGHT :number
-
The default height for the filebrowser. (WA-312)
Type:
- number
-
<static> EventTypes :string
-
Event types generated by the File Browser.
Type:
- string
Properties:
Name Type Default Description USER_ACTION_REQUIRED
string user_action_required The Event dispatched when some user action is required in order to be able to list the content of a folder.
See sync.api.FileBrowsingDialog.UserActionRequiredEvent for more details. -
fileBrowserProps :sync.api.FileBrowsingDialog.Options
-
The properties that control the file browser.
Type:
Methods
-
chooseUrl(context, chosen, purpose)
-
Invokes the URL chooser.
Parameters:
Name Type Description context
sync.api.UrlChooser.Context The context in which the chooser is invoked - it contains information like the type of the resource that we want the user to choose: image, external xml file, etc. chosen
sync.api.UrlChooser~urlChosen The function to be called with the result of the choice. purpose
sync.api.UrlChooser.Purpose The purpose the chooser is invoked with. - Inherited From:
- Overrides:
-
clearFileBrowsingData()
-
Clear the file browsing data (current url, selected url).
-
getCurrentFolderUrl()
-
Returns:
the URL of the current folder.- Type
- string
-
getEventTarget()
-
Getter for the url chooser's event target.
Returns:
target the object on which to listen for url chooser specific events. -
getFileName()
-
Returns:
The name of the selected file.- Type
- string
-
getRootUrl()
-
- Since:
-
- 20.1.1
Returns:
The root URL of the file browser.- Type
- string
-
handleOpenRepo(element, e)
-
Called when the repository configuration should be opened.
Parameters:
Name Type Description element
HTMLElement The container element of the repo editing UI. e
goog.events.Event The event that triggered the opening - you can cancel it. -
openUrl(url, isFile [, e])
-
Opens the following URL. If the URL denotes a File, the file is chosen. If the URL denotes a Folder, the dialog switches to that folder.
Parameters:
Name Type Argument Description url
string The URL to open. isFile
boolean true if the url points to a file rather than to a folder. e
goog.events.Event <optional>
The event that made you want to open the URL. If the call is made outside an event handler, pass null. -
refresh()
-
Refresh the url chooser. Refresh the url chooser in case the chooser does not reflect the actual resource state.
-
renderRepoEditing(element)
-
Render the repo editing UI.
Parameters:
Name Type Description element
HTMLElement The container element. -
renderRepoPreview(element)
-
Render the repo preview UI.
Parameters:
Name Type Description element
HTMLElement The container element. -
saveFile(fileURL, suggestedFileName, callback)
-
Saves the file given file. IMPORTANT: Please consider overriding sync.api.UrlChooser#chooseUrl instead of this one. The default implementation for this method uses sync.api.UrlChooser#chooseUrl to determine the save location. An use-case for this method is to re-use a 'saver' widget which already takes care of the saving itself.
Parameters:
Name Type Description fileURL
string the URL of the file to be saved. suggestedFileName
string the proposed name for the new file. callback
sync.api.UrlChooser~fileSaved the callback to be called with the saved file url. - Inherited From:
-
setRootUrl( [root])
-
Sets the root URL, above which navigation is prohibited.
Parameters:
Name Type Argument Description root
string <optional>
the root url of the server. -
showErrorMessage(message [, errorType])
-
Shows an error message inline.
Parameters:
Name Type Argument Description message
string The error message. errorType
InplaceNotificationReporter.types <optional>
The type of the error message, error by default. -
supports(type)
-
Checks whether the URL chooser supports choosing a given type of resource sync.api.UrlChooser.Type. If not supported, the default UI (which is usually a text-field) will be presented to the user.
Parameters:
Name Type Description type
sync.api.UrlChooser.Type The type of the URL to be chosen. - Inherited From:
- Overrides:
Returns:
true if the chooser supports the given type.- Type
- boolean
-
supportsOperation(purpose)
-
Needs to be implemented to reflect whether the chooser suports the given operation: save or choose.
Parameters:
Name Type Description purpose
sync.api.UrlChooser.Purpose The operation. - Inherited From:
- Overrides:
Returns:
true if the given operation is supported.- Type
- boolean
-
switchToFileBrowsing()
-
Switches the dialog into file browsing mode.
-
switchToRepoConfig()
-
Switches the dialog into repository configuration editing mode.
Type Definitions
-
Options
-
options The options used to configure the file browsing dialog.
Type:
- Object
Properties:
Name Type Argument Description options.root
string <optional>
The root url of the file repository on which the browsing will be performed. options.initialUrl
string <optional>
The URL of the folder where the dialog points to initially. options.listFolder
sync.api.FileBrowsingDialog~listFolderFunction <optional>
The function to call to retrieve files - by default the server-side ro.sync.net.protocol.FileBrowsingConnection.listFiles() method is called. -
listFolderFunction(folderUrl, successCalback, failureCallback)
-
Callback that returns the contents of the given folder.
Parameters:
Name Type Description folderUrl
string The URL of the folder to list. successCalback
sync.api.FileBrowsingDialog~listFolderSuccessCallback The function to call when the folder listing is available. failureCallback
function The function to call when there was a failure retrieving folder content, passing in the exception. -
listFolderSuccessCallback(folderEntries)
-
Callback that receives the folder entries.
Parameters:
Name Type Description folderEntries
Array.<sync.api.FileBrowsingDialog.FolderEntryDescriptor> The list of the URLs of the folder entries.