20 Answers, 1 is accepted
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
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
Should I create my own OnClientPasteHtml function in the MOSSEditorTool.js file ?
Sébastien
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
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 ?
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
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.
Does the ConfigFile.xml help to diagnose the problem ?
Kind regards,
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
>
Regards,
Stanimir
the Telerik team
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.
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
I'll try that then.
Kind regards,
Sébastien.
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.
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
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.
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
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 ?
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
Customizing the dialog made the trick.