I've built a GUI extension to 'inject' my own JavaScript into the SDL Tridion 2011 publish dialog (as explained in this post and comment: http://albertromkes.wordpress.com/2012/01/30/tridion-gui-extensions-how-to-load-a-javascript-without-showing-a-gui-element/)
I see in SDL Tridion's publish dialog (publish.js) that the publish dialog takes some parameters (not on the URL), these are passed in. For example:
var p = this.properties;
if (p.params && p.params.items && p.params.items.length > 0)
So in my JavaScript I'd like to get hold of the properties.params.items but I cannot seem to get hold of it.
My JavaScript code is inserted 'after' the publish view has loaded:
<cfg:extension target="Tridion.Web.UI.Editors.CME.Views.Popups.Publish">
<cfg:insertafter>Extensions.Resources</cfg:insertafter>
</cfg:extension>
And in my JavaScript (and in Firebug Console) I've tried to obtain the value using $display.getView().properties
, but this returns a null
object.
I've been using Firebug to look around the window
, $display
and various other objects, but cannot see a way to get to the params
object.
My JavaScript looks like this:
$evt.addEventHandler($display, "start", itemsForPublish);
function itemsForPublish() {
var p = $display.getView().properties;
var items = p.params.items || [];
alert(items);
}
This should work:
function itemsForPublish() {
alert(window.dialogArguments.items);
}
In the 'Publishing.js' (and in 'Publish.js') you can see that the items to publish are send to the Popups' dialogArguments.