Media Manager

Posted by Community Admin on 03-Aug-2018 14:57

Media Manager

All Replies

Posted by Community Admin on 17-Aug-2011 00:00

Hello,

We are using Sitefinity 4.2 in our website,  and we are using the Videos module to store and display wmv videos throughout the website.
We need to know, is there a way to extend the media manager of the content block to generate silverlight object as in the "Video" widget instead of the generated ActiveX object?

Thanks.

Posted by Community Admin on 22-Aug-2011 00:00

Hi Amrelsayed,

This can be done with an easy modification of the RadEditor template Sitefinity use. Basically the media manager dialog puts active-x object which is taken from RadEditor default dialog file.
To modify add ExternalDialogsPath property to point to the modified media manager dialog.
Here are the steps you need to take.
1. Create a custom template based on the below sample (name is not important in this case, as long as you specify the correct application relative path when mapping the template):

<%@ Control Language="C#" CodeFile="~/Controls/EditorTemplate.ascx.cs" Inherits="SitefinityWebApp.Controls.EditorTemplate"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
       
<sf:ConditionalTemplateContainer ID="conditionalTemplate" runat="server">
    <Templates>
        <sf:ConditionalTemplate ID="ConditionalTemplate1" Left="DisplayMode" Operator="Equal" Right="Read" runat="server">
            <sf:SitefinityLabel id="titleLabel_read" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfTxtLbl" />
            <sf:SitefinityLabel id="viewControl" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfRTFContent" />
        </sf:ConditionalTemplate>
        <sf:ConditionalTemplate ID="ConditionalTemplate2" Left="DisplayMode" Operator="Equal" Right="Write" runat="server">
            <sf:ResourceLinks id="resourcesLinks2" runat="server">
                <sf:EmbeddedResourcePropertySetter Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.EditorDialogs.css" Static="true" ControlID="editControl" ControlPropertyName="DialogsCssFile" />
                <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.Window.css" Static="true" />
            </sf:ResourceLinks>
            <asp:Label ID="titleLabel_write" runat="server" CssClass="sfTxtLbl" AssociatedControlID="editControl" />
            <asp:LinkButton ID="expandLink" runat="server" OnClientClick="return false;" CssClass="sfOptionalExpander" />
            <asp:Panel ID="expandableTarget" runat="server" CssClass="sfEditorWrp sfClearfix">
                <telerik:RadEditor
                    ID="editControl"
                    runat="server"
                    Skin="Sitefinity"
                    Width="100%"
                    Height="550px"
                    EnableResize="False"
                    EditModes="Design,HTML"
                    ExternalDialogsPath
                    DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"
                    Content=""
                    NewLineBr="False"
                    StripFormattingOptions="Css,Font,Span"
                    OnClientLoad="Telerik$Sitefinity$Web$UI$Fields$HtmlField$radEditorToggleAdvancedToolbars"
                    OnClientPasteHtml="OnClientPasteHtml"
                    OnClientCommandExecuting="OnClientCommandExecuting">
                    <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
                </telerik:RadEditor>
                <sf:SitefinityLabel id="descriptionLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfDescription" />
                <sf:SitefinityLabel id="exampleLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfExample" />
            </asp:Panel>      
        
            <script type="text/javascript">
                /* <![CDATA[ */
                       
                var className = null;
                var toRemove = false;
                var handlersAdded = false;
       
                function OnClientPasteHtml(sender, args)
                
                    var newContent = args.get_value();
                    newContent = newContent.replace(new RegExp("<b(\\s([^>])*?)?>", "ig"), "<strong$1>");
                    newContent = newContent.replace(new RegExp("</b(\\s([^>])*?)?>", "ig"), "</strong$1>");
                    newContent = newContent.replace(new RegExp("<i(\\s([^>])*?)?>", "ig"), "<em$1>");
                    newContent = newContent.replace(new RegExp("</i(\\s([^>])*?)?>", "ig"), "</em$1>");
                    var regex = /<([a-zA-Z]+) ?[^>]*?>\s*<\/\1>/gi;
                    newContent = newContent.replace(regex, "");
                           
                    args.set_value(newContent);
                
       
                function OnClientCommandExecuting(editor, args)
                       
                    var name = args.get_name();
                    var val = args.get_value();
                           
                    var commandName = args.get_commandName();
                    className = "re" + commandName;
                    if (editor.get_dialogOpener())
                    
                        if (editor.get_dialogOpener()._container && !handlersAdded)
                        
                            editor.get_dialogOpener()._container.add_show(AddRemoveCSSClass);
                            editor.get_dialogOpener()._container.add_close(AddRemoveCSSClass);
                            handlersAdded = true;
                        
                    
       
                    if (name == "MergeTags")
                    
                        editor.pasteHtml(val);
                        //Cancel the further execution of the command as such a command does not exist in the editor command list
                        args.set_cancel(true);
                    
       
                    if (commandName == "ToggleScreenMode")
                        var containerWnd = GetRadWindow();
                        if (!editor.isFullScreen()) //if the editor is placed in fullscreen mode specify the needed content area width
                        
                            $(editor.get_element()).addClass("sfFullScreenEditor");
                            if(containerWnd != null && !containerWnd.isMaximized())
                            
                                containerWnd.maximize();
                                $(containerWnd.get_element()).addClass("sfWndToBeRestored");
                            
                            editor.get_document().body.style.maxWidth = "640px";
                        
                        else
                        
                            $(editor.get_element()).removeClass("sfFullScreenEditor");
                            if(containerWnd != null && $(containerWnd.get_element()).hasClass("sfWndToBeRestored"))
                            
                                $(containerWnd.get_element()).removeClass("sfWndToBeRestored");
                                containerWnd.restore();
                            
                            editor.get_document().body.style.maxWidth = "100%";
                        
                    
       
                
       
                function AddRemoveCSSClass(sender, args)
                
                    var popupElement = sender.get_popupElement();
                    if (!toRemove)
                    
                        Sys.UI.DomElement.addCssClass(popupElement, className);
                    
                    else
                    
                        Sys.UI.DomElement.removeCssClass(popupElement, className);
                    
                
       
                function GetRadWindow()
                
                    var oWindow = null;
                    if (window.radWindow) oWindow = window.radWindow;
                    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                    return oWindow;
                
       
                /* ]]> */
            </script>
        </sf:ConditionalTemplate>
    </Templates>      
