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

Forums / Bugs & Issues / Allow NoScript tag

Allow NoScript tag

16 posts, 0 answered
  1. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    17 Aug 2009
    Link to this post
    Is there a way to allow the noscript tag in a generic content module? Right now if someone enters a noscript tag it looks fine but when they save it and go back to edit it, the tag is empty.
  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    19 Aug 2009
    Link to this post
    Hi Connections Academy,

    You need to set the AllowScript property of RadEditor to be true.
    AllowScripts="true" and configure the ContentFilters for the RadEditor.

    To do that you need to modify every RadEditor you want to use.
    Setup
    1. You will need to use external templates for the Generic Content module.
    You need to add these lines to the Telerik.Configuration.xml:
        <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" /> 
     

    2. Add the property AllowScripts="true" in the RadEditor in the external templates. Also change the ContentFilters property
    <telerik:RadEditor   
        AllowScripts="true"  
        runat="server"   
        ContentFilters="IndentHTMLContent" 

    I hope this helps.

    Kind regards,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    25 Aug 2009
    Link to this post
    I tried your fix but could not get it to work. I noticed that the files /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx and /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentNewView.ascx are not in my visual studio project. 

    <%@ Control Language="C#" %>
    <telerik:JsFileLink id="jsLink" runat="server" ScriptType="jQuery" />

    <div class="ctrlPropsGeneric">
    <telerik:RadEditor 
        runat="server" 
        ID="textEditor"
        ContentAreaCssFile="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorContentArea.css"
        ToolsFile="~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml"    
        Skin="WebBlue"
        NewLineBr="False"
        Height="360px" 
        Width="98%"
        AllowScripts="true"
        ContentFilters="FixUlBoldItalic,FixEnclosingP,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent"> 
        <ImageManager ViewPaths="~/Images" UploadPaths="~/Images" DeletePaths="~/Images" />
        <MediaManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
        <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
        <DocumentManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
        <CssFiles>
            <telerik:EditorCssFile Value="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorCssFile.css" />
        </CssFiles>
    </telerik:RadEditor>
    <script type="text/javascript">
    Telerik.Web.UI.Editor.CommandList["LibraryImageManager"] = function(commandName, editor, args) {
    var editorArgs = editor.getSelectedElement();
    if (!editorArgs.nodeName || typeof (editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
    editorArgs = editor.getSelection();

    var myCallbackFunction = function(sender, args) {
    if (typeof (editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "IMG")
    args.parentNode.replaceChild(editorArgs, args);
    else {
    var cloned = args.cloneNode(true);
    var div = args.ownerDocument.createElement("DIV");
    div.appendChild(cloned);
    editorArgs.pasteHtml(div.innerHTML);
    }
    }
    var path = sf_AppRoot + 'Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx';
    editor.showExternalDialog(
       path,
       editorArgs,
       750,
       515,
       myCallbackFunction,
       null,
       'ImageLibraryDialog',
       true,
       Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
       false,
       true)
    };

    Telerik.Web.UI.Editor.CommandList["LibraryDocumentManager"] = function(commandName, editor, args) {
    var editorArgs = editor.getSelectedElement();
    if (!editorArgs.nodeName || typeof (editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
    editorArgs = editor.getSelection();

    var myCallbackFunction = function(sender, args) {
    if (typeof (editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "A")
    args.parentNode.replaceChild(editorArgs, args);
    else {
    var cloned = args.cloneNode(true);
    var div = args.ownerDocument.createElement("DIV");
    div.appendChild(cloned);
    editorArgs.pasteHtml(div.innerHTML);
    }
    }
    var path = sf_AppRoot + 'Sitefinity/UserControls/Dialogs/DocumentEditorDialog.aspx';
    editor.showExternalDialog(
       path,
       editorArgs,
       750,
       515,
       myCallbackFunction,
       null,
       'ImageLibraryDialog',
       false,
       Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
       false,
       true)
    };

    Telerik.Web.UI.Editor.CommandList["LinkManager"] = function(commandName, editor, args) {
    var editorArgs = editor.getSelectedElement();
    if (!editorArgs.nodeName || typeof (editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A") {
    var sel = editor.getSelection();
    editorArgs = sel;
    editorArgs.Html = sel.getHtml();
    editorArgs.Text = sel.getText();
    }

    var myCallbackFunction = function(sender, args) {
    if (typeof (editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "A")
    args.parentNode.replaceChild(editorArgs, args);
    else {
    var cloned = args.cloneNode(true);
    var div = args.ownerDocument.createElement("DIV");
    div.appendChild(cloned);
    editorArgs.pasteHtml(div.innerHTML);
    }
    }
    var path = sf_AppRoot + 'Sitefinity/UserControls/Dialogs/LinksDialog.aspx';
    editor.showExternalDialog(
       path,
       editorArgs,
       750,
       515,
       myCallbackFunction,
       null,
       'ImageLibraryDialog',
       false,
       Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
       false,
       true)
    };

    Telerik.Web.UI.Editor.CommandList["SetLinkProperties"] = function(commandName, editor, args) {
    var editorArgs = editor.getSelectedElement();
    if (!editorArgs.nodeName || typeof (editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
    editorArgs = editor.getSelection();

    var myCallbackFunction = function(sender, args) {
    if (typeof (editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "A")
    args.parentNode.replaceChild(editorArgs, args);
    else {
    var cloned = args.cloneNode(true);
    var div = args.ownerDocument.createElement("DIV");
    div.appendChild(cloned);
    editorArgs.pasteHtml(div.innerHTML);
    }
    }
    var path = sf_AppRoot + 'Sitefinity/UserControls/Dialogs/LinksDialog.aspx';
    editor.showExternalDialog(
       path,
       editorArgs,
       750,
       515,
       myCallbackFunction,
       null,
       'ImageLibraryDialog',
       false,
       Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
       false,
       true)
    };

    RadEditorCommandList["IncreaseSize"] = function(commandName, editor, oTool) {
    var currentWidth = editor.get_element().style.width; //get the width of Telerik RadEditor
    var currentHeight = editor.get_element().style.height; //get the heigh of Telerik RadEditor

    editor.SetSize(currentWidth, currentHeight + 30); //set the height size of the editor to increase with 30px
    };

    RadEditorCommandList["DecreaseSize"] = function(commandName, editor, oTool) {
    var currentWidth = editor.get_element().style.width;
    var currentHeight = editor.get_element().style.height;

    editor.SetSize(currentWidth, currentHeight - 30); //set the height size of the editor to decrease with 30px
    };
    var oldFunction = Telerik.Web.UI.Editor.CommandList["ToggleScreenMode"]; //save the original Paste function

    Telerik.Web.UI.Editor.CommandList["ToggleScreenMode"] = function(commandName, editor, args) {
    oldFunction(commandName, editor, args);
    var bd = document.getElementsByTagName("body")[0];

    if (/fullScreenMode/.test(bd.className)) {
    var rep = bd.className.match(' ' + 'fullScreenMode') ? ' ' + 'fullScreenMode' : 'fullScreenMode';
    bd.className = bd.className.replace(rep, '');

    } else {
    bd.className += bd.className ? ' ' + 'fullScreenMode' : 'fullScreenMode';
    }
    }
    </script>
    </div>
    <div class="footLinks">
        <p id="warningConainer" runat="server"><strong><asp:Literal ID="warning" runat="server"></asp:Literal></strong></p>
        <asp:LinkButton ID="ShareContent" CommandName="shareContent" runat="server" CssClass="share"></asp:LinkButton> 
        <asp:LinkButton ID="SelectContent" CommandName="selectContent" runat="server" CssClass="select"></asp:LinkButton>
    </div>

    <script type="text/javascript">

         $(document).ready(function() {
        
            var windowDiffConst = 174;
            var textEditorWrapperDiffIEConst = -57;
            
            $(window).bind('load', function() {
                
                $(".ToggleScreenMode").parent().hide();
                if($(".rwMaximizedWindow", parent.document.body).length > 0)
                {
                    var $textEditor = $("#<%= textEditor.ClientID %>");
                    var $textEditorWrapper = $textEditor.children().eq(1);

                    var editorDiff = $textEditor.height() - $textEditorWrapper.height();
                    var newHeight = $(window).height() - windowDiffConst;
                    
                    $(".ctrlPropsGeneric").eq(0).css("height",newHeight+"px");
                    
                    $textEditor.css("height",parseInt(newHeight-2)+"px");
                    $textEditorWrapper.css("height",parseInt(newHeight-4+editorDiff)+"px");
                }
            });
            if($.browser.msie && jQuery.browser.version == "6.0")
            {
                $(".RadWindow", parent.document.body).find(".rwMaximizeButton").hide();
            }
            else
            {
                var $textEditor = $("#<%= textEditor.ClientID %>");
                var $textEditorWrapper = $textEditor.children().eq(1);
                
                var editorDiff = $textEditor.height() - $textEditorWrapper.height();
                
                $(window).bind('resize', function() {
                    var newHeight = $(window).height() - windowDiffConst;
                    if($.browser.msie && (jQuery.browser.version == "7.0" || jQuery.browser.version == "8.0"))
                    {
                        editorDiff = textEditorWrapperDiffIEConst;
                    }
                    $(".ctrlPropsGeneric").eq(0).css({"height":newHeight+"px"});
                    
                    $textEditor.css({"height":parseInt(newHeight-2)+"px","min-width":"0","min-height":"0"});
                    $textEditorWrapper.css("height",parseInt(newHeight-4+editorDiff)+"px");

                });
            }
        });
        
    </script>
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    26 Aug 2009
    Link to this post
    Hi Connections Academy Developer,

    If you are using Sitefinity 3.6 or above you will not have the external templates. Since in those versions control templates are embedded we provide an additional download for the external templates. You will have to download them form your Client.Net account. Please make sure that you download the external templates for the version of Sitefinity you are using.

    Sincerely yours,
    Rado
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  5. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    26 Aug 2009
    Link to this post
    We are running 3.6 SP1 with .NET 3.5 right now. I downloaded the external templates for that version but I still do not see /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx and /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentNewView.ascx.
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    26 Aug 2009
    Link to this post
    Hi Connections Academy Developer,

    Are you sure you are looking at the correct place? Path is /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx, not /Sitefinity/ControlTemplates/Generic_Content/ContentEditView.ascx. I am sending you external templates file downloaded from the dowloads section on Sitefinity.com and it has the needed files.

    Best wishes,
    Rado
    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.
  7. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    03 Sep 2009
    Link to this post
    Thank you very much, I was able to get the correct templates but when I tried to rebuild the project, I got a bunch of "The resouce object with key 'key name here' was not found on the 2 pages I just added (/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx and /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentNewView.ascx).
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Sep 2009
    Link to this post
    Hello ,

    You should also map the external resources for these templates. The resources are located under App_LocalResources folder.

    All the best,
    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.
  9. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    09 Sep 2009
    Link to this post
    I need some more clarification on which file to add the resources to. I have files under both /Sitefinity/Admin/App_LocalResources and /Sitefinity/Admin/ControlTemplates/Generic_Content/App_LocalResources. Which file should I add the resources to?
  10. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    15 Sep 2009
    Link to this post
    Hi,

    Can you please describe us what you are trying to achieve? If you want to localize the administration of Sitefinity to some of the languages we already have, these are all the steps that you should follow:

    1. Map the templates via the ControlsConfig.xml file.
    2. Extract the resource files over the control templates. Each resource file should be in App_LocalResource directory, which is placed in the control directory. Example:

    control - \dir\Control.ascx
    resource - \dir\App_LocalResource\Control.ascx.resx

    3. Make sure that Asp.Net has read permissions over these files. 

    This should be everything. We are inheriting this technique from Asp.Net.

    Kind regards,
    Georgi
    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.
  11. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    21 Sep 2009
    Link to this post
    I am simply trying to allow users to enter noscript tags into the generic content module. I was able to add /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx and /Sitefinity/Admin/ControlTemplates/Generic_Content/ContentNewView.ascx and their appropriate resx files and my project builds successfully. I also added AllowScripts="true" and ContentFilters="IndentHTMLContent" to both files and /Sitefinity/Admin/ControlTemplates/Generic_Content/GenericContentDesigner.ascx. When I edit a generic content module, I add a noscript tag like the following (in html mode):

    <noscript>
    <div style="display:inline;">
    <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1044945553/?label=NqssCKeqigEQkbWi8gM&amp;guid=ON&amp;script=0"/>
    </div>
    </noscript>

    When I save the page and go back to edit in html mode, the script has changed to <noscript></noscript>. The problem has not been fixed.
  12. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    23 Sep 2009
    Link to this post
    Hello,

    I have contacted the RadControls teams and they informed me that this is a known issue, which exists even in the current official version of the controls suite. Therefore we should think for some kind of a workaround. Here is what I suggest you - you can use a marker in the Editor content, and replace the marker with the nocode script on the html Render.

    1. App_Code:
    InternalPageTweak.cs
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using Telerik.Cms.Web; 
    using System.Web.UI; 
    using System.IO; 
     
    /// <summary> 
    /// Summary description for InternalPageTweak 
    /// </summary> 
    namespace Telerik.Samples 
        public class InternalPageTweak : InternalPage 
        { 
            public InternalPageTweak() 
            { 
                // 
                // TODO: Add constructor logic here 
                // 
            } 
     
            protected override void Render(HtmlTextWriter writer) 
            { 
                HtmlTextWriter output = new HtmlTextWriter(new StringWriter()); 
     
                base.Render(output); 
                string outputString = output.InnerWriter.ToString().Replace("[nocode]""<nocode>yourcode</nocode>"); 
     
                writer.Write(outputString); 
            } 
        } 

    2. Register the new InternalPage class to be used with all the CMS Pages:
    Open the following file - [YourProject]\Sitefinity\cmsentrypoint.aspx

    and change:
    <%@ Page Inherits="Telerik.Cms.Web.InternalPage" MasterPageFile="~/Sitefinity/Dummy.master" %> 

    to:
    <%@ Page Inherits="Telerik.Samples.InternalPageTweak" MasterPageFile="~/Sitefinity/Dummy.master" %> 

    Save the file and test. 

    Basically, all request for CMS pages in Live View (when they are viewed through the front end) are going through this file. 

    I hope this helps, and sorry for the inconvenience. 

    Best wishes,
    Georgi
    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.
  13. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    05 Oct 2009
    Link to this post
    I tried your solution but it did not work for me and the noscript tags are still getting deleted. Is there anything else I can try?
  14. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    06 Oct 2009
    Link to this post
    Hi,

    Can you provide me an URL of a web page, where the [noscript] marker is not replaced? 

    Greetings,
    Georgi
    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.
  15. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    06 Oct 2009
    Link to this post
    Thank you for your help. I am opening a support ticket so that I can provide you with the necessary information.
  16. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    06 Oct 2009
    Link to this post
    Hi,

    Alright, we will follow up in the support thread. 

    Greetings,
    Georgi
    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.
Register for webinar
16 posts, 0 answered