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

Extending Link Manager

3 Answers 122 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Sups
Top achievements
Rank 1
Sups asked on 29 Sep 2009, 04:26 PM
Hello,

I want to extend linkmanager usercontrol dialog of radeditor.
I have added a button control in LinkManager.ascx. by setting the title etc as done for 'Insert button'....

<input type="text" id="LinkURL" style="width: 222px;" />
<button type="button" id="CustomButton" style="min-width: 80px; _width: 80px; margin-left: 8px;">
<script type="text/javascript">
setInnerHtml("CustomButton", localization["Custom"]); 
</script
</button>

but when dialog opened the button's title is set as 'undefined'. How can this be acheived?

Also, I want to pass some value to the usercontrol to decide whether to show or hide this new 'custom button'.
I tried something in 'Page_PreRenderComplete' in which I have my RadEditor like ..

 Dim showcustom As Boolean = True
Dim linkManager As Telerik.Web.UI.DialogDefinition = radEHtmlContent.GetDialogDefinition("LinkManager")
linkManager.Width = "500"
linkManager.Height = "300"
linkManager.ClientCallbackFunction = ""... here can I pass the value of showcustom and how to read that in LinkManager.ascx to show/hide the 'custombutton'

Quick reply will be of great help.

Thanks  in advance.
skelkar

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 02 Oct 2009, 12:59 PM
Hi Skelkar,

Straight to the points:

1) Currently, it is not possible to localize the newly added buttons in the external dialogs. You should do that manually set the button's title and name, e.g.

<button type="button" id="Button1" title="My Button">My Button</button>

2) To pass some information (argument) from the page with RadEditor to the link manager, you should override the LinkManager command and use the argument variable:

         <telerik:radeditor  
            ID="RadEditor1"  
            ExternalDialogsPath="~/EditorDialogs" 
            runat="server"
          </telerik:radeditor>  
         
        <script type="text/javascript"
        Telerik.Web.UI.Editor.CommandList.LinkManager = function(commandName, editor, commandArgs) 
        {    
            var dialogName = commandName == "DocumentManager" ? "DocumentManager" : "LinkManager"
            var argument = "aaaa" + Telerik.Web.UI.Editor.CommandList._getLinkArgument(editor); 
            Telerik.Web.UI.Editor.CommandList._getDialogArguments(argument, "A", editor, commandName); 
 
            var callbackFunction = Telerik.Web.UI.Editor.CommandList.getCallbackFunction(commandArgs, function(sender, args) 
            { 
                var realLink = args.get_value(); 
                //backwards compatibility 
                if (!realLink) realLink = args.Result; 
                if (!realLink) realLink = args.realLink; 
 
                editor.pasteHyperLink(realLink, commandName); 
            }); 
            editor.showDialog(dialogName, argument, callbackFunction); 
            return false
        }; 
        </script>    

After that to obtain the argument information open the \EditorDialogs\LinkManager.ascx file and use the clientParameters parameter of the clientInit function:


clientInit: function(clientParameters) 
    { 
        this._clientParameters = clientParameters; 
         
        alert(clientParameters); 


Kind regards,
Rumen
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.
0
Sups
Top achievements
Rank 1
answered on 02 Oct 2009, 04:19 PM
Hello Rumen,

Thanks for quick reply.
I tried the code given in you reply but its giving me 'Object does not support property or method..' for these lines.

            Telerik.Web.UI.Editor.CommandList._getDialogArguments(argument, "A", editor, commandName); 
 
            var callbackFunction = Telerik.Web.UI.Editor.CommandList.getCallbackFunction(commandArgs, function(sender, args) 
            { 

I checked in telerik documents and it did not give any results for getCallbackfunction or _getDialogArguments in Telerik.Web.UI.Editor.CommandList. Are these methods added in new version. I am using version '2008.2.826.20' of telerik.

Also, when doing alert in LinkManager.ascx for Client Parameters it just gives 'object object'. Which property to use from ClientParameters to get the arguments passed?

Please help in this.

Thanks
Skelkar
0
Rumen
Telerik team
answered on 07 Oct 2009, 01:32 PM
Hi Skelkar,

Yes, the provided solution applies to the latest Q2 2009 version of RadControls for ASP.NET AJAX. The dialogs of RadEditor was enhanced and you cannot use the solution with the old Q2 2008 version.

My recommendation is to upgrade to the new version to achieve the required functionality.

Kind regards,
Rumen
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.
Tags
Editor
Asked by
Sups
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Sups
Top achievements
Rank 1
Share this question
or