</sf:ConditionalTemplateContainer>
2. Next step is to create a codefile (in my case EditorTemplate.ascx.cs) where you point the Editor control to the location of your custom ToolsFile:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
       
namespace SitefinityWebApp.Controls
    public partial class EditorTemplate : System.Web.UI.UserControl
    
        protected void Page_Load(object sender, EventArgs e)
        
            editControl.PreRender += new EventHandler(editControl_PreRender);
        
       
        void editControl_PreRender(object sender, EventArgs e)
        
            editControl.ToolsFile = "~/Controls/EditorTools.xml";               // specify the app relative path to your custom ToolsFile
        
    
3. Please find the default ToolsFile we're using for the Editor, you can add your custom buttons to it according to this article from our RadEditor documentation. In the same section you can find guidance on adding custom dialogs as well
<?xml version="1.0" encoding="utf-8" ?>
<root>
    <modules>
        <module name="RadEditorStatistics" dockingZone="Bottom" visible="false" />
        <module name="RadEditorDomInspector" visible="false" />
        <module name="RadEditorNodeInspector" visible="false" />
        <module name="RadEditorHtmlInspector" visible="false" />
    </modules>
    <tools name="MainToolbar">
    <tool name="ToggleAdvancedToolbars"/>
    <tool name="Bold" shortcut="CTRL+B"/>
    <tool name="Italic" shortcut="CTRL+I"/>
    <tool name="ApplyClass" />
    <tool separator="true"/>
    <tool name="InsertOrderedList" />
    <tool name="InsertUnorderedList" />
    <tool separator="true"/>
    <tool name="LinkManager" shortcut="CTRL+K"/>
    <tool name="Unlink" shortcut="CTRL+SHIFT+K"/>
    <tool name="ImageManager" shortcut="CTRL+G"/>
    <tool separator="true"/>
    <tool name="AjaxSpellCheck"/>
    <tool separator="true"/>
    <tool name="PasteFromWord" />
    </tools>
    <tools>
    <tool separator="true"/>
    <tool name="JustifyLeft" />
    <tool name="JustifyRight" />
    <tool name="JustifyCenter" />
    <tool name="JustifyFull" />
    <tool separator="true"/>
    <tool name="Indent" />
    <tool name="Outdent" />
  </tools>
  <tools>
    <tool name="FontName" shortcut="CTRL+SHIFT+F"/>
    <tool separator="true"/>
    <tool name="RealFontSize"/>
    <tool separator="true"/>
    <tool name="FormatBlock"/>
    <tool separator="true"/>
    <tool name="ForeColor"/>
    <tool name="BackColor"/>
    <tool separator="true"/>
    <tool name="MediaManager" />
    <tool name="FlashManager" />
    <tool name="DocumentManager" />
  </tools>
  <tools>
    <tool name="InsertParagraph" />
    <tool name="InsertTable" />
    <tool name="InsertSymbol"/>
    <tool name="InsertHorizontalRule" />
    <tool separator="true"/>
    <tool name="Superscript" />
    <tool name="Subscript" />
    <tool separator="true"/>
    <tool name="FormatStripper"/>
    <tool separator="true"/>
    <tool name="FindAndReplace" shortcut="CTRL+F"/>
    <tool name="Print" shortcut="CTRL+P"/>
    <tool name="ToggleScreenMode" />
  </tools>
