Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • FH 2 posts 52 karma points
    Feb 03, 2014 @ 18:28
    FH
    0

    Media Picker in Modal Popup for Custom section

    Hi

    I have this piece of code which opens a Model Window with a content picker and returns a breadrumb string for any selected node. This works in a custom area.

    What I want to do is, in a custom area, have a media picker open in a modal popup so I can get the id of the media item selected. I was hoping just to adapt this code but my changes haven't worked and also I don't know if its meant to work! The 'GetPickerurl' is depretiated but I don't know if there is a new way? I'm using umbraco 6.1.6. Many Thanks

    <script>
        function showTree() {
            var treePicker = parent.UmbClientMgr.openModalWindow('@(umbraco.uicontrols.TreeUrlGenerator.GetPickerUrl(true,"content","content"))', 'Select Redirect Target', true, 600, 425, null, null, null, function (args) {
                $.ajax({
                    type: "POST",
                    url: '/umbraco/webservices/legacyAjaxCalls.asmx/GetNodeBreadcrumbs',
                    data: '{ "nodeId": ' + args.outVal + ' }',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) {
                        var a = msg.d;
                        var name = a[a.length - 1];
                        var breadcrumbs = a.join(" > ");

                        $('p#pickedContent').html(breadcrumbs);
                    }
                });
            });
        }
    </script>
    <a href="javascript: showTree();">Pick Content</a>
    <p id="pickedContent"></p>

  • FH 2 posts 52 karma points
    Feb 05, 2014 @ 13:53
    FH
    100

    Problem fixed. After looking at the urls in the popup I could see that the string wasn't being encoded properly-

        /dialogs/treepicker.aspx?rnd=b235c90e995344f6a2e299a21013c7a8&amp;id=-1&amp;treeType=media&amp;contextMenu=true&amp;isDialog=false&amp


    It just needed Html.Raw around the call - also note the "media" parameters.

        parent.UmbClientMgr.openModalWindow('@(Html.Raw(umbraco.uicontrols.TreeUrlGenerator.GetPickerUrl("media", "media")))

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies