This is a migrated thread and some comments may be shown as answers.

Strip Absolute Paths - Part 2!

3 Answers 35 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Jason Brownhill
Top achievements
Rank 1
Jason Brownhill asked on 22 Jun 2010, 04:44 PM
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.

3 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 23 Jun 2010, 09:12 AM
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
0
Jason Brownhill
Top achievements
Rank 1
answered on 23 Jun 2010, 09:19 AM

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.
0
Accepted
Stanimir
Telerik team
answered on 23 Jun 2010, 11:08 AM
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
Tags
WebParts for SharePoint
Asked by
Jason Brownhill
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Jason Brownhill
Top achievements
Rank 1
Share this question
or