Module: alfresco/services/PreferenceService

alfresco/services/PreferenceService

This service provides access to user preferences as a whole as well as subscribing to specific topics for setting Document Library preferences (views, sidebar visibility/width, breadcrumb visibility, etc) and adding and removing documents or folders from a the users favourites list.
Author:
  • Dave Draper
License:
Source:

Mixes In

Members

FAVOURITE_DOCUMENTS :string

This is the dot-notation preferences property address for favourite documents
Type:
  • string
Default Value:
  • "org.alfresco.share.documents.favourites"
Source:

FAVOURITE_FOLDERS :string

This is the dot-notation preferences property address for favourite folders
Type:
  • string
Default Value:
  • "org.alfresco.share.folders.favourites"
Source:

localPreferences :object

The preferences provided at services instantiation.
Type:
  • object
Default Value:
  • null
Source:

Methods

getPreference(payload)

Retrieves a preference from the local copy rather than getting them remotely.
Parameters:
Name Type Description
payload object
Source:

onAddFavouriteDocument(payload)

Makes the supplied node or nodes favourites of the current user
Parameters:
Name Type Description
payload object
Source:

onPreferenceRetrievalFail(response, requestConfig)

This is the failure callback for retrieving preferences
Parameters:
Name Type Description
response object The object returned from the successful XHR request
requestConfig object The original configuration passed when the request was made
Source:

onPreferenceRetrieved(response, requestConfig)

This is the success callback for retrieving preferences. If a name and value are included then the preferences will be updated.
Parameters:
Name Type Description
response object The object returned from the successful XHR request
requestConfig object The original configuration passed when the request was made
Source:

onRemoveFavouriteDocument(payload)

Removes the supplied node or nodes from being a favourite.
Parameters:
Name Type Description
payload object
Source:

onShowFolders(payload)

Updates the current users preference for seeing folders in the Document List
Parameters:
Name Type Description
payload object
Source:

onShowPath(payload)

Updates the current users preference for seeing the current path in the Document List
Parameters:
Name Type Description
payload object
Source:

onViewSelection(payload)

Updates the current users preferred view for Document Lists. However, this will NOT set a view preference if the view provided is "Abstract".
Parameters:
Name Type Description
payload object
Source:

processFavourites(payload, alfTopic, add)

Adds nodes to or removes nodes from the documents and folders favourites in the current user preferences.
Parameters:
Name Type Description
payload object The original payload for the add or remove favourites request.
alfTopic string The topic to publish on the callback
add boolean Indicates whether or not this is an add request
Since:
  • 1.0.38
Source:

registerSubscriptions()

Sets up the subscriptions for the PreferenceService
Since:
  • 1.0.32
Source:
Listens to Events:

separateFoldersAndDocuments(nodes, folders, documents)

Iterates over the supplied array of Nodes and puts the NodeRefs from them into the supplied arrays of folders and documents based on whether or not the Node has an "isContainer" attribute set to true.
Parameters:
Name Type Description
nodes object[] An array of nodes to iterate over
folders string[] A string array to populate with folder NodeRefs
documents string[] A string array to populate with document NodeRefs
Since:
  • 1.0.38
Source:

setPreference(payload)

Sets a preference remotely.
Parameters:
Name Type Description
payload object
Source:

update(payload, add)

This function updates and existing preference where that preference is intended to be an array of items. In order to perform the update the existing preferences must be retrieved and then the preference can be added or removed depending on the supplied mode.
Parameters:
Name Type Description
payload object The details of the preference to add
add boolean Indicates whether or not the update is to add or remove a preference
Source:

<inner> setLocalPreferences(payload, preferences)

Sets the local copy of the preferences onces they've been retrieved from the Repository.
Parameters:
Name Type Description
payload object The payload from the original request to get preferences
preferences object The retrieved preferences object
Source: