I am trying to open the "OOB" AssetPortalBrowser.aspx from a page within a SharePoint native modal popup.
My aim is to get the selected filename back to the script. So far I was able to open the popup with the AssetPortalBrowser.aspx, but I don't know how to "close" the popup while clicking the built-in "OK" button on the AssetPortalBrowser.aspx.
When I click OK the AssetPortalBrowser.aspx page within the modal popup does not completely close. Instead the popup changes to a box with the following text:
"Please wait while your changes are processed."
and a title
"Processing...".
More specifically, I don't know where to write the code to close the form and return to the "dialogReturnValueCallback" function (just like it happens when the "Cancel" button gets clicked").
Please find below my code:
function InitiateAssetPickerPopUp(){
var context = new SP.ClientContext.get_current();
this.Web = context.get_web();
context.load(this.Web);
context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
Function.createDelegate(this, this.onFail));
}
function onSuccess(sender, args){
var options = {
title: 'My Dialog',
width: 500,
height:600,
showClose: false,
url: _spPageContextInfo.siteServerRelativeUrl+'/_layouts/AssetPortalBrowser.aspx?&AssetUrl='+_spPageContextInfo.siteServerRelativeUrl+'&RootFolder='+_spPageContextInfo.siteServerRelativeUrl+'&MDWeb='+this.Web.get_id()+'&AssetType=Link',
dialogReturnValueCallback:function(dialogResult)
{
alert(dialogResult);
}
};
SP.UI.ModalDialog.showModalDialog(options);
}
function onFail(sender, args) {
alert('Failed:' + args.get_message());
}