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

Relatives links... :(

9 Answers 250 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Samuel
Top achievements
Rank 1
Samuel asked on 18 Jul 2008, 09:20 AM
Hello,

I use "Telerik RadEditor for MOSS" and I have a problem with relative links.I use the "Hyperlink Manager" to add a link: I type my relative URL in the URL text field (for example: ./Help.aspx) and I choose the "Other" type. I click "OK".

And finally, when I take a look to the generated HTML code, I haven’t my relative link but an absolute link has been created:
http://xxx:port/website/Pages/Help.aspx

I really need use a relative link because the website will be moved on a staging and after a production server... The absolute links will point on the development server pages...  :(Please, help me! Thanks!

Regards,

Samuel

9 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 18 Jul 2008, 01:05 PM
Hello Samuel,

By default, Internet Explorer (IE) converts all relative links to absolute on the client. This behavior is due to the DOM engine of the Internet Explorer browser which “fills” the paths (href or src) for the objects in an editing area. Since RadEditor relies in most part to the Internet Explorer's engine, one may observe that the editor converts relative paths to absolute after switching to HTML mode and back to edit mode. Actually, it is Internet Explorer which is converting the links. This problem does not apply to NS/Mozilla/Firefox browsers. For v5, Telerik has employed a flexible mechanism based on regular expressions that strips absolute paths. For better performance the mechanism runs only when the user switches to HTML mode or submits the page. In order to enabled the editor absolute strip path filters you should open the ConfigFile.xml and ListConfigFile.xml files and set the StripAbsoluteImagesPaths and StripAbsoluteAnchorPaths properties to true, e.g.

  <property name="StripAbsoluteImagesPaths">true</property>
  <property name="StripAbsoluteAnchorPaths">true</property>


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Samuel
Top achievements
Rank 1
answered on 30 Jul 2008, 11:08 AM
Thanks Rumen ! You have solved my problem ! ;o)

Best regards,

Samuel
0
Nick
Top achievements
Rank 1
answered on 04 Aug 2008, 04:30 PM
A couple of quick questions:

  1. Are these config settings listed above only available when RadEditor Lite is installed? I can't find these entries in the config files when using the trial version of RadEditor v5 -- is it configured to strip out absolute paths automatically, or do i need to change something else?
  2. Even when using RadEditor Lite (with the necessary config changes made) and i add a relative link to another page using the Telerik editor, it still prepends the domain name to the URL. I can tell this by switching to the code view.  If i manually remove the domain name from the URL while in the code view and save the content, it seems to maintain the relative link. This is great, except i obviously don't want to have to manually edit each hyperlink when entering new content.  Can you tell me if i'm missing something here?

Thanks...

0
Lini
Telerik team
answered on 05 Aug 2008, 08:42 AM
Hello Nick,

The StripAbsoluteAnchorPaths and StripAbsoluteImagesPaths are not used in the new version of the MOSS full featured editor (5.x). The Lite build is based on the old version (4.x) and it respects the above properties if you set them in the configuration file.

If I understand correctly, you are using the Lite version and you have set the above properties to True. When you enter a relative URL, e.g. "/Pages/Default.aspx", the editor keeps it relative after you save the content. However, when you enter an absolute URL, e.g. "http://server/Pages/Default.aspx", the editor does not automatically convert it to be relative and it is kept absolute when you save the content. I think that this is the expected behavior - all URLs are kept the way you enter them. If you wish to force the editor to strip certain absolute paths, you need to use the AnchorPathToStrip property - http://www.telerik.com/help/aspnet/editor/radeditor-telerik.webcontrols.radeditor-anchorpathtostrip.html


Kind regards,
Lini
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nick
Top achievements
Rank 1
answered on 05 Aug 2008, 08:53 AM
To clarify, whether i'm using the lite or the full version of RadEditor, it is still adding the domain name to my relative links.  This is the same behaviour that is exhibited by the built-in Microsoft editor with Internet Explorer.

I think this is because the Hyperlink Manager button on my RadEditor instance still fires up the original Microsoft dialog -- not the Telerik one.  Is this a config setting i need to change?

NB: If i insert an image it uses the Telerik RadWindow dialog.
0
Nick
Top achievements
Rank 1
answered on 05 Aug 2008, 09:09 AM
The tooltip on the Hyperlink button in my editor actually says "MOSSLinkManager" -- not "Hyperlink Manager".
0
Nick
Top achievements
Rank 1
answered on 06 Aug 2008, 02:48 AM

Solution: You need to edit the RadEditor tools configuration file to instruct the RadEditor to use its built-in Hyperlink Manager tool instead of Microsft's MOSS Hyperlink Manager tool.

Configuration file located here:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\5.2.0.0__1f131a624888eeed\Resources\ToolsFile.xml

More details here:

http://www.telerik.com/help/aspnet-ajax/difference-between-internal-editor-and-moss-dialogs.html
0
Alan
Top achievements
Rank 1
answered on 15 Dec 2008, 10:03 AM
If you want to stick with the MOSS Hyperlink Manager tool, there is a great solution to this posted by Stanimir of the Telerik team at:

http://www.telerik.com/community/forums/sharepoint-2007/full-featured-editor/absolute-urls-to-images-documents.aspx#680247
detail from link posted below:

1. You should use the OnClientLoad property of the RadEditor to attach a handler. To do this you should add the following line in the ConfigFile.xml
<property name="OnClientLoad">OnClientLoad</property>  

2. You can use MOSSEditorTools.js to add custom java script code to RadEditor. There you should define the OnClientLoad handler and your custom content filter.
Here is an example that you may find useful:

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
        newContentnewContent = newContent.replace(/http:\/\/mossrtm\//g, ""); 
        return newContent; 
    }, 
 
    getDesignContent : function(content) 
    {                       
        var newContent = content
        return newContent; 
    }        
             
MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter); 

Just add this code at the end of MOSSEditorTools.js .

Once you follow these steps, the absolute part of the URL should be stripped.
0
Stanimir
Telerik team
answered on 15 Dec 2008, 10:48 AM
Hello Alan,

There is a small javascript error in the code bellow. It was caused by the Format Code Block tool. I forgot to specify the language.

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

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


Greetings,
Stanimir
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
WebParts for SharePoint
Asked by
Samuel
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Samuel
Top achievements
Rank 1
Nick
Top achievements
Rank 1
Lini
Telerik team
Alan
Top achievements
Rank 1
Stanimir
Telerik team
Share this question
or