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

Default Property of Media Manager

20 Answers 117 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
lee
Top achievements
Rank 1
lee asked on 01 Nov 2007, 08:41 AM

When I uploaded media into a post.I saw the media automatic started.
What the default property of media? automatic started?

How to set the default property of media to start by user (Auto Start = false)?

Thank you

20 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 01 Nov 2007, 01:37 PM
Hi,

You can set the AutoStart attribute to false directly from Properties dropdown in the Media manager. For your convenience I have attached a video demonstrating how to do this.

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
lee
Top achievements
Rank 1
answered on 02 Nov 2007, 04:58 AM
I understand that the user can set the AutoStart property to false. But that would be a hassle for the user to do that everytime he uploads a media file. I mean to ask if there is a way that we can set the AutoStart property to be False by default? Maybe there is a property in config file that can set default AutoStart property to False but i'm not sure about that.
0
Rumen
Telerik team
answered on 02 Nov 2007, 03:35 PM
Hi Lee,

Thank you for the additional information!

The example below demonstrates how to customize the Media manager and modify the inserted EMBED tag from the media manager to the content area and set the AutoStart attribute by default to false.

Open the Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\4.4.1.0__1f131a624888eeed\RadControls\Editor\Dialogs file and customize the OkClicked function as follows:

/* OK button clicked */
function OkClicked()
{
    if (fileBrowser.SelectedItem.Type == "D")
    {
        alert(localization[
"NoMediaSelectedToInsert"]);
        return;
    }
    if ((trim(document.getElementById("mediaWidth").value) == "") ||
        (trim(document.getElementById(
"mediaHeight").value) == ""))
    {
        alert(localization.AlertWidthHeight);
    }
    else
    {
        var mediaObject = previewer.GetHtml(); //this is a string that will be inserted representing the EMBED tag
        var oDiv = document.createElement("DIV");
        oDiv.innerHTML = mediaObject; 
        var src= oDiv.firstChild.setAttribute("AutoStart", "false");
//using this technic you can set all the properties of the media file
        CloseDlg(oDiv.innerHTML);
    }
}

Save the file, restart your browser and test the Media manager.


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sébastien Nunes
Top achievements
Rank 1
answered on 10 Mar 2011, 09:11 AM
How do I achieve the same thing with version 5.7.1.0__1f131a624888eeed because I can't find the RadControls\Editor\Dialog files ?

Should I create my own OnClientPasteHtml function in the MOSSEditorTool.js file ?

Sébastien
0
Stanimir
Telerik team
answered on 11 Mar 2011, 07:47 AM
Hello Sébastien Nunes,

You can find helpful information on how to use the OnClientPasteHtml event in the following online help articles:
http://www.telerik.com/help/aspnet-ajax/editor-onclientpastehtml.html
http://www.telerik.com/help/aspnet-ajax/moss-set-properties-via-config-file.html
Here you should know that the best place to put your javascript code is the MOSSEditorTools.js, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder.

If you want to modify the dialog it self review the flowing online help article: http://www.telerik.com/help/aspnet-ajax/moss_externaldialogspath_property.html. There is explained how to modify the FileBrowser.ascx dialog, but you can use the same approach for MediaManager.ascx. Also you can find the EditorDialogs folder containing the dialogs in the installation folder of RadControls for ASP.NET AJAX. For example C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q1 2011


All the best,
Stanimir
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Sébastien Nunes
Top achievements
Rank 1
answered on 11 Mar 2011, 10:26 AM
Hi,

Thanks for your answer, I managed to add a custom OnClientPasteHtml function and the param AutoStart is added succesfully. BUT, I have a strange behavior, when the user adds a video using the media manager the video is added and the param AutoStart is set to false in the HTML (due to my custom OnClientPasteHtml) but when the user switch to HTML mode the auto  start param is removed from the HTML tags...

How does it come ? How can I prevent that ?
0
Stanimir
Telerik team
answered on 14 Mar 2011, 07:56 AM
Hello Sébastien Nunes,

Could you provide me with the ConfigFile.xml file, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder? I will review it and advice you further.


Best wishes,
Stanimir
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Sébastien Nunes
Top achievements
Rank 1
answered on 14 Mar 2011, 09:03 AM
Hi Stanimir,

Here is the config file:
<?xml version="1.0" encoding="utf-8" ?>
<!-- ==============================================================================================
    Config File valid structure:
    <configuration>
    <property>...</property>
    ...
        <property>
            <item>...</item>
            <item>...</item>
            ...
        </property>
        ...
    </configuration>
=============================================================================================== -->
<configuration>
  <property name="ToolbarMode">ShowOnFocus</property>
  <property name="AllowScripts">true</property>
  <property name="UseSharedToolbar">true</property>
  <property name="Width">96%</property>
  <property name="ToolsWidth">500px</property>
  <property name="EnableHtmlIndentation">true</property>
  <!--Start modification 08/02/2010 nevenjo-->
  <property name="NewLineBr">false</property>
  <property name="OnClientPasteHtml">OnClientPasteHtml</property>
  <!--<property name="OnClientLoad">OnClientLoad</property>-->
  <property name="DocumentsFilters">
    <item>*.doc</item>
    <item>*.docx</item>
    <item>*.txt</item>
    <item>*.xls</item>
    <item>*.xlsx</item>
    <item>*.pdf</item>
    <item>*.ppt</item>
    <item>*.pptx</item>
  </property>
  <property name="MaxDocumentSize">209716514</property>
  <property name="MaxImageSize">209716514</property>
  <property name="MaxFlashSize">209716514</property>
  <property name="MaxMediaSize">209716514</property>
  <!--End modification-->
  <property name="ImagesPaths">
    <item>/SiteCollectionImages</item>
    <item>PublishingImages</item>
  </property>
  <property name="SPOptions-EnableAutomaticApprove">false</property>
  <property name="SPOptions-EnableAutomaticPublish">false</property>
  <property name="ContentFilters">RemoveScripts,MakeUrlsAbsolute,FixUlBoldItalic,FixEnclosingP,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent</property>
  <property name="SpellAllowAddCustom">false</property>
  <property name="ImagesFilters">
    <item>*.jpg</item>
    <item>*.jpeg</item>
    <item>*.gif</item>
    <item>*.png</item>
    <item>*.bmp</item>
  </property>
  <property name="MediaFilters">
    <item>*.wmv</item>
    <item>*.avi</item>
    <item>*.mpeg</item>
    <item>*.mpg</item>
    <item>*.mov</item>
    <item>*.flv</item>
    <item>*.m4v</item>
    <item>*.mp3</item>
    <item>*.mp4</item>
  </property>
</configuration>

Thanks for your help.

Sébastien.
0
Sébastien Nunes
Top achievements
Rank 1
answered on 15 Mar 2011, 03:44 PM
Hi,

Does the ConfigFile.xml help to diagnose the problem ?

Kind regards,

Sébastien
0
Stanimir
Telerik team
answered on 16 Mar 2011, 08:21 AM
Hello Sébastien,

I tested the issue and I was able to reproduce it. I think that the problem is in the setting of the ContentFilters property. I removed the following element from the ConfigFile.xml file
<property name="ContentFilters">RemoveScripts,MakeUrlsAbsolute,FixUlBoldItalic,FixEnclosingP,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent</property>
and the AutoStart parameter was not stripped.


Regards,
Stanimir
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Sébastien Nunes
Top achievements
Rank 1
answered on 17 Mar 2011, 10:27 AM
Hi thanks for your answer.

I'm a bit disappointed by the solution as all the ContentFilters are there for a reason.

I'm not sure the behavior of the Telerik editor will suit my business users needs if I remove all those filters.

0
Stanimir
Telerik team
answered on 17 Mar 2011, 10:56 AM
Hello Sébastien,

You can try to create your own custom filter, which will add the AutoStart parameter, regardless of the built-in filters. Here you can find information of how to do this:
Content Filters
Set Properties Via Config File


All the best,
Stanimir
the Telerik team
0
Sébastien Nunes
Top achievements
Rank 1
answered on 17 Mar 2011, 12:52 PM
Thanks Stanimir,

I'll try that then.

Kind regards,
Sébastien.
0
Sébastien Nunes
Top achievements
Rank 1
answered on 18 Mar 2011, 10:25 AM
Hi Stanimir,

I just did a test removing the ContentFilters line from the ConfigFile.xml but my Autostart param is still removed from HTML as soon as I switch to HTML mode or even if I save the save the page without switching to the HTML Mode.

Is there anything else I should check beside the ContentFilters in the ConfigFile.xml ?

Kind regards,

Sébastien.
0
Stanimir
Telerik team
answered on 22 Mar 2011, 04:25 PM
Hello Sébastien Nunes,

I tested the autostart param and indeed there is a problem with the editor. Could you send me the implementation of the OnClientPasteHtml function. I will check it and try to come with a custom solution for you.


All the best,
Stanimir
the Telerik team
0
Sébastien Nunes
Top achievements
Rank 1
answered on 24 Mar 2011, 11:36 AM
Hi Stanimir,

Thanks for your help.

Here is the code I use in the OnClientPasteHtml function:
function OnClientPasteHtml(editor, args) {
    var commandName = args.get_commandName();
  
    if (commandName == "PasteFromWord"
    {
        var value = args.get_value();
        var div = document.createElement("DIV");
        div.innerHTML = value;
        var paragraphs = div.getElementsByTagName("P");
        for (i = 0; i < paragraphs.length; i++) {
            var para = paragraphs[i]; ;
            para.style.margin = "";
  
        }
        args.set_value(div.innerHTML);                
        value = value.replace("<p style=\"margin: 0cm 0cm 0pt;\">", "<p>");
        args.set_value(value);
    }
  
    if (commandName == "MediaManager"
    {
        var value = args.get_value();
  
        if (value.toUpperCase().indexOf(".MOV") >= 0) {
            value = value.replace('type="application/x-oleobject"', 'codebase="http://www.apple.com/qtactivex/qtplugin.cab"');
            value = value.replace('classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"', 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"');
  
            value = value.replace('<param name="URL"', '<param name="src"');
            value = value.replace('<embed', '<param name="controller" value="true" /><param name="type" value="video/quicktime" /><embed');
            value = value.replace('type="application/x-mplayer2"', 'type="video/quicktime"');
            value = value.replace('pluginspage="http://www.microsoft.com/Windows/MediaPlayer"', 'pluginspage="http://www.apple.com/quicktime/download/"');
        }
          
  
        if (value.toUpperCase().indexOf("AUTOSTART") < 0)
        {          
           value = value.replace('<embed', '<param name="AutoStart" value="false"/> <embed');
        }
  
        args.set_value(value);
    }
}

Kind regards,
Sébastien.
0
Stanimir
Telerik team
answered on 28 Mar 2011, 04:10 PM
Hi Sébastien Nunes,

Thank you for the provided code it was helpful indeed. What you need to do is add the following code to your OnClientPasteHtml method:
var filterIE = editor._filtersManager.getFilterByName("IEKeepObjectParamsFilter");
var filterMozz = editor._filtersManager.getFilterByName("MozillaKeepFlashString");
value = (filterIE) ? filterIE.getDesignContent(value) : value;
value = (filterMozz) ? filterMozz.getDesignContent(value) : value;

So the method should look like this:
function OnClientPasteHtml(editor, args)
{
    var commandName = args.get_commandName();
 
    if (commandName == "PasteFromWord")
    {
        var value = args.get_value();
        var div = document.createElement("DIV");
        div.innerHTML = value;
        var paragraphs = div.getElementsByTagName("P");
        for (i = 0; i < paragraphs.length; i++)
        {
            var para = paragraphs[i]; ;
            para.style.margin = "";
 
        }
        args.set_value(div.innerHTML);
        value = value.replace("<p style=\"margin: 0cm 0cm 0pt;\">", "<p>");
        args.set_value(value);
    }
 
    if (commandName == "MediaManager")
    {
        var value = args.get_value();
 
        if (value.toUpperCase().indexOf(".MOV") >= 0)
        {
            value = value.replace('type="application/x-oleobject"', 'codebase="http://www.apple.com/qtactivex/qtplugin.cab"');
            value = value.replace('classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"', 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"');
 
            value = value.replace('<param name="URL"', '<param name="src"');
            value = value.replace('<embed', '<param name="controller" value="true" /><param name="type" value="video/quicktime" /><embed');
            value = value.replace('type="application/x-mplayer2"', 'type="video/quicktime"');
            value = value.replace('pluginspage="http://www.microsoft.com/Windows/MediaPlayer"', 'pluginspage="http://www.apple.com/quicktime/download/"');
        }
 
 
        if (value.toUpperCase().indexOf("AUTOSTART") < 0)
        {
            value = value.replace('<embed', '<param name="AutoStart" value="false"/> <embed');
        }
 
        var filterIE = editor._filtersManager.getFilterByName("IEKeepObjectParamsFilter");
        var filterMozz = editor._filtersManager.getFilterByName("MozillaKeepFlashString");
        value = (filterIE) ? filterIE.getDesignContent(value) : value;
        value = (filterMozz) ? filterMozz.getDesignContent(value) : value;
 
        alert(value);
        args.set_value(value);
    }
}


This will work with your setting of the ContentFilters property:
<property name="ContentFilters">RemoveScripts,MakeUrlsAbsolute,FixUlBoldItalic,FixEnclosingP,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent</property>



Regards,
Stanimir
the Telerik team
0
Sébastien Nunes
Top achievements
Rank 1
answered on 04 Oct 2011, 02:07 PM
Hi Stanimir,

I still have troubles with this.

I'm running IE8 and I've changed my OnClientPasteHtml method and the ContentFilters property as you suggested earlier. When I add a movie using the Media manager, the movie does not starts automatically, if I switch to HTML view, I can see that my AutoStart parameter was added in the HTML. I can switch to Preview mode and back to Design mode, the AutoStart parameter is not removed.

But as soon as I save my changes on the page or check-in/publish the page, the AutoStart Parameter is removed.

Also I review the article here http://www.telerik.com/help/aspnet-ajax/moss_externaldialogspath_property.html to modify the Dialog itself to set the AutoStart to false by default directly in the Dialog but I can't find the EditorDialogs folder from the installation folder. Actually I have no installation package at all, I just received a ZIP file with the radeditormoss.wsp

How can I achieve Dialog customization ?
0
Stanimir
Telerik team
answered on 05 Oct 2011, 06:27 AM
Hi Sébastien Nunes,

You can customize the dialog exactly as it is explained in the article, which you mention in your post:

1. Copy the EditorDialogs folder (it comes with the installation of RadControls for ASP.NET AJAX) to the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ foder.

2. Set the ExternalDialogsPath property to point to the EditorDialogs folder. In order to do this add the following element in the respective ConfigFilie.xml and ListConfigFile.xml (for list, wiki, blog ...).
<property name="ExternalDialogsPath">/_wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/EditorDialogs</property>
 
3. In your case you need to modify the MediaManager.ascx file.

Regarding the removing of the AutoStart parameter, unfortunately, this seems to be yet another problem, caused by the MOSS content filter. When you submit the page, MOSS will validate it and automatically make changes if the content is "not" valid.



Greetings,
Stanimir
the Telerik team
Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.
0
Sébastien Nunes
Top achievements
Rank 1
answered on 06 Oct 2011, 07:46 AM
Thanks for your help Stanimir,

Customizing the dialog made the trick.
Tags
WebParts for SharePoint
Asked by
lee
Top achievements
Rank 1
Answers by
Rumen
Telerik team
lee
Top achievements
Rank 1
Sébastien Nunes
Top achievements
Rank 1
Stanimir
Telerik team
Share this question
or