More in this section

Forums / General Discussions / Content Block Media Manager

Content Block Media Manager

3 posts, 0 answered
  1. AmrElsayed
    AmrElsayed avatar
    87 posts
    Registered:
    18 Jul 2012
    12 Sep 2011
    Link to this post
    Hello, 

    We need to extend the Media Manager dialog by adding an extra function that would impact the html that is generated in the content block, we would like to create something like the resizing radio buttons options (please review MediaManager.png), we need to get the media manager dialog currently used in Sitefinity, I know that the editor dialogs are downloaded with the SDK in [Telerik Downloaded Path]\RadControls for ASP.NET AJAX Q2 2011\EditorDialogs but I think Sitefinity content blocks use another media manager dialog template as we can't seem to find all the html/javascript that makes up the control.

    Thanks
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    15 Sep 2011
    Link to this post
    Hello Amrelsayed,

    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. You need to modify eventArgs._argument._commandArgument in the OnClientClose event.

    Regards,
    Radoslav Georgiev
    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
  3. AmrElsayed
    AmrElsayed avatar
    87 posts
    Registered:
    18 Jul 2012
    18 Oct 2011
    Link to this post
    Thanks Radoslav, it is working properly.
3 posts, 0 answered