Enhancement

Implement a provider model for supplying alternative rich text/html services including commercial products (if desired).

User Story

The Rich Text Editor enhancement is focused on two goals:

  1. Allow for seamless upgrade or replacement of the Rich Text Editing control  
  2. Allow for 3rd party module developers to call on a Rich Text Editing control regardless of the control being used.

Acceptance Tests

  1. A properly developed provider assembly for a 3rd party rich text editing control can be installed without any changes to the core or modules.
  2. Module developers are able to successfully reference a generic rich text editing control, regardless of the provider in use.

Engineering Tasks

Overview

The provider model used in our data abstraction enhancement of version 2.0 (See Data Access White-paper), applied to the editor control, will allow us to address our requirements.

By creating an HTMLEditorProvider class and abstracting the editor control into a separate provider assembly, different provider assemblies can be developed and easily plugged into DotNetNuke. 

To address compatibility, a focus must be put on making the number of required functions and properties an individual provider must implement few and universal.  Extra features specific to a rich text editing control will be handled within the controls own provider (ie custom toolbar buttons, image chooser).  Similarly, implementation requirements/procedures specific to an individual control will also be handled in the controls provider (ie setting a 'control.imagedirectory' property).

This abstraction will not only allow for replacement and upgrade of the rich text editing control. It will also allow 3rd party module developers to call on a generic HTMLEditorProvider class without having to know the specifics of the user's implementation/control of choice. 

Legacy issues, such as 3rd party modules which directly call the FreeTextBox control instead of the provider, will also be addressed.  DotNetNuke will ship with a FreeTextbox Provider as the default HTMLEditorProvider.  This provider will have the freetextbox.dll that will still be directly accessible. 

The <dnn:texteditor> control

<dnn:texteditor>, a new DotNetNuke control, will be introduced with this enhancement.  This control will allow module developers to use a generic text editor control without knowing which provider is installed.  The properties for this control are:

  • ChooseMode as Boolean - determines wether or not the user will have the choice between Basic Text and Rich Text Editing (like the Text/HTML core module currently has).  The default is True.
  • ChooseRender as Boolean - determines wether or not the Text/HTML button is rendered in Basic mode. The default is True.
  • DefaultMode as String - will set the default mode of the <dnn:texteditor> control to either 'Basic' or 'Rich'.  The default is 'Basic'
  • HTMLEncode as Boolean - determines wether the Text property will return Server.HTMLEncoded text.  It also determines wether the assigning a value to the Text property will Server.HTMLDecode it on load.  The default is True.
  • Height as System.Web.UI.WebControls.Unit - will set the height of the control.
  • Mode as String (ReadOnly) - returns the current mode of the control, either “B“ for Basic Text mode or “R“ for Rich Text mode.
  • Text as String- will be used to populate and retrieve the text/html from the control.
  • Width as System.Web.UI.WebControls.Unit - will set the width of the control.

HTMLEditorProviders

New Providers may be created by inheriting from the new HTMLEditorProvider Class and implementing control specific features/functionality withing the provider. I will use the FTBHTMLEditorProvider as an example.

First it is defined in the web.config file:

<HTMLEditor defaultProvider="FTBHTMLEditorProvider" >

<providers>

<clear/>
<add
name = "FTBHTMLEditorProvider"
type = "DotNetNuke.HTMLEditor.FTBHTMLEditorProvider, DotNetNuke.FTBHTMLEditorProvider"
providerPath = "~\Providers\HTMLEditorProviders\FTBHTMLEditorProvider\"
/>

</providers>

</HTMLEditor>

The Class FTBHTMLEditorProvider must have the following methods / properties:

Public Sub New()

New() will

    • Read the configuration specific information for this provider
    • Initialize the control (set control specific properties ie FTB.ImageGalleryPath)
    • Assign the initialized control as the HTMLEditorControl. The HTMLEditorControl is a actual control that is accessed via the generic HTMLEditorProvider class

 

Public ReadOnly Property ProviderPath()

 

Public Overrides Property Text() As String
Public Overrides Property Width() As System.Web.UI.WebControls.Unit
Public Overrides Property Height() As System.Web.UI.WebControls.Unit

The Text, Width, and Height properties are retrieved and set by typing (CType) the generic HTMLEditorControl Web.UI.Control to FreeTextBoxControls.FreeTextBox and accessing the FreeTextBox properties Text, Width, and Height.

ex: Text = CType(Me.HTMLEditorControl, FreeTextBoxControls.FreeTextBox).Text

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft .NET. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates Snowcovered.com where users purchase third party apps for the platform.