To open your own popup, you simply call the createExternalPopup method of the $popupManager class and pass in the URL and a few other parameters.
For example (taken from the command of my open-sourced CountItems Alchemy plug-in):
execute: function (selection)
{
var p = this.properties;
var selectedItem = this._getSelectedItem(selection);
var url = "${ViewsUrl}CountItemsPopup.aspx#selectedItem=" + selectedItem;
var height = this._getPopupHeight(selectedItem);
var parameters = "width=432px, height=" + height + "px";
var args = { popupType: Tridion.Controls.PopupManager.Type.EXTERNAL };
p.popup = $popupManager.createExternalContentPopup(url, parameters, args);
$evt.addEventHandler(p.popup, "close", this.getDelegate(this.closePopup));
p.popup.open();
}
I recommend implementing your popup window as a View (this.addInterface("Tridion.Cme.View");
) and to fire events when buttons are clicked (such as fireEvent("close")
to close the popup from the calling execute
method).
For an example, take a look at the Popup.js file in the CountItems repository. On line 6, it inherits from Tridion.Cme.View
and in the close() method it calls fireEvent
.