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

Inherit from FlashManager and customize

11 Answers 83 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 30 Nov 2010, 02:30 PM
Hi there, is it possible to Inherit from the original FlashManager and modify for example the onPasteClient ?

I'm using Telerik.Web.UI , Version 5.2.0.0__1f131a624888eeed.

11 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 02 Dec 2010, 10:37 AM
Hello Stephan,

1. I suggest you upgrade to the latest version of RadEditor for MOSS, which now is 5.8.4. You can find the upgrade instructions in the following online help article: Upgrading to a newer version of RadEditor for MOSS.

2. You can find information on how to modify the flash manager in the following online help articles:
http://www.telerik.com/help/aspnet-ajax/customizingimagedialog.html
http://www.telerik.com/help/aspnet-ajax/moss_externaldialogspath_property.html - (use the same approach for FlashManager.ascx)

3. In order to overwrite OnClientPaste you need to do the following.
Add the following code in the ConfigFile.xml or ListConfigFile.xml, which are located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder:
<property name="OnClientPasteHtml">OnClientPasteHtml</property>

Add the following code to the MOSSEditorTools.js, which is located in the mentioned above folder:
function OnClientPasteHtml(editor, args)
{
    var commandName = args.get_commandName();
 
    if (commandName == "FlashManager")
    {
        var value = args.get_value();
 
        //modify value variable to match the requirements
 
        args.set_value(value);
    }
}




Greetings,
Stanimir
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Stephan
Top achievements
Rank 1
answered on 07 Dec 2010, 01:33 PM
Hi :)

I just added the changes you suggested, but now my toolbar isn't even showing up anymore and the buttons for the editor mode don't respond on clicking. Any Idea?

Edit:
just set the toolbar mode to Default, and now I can see the toolbar again and click the buttons. They aren't responding .... :/
and the "editor" isn't accessible anymore (I just have the default "pointer"-cursor instead of the "text"-cursor)...

Edit2:
I removed onClientPaste from my Config.xml and the editor is working as before. Here is the Config.xml:#
<configuration>
  <property name="AllowThumbGeneration">True</property>
  <property name="ExternalDialogsPath">/_wpresources/RadEditorSharePoint/5.2.0.0__1f131a624888eeed/Resources/Dialogs</property>
  <property name="ConvertToXhtml">True</property>
  <!-- <property name="OnClientPasteHtml">OnClientPasteHtml</property> -->
  <property name="EnableDocking">False</property>
  <property name="ShowHtmlMode">True</property>
  <property name="ShowPreviewMode">False</property>
  <property name="ToolbarMode">Default</property>
  <property name="ToolsWidth">800px</property>
  <property name="Skin">Telerik</property>
  <property name="DocumentsPaths">
    <item>/RootSharedDocuments</item>
    <item>CurrentSiteLibraries/DocumentsLibrary</item>
    </property>
<property name="DocumentsFilters">
 <item>*.*</item>
</property>
<property name="MaxDocumentSize">4096000</property>
</configuration>


greetings Stephan
0
Rumen
Telerik team
answered on 07 Dec 2010, 02:46 PM
Hi Stephan,

The editor could become unresponsive only if there is a JavaScript error on the page. Please, check the OnClientPasteHtml function for errors.

You can also comment the lines of the function

function OnClientPasteHtml(editor, args)
{
    //var commandName = args.get_commandName();
  
    //if (commandName == "FlashManager")
    //{
        //var value = args.get_value();
  
        //modify value variable to match the requirements
  
        //args.set_value(value);
    //}
}

and see whether the problem still persists. If this fixes the problem, uncomment the lines one by one and see which one is causing the problem.

Regards,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Stephan
Top achievements
Rank 1
answered on 07 Dec 2010, 02:51 PM
well thanks for your support first.

I commented the whole code but editor is still not responding.

MOSSEditorTools.js snippet:
function OnClientPasteHtml(editor, args)
{
    //var commandName = args.get_commandName();
    //alert("commandName ist");
 
    /*if (commandName == "FlashManager") {
        var value = args.get_value();
 
        //modify value variable to match the requirements
 
        args.set_value(value);
    }*/
}

ConfigFile.xml :
<?xml version="1.0" encoding="utf-8" ?>
<!-- ==============================================================================================
    Config File valid structure:
    <configuration>
    <property>...</property>
    ...
        <property>
            <item>...</item>
            <item>...</item>
            ...
        </property>
        ...
    </configuration>
=============================================================================================== -->
<configuration>
  <property name="AllowThumbGeneration">True</property>
  <property name="ExternalDialogsPath">/_wpresources/RadEditorSharePoint/5.2.0.0__1f131a624888eeed/Resources/Dialogs</property>
  <property name="ConvertToXhtml">True</property>
  <property name="OnClientPasteHtml">OnClientPasteHtml</property>
  <property name="EnableDocking">False</property>
  <property name="ShowHtmlMode">True</property>
  <property name="ShowPreviewMode">False</property>
  <property name="ToolbarMode">Default</property>
  <property name="ToolsWidth">800px</property>
  <property name="Skin">Telerik</property>
  <property name="DocumentsPaths">
    <item>/RootSharedDocuments</item>
    <item>CurrentSiteLibraries/DocumentsLibrary</item>
    </property>
<property name="DocumentsFilters">
 <item>*.*</item>
</property>
<property name="MaxDocumentSize">4096000</property>
</configuration>
0
Stanimir
Telerik team
answered on 08 Dec 2010, 08:44 AM
Hello Stephan,

Could you confirm that the MOSSEditorTools.js file is not cached in the browser? What you can do is add the following code to check if the javascript is executing correctly:
function OnClientPasteHtml(editor, args)
{
    alert("OnClientPasteHtml is executing!!!");
}

Also could you check if there is a js error on the page where the editor is not responsive? If there is please provide me with the error message which you are receiving.


Regards,
Stanimir
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Stephan
Top achievements
Rank 1
answered on 09 Dec 2010, 10:28 AM
Hi :)

I've cleaned my Cache several times (everytime I changed something in any concerned File) <- I HAVENT!!! :D

Just thought it is enough to press strg+f5 ... but now i tried to manually clean the cache and it is working! The alert is beeing displayed after pasting the html code from FlashManager.

My Question now is: How can I change the Text which gets pasted?!

Thanks a lot!


greets

Stephan
0
Accepted
Rumen
Telerik team
answered on 09 Dec 2010, 12:07 PM
Hi Stephan,

Please see this demo: OnClientPasteHtml which provides guidance how to obtain the pasted content, modify it and paste it in the editor.

var commandName = args.get_commandName(); //returns the name of the command that is executed
//check whether the command is FlashManager
if (commandName == "FlashManager")
{
      var value = args.get_value(); //returns the content that will be pasted from the manager.
      //do the desired corrections and modifications in the value string using regular expressions or replace methdo
     // when you are ready paste the new content
      args.set_value(newContent);
}

This is a custom solution and it is up to the developer working with the control to modify the content.

Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Stephan
Top achievements
Rank 1
answered on 09 Dec 2010, 04:08 PM
Well this works fine so far! :)

The Problem I have, is that I'd like to be able to specify a special "alt"-image for every single flash object (e.g. something like an screenshot of the flash movie, to make it look nearly the same for flash/non flash users).

My first idea was to get the html from flash manager and just exchange the extension of my filename to jpg and upload a new jpg image with the same prefix/name. Now my problem was that FlashManager doesn't allow the upload of other filetypes then swf. And I wasn't able to add a field to FlashManager where the user can specify the certain alt images :/

Here is my OnClientPasteHtml:
function OnClientPasteHtml(editor, args) {
    var commandName = args.get_commandName();
     
    if (commandName == "FlashManager") {
        var value = args.get_value();
         
        //Height
        var start = value.indexOf("height=");
        var height = value.substring(start, start + 12);
        alert(height);
         
        //Width
        start = value.indexOf("width=");
        var width = value.substring(start, start + 11);
        alert(width);
 
        var widthPix = width.replace(/width=/, "");
        var heightPix = height.replace(/height=/, "");
        alert(widthPix);
        alert(heightPix);
         
        //Path and Filename
        start = value.indexOf("flashSrc=");
        var path = value.substring(start + 10, value.length);
        var end = path.indexOf(" width");
        path = path.substring(0, end-1);
        var file = path;
        alert(file);
        path = path.substring(0, path.lastIndexOf("/"))+"/";
        alert(path);
        var imagefile = file.substring(0, file.length - 3) + "jpg";
 
           //for testing purposes only:
          value =
"<script type=\"text/javascript\" src=\"_wpresources/RadEditorSharePoint/5.2.0.0__1f131a624888eeed/Resources/swfobject/swfobject.js\"></script>";
        value = value.concat("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 \"" + width + " " + height + " >");
        value = value.concat("\n<param name=\"movie\" value=\"" + file + "\" />");
        value = value.concat("\n<!--[if !IE]>-->");
        value = value.concat("\n<object type=\"application/x-shockwave-flash\" data=\"" + file + "\" " + width + " " + height + ">");
        value = value.concat("\n<!--<![endif]-->");
        value = value.concat("\n <img src=\"" + imagefile+ "\"" + " name=\"flashcontent\" " + width + " " + height + " />");
        value = value.concat("\n<!--[if !IE]>-->");
        value = value.concat("\n</object>");
        value = value.concat("\n<!--<![endif]-->");
        value = value.concat("\n</object>");      
        
        args.set_value(value);
        alert(value);
    }
}
0
Stephan
Top achievements
Rank 1
answered on 14 Dec 2010, 03:03 PM
Hi there, its me again! :)

So far everything went nice, the only problem left is a different behaviour of IE.

I'm using now swfobject and I prompt the user to specify an alt-img for the flash content, and if he isn't entering anything, I delete the alternative content complete:
if (alt != ""&&alt!=null) {
    //alert(alt);
    imagefile = path + alt;
    value = value.concat("\n <img src=\"" + imagefile + "\"" + " name=\"flashcontent\" " + width + " " + height + " />");           
}

Also this thing works fine ... The Problem is that my value isn't properly posted into rad-editor. I do this by:
...
        value = value.concat("\n<!--[if !IE]>-->");
        value = value.concat("\n</object>");
        value = value.concat("\n<!--<![endif]-->");
        value = value.concat("\n</object>\n");
        args.set_value(value);
        alert(value);

And the last alert shows the text I'd like to insert (see attachement) but my rad-editor keeps staying empty (you can see the cursor jump down very quick as if something is inserted and then the cursor jumps back to the first line)
0
Rumen
Telerik team
answered on 20 Dec 2010, 07:33 AM
Hi Stephan,

We were able to reproduce the problem, but we will need more time to find and provide a solution. We will write back later this week with more information.

Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Rumen
Telerik team
answered on 05 Jan 2011, 10:27 AM
Hi Stephan,

I just want to inform you that the problem is still not resolved, but the issue is logged in our PITS system and you can check its status here: Public URL.

Kind regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
Stephan
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Stephan
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or