</root>
4. Once you have built the project, go to Sitefinity Backend -> Administration->Settings->Advanced->Controls->ViewMap and create and click on the Creae new button.
Fill in the fields accordingly (all without the quotes):
HostType: "Telerik.Sitefinity.Web.UI.Fields.HtmlField"
LayoutTemplatePath:"relative path to the template where you have declared HtmlField control"
Build the project, and restart the application, and you should have your custom tools loaded globally throughout your website in all instances of the Content editor.

Here is more info on customizing the dialog. To get the dialog file go to RadControls for ASP.NET AJAX Q2 2011\EditorDialogs folder and find MediaManager. There you will be able to type the new object you want to use.
objectParams["type"] = "application/x-oleobject";


Best wishes,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 22-Aug-2011 00:00

Hi Amrelsayed,

To follow up: In sitefinity 4.2 there is a new template for the editor. Please use this when mapping the template.

<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Extenders" TagPrefix="sf" %>
 
<sf:ConditionalTemplateContainer ID="conditionalTemplate" runat="server">
    <Templates>
        <sf:ConditionalTemplate Left="DisplayMode" Operator="Equal" Right="Read" runat="server">
            <sf:SitefinityLabel id="titleLabel_read" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfTxtLbl" />
            <sf:SitefinityLabel id="viewControl" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfRTFContent" />
        </sf:ConditionalTemplate>
        <sf:ConditionalTemplate Left="DisplayMode" Operator="Equal" Right="Write" runat="server">
            <sf:ResourceLinks id="resourcesLinks2" runat="server">
                <sf:EmbeddedResourcePropertySetter Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.EditorDialogs.css" Static="true" ControlID="editControl" ControlPropertyName="DialogsCssFile" />
                <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.Window.css" Static="true" />
            </sf:ResourceLinks>
            <asp:Label ID="titleLabel_write" runat="server" CssClass="sfTxtLbl" AssociatedControlID="editControl" />
            <asp:LinkButton ID="expandLink" runat="server" OnClientClick="return false;" CssClass="sfOptionalExpander" />
            <asp:Panel ID="expandableTarget" runat="server" CssClass="sfEditorWrp sfClearfix">
                <telerik:RadEditor
                    ID="editControl"
                    runat="server"
                    Skin="Sitefinity"
                    Width="100%"
                    Height="550px"
                    EnableResize="False"
                    EditModes="Design,HTML"
                    DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"
                    Content=""
                    NewLineBr="False"
                    StripFormattingOptions="Css,Font,Span" >
                    <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
                </telerik:RadEditor>
                <sf:RadEditorCustomDialogsExtender runat="server" id="editorCustomDialogsExtender" TargetControlID="editControl"/>
                <sf:SitefinityLabel id="descriptionLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfDescription" />
                <sf:SitefinityLabel id="exampleLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfExample" />
            </asp:Panel
 
        </sf:ConditionalTemplate>
    </Templates>       
</sf:ConditionalTemplateContainer>htmlfield


Kind regards,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 06-Sep-2011 00:00

Hello Stanislav,

We tried to map the Html field control but it's still not reflecting properly, here are the steps we followed, we are using a clean Sitefinity 4.2 installation:

1- Create a user control to map the html field control (~/CustomHtmlField.ascx)

<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Extenders" TagPrefix="sf" %>
  
<sf:ConditionalTemplateContainer ID="conditionalTemplate" runat="server">
    <Templates>
        <sf:ConditionalTemplate ID="ConditionalTemplate1" Left="DisplayMode" Operator="Equal" Right="Read" runat="server">
            <sf:SitefinityLabel id="titleLabel_read" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfTxtLbl" />
            <sf:SitefinityLabel id="viewControl" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfRTFContent" />
        </sf:ConditionalTemplate>
        <sf:ConditionalTemplate ID="ConditionalTemplate2" Left="DisplayMode" Operator="Equal" Right="Write" runat="server">
            <sf:ResourceLinks id="resourcesLinks2" runat="server">
                <sf:EmbeddedResourcePropertySetter Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.EditorDialogs.css" Static="true" ControlID="editControl" ControlPropertyName="DialogsCssFile" />
                <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.Window.css" Static="true" />
            </sf:ResourceLinks>
            <asp:Label ID="titleLabel_write" runat="server" CssClass="sfTxtLbl" AssociatedControlID="editControl" />
            <asp:LinkButton ID="expandLink" runat="server" OnClientClick="return false;" CssClass="sfOptionalExpander" />
            <asp:Panel ID="expandableTarget" runat="server" CssClass="sfEditorWrp sfClearfix">
                <telerik:RadEditor
                    ID="editControl"
                    runat="server"
                    Skin="Sitefinity"
                    Width="100%"
                    Height="550px"
                    EnableResize="False"
                    EditModes="Design,HTML"
                    DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"
                    Content=""
                     ExternalDialogsPath="~/EditorDialogs/"
                    ToolsFile="~/Tools.xml"
                    NewLineBr="False"
                    StripFormattingOptions="Css,Font,Span" >
                    <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
                </telerik:RadEditor>
                <sf:RadEditorCustomDialogsExtender runat="server" id="editorCustomDialogsExtender" TargetControlID="editControl"/>
                <sf:SitefinityLabel id="descriptionLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfDescription" />
                <sf:SitefinityLabel id="exampleLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfExample" />
            </asp:Panel>
 <script type="text/javascript">
                /* <![CDATA[ */
                        
                var className = null;
                var toRemove = false;
                var handlersAdded = false;
        
                function OnClientPasteHtml(sender, args)
                
                    var newContent = args.get_value();
                    newContent = newContent.replace(new RegExp("<b(\\s([^>])*?)?>", "ig"), "<strong$1>");
                    newContent = newContent.replace(new RegExp("</b(\\s([^>])*?)?>", "ig"), "</strong$1>");
                    newContent = newContent.replace(new RegExp("<i(\\s([^>])*?)?>", "ig"), "<em$1>");
                    newContent = newContent.replace(new RegExp("</i(\\s([^>])*?)?>", "ig"), "</em$1>");
                    var regex = /<([a-zA-Z]+) ?[^>]*?>\s*<\/\1>/gi;
                    newContent = newContent.replace(regex, "");
                            
                    args.set_value(newContent);
                
        
                function OnClientCommandExecuting(editor, args)
                        
                    var name = args.get_name();
                    var val = args.get_value();
                            
                    var commandName = args.get_commandName();
                    className = "re" + commandName;
                    if (editor.get_dialogOpener())
                    
                        if (editor.get_dialogOpener()._container && !handlersAdded)
                        
                            editor.get_dialogOpener()._container.add_show(AddRemoveCSSClass);
                            editor.get_dialogOpener()._container.add_close(AddRemoveCSSClass);
                            handlersAdded = true;
                        
                    
        
                    if (name == "MergeTags")
                    
                        editor.pasteHtml(val);
                        //Cancel the further execution of the command as such a command does not exist in the editor command list
                        args.set_cancel(true);
                    
        
                    if (commandName == "ToggleScreenMode")
                        var containerWnd = GetRadWindow();
                        if (!editor.isFullScreen()) //if the editor is placed in fullscreen mode specify the needed content area width
                        
                            $(editor.get_element()).addClass("sfFullScreenEditor");
                            if(containerWnd != null && !containerWnd.isMaximized())
                            
                                containerWnd.maximize();
                                $(containerWnd.get_element()).addClass("sfWndToBeRestored");
                            
                            editor.get_document().body.style.maxWidth = "640px";
                        
                        else
                        
                            $(editor.get_element()).removeClass("sfFullScreenEditor");
                            if(containerWnd != null && $(containerWnd.get_element()).hasClass("sfWndToBeRestored"))
                            
                                $(containerWnd.get_element()).removeClass("sfWndToBeRestored");
                                containerWnd.restore();
                            
                            editor.get_document().body.style.maxWidth = "100%";
                        
                    
        
                
        
                function AddRemoveCSSClass(sender, args)
                
                    var popupElement = sender.get_popupElement();
                    if (!toRemove)
                    
                        Sys.UI.DomElement.addCssClass(popupElement, className);
                    
                    else
                    
                        Sys.UI.DomElement.removeCssClass(popupElement, className);
                    
                
        
                function GetRadWindow()
                
                    var oWindow = null;
                    if (window.radWindow) oWindow = window.radWindow;
                    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                    return oWindow;
                
        
                /* ]]> */
            </script>
        </sf:ConditionalTemplate>
    </Templates>      
