Module: alfresco/forms/controls/FilePicker

alfresco/forms/controls/FilePicker

This widget is intended to ultimately to replace the DocumentPicker but at the moment it is still in development and not ready for production use. However it is currently included in Aikau releases for feedback and community collaboration. See https://issues.alfresco.com/jira/browse/AKU-1033 for the complete of tasks remaining to complete the first cut of the widget. It is however currently functional in that it can be used to select files.

A number of services (or customized equivalents) need to be included on a page for this picker to be functional, these are:

  • alfresco/services/SearchService
  • alfresco/services/SiteService
  • alfresco/services/DialogService
  • alfresco/services/DocumentService

Since:
  • 1.0.81
Author:
  • Dave Draper
License:
Source:

Members

allSites :object[]

An array of sites available the current user. This will be generated the first time that onRecentSitesOptionsRequest is called.
Type:
  • object[]
Default Value:
  • null
Source:

favouriteSites :object[]

An array of the favourite sites. This will be generated the first time that onFavouriteSitesOptionsRequest is called.
Type:
  • object[]
Default Value:
  • null
Source:

i18nRequirements :Array

An array of the i18n files to use with this widget.
Type:
  • Array
Source:

itemKeyProperty :string

This is the property that is used to uniquely identify each item that is picked. Ultimately this will be the data that is used as the value of the form control.
Type:
  • string
Default Value:
  • "nodeRef"
Source:

multipleItemSelection :boolean

Indicates whether or not more than one can be picked.
Type:
  • boolean
Default Value:
  • false
Source:

recentSites :object[]

An array of the recent sites. This will be generated the first time that onRecentSitesOptionsRequest is called.
Type:
  • object[]
Default Value:
  • null
Source:

repositoryRootNode :string

The root node at which to start repository browsing.
Type:
  • string
Default Value:
  • "alfresco://company/home"
Source:

selectedFiles :object[]

Used to track the files that have been selected.
Type:
  • object[]
Default Value:
  • null
Source:

showAllSites :boolean

Indicates whether or not the "All Sites" tab in the picker dialog should be displayed.
Type:
  • boolean
Default Value:
  • true
Source:

showFavouriteSites :boolean

Indicates whether or not the "Favourite Sites" tab in the picker dialog should be displayed.
Type:
  • boolean
Default Value:
  • true
Source:

showRecentSites :boolean

Indicates whether or not the "Recent Sites" tab in the picker dialog should be displayed.
Type:
  • boolean
Default Value:
  • true
Source:

showRepository :boolean

Indicates whether or not the "Repository" tab in the picker dialog should be displayed.
Type:
  • boolean
Default Value:
  • true
Source:

showSearch :boolean

Indicates whether or not the "Search" tab in the picker dialog should be displayed.
Type:
  • boolean
Default Value:
  • true
Source:

widgetsForBrowseView :object[]

The model used for the view when browsing folders returned by the DocumentService.
Type:
  • object[]
Source:

widgetsForDialog :object[]

The model to use in the file selection dialog.
Type:
  • object[]
Source:

widgetsForSearchView :object[]

This is the model for the search view.
Type:
  • object[]
Source:

widgetsForSelectedFilesView :object[]

Type:
  • object[]
Source:

Methods

addPreviouslySelectedFiles()

This function is called when the dialog is opened. It calls updateSelectedFiles to ensure that the previously selected files are shown in the dialog.
Source:

createFormControl()

Source:

getSiteOptions(requestTopic, options, responseTopic)

Parameters:
Name Type Description
requestTopic string The topic to publish on to request the sites
options object[] The array to populate with the site options
responseTopic string The topic to publish the retrieved sites on.
Source:

getValue() → {object}

Overrides the inherited function to return the current value that has been generated.
Support:
  • This function is safe to be overridden by extending or mixing modules (at least until the next major release). The inherited code must be called in the overriding function and if the inherited function returns a value then that value must be returned by the overriding function.
Source:
Returns:
The current value of the field.
Type
object

normaliseFile(file)

Because files can be sourced from both the Search and Document Library APIs it is necessary to normalise the file data for display purposes to ensure that all the expected properties are available to be rendered by the view.
Parameters:
Name Type Description
file object The file to be normalised.
Source:

onAllSitesOptionsRequest(payload)

Parameters:
Name Type Description
payload object The request for sites. This contains the responseTopic to publish the options on.
Source:

onFavouriteSitesOptionsRequest(payload)

Parameters:
Name Type Description
payload object The request for favourite sites. This contains the responseTopic to publish the options on.
Source:

onFileRemoved(payload)

Handles requests to remove a previously picked item. Both from within the dialog and the main control itself.
Parameters:
Name Type Description
payload object The file that has been removed
Source:

onFileSelected(payload)

Handles selection of files anywhere within the picker.
Parameters:
Name Type Description
payload object The details of the file that has been selected.
Source:

onFileSelectionConfirmed()

This function is called when the user confirms that they have completed file selection.
Source:

onRecentSitesOptionsRequest(payload)

Parameters:
Name Type Description
payload object The request for recent sites. This contains the responseTopic to publish the options on.
Source:

onShowSiteBrowser(topic, payload)

This function is called whenever the user changes the site that they want to browse for files in. This site can be from the drop-down showing favourites or recent sites, but the effect is the same - to update a DynamicWidgets widget with a model that allows the user to browse the selected site.
Parameters:
Name Type Description
topic string The topic to publish a new widget model on
payload object The payload of the changed selecte widget containing the new site browse
Source:

setupPubSubData()

This function generates the scopes, topics and subscriptions required to prevent this picker instance (or any of its nested widgets) from inadvertently communicating with other instances or widgets.
Source:

setValue(value)

Overrides the inherited function to make sure that all Node details are retrieved for the values being set. This allows only a NodeRef to be set as a file value but for the metadata to be retrieved and displayed.
Parameters:
Name Type Description
value object The value to set
Source:

updateSelectedFiles(topic)

This function is called to update the display of selected items. The supplied topic is published in order for a DynamicWidgets widget to update its display with a view of the currently selected files.
Parameters:
Name Type Description
topic string The topic to publish the widgets model on.
Source: