Default Property of Media Manager

21 posts, 0 answers
  1. lee
    lee avatar
    20 posts
    Member since:
    Aug 2007

    Posted 01 Nov 2007 Link to this post

    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

  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 01 Nov 2007 Link to this post

    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

  3. lee
    lee avatar
    20 posts
    Member since:
    Aug 2007

    Posted 01 Nov 2007 Link to this post

    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.
  4. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 02 Nov 2007 Link to this post

    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
  5. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 10 Mar 2011 Link to this post

    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
  6. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 11 Mar 2011 Link to this post

    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!
  7. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 11 Mar 2011 Link to this post

    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 ?
  8. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 14 Mar 2011 Link to this post

    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!
  9. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 14 Mar 2011 Link to this post

    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.
  10. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 15 Mar 2011 Link to this post

    Hi,

    Does the ConfigFile.xml help to diagnose the problem ?

    Kind regards,

    Sébastien
  11. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 16 Mar 2011 Link to this post

    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!
  12. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 17 Mar 2011 Link to this post

    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.

  13. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 17 Mar 2011 Link to this post

    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
  14. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 17 Mar 2011 Link to this post

    Thanks Stanimir,

    I'll try that then.

    Kind regards,
    Sébastien.
  15. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 18 Mar 2011 Link to this post

    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.
  16. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 22 Mar 2011 Link to this post

    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
  17. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 24 Mar 2011 Link to this post

    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.
  18. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 28 Mar 2011 Link to this post

    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
  19. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 04 Oct 2011 Link to this post

    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 ?
  20. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 05 Oct 2011 Link to this post

    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.
  21. Sébastien Nunes
    Sébastien Nunes avatar
    30 posts
    Member since:
    Mar 2010

    Posted 06 Oct 2011 Link to this post

    Thanks for your help Stanimir,

    Customizing the dialog made the trick.
Back to Top