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

Activate control

10 Answers 117 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
edgar.cardeira
Top achievements
Rank 1
edgar.cardeira asked on 18 Jan 2008, 11:09 AM
Hello!

How can we solve the click to activate eolas problem in rad editor. Is there any js i can edit to change the way rad inserts flash?

thanks

10 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 18 Jan 2008, 01:06 PM
Hi,

Microsoft has already stated that the problem will be fixed in a automatic update for IE in the beginning of 2008. The update is already available for download at http://support.microsoft.com/kb/945007

The code, which creates the flash is located in the following file - \Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\4.5.0.0__1f131a624888eeed\RadControls\Editor\Dialogs\FlashManager.ascx. You can edit this file and change the OkClicked JS function. This function controls what HTML code is sent back to the editor from the flash dialog. I don't think that there is an easier way to override the flash insert routine.

Kind regards,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Henrik
Top achievements
Rank 1
answered on 08 Oct 2008, 12:16 PM
The path to the .ascx file seems to have changed. I have C:\Program Files\Common Files\microsoft shared\Web Server Extensions\wpresources\RadEditorSharePoint\5.2.2.0__1f131a624888eeed, but below that there is only a Resources folder and its subfolders, and no .ascx file there. Where is this Javascript function in current version, or what is currently the best way to add custom html around the object/embed tag that is generated?
0
Lini
Telerik team
answered on 10 Oct 2008, 11:36 AM
Hi Henrik,

I think the easiest way to intercept the flash manager's output is to register a handler for the editor's pasteHtml event and check if the pasted content is coming from the flash manager. If it is, you can modify it before it is actually pasted in the content area. Here is a sample JavaScript function that does this:

function pageLoad() 
    var pasteHandler = function(sender, args) 
    { 
        if (args.get_commandName() == "FlashManager"
        { 
            var oldValue = args.get_value(); 
            args.set_value("<p class='wrapper'>"+oldValue+"</p>"); 
        } 
    } 
    if (typeof($telerik) != "undefined" && $telerik.radControls)
    { 
        for (var i=0;i<$telerik.radControls.length;i++) 
        { 
            var control = $telerik.radControls[i]; 
            if (Telerik.Web.UI.RadEditor.isInstanceOfType(control)) 
            { 
                control.add_pasteHtml(pasteHandler); 
            } 
        } 
    } 

The first part of the function defines the paste handler, which will wrap all content from the flash manager in a <p> tag. The second part of the function scans all Telerik controls on the page and attaches the paste handler to all RadEditor instances. Simply put this function on the page and it will be executed automatically by the ASP.NET AJAX framework.




About the editor dialogs - the 5.x version of the RadEditor for MOSS uses RadEditor for ASP.NET AJAX and not the classic RadEditor for ASP.NET. The new version no longer has a RadControls folder with all the dialogs, scripts, and skins - instead, all these files are embedded in the control assembly. Here is what you need to do in order to modify one of the editor dialogs in the new version:

1) set the ExternalDialogsPath property in the editor config file to point a folder in your web application. For example:

<property name="ExternalDialogsPath">/_wpresources/RadEditorSharePoint/5.2.2.0__1f131a624888eeed/Resources/Dialogs</property>

2) download the RadControls for ASP.NET AJAX hotfix archive from your Client.Net account. If you have the MOSS editor 5.22, you need to download RadControls 2008.2.826. You can also check the version of the Telerik.Web.UI assembly in your MOSS server's GAC to see which one you need to get.

3) Extract the dialog you need (e.g. FlashManager.ascx) from the EditorDialogs folder in the hotfix archive into the folder you used in the ExternalDialogsPath property. In this case it is c:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\5.2.2.0__1f131a624888eeed\Resources\Dialogs\

After that you can edit the dialog's ascx file and the next time you open the dialog from the editor you will see your changes are applied.

Best wishes,
Lini
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Henrik Hausen
Top achievements
Rank 1
answered on 14 Nov 2008, 08:45 AM
Hi, 

Trying this out now. Changed the code a little so that it doesn't cause a JavaScript error in view mode (when there is no Telerik.Web.UI.RadEditor object).

I can get the sample to work, but it is not quite what I need. What I need is to implement the Eolas patent workaround, i.e. not write HTML <object> tag directly to page, but instead write it using JavaScript. 

If I try that, nothing is stored in RadHtmlField. Below are the things I tried. Does RadHtmlField even allow HTML <script> tags in its content, or do I have to set some property to allow it (I have AllowSpecialTags=true).

This is the code, any ideas?



    function pageLoad() {
        var pasteHandler = function(sender, args) {
            if (args.get_commandName() == "FlashManager" || args.get_commandName() == "MediaManager") {
                var oldValue = args.get_value();
                //args.set_value("<p>Testing</p>"); //Works, but not what is needed
                //args.set_value("<p>Testing</p>" + oldValue); //Works, but not what is needed
                args.set_value("<script type=\"text/javascript\">document.write('<p>Testing</p>')<\/script>"); //Does not work, is not stored in RadHtmlField
                //args.set_value("<script type=\"text/javascript\">document.write('" + oldValue + "')<\/script>"); //This is what is needed. Does not work, is not stored in RadHtmlField               
            }
        }
        if (typeof ($telerik) != "undefined") {
            if ($telerik.radControls && Telerik.Web.UI.RadEditor) {
                for (var i = 0; i < $telerik.radControls.length; i++) {
                    var control = $telerik.radControls[i];
                    if (Telerik.Web.UI.RadEditor.isInstanceOfType(control)) {
                        control.add_pasteHtml(pasteHandler);
                    }
                }
            }
        }
    } 
0
Henrik Hausen
Top achievements
Rank 1
answered on 14 Nov 2008, 09:04 AM
Update: using Reflector, found the AllowScripts property which I've set to True in my custom config.xml file.

This allow me to enter script tags in the editor in HTML source view, and this works. But, script tags added in the pastehandler (see code in my previous post) are still removed from the editor, and nothing is stored.


0
Stanimir
Telerik team
answered on 14 Nov 2008, 10:42 AM
Hi Henrik Hausen,

You can find information on how to enable the use of Scripts when using RadEditor for MOSS in our online help:
http://www.telerik.com/help/aspnet-ajax/scripts-in-radeditor.html

If you need any further assistance, we will be glad to help.

Regards,
Stanimir
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Henrik Hausen
Top achievements
Rank 1
answered on 14 Nov 2008, 12:00 PM
Hi,

I found that if you insert a <script> element in the pastehandler, you must precede with "&nbsp;", otherwise the content i stripped like I wrote above. This is described in http://www.telerik.com/community/forums/aspnet/editor/inserting-script-via-a-dialog.aspx.

Another thing I found is that if try to use document.write in the script that is inserted, I will get a "Permission is denied" error when trying to switch to HTML source view or when trying to save the MOSS page.

However, this line works. It uses swfobject (now with hard-coded parameters) instead of document.write:
                args.set_value("&nbsp;<script type=\"text/javascript\">swfobject.embedSWF(\"/_layouts/TEDI/SWFObject/test.swf\", \"myContent\", \"300\", \"120\", \"9.0.0\", \"/_layouts/TEDI/SWFObject/expressInstall.swf\");<\/script>");

The next question is how to get the values for the swf file name, width and height etc dynamically. In the pastehandler, I assume that I could take them from the args parameter, but where can i find documentation for this? I've seen a couple of code examples that use args.get_value(), but what type of object is it and what methods and properties does it have? Is there a way to parse the individual properties (Flash file name, width, height) that are set in the FlashManager dialog?

If this is not possible, I should probably look at how to modify what is outputted by FlashManager before the pasteHtml event. Would I do this by modifying the FlashManager dialog or by overriding a server control, any pointers?
0
Stanimir
Telerik team
answered on 17 Nov 2008, 12:38 PM
Hello Henrik,

In forms scenarios such as Lists, Wikis, Blogs, etc. SharePoint strips all <script>, <object>, <embed>, <iframe>, etc. tags after submit. The RadEditor does not have control over the presentation view which means that we cannot control the output when it is not in edit mode.

This is why script tags added in the pastehandler are still removed from the editor and nothing is stored.


Best wishes,
Stanimir Patarinski
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Henrik Hausen
Top achievements
Rank 1
answered on 17 Nov 2008, 02:20 PM
This is not a Forms scenario, this is the WCM scenario where I have a MOSS publishing page with your RadHtmlField control, and I want to implement the Eolas workaround and Flash alternate content for Flash coming from your FlashManager dialogue. So, why are the <script> tags stripped?

FYI I have now been testing a modified version of the FlashManager dialog (FlashManager.ascx). It would seem that I can do the needed changes there (replace <object> tag with needed <script> tag), but the problem is that the <script> tag is stripped. This can be handled by adding &nbsp; before the <script> tag, but this requires making a handler for the pasteHtml event, and this does not seem to work reliably.

Do you have any other way to achieve this other use a handler for pasteHtml?

Regards,

-Henrik


0
Stanimir
Telerik team
answered on 19 Nov 2008, 11:56 AM
Hi Henrik,

Here are the steps to enable the <script> tags.

1. Set (add if not present) the AllowScripts property to true in ConfigFile.xml .
2. Replaced the original editor through SharePoint Designer. You can find the means to do that in our online help
http://www.telerik.com/help/aspnet-ajax/using-radeditor-in-web-content-management-scenario.html
Follow the instructions in Using SharePoint Designer section of the page.
3. Set AllowSpecialTags in the current page using SharePoint Designer. Click here for more information.


All the best,
Stanimir
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
WebParts for SharePoint
Asked by
edgar.cardeira
Top achievements
Rank 1
Answers by
Lini
Telerik team
Henrik
Top achievements
Rank 1
Henrik Hausen
Top achievements
Rank 1
Stanimir
Telerik team
Share this question
or