</sf:ConditionalTemplateContainer>


2- change the build action of the user control to be "Embedded Resource"
3- map the html field to this template (ViewMap.png)
4- copy the "[Telerik downloaded path]\RadControls for ASP.NET AJAX Q2 2011\EditorDialogs" folder to the root of the website
6- create "Tools.xml" file on the root of the website 

<?xml version="1.0" encoding="utf-8" ?>
<root>
  <modules>
    <module name="RadEditorStatistics" dockingZone="Bottom" visible="false" />
    <module name="RadEditorDomInspector" visible="false" />
    <module name="RadEditorNodeInspector" visible="false" />
    <module name="RadEditorHtmlInspector" visible="false" />
  </modules>
  <tools name="MainToolbar">
    <tool name="ToggleAdvancedToolbars"/>
    <tool name="Bold" shortcut="CTRL+B"/>
    <tool name="Italic" shortcut="CTRL+I"/>
    <tool name="ApplyClass" />
    <tool separator="true"/>
    <tool name="InsertOrderedList" />
    <tool name="InsertUnorderedList" />
    <tool separator="true"/>
    <tool name="LinkManager" shortcut="CTRL+K"/>
    <tool name="Unlink" shortcut="CTRL+SHIFT+K"/>
    <tool name="ImageManager" shortcut="CTRL+G"/>
    <tool separator="true"/>
    <tool name="AjaxSpellCheck"/>
    <tool separator="true"/>
    <tool name="PasteFromWord" />
  </tools>
  <tools>
    <tool separator="true"/>
    <tool name="JustifyLeft" />
    <tool name="JustifyRight" />
    <tool name="JustifyCenter" />
    <tool name="JustifyFull" />
    <tool separator="true"/>
    <tool name="Indent" />
    <tool name="Outdent" />
  </tools>
  <tools>
    <tool name="FontName" shortcut="CTRL+SHIFT+F"/>
    <tool separator="true"/>
    <tool name="RealFontSize"/>
    <tool separator="true"/>
    <tool name="FormatBlock"/>
    <tool separator="true"/>
    <tool name="ForeColor"/>
    <tool name="BackColor"/>
    <tool separator="true"/>
    <tool name="MediaManager" />
    <tool name="FlashManager" />
    <tool name="DocumentManager" />
  </tools>
  <tools>
    <tool name="InsertParagraph" />
    <tool name="InsertTable" />
    <tool name="InsertSymbol"/>
    <tool name="InsertHorizontalRule" />
    <tool separator="true"/>
    <tool name="Superscript" />
    <tool name="Subscript" />
    <tool separator="true"/>
    <tool name="FormatStripper"/>
    <tool separator="true"/>
    <tool name="FindAndReplace" shortcut="CTRL+F"/>
    <tool name="Print" shortcut="CTRL+P"/>
    <tool name="ToggleScreenMode" />
  </tools>
</root>

7- change the object type in the media manager dialog (MediaManager.png)
8- Build Application
9- Restart the website
10- Create a content block from Content > Content block, but our changes are not still reflecting (ContentBlock.png)

Posted by Community Admin on 12-Sep-2011 00:00

Hi Amrelsayed,

When using Sitefinity 4.2 please use the HTML field template from my second post. In Sitefinity 4.2 the javascript, tools file and codebehind are loaded from external files, but loaded from assemblies. When using the template you mention you should be getting error messages, but you avoid them because you have set the build action of the template to embedded resource. The embedded template will not be called, in this case with mapping templates. You don`t need to set the build action to embedded resource.

Regards,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 12-Sep-2011 00:00

Hi Stanislav,

That still isn't working, I need to know if you have tried this approach and if it has reflected properly, no matter what we set the ExternalDialogs to (Content or Embedded Resource), no changes reflect as if it is still using the embedded template.

The situation right now is like this, we are using your HTML field template (second post) and it is pointing to the ExtenalDialogs folder which contains all the dialog templates taken from the SDK, it is also pointing to the Tools.xml.

Any changes that we do in the Tools.xml reflect instantly on the control so we are assured that the mapping is correct.

However, any change that we do to the MediaManager dialog doesn't reflect on the UI whether the user control is set to Content or Embedded Resource, see the previous post attachment for samples of the changes. It seems that the site still isn't reading from the external template, we have set the ExternalDialogsPath property to point to that folder as explained.

I would really appreciete prompt support as this has been pending for quite some time.

Posted by Community Admin on 15-Sep-2011 00:00

Hi Amrelsayed,

I have managed to access the dialog media type argument with a different approach:
Create a template for the MediaManager dialog in your site root.
The template is:

<%@ Control Language="C#"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.ItemLists" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sfFields" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI.Designers" TagPrefix="sfViews" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI.Designers" TagPrefix="sfDesigners" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.ControlDesign" TagPrefix="sf" %>
 <telerik:RadWindowManager runat="server" ID="test"></telerik:RadWindowManager>
<sf:ResourceLinks ID="resourcesLinks" runat="server">
    <sf:ResourceFile JavaScriptLibrary="JQuery" />
    <sf:ResourceFile Name="Styles/ListBox.css" />
</sf:ResourceLinks>
<div class="sfSmallLargeColsDim">
    <div class="sfClearfix sfColWrapper">
        <sf:BinderSearchBox
            id="searchBox"
            runat="server"
            MinCharacters="0"
            SearchType="Contains"
            SearchFields="Title"
            DisableHighlighting="true"
            BinderBoxLabelText="<%$ Resources:Labels, NarrowByTyping %>" />
        <div class="sfLeftCol">
            <telerik:RadListBox runat="server" ID="libraryListBox" Skin="Sitefinity" Height="350" Width="125" ></telerik:RadListBox>
            <sf:RadListBoxBinder id="libraryBinder"
                runat="server"
                ServiceUrl="~/Sitefinity/Services/Content/ContentService.svc/"
                TargetId="libraryListBox"
                BindOnLoad="false"
                DataKeyNames="Id"
                DataMembers="Id, Title">
                <Containers>
                    <sf:BinderContainer ID="BinderContainer1" runat="server" RenderContainer="true">
                        <span>Title</span>
                    </sf:BinderContainer>
                </Containers>
            </sf:RadListBoxBinder>
        </div>
        <div class="sfUploadedItemWrp sfRightCol">
            <sf:ItemsList ID="mediaContentItemsList"
                runat="server"
                ServiceBaseUrl="~/Sitefinity/Services/Content/ContentService.svc/"
                BindOnLoad="false"
                AllowMultipleSelection="false"
                DataKeyNames="Id"
                ConstantFilter="Visible == true AND Status == Live"
                PageSize="20">
                <Items>
                    <sf:ItemDescription Name="ItemDescription1"></sf:ItemDescription>                
                </Items>
            </sf:ItemsList>
        </div>
    </div>
    <sfDesigners:ResizingOptionsControl id="resizingOptionsControl" runat="server" />
    Test Test <%--Here is test to see if you have sucessfuly mapped the template--%>
</div>
<script type="text/javascript">
    function GetRadWindow()
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    
    function OnClientClose(sender, eventArgs)
        if (eventArgs.get_argument() != "undefined")
            if (eventArgs.get_argument()._commandArgument != null)  
//            _argument is where the html string generated is created and written to RadEditor
                var media = "x-mplayer2";
                var silverlight = "application/x-silverlight-app";
                var replace = eventArgs._argument._commandArgument.toString();
                //provide logic that will manipulate the html
                 
                debugger;
                eventArgs._argument._commandArgument= replace;
            
        
        debugger;
    
    var oWindow = GetRadWindow();
    if (oWindow)
        oWindow.add_close(OnClientClose);
    debugger;
</script>
To map the template go to Administration->Settings->Advanced->Controls->ViewMap
HostType: Telerik.Sitefinity.Modules.Libraries.Web.UI.Designers.MediaContentSelectorView
LayoutTemplatePath:~/MediaDialog.ascx

Debugging in with Firebug you can see how the string is stored in _argument.

Kind regards,
Stanislav Velikov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 18-Oct-2011 00:00

yeah, it is working well.
Thanks Stanislav.

This thread is closed