More in this section

Forums / Developing with Sitefinity / Best practice to change radEditor toolsfile and template

Best practice to change radEditor toolsfile and template

18 posts, 0 answered
  1. Mikael Kleinwort
    Mikael Kleinwort avatar
    78 posts
    Registered:
    17 May 2004
    21 Feb 2009
    Link to this post
    I am using SF 3.6 hotfix.

    I want to customize RadEditor toolsfile and template files in my project, and I would like to do it in a way which is "update save". What is the best way to do this?

    I saw that for instance in the template file of the editor, there is lots of code included, besides some of the control statements I might want to change. I want to avoid the need to check the files I am changing every time I install an update.

    I would think that the best way to accomplish is to use some code that runs i.e. in the page load event of the page or master page to set the properties of the RadEditor or alter the toolsfile programmatically. This way, any SF updates of those files would take effect and my minor changes would come on top of it, and I don't have to worry about it.

    Would you agree? I am looking forward to your insights on this issue.

    Regards, Mikael
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    25 Feb 2009
    Link to this post
    Hi Mikael,

    This is exactly what we are trying to achieve with the 3.6, and the releases after it. When you change your templates and any additional files (like the tools file), we will not touch them at all with the next update. We are no longer overriding your templates, and use our internal ones by default. You can use your templates if you configure this from the ControlsConfig file, which is placed in the App_Data directory. Please check the post Sitefinity 3.6 beta - Mapping views to use external templates article for more information about this architecture.

    All the best,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Mikael Kleinwort
    Mikael Kleinwort avatar
    78 posts
    Registered:
    17 May 2004
    26 Feb 2009
    Link to this post
    Hello Georgi,

    2 questions about your answer:

    1. I checked the information you are referring to and I checked the external template archive. I am confused about which files to change when I want to customize the RadEditor for generic content editing. Do you have some comprehensive example for this standard task which applies to SF 3.6? I can't find my way through.

    2. Is there an easy way to customize the RadEditor for Generic Content toolbar without messsing with templates?

    Regards, Mikael
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    03 Mar 2009
    Link to this post
    Hello Mikael Kleinwort,

    Yes, you can enable additional tools for the RadEditor, without touching any control templates. Just open the EditorToolsFile.xml file located at \[YourProject]\Sitefinity\Admin\ControlTemplates. All available tools could be seen in EditorToolsFileAll.xml, in the same directory.

    As for the Generic Content Items template, here is an excerpt from the ControlsConfig file:
        <!--Provides user interface for editing a content item in the Generic Content module.--> 
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]"  
       layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx" /> 
        <!--Provides user interface for adding a new content item in the Generic Content module.--> 
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemNew`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]"  
       layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentNewView.ascx" /> 
     

    I hope this helps.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Mikael Kleinwort
    Mikael Kleinwort avatar
    78 posts
    Registered:
    17 May 2004
    03 Mar 2009
    Link to this post
    Hi Georgi,

    thank you for your input! I think I slowly understand.

    regards, Mikael
  6. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    04 Mar 2009
    Link to this post
    This has been very helpful.

    I have a question about customizing the Hyperlink control that the RadEditor uses(via the Insert Hyperlink button in the tool bar) when editing a Generic Content Module..

    How can I customize that template?   I want users to be able specify a CssClass (among other things) for the hyperlink, but my only options are URL, Text, and Tool Tip.

    Also, I'd like to add my own buttons to the RadEditor used when editing a Generic Content Module - but I don't know where I can tell it which class/methods to call when its used?  
  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    05 Mar 2009
    Link to this post
    Hi,

    The hyperlink manager dialog is actually a user control (in a page used by the editor). The user control itself is [YourProject]\Sitefinity\Admin\ControlTemplates\Pages\Dialogs\LinksEditorDialog.ascx. It is not an embedded one, so you do not need to touch the ControlsConfig file for that.
    We will try to add this functionality out of the box in the next service pack, since it is very popular demand.

    As for your second request, I am not exactly sure what you mean. If you want to add buttons with your own functionality (rather than optional buttons from the EditorToolsFileAll.xml), then I suggest you take a look at the demo Custom Tools. There is one more demo on the same page - Custom Dialogs. By the way, the LinkManager dialog is not the RadEditor's built-in dialog, it is our own, custom one.

    Hopefully this will get you started.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    05 Mar 2009
    Link to this post
    Ok, thanks.

    So it sounds like the proper way to change the Hyperlink tool that the RadEditor uses (when editing a Generic Content Control) - is to edit the \Sitefinity\Admin\ControlTemplates\Pages\Dialogs\LinksEditorDialog.ascx template.

    Or, if I wanted to add my own button, I should edit the editor template for the Generic Content Control, and add my own logic to the existing telerik:radEditor tag that exists in that template.

  9. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    05 Mar 2009
    Link to this post
    Hi,

    That's right.
    Let us know if you face any problems though.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    06 Mar 2009
    Link to this post
    There is a major problem with editing:

    /sitefinity/admin/controltemplates/generic_content/editorTemplate.ascx

    It doesn't work.  You can do whatever you want to that file.  You can even delete that user control completely and the page for editing Generic Content never changes.   

    Are you aware that this functionality is broken?  When do you expect to fix it?
  11. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    07 Mar 2009
    Link to this post
    Hi,

    It seems to me that you have not mapped the right view to this template through the ControlsConfig file. In order to use your external template, you should have the following entry:
    <viewSettings hostType="Telerik.Cms.Engine.WebControls.HtmlContentEditor"  
    layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx" />  
     

    Let me know about the results.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  12. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    09 Mar 2009
    Link to this post
    I have checked this file:

    [root]\App_Data\Configuration\Telerik.Sitefinity.Configuration.ControlsConfig.xml

    I then verified it had this setting:

    <viewSettings hostType="Telerik.Cms.Engine.WebControls.HtmlContentEditor" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx" />

    No matter what I change about that file, it doesn't show up in the page/window where you edit Generic Content.

    I then went and deleted this file entirely:

    ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx

    Yet, I can somehow still edit Generic Content without getting an error.  Clearly, that user control is not what is used when editing Generic Content.  Besides the fact that I can delete the user control, that user control doesn't have a TabStrip control in it - which is clearly used by the Generic Content edit page (You see "Basic" and "Advanced" tabs).



  13. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Mar 2009
    Link to this post
    Hello,

    Now I see the misunderstanding from our side.
    <viewSettings hostType="Telerik.Cms.Engine.WebControls.HtmlContentEditor"  
    layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx" /> 

    This is used only in user controls implementing IContentContainer interface. These controls are showing the RadEditor, and this is its template.

    Now, for the Generic Content control, you should use the following mapping:
    <viewSettings hostType="Telerik.Cms.Engine.WebControls.Design.GenericContentDesigner"  
    layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/GenericContentDesigner.ascx" /> 

    After the mapping and making any changes to the template, please restart the application.

    Once again, I apologize for the inconvenience.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  14. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    10 Mar 2009
    Link to this post
    Thank you.  I will try that.  Is there any documentation that describes which viewSettings keys correspond to which components?    For example, which key do I use for customizing the user control for creating/editing an event?

    To give you a better idea of what we are trying to do with events - we want to add a bunch of custom properties to Events, and we want to make a page for listing events in a custom way.   So, say we want to add a page that has a State drop down list on it, and users could choose a state and see all the upcoming events for that state.  

    I know that to change the edit form, I'll need to make another viewSettings key change - but I don't know what values to use?

    For the second part (the page listing events by state), I'm really not sure how you'd recommend going about this.

    Thanks in advance.
  15. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    11 Mar 2009
    Link to this post
    Ok, I tried that, but there isn't a file called:

    GenericContentDesigner.ascx

    in that directory.  I was hoping I could start with whatever the default is, and add my stuff from there.  Any ideas? 
  16. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    11 Mar 2009
    Link to this post
    This is becoming very frustrating.

    First, you told me to use one thing.  Then you told me to use this:

    <viewSettings hostType="Telerik.Cms.Engine.WebControls.Design.GenericContentDesigner"  
    layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/GenericContentDesigner.ascx" /> 

    That file isn't even in the project.  Then, I downloaded the ZIP file from my Client.net which contains all the itemKeys and external templates, and the .xml config file says I should use this.  Which is correct?

    <div>&lt;!--Provides user interface for editing a content item in the Generic Content module.-
    -
    ></div><div>    &lt;viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx" /></div
        
  17. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    17 Mar 2009
    Link to this post
    Hi,

    I can completely understand your frustration.
    Let me explain you the difference. The reference which I gave to you in my last post is for the Generic Content control which you drag and drop. The reference which you found in the list with the templates, is used in Admin panel, in the Generic Content module.

    All the best,
    Georgi
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  18. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    17 Mar 2009
    Link to this post
    Hello Connections Academy Developer,

    There is a lot going on in this thread and I'm having trouble getting my head around all the issues.

    However, I just published a couple of blog articles related to this subject on Sitefinity Watch:

    Neither of these tasks required me to override Views.  They merely involved a few changes to the EditorToolsFile.xml file.

    This being said, there might be scenarios where the changes you require can't be configured in the EditorToolsFile.xml file.  In these cases, overriding the View might be necessary. 

    If you can help me understand your objective, I'll try to help!

    Gabe Sumner
    http://www.sitefinitywatch.com/

Register for webinar
18 posts, 0 answered