DNN FckHtmlEditorProvider

using System;

using DotNetNuke.Common;

using DotNetNuke.Entities.Portals;

using DotNetNuke.Framework.Providers;

using DotNetNuke.Modules.HTMLEditorProvider;

 

using FredCK.FCKeditorV2;

 

namespace DotNetNuke.HtmlEditor

{

  public class FckHtmlEditorProvider : HtmlEditorProvider

  {

    private const string ProviderType = "htmlEditor";

    private ProviderConfiguration _providerConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType);

    private string _providerPath = string.Empty;

 

    private FCKeditor _fckEditor = new FCKeditor();

    private string _controlId = string.Empty;

    private string _rootImageDirectory = string.Empty;

    private string _toolbarSet = string.Empty;

 

    #region Provider

 

    public FckHtmlEditorProvider()

    {

      PortalSettings ps = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings();

      Provider p = _providerConfiguration.Providers[_providerConfiguration.DefaultProvider] as Provider;

      _providerPath = p.Attributes["providerPath"];

      _toolbarSet  = p.Attributes["toolbarSet"];

    }

 

    public string ProviderPath

    {

      get { return _providerPath; }

    }

 

    public string ToolbarSet

    {

      get { return _toolbarSet; }

    }

 

    #endregion

 

    #region Properties

 

    public override System.Web.UI.Control HtmlEditorControl

    {

      get

      {

        return _fckEditor;

      }

    }

 

    public override string Text

    {

      get

      {

        return _fckEditor.Value;

      }

      set

      {

        _fckEditor.Value = value;

      }

    }

 

    public override string ControlID

    {

      get

      {

        return _controlId;

      }

      set

      {

        _controlId = value;

      }

    }

 

    public override System.Collections.ArrayList AdditionalToolbars

    {

      get

      {

        return null;

      }

      set

      {

      }

    }

 

    public override string RootImageDirectory

    {

      get

      {

        if( _rootImageDirectory == string.Empty )

        {

          PortalSettings ps = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings();

          return ps.HomeDirectory.Substring(ps.HomeDirectory.IndexOf("/Portals"));

        }

        else

        {

          return _rootImageDirectory;

        }

      }

      set

      {

        _rootImageDirectory = value;

      }

    }

 

    public override System.Web.UI.WebControls.Unit Width

    {

      get

      {

        return _fckEditor.Width;

      }

      set

      {

        _fckEditor.Width = value;

      }

    }

 

    public override System.Web.UI.WebControls.Unit Height

    {

      get

      {

        return _fckEditor.Height;

      }

      set

      {

        _fckEditor.Height = value;

      }

    }

 

    #endregion

 

    #region Public Methods

 

    public override void AddToolbar() { }

 

    public override void Initialize()

    {

      _fckEditor = new FCKeditor();

      _fckEditor.ID = this.ControlID;

      _fckEditor.BasePath = DotNetNuke.Common.Globals.ResolveUrl("~/Providers/HtmlEditorProviders/FckHtmlEditorProvider/FCKeditor/");

      _fckEditor.ToolbarSet = this.ToolbarSet;

    }

 

    #endregion

  }

}

posted @ Tuesday, February 15, 2005 2:59 PM


Print

Comments on this entry:

# re: DNN FckHtmlEditorProvider

Left by Willie at 2/18/2005 7:35 AM

I haven't really looked at DNN too much yet, but how would you use this? You just have to add this, or is there something else to do?

# re: DNN FckHtmlEditorProvider

Left by Bill at 2/19/2005 6:36 AM

Well, if you wanted to use it in your DNN setup, I would send you two .dlls to put in your <DotNetNuke>/bin as well as a sample of the modifications you would need to make to your web.config file. That's it, two files and a config modification.

The dlls being DotNetNuke.FckHtmlEditorProvider.dll (a compilation of the above code) and FredCK.FCKeditorV2.dll

-Bill

# re: DNN FckHtmlEditorProvider

Left by Gianluca Hotz at 3/1/2005 2:26 PM

Hi Bill, does the above code work also for DNN 2.1.2?

# re: DNN FckHtmlEditorProvider

Left by Bill at 3/2/2005 10:02 AM

Truthfully Gianluca, I'm not sure. I only started getting into DNN with version 3.09. If I get some spare time, I'll look at the Html Editor Provider for 2.1.2 and see what I can find out.

P.S.
You're the first person (besides Willie) to post to my blog, YOU ROCK!

# re: DNN FckHtmlEditorProvider

Left by Peter at 10/17/2005 3:35 AM

Have you also done the code for FCKeditor 2.1.1 for dnn 3.1 ??

If so I would very much like to "see" it :-)

Peter

Your comment:



 (will not be displayed)


 
 
 
Please add 5 and 4 and type the answer here:
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789