Strip Absolute Paths - Part 2!

4 posts, 1 answers
  1. Jason Brownhill
    Jason Brownhill avatar
    55 posts
    Member since:
    Jun 2009

    Posted 22 Jun 2010 Link to this post

    Hi Stanimir,
     I'm afraid now that I've gotten the solution working from this article, I've found another fatal flaw or bug.

     If I enter a url such as - http://test.moss/_layouts/settings.aspx into the Hyperlink manager on a page....
     
    ...at a subsite level such as - http://test.moss/demo/test/ and set the configuration to strip out the 'http://test.moss/ part of the URL, I end up with a final rendered URL of :-

    http://test.moss/demo/test/_layouts/settings.aspx

    How can I avoid this so that the hyperlink manager is ignoring the link entered in context with the subsite?

    Thanks,
    Jason.
  2. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 23 Jun 2010 Link to this post

    Hello Jason,

    Could you confirm that I understand the problem correctly? In one site (http://test.moss) you want to execute the custom filter and in another (http://test.moss/demo/test) you do not. If this is the problem, you can create a custom ConfigFile.xml file for the site that you want to have the filter enabled as it is explained in the following online help article: http://www.telerik.com/help/aspnet-ajax/different-configuration-files-for-different-webs.html. Then you set the OnClientLoad property only in it:
    <property name="OnClientLoad">OnClientLoad</property>



    Kind regards,
    Stanimir
    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

  3. Jason Brownhill
    Jason Brownhill avatar
    55 posts
    Member since:
    Jun 2009

    Posted 23 Jun 2010 Link to this post


    Hi,
     The solution to this is to remove the escaped forward slash following the URL you're stripping. The change is made to the file MOSSEditorTools.js where the custom script is inserted. The original snippet of code looks like this :-

    function OnClientLoad(editor, args)  
    {      
        editor.get_filtersManager().add(new MyFilter());  
    }  
         
    MyFilter = function()  
    {  
        MyFilter.initializeBase(this);  
        this.set_isDom(false);  
        this.set_enabled(true);  
        this.set_name("RadEditor filter");  
        this.set_description("RadEditor filter description");  
    }  
    MyFilter.prototype =  
    {  
        getHtmlContent : function(content)  
        {                        
            var newContent = content;  
                 
            //here you replace absolute URL  
            newContent = newContent.replace(/http:\/\/mossrtm\//g, "");  
            return newContent;  
        },  
         
        getDesignContent : function(content)  
        {                        
            var newContent = content;  
            return newContent;  
        }         
    }  
                     
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter); 

     The change should look like this :-

    function OnClientLoad(editor, args)  
    {      
        editor.get_filtersManager().add(new MyFilter());  
    }  
         
    MyFilter = function()  
    {  
        MyFilter.initializeBase(this);  
        this.set_isDom(false);  
        this.set_enabled(true);  
        this.set_name("RadEditor filter");  
        this.set_description("RadEditor filter description");  
    }  
    MyFilter.prototype =  
    {  
        getHtmlContent : function(content)  
        {                        
            var newContent = content;  
                 
            //here you replace absolute URL  
            newContent = newContent.replace(/http:\/\/mossrtm/g, "");  
            return newContent;  
        },  
         
        getDesignContent : function(content)  
        {                        
            var newContent = content;  
            return newContent;  
        }         
    }  
                     
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter); 

     The subtle difference is changing this :-

    newContent = newContent.replace(/http:\/\/mossrtm\//g, "");

     To this :-

    newContent = newContent.replace(/http:\/\/mossrtm/g, "");  

     Removing the '\/' before the /g

     Would this conflict with anything else that I might not have overlooked?

    Regards,
    Jason.
  4. Answer
    Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 23 Jun 2010 Link to this post

    Hello Jason,

    I am glad that you found a solution for the problem.
    I just want to explain that the code that I provided is just an example. You need to modify it so it fits your needs best.

    Would this conflict with anything else that I might not have overlooked? - I do not think that the modification you made will cause any conflicts.


    Regards,
    Stanimir
    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
Back to Top