Custom Application Development Examples

This project is a sample for developing custom tabs, custom workflow external clients, and custom UI for Dynamic Execute. The following are only examples. This solution should not be modified or deployed. As with Automated_Task_Standard_Operations.csproj, the CMS site instance uses this project's compiled output via an MEF-based, late-binding system.

Custom Apps Development Examples

Except for the Ingeniux CMS references, all references in the project are NuGet packages. The package definitions are in place, but to save space, actual packages are not included in the installer. Before building the project the first time, restoring the packages is recommended.

Plug-in applications are ancillary apps that are developed for use with Ingeniux CMS. The plug-in application system assumes the plug-in application is based on ASP.NET MVC 4. You can still use WebForms or non-ASP.NET technologies, but the resulting application won't be able to use CMS application session objects.

CMSControllerBase Class

Because the CMS plug-in system locates plug-in applications via MVC routing, every plug-in application must start with a controller.

CMS plug-in system uses Managed Extensibility Framework (MEF) to lazy-load types exported in all plug-in folders, creating a controller instance in real time based on the URL of the application. The base type the plug-in system expects is CMSControllerBase.

 public abstract class CMSControllerBase : Controller { protected CMS_Common _Common; protected ContentStore _ContentStore; protected IReadonlyUser _CurrentUser; protected Exception _InitializationException; protected Ingeniux.CMS.L10N.LocalizationProvider_L10nProvider; protected string _XmlFolderLocation; public static string CUSTOM_APPLICATION_CONTROLLER_NAMESPACE; protected void _GetCommonObject(); protected void _GetContentStore(RequestContext requestContext, HttpApplicationStateBase application); public static Ingeniux.CMS.L10N.LocalizationProviderGetL10nProvider(RequestContext requestContext, HttpApplicationStateBase application); protected override void Initialize(RequestContext requestContext); protected IUserSession OpenReadSession(); protected IUserWriteSession OpenWriteSession(); }

The CMSControllerBaseclass contains important members that are used to retrieve information of the CMS application and user session context.

  • The _Common field wraps up all the necessary information on the CMS user context.
  • The _ContentStore field is the connection to the back-end database (Singleton object).
  • The _CurrentUser field is used to open sessions.
  • The _XmlFolderLocation field is location of the XML folder.
  • The _L10NProvider field is for retrieving localized strings for specific UI languages.
  • The _InitializationException field indicates whether or not has failed to initialize. If it is not null, the initialization failed.

Use OpenReadSession and OpenWriteSession to open session to retrieve and manipulate objects. Objects only reside in each session and are disposed upon session disposal.

CustomTabController Class

CustomTabController is the base class for controllers in custom tab applications. All custom tab controllers must derive from it. It is derived from CMSControllerBase.

 public abstract class CustomTabApplicationController : CMSControllerBase { public CustomTabParameters CMSContext { get; protected set; } } 

The CMSContext property of this class contains the environmental context of custom tab applications. It is derived from CMSControllerUrlContextclass.

 public class CMSControllerUrlContext { public string AssetBaseUrl; public string BaseUrl; } public class CustomTabParameters : CMSControllerUrlContext { public CustomTabParameters(CMS_Common common, RequestContext requestContext); public string PageId { get; protected set; } public string PublishingTargetId { get; protected set; } public IPublishingTarget GetCurrentPublishingTarget(IUserSession session); public IUser GetCurrentUser(IUserSession session); public IPage GetPage(IUserSession session); } 

This model class also provides support methods to retrieve context objects, like Page and Publishing Target.

DynamicExecuteInterfaceApplicationController Class

DynamicExecuteInterfaceApplicationController is also derived from CMSControllerBase. It is the base controller for Dynamic Execute User Interface applications.

public abstract class DynamicExecuteInterfaceApplicationController : CMSControllerBase { public ExecuteElementData ElementData { get; protected set; } } 

This controller contains the ElementData property, which is the object representation of the client-side JavaScript model for data of a element field. In this case, it's the data of a Dynamic Execute field.

public class ExecuteElementData { public Dictionary attributes; public ExecuteElementData[] childElements; public bool readOnly; public string type; public string ToJson(); } 

Since Dynamic Execute fields change all elements from the original schema into attributes, the childElements field is normally empty or null.

WorkflowClientApplicationController Class

WorkflowClientApplicationController is also derived from CMSControllerBase. It is the base controller for Workflow External Client applications.

 public abstract class WorkflowClientApplicationController : CMSControllerBase { public WorkflowClientParameters TransitionContext { get; protected set; } } 

The TransitionContext property contains all the information on the page's workflow status and transition.

 public class WorkflowClientParameters : CustomTabParameters { public WorkflowClientParameters(CMS_Common common, RequestContext requestContext); public string TransitionId { get; protected set; } public ITransition GetTransition(IUserSession session); } 

Custom Plug-in Applications by Example

The path [cms-site-instance]\site\App_Data\xml\Custom\SampleApp includes three custom applications, serving as a starting point for your customized plug-in apps.

See the three custom applications below.

This section includes: