Module: alfresco/header/AlfSitesMenu

alfresco/header/AlfSitesMenu

Author:
  • Dave Draper
License:
Source:

Members

_favouritesLoaded :boolean

Indicates whether the users favourite sites have been loaded yet.
Type:
  • boolean
Default Value:
  • false
Source:

_favouritesMessageItem :object

This is a reference to any favourites message item that gets created (typically when either favourites could not be loaded or there are no favourites to display).
Type:
  • object
Default Value:
  • null
Source:

_favouritesUrl :string

A URL to override the default. Primarily provided for the test harness.
Type:
  • string
Default Value:
  • null
Source:

_menuLoaded :boolean

Indicates whether or not the menu has been loaded yet.
Type:
  • boolean
Default Value:
  • false
Source:

_menuMessageItem :object

This is a reference to any favourites message item that gets created (typically when either favourites could not be loaded or there are no favourites to display).
Type:
  • object
Default Value:
  • null
Source:

_menuUrl :string

A URL to override the default. Primarily provided for the test harness.
Type:
  • string
Source:

addFavouriteIconClass :string

Type:
  • string
Default Value:
  • "alf-add-favourite-site-icon"
Source:

addFavouriteLabel :string

Type:
  • string
Default Value:
  • "add-favourite-site.label"
Source:

createSiteIconClass :string

Type:
  • string
Default Value:
  • "alf-create-site-icon"
Source:

createSiteLabel :string

Type:
  • string
Default Value:
  • "create-site.label"
Source:

currentSite :string

This should be set with the short name of the current site. By default it is set to the null which indicates that the Sites Menu is not being displayed on a page related to a specific site. In which case the "Add" and "Remove" favourite options will NOT be added.
Type:
  • string
Default Value:
  • null
Source:

currentUser :string

This should be set with the id of the current user. By default it is set to null which indicates and if not overridden will result in the add/remove favourite sites menu items NOT being displayed.
Type:
  • string
Default Value:
  • null
Source:

favouriteGroupIconClass :string

Type:
  • string
Default Value:
  • "alf-favourite-site-icon"
Source:

favouriteGroupLabel :string

The label for the "Favourite Sites" group.
Type:
  • string
Default Value:
  • "favourite.sites.label"
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/AlfSitesMenu.properties"}]
Source:

mySitesIconClass :string

Type:
  • string
Default Value:
  • "alf-my-sites-icon"
Source:

mySitesLabel :string

Type:
  • string
Default Value:
  • "my-sites.label"
Source:

recentGroupLabel :string

The label for the "Recently Visited Sites" group.
Type:
  • string
Default Value:
  • "recent.sites.label"
Source:

removeFavouriteIconClass :string

Type:
  • string
Default Value:
  • "alf-remove-favourite-site-icon"
Source:

removeFavouriteLabel :string

Type:
  • string
Default Value:
  • "remove-favourite-site.label"
Source:

showCreateSite :boolean

Indicates whether or not the "Create Site" menu item should be displayed or not.
Type:
  • boolean
Default Value:
  • true
Source:

showFavourites :boolean

Indicates whether or not to show the "Favourites" cascading menu item.
Type:
  • boolean
Default Value:
  • true
Source:

showMySites :boolean

Indicates whether or not the "My Sites" menu item should be displayed or not.
Type:
  • boolean
Default Value:
  • true
Source:

showRecentSites :boolean

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

showSiteFinder :boolean

Indicates whether or not to show the "Site Finder" menu item.
Type:
  • boolean
Default Value:
  • true
Source:

showUsefulGroup :boolean

Indicate whether or not to show the "Useful" group.
Type:
  • boolean
Default Value:
  • true
Source:

siteFinderIconClass :string

Type:
  • string
Default Value:
  • "alf-site-finder-icon"
Source:

siteFinderLabel :string

Type:
  • string
Default Value:
  • "site-finder.label"
Source:

siteLandingPage :string

The standard landing page for a site
Type:
  • string
Since:
  • 1.0.38
Default Value:
  • "/dashboard"
Source:

usefulGroupLabel :string

The label for the "Useful" group - this group contains the Site Finder, Create Site and Add/Remove favourite menu items.
Type:
  • string
Default Value:
  • "useful.sites.label"
Source:

widgets :object

This defines the default widgets to display in the menu - just a loading image.
Type:
  • object
Source:

Methods

_addFavouriteMenuItem(siteShortName, siteTitle)

This is a 'private' function that should not be called directly. It is called from the 'addFavouriteMenuItem' function from two different code paths. It needed to be separated into a new function so that it could be used after retrieving the site title or when the site title was already available.
Parameters:
Name Type Description
siteShortName string The site shortname to use for the favourite
siteTitle string The title of the site to display as the label of the menu item.
Source:

_addMenuItem(group, widget, index)

Adds an individual menu item.
Parameters:
Name Type Description
group object The group to add the menu item to
widget object The menu item to add
index integer The index to add the menu item at.
Source:

_favouritesDataLoaded(response, originalRequestConfig)

Parameters:
Name Type Description
response object The response from the request
originalRequestConfig object The configuration passed on the original request
Source:

_favouritesDataLoadFailed(response, originalRequestConfig)

Parameters:
Name Type Description
response object The response from the request
originalRequestConfig object The configuration passed on the original request
Source:

_menuDataLoaded(response, originalRequestConfig)

Parameters:
Name Type Description
response object The response from the request
originalRequestConfig object The configuration passed on the original request
Source:

_menuDataLoadFailed(response, originalRequestConfig)

Parameters:
Name Type Description
response object The response from the request
originalRequestConfig object The configuration passed on the original request
Source:

addFavouriteMenuItem(data)

This function adds a new favourite to the favourites list.
Parameters:
Name Type Description
data object The details of the site to make a favourite
Source:

addFavouritesFailMessageItem()

Adds a non-functional message menu item to the favourites menu. This is used when needing to indicate that the favourites could not be loaded. The most likely cause of this would be when connectivity has been lost, authentication timed out or the repository has gone down since loading the page.
Source:

addMenuFailMessageItem()

Adds a non-functional message menu item to the favourites menu. This is used when needing to indicate that the favourites could not be loaded. The most likely cause of this would be when connectivity has been lost, authentication timed out or the repository has gone down since loading the page.
Source:

addNoFavouritesMessageItem()

Adds a non-functional message menu item to the favourites menu. This is used when needing to indicate that the favourites didn't load or that there are no favourites.
Source:

addRecentGroup(widgetsRecent)

Adds the "Recent" group to the AlfMenuGroups popup.
Parameters:
Name Type Description
widgetsRecent array An array of the recently visited site menu item widget configurations
Source:

addUsefulGroup(showAddFavourite, showRemoveFavourite)

This function add the 'Useful' group and associated menu items into the AlfMenuGroups popup.
Parameters:
Name Type Description
showAddFavourite boolean Indicates whether or not to display the "Add Favourite" menu item
showRemoveFavourite boolean Indicates whether or not to display the "Remove Favourite" menu item
Source:

constructor()

Extend the default constructor to add subscriptions for handling favourites being added and removed.
Source:

favouriteAdded(data)

Parameters:
Name Type Description
data object An object that should contain site and user attributes
Source:

favouriteRemoved(data)

Parameters:
Name Type Description
data object An object that should contain site and user attributes
Source:

loadFavourites()

This function is called when the user clicks on the "Favourites" cascading menu item to asynchronously load their favourite sites.
Source:

loadMenu()

This function is called when the associated AlfMenuGroups popup is opened. It asynchronously loads the recently visited sites information.
Source:

postCreate()

Extend the default postCreate function to setup handlers for adding the 'Useful' group once all the other menu groups and items have been processed.
Source:

siteDetailsUpdated(data)

Parameters:
Name Type Description
data object
Source:

siteJoined(data)

When a user joins a site then they should automatically be given the option to make the site a favourite. The current design of the header means that the entire page will be reloaded (which will then reflect the change in favourites).
Parameters:
Name Type Description
data object An object that should include details of the user and the joined site
Source:

siteLeft(data)

When a user leaves a site this function is called so that the favourite site is removed from their preferences.
Parameters:
Name Type Description
data object An object that should include details of the user and the joined left
Source:

sortFavourites(item1, item2)

This is the sort function used for ordering favourite site menu items.
Parameters:
Name Type Description
item1 object The first menu item to compare
item2 object The second menu item to compare
Source:
Returns:
1 if item1 is alphabetically after item2, -1 if item2 is alphabetically after item1