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(" > ");
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>
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&id=-1&treeType=media&contextMenu=true&isDialog=false&
It just needed Html.Raw around the call - also note the "media" parameters.
parent.UmbClientMgr.openModalWindow('@(Html.Raw(umbraco.uicontrols.TreeUrlGenerator.GetPickerUrl("media", "media")))
is working on a reply...