4

I'm making a GUI Extension.

Adding new context menu to SDL Web 8, and open ASP.NET as pop up page by clicking the context menu.I need to pass selected folder's TCMURI to the ASP.NET page, so I use $popupManager.createExternalContentPopup function and pass folder's TCMURI as a parameter. But on Internet Explorer and Google Chrome, it failed to get folder's TCMURI from the ASP.NET page(only Firefox is no problem).

So I made following test program(GUI Extension) and examined whether passing value to pop up page is possible.

GUI Extension's JavaScript

Type.registerNamespace("ImageUploader.UI.Editor.Commands");

ImageUploader.UI.Editor.Commands.ImageUploader = function Commands$ImageUploader() {
    Tridion.OO.enableInterface(this, "ImageUploader.UI.Editor.Commands.ImageUploader");
    this.addInterface("Tridion.Web.UI.Editors.Base.Commands.CommandBase", ["ImageUploader"]);
};

ImageUploader.UI.Editor.Commands.ImageUploader.prototype._isAvailable = function DealerImport$_isAvailable(selection) {
    return true;
};

ImageUploader.UI.Editor.Commands.ImageUploader.prototype._isEnabled = function DealerImport$_isEnabled(selection) {
    return true;
};

ImageUploader.UI.Editor.Commands.ImageUploader.prototype._execute = function ImageUploadert(selection) {
    $popupManager.createExternalContentPopup("/WebUI/Editors/BinaryUploadExtension/test.html", "width=820px,height=550px,resizable=1,status=1", {para:"test value"}).open();
};

Pop up page(test.html)

<html>
<head>
</head>
<body>
<script>
alert("window.dialogArguments.para:" + window.dialogArguments.para);
</script>
</body>
</html>

Result is following.

  • Internet Explorer:NG
  • Google Chrome:NG
  • Firefox:OK

(When NG, dialogArguments is "undifined")

"createExternalContentPopup" is used in SDL Web 8's JavaScript, so I believe it works.

But SDL Web 8 pass folder's TCMURI by URL parameter, like this.

/WebUI/item.aspx?tcm=16#type=tcm:16&org=tcm:15-7-2&pub=tcm:0-15-1&sub=0

Is it possible to pass value to pop up page by "createExternalContentPopup" function on any browser?

Which does SDL Web 8 get folder's TCMURI from URL parameter, or JavaScript parameter(dialogArguments)?

3

That is indeed the correct way to pass arguments to an 'external' popup. You are just missing the right way to read them again.

To do so, you should register a view ($display.registerView) in your popup that inherits (perhaps indirectly) from Tridion.Web.UI.Editors.Base.Views.ViewBase. After the base initialize method has been called, you can then use the this.getDialogArguments() method to get all of the parameters.

As you noticed, another option for things like URIs is to pass it in the URL as a hash parameter. Usually this is reserved for items you want to be able to bookmark/favorite so the number of parameters are kept very low. To read hash parameters in your popup, you can use the $url.getHashParam("uri") method.

  • I researched SDL Web 8's JavaScripts, but I couldn't find how JavaScript and ASPX is related(how is "Component.js" used when "Component.aspx" is called). Could you tell me about that? – Hirokazu Shikata Sep 14 '16 at 8:20
  • It's specified in the configuration of your editor. There's an obvious naming convension there, but you could call the file anything you want -- you just need a group that contains the JS file and is being included in your popup. – Peter Kjaer Sep 14 '16 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.