+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Generic Content control -- RadEditor -- script tags

Generic Content control -- RadEditor -- script tags

24 posts, 0 answered
  1. Zack
    Zack avatar
    41 posts
    Registered:
    18 Apr 2007
    26 Mar 2008
    Link to this post
    The issue I'm running into is this:

    • --Add Generic Content control to a page in Sitefinity. 

    • --Add some html markup AND <script type='text/javascript">alert('test');</script> to the Generic Content control.

    -- Save and Publish ... alert box functions as expected.

    -- Now go back and edit that same Generic Content control ... script code is gone. 

    I did a little research and apparently the Q3 version of RadEditor now strips out <script> tags, which I suspect is the problem I'm running into.

    So my question is whether this is a "feature" or a "bug".  We really need the ability to add script code via Generic Content controls in order to work with Analytics frameworks like google, use Flash media controls, etc., write custom script code, etc. etc.   I cannot imagine that we're alone in this need and I haven't seen any other complaints about this in the forum so it makes me wonder if perhaps we're doing something wrong or if there's a setting somewhere that I'm missing, etc. etc.

    Help!??!?!

    (We're using Sitefinity 3.2 converted into a Web Application Project, btw)

    Thanks!
  2. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    27 Mar 2008
    Link to this post
    Hello Zack,

    To allow scripts in RadEditor "Prometheus", you need to open the corresponding template in Sitefinity and set this property in the control declaration:

    <telerik:RadEditor  
        runat="server"  
        ID="RadEditor1" 
        AllowScripts="true" 

    The templates are located in ~/Sitefinity/Admin/ControlTemplates/ folder. For example, ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx is the template for the Generic Content public control.

    Do let us know if you need any further assistance.


    Best wishes,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Chris
    Chris avatar
    2 posts
    Registered:
    10 Dec 2008
    10 Dec 2008
    Link to this post
    I'm having the same issue and we need to add <script> tags using the Content Editor.  I ran through the steps recommended by Rebecca below by adding the [AllowScripts="true"] directive to the ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx file and am still unable to add script tags.

    Do you have any recommnedations as to how I can enable scripts?

    We are using SiteFinity 3.2
  4. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    11 Dec 2008
    Link to this post
    Hi Chris,

    AllowScripts property is now deprecated. Alternatively, please use ContentFilters="None". For details refer to the following article: Content Filters

    Do let us know if this helps.

    Best wishes,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Chris
    Chris avatar
    2 posts
    Registered:
    10 Dec 2008
    12 Dec 2008
    Link to this post
    I thought that the ContentFilters directive was only available in SF 3.5+.  Does ContentFilters work in 3.2 as well?

    I tried implementing it by removing the RemoveScripts directive and adding ContentFilters="None", but the script tags are still getting removed.  Any thoughts on this?

    Thanks!
  6. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    15 Dec 2008
    Link to this post
    Hi Chris,

    I am sorry for misleading you.
    Yes, in Sitefinity v.3.2, to enable scripts you need to set AllowScripts property to true in the RadEditor declaration like this:

    <telerik:RadEditor  
        runat="server"  
        ID="RadEditor1" 
        ContentAreaCssFile="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorContentArea.css" 
        ToolsFile="~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml" 
        EnableEmbeddedSkins="False" Skin="Sitefinity"  
        NewLineBr="False" 
        Height="360px"  
        Width="98%" 
        AllowScripts="true">  
        ... 
    </telerik:RadEditor> 

    Please, make sure you have edited the right file:
    ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx - represents the template used by the Generic Content public control
    ~/Sitefinity/Admin/ControlTemplates/[Module_Name]/ControlPanelInsert.ascx - represents the template which defines the Insert mode of the module Control Panel
    ~/Sitefinity/Admin/ControlTemplates/[Module_Name]/ControlPanelEdit.ascx - represents the template which defines the Edit mode of the module Control Panel

    If the above does not help, please open a new support ticket and send us the modified version of your template. Also, check the version of Telerik.Web.UI assembly located in the ~/bin folder of your project.

    Do let us know how it goes.

    Regards,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Slawek
    Slawek avatar
    16 posts
    Registered:
    16 Feb 2009
    17 Feb 2009
    Link to this post
    How can I allow javascript in Sitefinity 3.6?

    I can't find the file ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx

  8. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    18 Feb 2009
    Link to this post
    Hello Slawek,

    In Sitefinity 3.6 the template system has been changed. Now Embedded Templates are used.

    There is an article in the knowledge base describing this change.

    Right now we are working on a hot-fix that will address this problem, as well as upgrading the user manual to reflect these changes.

    In short, these are the steps to be able to customize your template for editing a generic content item
    • Obtain a copy of EmbeddedTemplates.zip. The download link is provided in the knowledge base article I pointed you to. If, for some reason, the file gets downloaded without extension, rename it so that it ends with.zip
    • Extract your copy of this archive.
    • Open the project in Visual Studio
    • Right-click App_Data and add a new folder named Configuration
    • Right-click on the newly created folder, and choose Add New Item. From the dialog box, select XML File and name it Telerik.Sitefinity.Configuration.ControlsConfig.xml
    • Open the file and enter the following code:

        <!-- Edits a generic content item --> 
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]], Telerik.Cms.Engine" 
    layoutTemplatePath="~/Sitefinity/Admin/Externel/Generic_Content/ContentEditView.sft"
        </viewSettings> 

    • Again, go to Visual studio, navigate to ~./Sitefinity/Admin/ControlTemplates/Generic_Content and add a new Web User Control
    • Name the control ContentEditView.ascx . Go to your archive, and open the file <archive root>\Sitefinity\Admin\ControlTemplates\Generic_Content\ContentEditView.sft with notepad or any editor you like.
    • Copy the contents of the file you just opened to the user control that you created (completely replacing its contents).
    • Now you are free to edit the template

    Note:
    After making changes to your ControlsConfig.xml, or to the template itself, you need to restart the application pool. The quickest way to do so is to make a simple change to web.config (i.e. add space, delete it and save). 

    Sincerely yours,
    Dido
    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.
  9. Slawek
    Slawek avatar
    16 posts
    Registered:
    16 Feb 2009
    20 Feb 2009
    Link to this post
    Is there any other (easier) way to enable javascript in generic content? I can't do it this way as I don't have sf project I only have ftp access to the files. I really need to enable it I have scripts not working on my website.
  10. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    21 Nov 2016
    23 Feb 2009
    Link to this post
    Hi Slawek,

    There is no way to change the embedded templates. Using the external templates is the only way to reconfigure the Editor's options.

    Regards,
    Nikolai
    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.
  11. Slawek
    Slawek avatar
    16 posts
    Registered:
    16 Feb 2009
    23 Feb 2009
    Link to this post
    Ok, thanks for your help but I've done it different way.

    I found a way to embed javascript files so I'm moving all the code to .js files and embed it using JsFileLink.

    For the people having the same problem - look at this thread to see how to embed .js files using
    JsFileLink control

    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bhcemh.aspx
  12. Imran
    Imran avatar
    75 posts
    Registered:
    17 Jan 2007
    31 Mar 2009
    Link to this post
    Dido

    Can you please confirm that the old EditorTemplate.ascx

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

    is actually ContentEditView.ascx in the new templates? As the code looks very different ?
  13. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    31 Mar 2009
    Link to this post
    Hi Imran,

    I think there is some misunderstanding.

    The EditorTemplate.ascx is used for custom controls, implementing the IContentContainer. These are controls, which have the RadEditor inside, and the EditorTemplate defines the RadEditor itself. If you have such control, then the mapping should be:
      <viewMap>  
        <viewSettings  
         hostType="Telerik.Cms.Engine.WebControls.HtmlContentEditor"  
         layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx" />  
      </viewMap>  
     

    ContentEditView.ascx is used in the screen where you edit your Generic Content items. This is the backend, in the Generic Content module, but not in the custom control. If you want to change this view, you can map it to the external template, and do your modifications there:

       <!-- Edits a generic content item -->  
        <viewSettings 
         hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]], Telerik.Cms.Engine"  
         layoutTemplatePath="~/Sitefinity/Admin/Externel/Generic_Content/ContentEditView.sft">  
        </viewSettings>  

    I hope this explains the confustion. Let me know if you need any further information though.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  14. Imran
    Imran avatar
    75 posts
    Registered:
    17 Jan 2007
    31 Mar 2009
    Link to this post
    Thanks for that. I've downloaded the templates, and EditorTemplate.ascx doesnt exist.

    Has it been renamed to GenericContentDesigner.ascx ?
  15. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    31 Mar 2009
    Link to this post
    Hello Imran,

    Please use the attached file.
    I will take a look at the control templates archive, and will investigate why it is missing in there.

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  16. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    14 Dec 2009
    Link to this post

    Is the code for the Configuration file below still accurate for 3.7? (not SP1 or 2)

     <!-- Edits a generic content item -->    
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]], Telerik.Cms.Engine"    
    layoutTemplatePath="~/Sitefinity/Admin/Externel/Generic_Content/ContentEditView.sft">    
        </viewSettings>    
     

    I looked through it and there is no path called "Externel". I would like to add this change to my editor so we can add scripts.
  17. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    15 Dec 2009
    Link to this post
    Hello Armysniper,

    We have never had a folder called Externel in our External Templates archive which you can download. External templates in our archive are in ~/Sitefinity/Admin/ControlTemplates/  (for backend) and ~/Sitefinity/ControlTemplates/ (for frontend). This path has been added by someone on your side. The default configuration line for this control is:
    <!-- 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" />


    Regards,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  18. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    15 Dec 2009
    Link to this post
    Hey Radi,

    Look at Dido's response to a customer and you will see Externel in the code he suggests using. And please watch the accusational tone of failure...I am the lone developer at my company.
  19. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Dec 2009
    Link to this post
    Hi Armysniper,

    This is a sample code. The template should be located in each folder you prefer. The important thing here is that the layoutTemplatePath should be set correctly.


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  20. Libby Stainer
    Libby Stainer avatar
    3 posts
    Registered:
    19 Mar 2010
    02 Jun 2010
    Link to this post
    Telerik please provide an update on the status of a hotfix for this bug. (3.7)
  21. Libby Stainer
    Libby Stainer avatar
    3 posts
    Registered:
    19 Mar 2010
    02 Jun 2010
    Link to this post
    Telerik please provide an update on the status of a hotfix for this bug. (3.7)
  22. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Jun 2010
    Link to this post
    Hi Libby Stainer,

    AllowScripts property is now deprecated. Alternatively, please use ContentFilters="None". For details refer to the following article: Content Filters

    For mapping external templates, take a look at How to map an external template

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  23. Libby Stainer
    Libby Stainer avatar
    3 posts
    Registered:
    19 Mar 2010
    02 Jun 2010
    Link to this post
    Thanks Ivan.

    Mapping an external template seems extraordinarily complicated. I was looking for a simple way to overcome this bug. Even as an experienced software engineer I don't fancy tackling those instructions!
  24. Slawek
    Slawek avatar
    16 posts
    Registered:
    16 Feb 2009
    03 Jun 2010
    Link to this post
    Exactly the same case with me I'd love to have script filtering disabled by ticking a box.
Register for webinar
24 posts, 0 answered