Depending on the functionality that you are implementing, it may be necessary to expose some administrative options within the Administration UI of Telligent Community. The Administration UI is completely defined using plugins so its easy to add to.
[toc]
Types of administration UI extensions
The administration UI in Telligent Community is used by moderators and administrators to configure global options and enable specific functionality.
It is built using three types of plugins:
- Categories. Categories are the top-level navigation items ("Activity Stream" in the left-most column above) within the administration UI and are used for categorizing panels, which implement specific functionality.
- Panels. Panels live within a category and are listed with other panels in the same category ("Options" in the second column above) and have a specific UI when selected (third column above)
- Plugin Type Panels. Plugin type panels are a special grouping of plugins of a specific type within a category ("Activity Story Types" in the second column above). Their UI (third column above) is defined by the platform and available plugin type editors.
- Plugin Type Editors. Plugin type editors are used by the platform to extend platform-defined editing of plugins within Plugin Type Panels. Plugin type editors get to add to the UI (third column above) when editing a plugin that matches certain criteria defined by the plugin type editor.
- Explicit Panels. Explicit panels are panels that are only accessible via a direct link. For example, editing a member in the administration UI is available in a few different panels and categories, but is implemented once by linking to the explicit panel that edits a member. Explicit panels are useful when the same functionality will need to be accessed from multiple locations.
Administration categories
To add a top-level category to the administration UI, a plugin implementing the IAdministrationPanelCategory interface must be defined and enabled. The IAdministrationPanelCategory interface is defined in the Telligent.Evolution.Extensibility.Administration.Version1 namespace of Telligent.Evolution.Core.dll. The following sample creates a category named "Category":
using System; using Telligent.Evolution.Extensibility.Administration.Version1; namespace Samples { public class SampleAdministrationCategory : IAdministrationPanelCategory { private readonly Guid _id = new Guid("f3222021-a025-411a-a855-078fe5d1c15e"); #region IPlugin // ... #endregion #region IAdministrationPanelCategory public Guid AdministrationPanelCategoryId { get { return _id; } } public string AvatarUrl { get { return null; } } public string CategoryName { get { return "Category"; } } public int? DisplayOrder { get { return null; } } #endregion } }
The AdministrationPanelCategoryId should be a unique identifier used to uniquely reference this category. Note that an administration category without any panels will not render in the site. When it has panels that are accessible to a user, the panel will be shown in the administration UI:
Administration panels
To add a new administration panel to the administration UI, a plugin implementing the IAdministrationPanel interface must be defined and enabled. The IAdministrationPanel interface is defined in Telligent.Evolution.Core.dll. A very basic sample of a panel (added to the category created above) is below:
using System; using Telligent.Evolution.Extensibility.Administration.Version1; namespace Samples { public class SampleAdministrationPanel : IAdministrationPanel { private readonly Guid _id = new Guid("4ddc50bb-76d0-49f5-ab7a-6466309e89dd"); #region IPlugin // ... #endregion #region IAdministrationPanel public Guid PanelId { get { return _id; } } public string PanelName { get { return "Panel"; } } public string PanelDescription { get { return "Panel description."; } } public bool VaryCacheByUser { get { return false; } } public string GetViewHtml() { return "<p>Panel content</p>"; } public bool HasAccess(int userId) { return true; } public Guid AdministrationPanelCategoryId { get { return new Guid("f3222021-a025-411a-a855-078fe5d1c15e"); } } public string CssClass { get { return string.Empty; } } public int? DisplayOrder { get { return null; } } public bool IsCacheable { get { return true; } } #endregion } }
The PanelId should be a unique identifier for this panel. The AdministrationPanelCategoryId should reference the identifier of an administration category (the sample references the category we created above). The PanelName and PanelDescription properties identify the panel in the UI and the GetViewHtml() method returns the HTML that populates the large content area (3rd column) of the administration UI when this panel is active.
The full content of the panel could be defined in code, but all administration panels that are part of the platform make use of plugin-defined widgets.
When only a single panel is available within a category, the second level navigation is removed and navigating to the category or panel will render the single available panel. When more than a single panel is available to a user in a category, the second level navigation is shown and the top-most panel is selected when navigating into a category. When multiple panels are available and the category is selected, this sample panel will render as:
Plugin type panels
To add a list of plugins to an administration category by type, a plugin implementing the IPluginTypesAdministrationPanel interface should be defined and enabled. The IPluginTypesAdministrationPanel interface is defined in the Telligent.Evolution.Extensibility.Administration.Version1 namespace of Telligent.Evolution.Core.dll. A sample implementation that includes a list of content type plugins under the label "Plugin Types" is below:
using System; using Telligent.Evolution.Extensibility.Administration.Version1; namespace Samples { public class SamplePluginTypesAdministrationPanel : IPluginTypesAdministrationPanel { #region IPlugin // ... #endregion public Guid AdministrationPanelCategoryId { get { return new Guid("f3222021-a025-411a-a855-078fe5d1c15e"); } } public string PluginTypesName { get { return "Plugin Types"; } } public IEnumerable<Type> PluginTypes { get { return new Type[] { typeof(Telligent.Evolution.Extensibility.Content.Version1.IContentType) }; } } public int? DisplayOrder { get { return null; } } } }
The AdministrationPanelCategoryId property references the category into which this list of plugins should be added. The PluginTypesName property identifies the label to show above the list of plugins. The PluginTypes property lists the types of plugins that should be listed which can be interfaces or base or concrete classes. The platform renders the list of matching plugins which links to the platform-defined plugin editor.
The platform includes optimizations to provide filtering options when there are a reasonable number of matching plugins in the list and also collapses the list to appear like other panels when there is only one matching plugin.
The sample renders as:
Plugin type editors
TBD
Explicit administration panels
TBD