Module: alfresco/documentlibrary/AlfCreateTemplateContentMenu

alfresco/documentlibrary/AlfCreateTemplateContentMenu

This is a customization of the AlfCascadingMenu to asynchronously load the available node creation templates from the Alfresco Repository. Currently this makes its own XHR call to retrieve the data (as this is quite a specific requirement) however it could potentially be decoupled via pub/sub to make more generic.
Author:
  • Dave Draper
License:
Source:

Members

_menuItemToParentTopic :String

This is the topic that is published by each menu item created within the cascade. It should not be reconfigured it as it is automatically generated to be a unique value so that only menu items added to this cascading menu will use it.
Type:
  • String
Default Value:
  • null
Source:

_templatesAlreadyLoaded :boolean

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

_templatesUrl :string

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

i18nRequirements :object[]

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

templateIconClass :string

The iconClass to use on each template content menu item
Type:
  • string
Default Value:
  • "alf-textdoc-icon"
Source:

templatePublishTopic :string

The topic to publish on when requesting to create templated content
Type:
  • string
Default Value:
  • "ALF_CREATE_CONTENT"
Source:

templateType :string

The type of template to be created. Either "node" or "folder".
Type:
  • string
Default Value:
  • "node"
Source:

widgets :object[]

This defines the default widgets to display in the menu which is initially just a loading message which should be replaced when the XHR request returns with some data.
Type:
  • object[]
Source:

Methods

_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:

_templatesLoaded(response, originalRequestConfig)

Handles the successful loading of template nodes.
Parameters:
Name Type Description
response object The response from the request
originalRequestConfig object The configuration passed on the original request
Source:

_templatesLoadFailed(response, originalRequestConfig)

Handles failed attempts to load templates.
Parameters:
Name Type Description
response object The response from the request
originalRequestConfig object The configuration passed on the original request
Source:

addNoTemplatesMessageItem()

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

addTemplatesFailMessageItem()

Adds a non-functional message menu item to the templates menu. This is used when needing to indicate that the templates 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:

loadTemplates()

This function is called when the user clicks on the "Templates" cascading menu item to asynchronously load the available content templates.
Source:

onCreateTemplatedContent(payload)

Adds the current node in which to create the templated content to the received payload and then publishes on to the ActionService to create the templated content.
Parameters:
Name Type Description
payload object The payload relating to the template to create.
Source:

postCreate()

Extends the superclass function to subscribe to setup handlers to call loadTemplates when the cascading menu is opened.
Source: