Page 1 of 1

opening a pui program in a new tab

Posted: Fri May 27, 2011 12:56 am
by amc
Hi,
I have a PUI program running in an Atrium Tab. I want to click a button in that program to open & new PUI program in a new tab & change to that tab.
So, in the program I put a button with onclick event code

Code: Select all

tabref = Atrium.launchItem(117);  Atrium.activate(tabref);
117 if the program id I obtain from the edit navigation in Atrium Control Panel. When I click on the button, I get this error from chrome
chrome.png
chrome.png (9.93 KiB) Viewed 3831 times
and this error from firefox
ff.png
ff.png (4.39 KiB) Viewed 3832 times
Can somebody help me with the correct method to achieve what I want.
Thanks
Tony C
(P.S. this is version 3.0.0)

Re: opening a pui program in a new tab

Posted: Fri May 27, 2011 9:26 am
by David
There are two problems here:

1. You've run into a bug with 3.0.0 when using the Atrium.launchItem() API in conjunction with the Accordion-style menu. This will be fixed for the next update.

In the meanwhile, I've attached a patch that you can apply to fix this problem. To apply the patch, copy the file into your /www/profoundui/htdocs/profoundui/proddata/js folder, overwriting the original file.

This will allow the item to launch properly.

2. In your code, there is a slight problem. There is no Atrium.activate() API. Try Atrium.activateTab() instead.

Re: opening a pui program in a new tab

Posted: Fri May 27, 2011 9:58 am
by amc
Thanks David,

replaced the js file & corrected the script - all now works as expected.

Re: opening a pui program in a new tab

Posted: Fri May 27, 2011 10:02 am
by David
Great! Glad to hear it's working well.

Re: opening a pui program in a new tab

Posted: Fri May 27, 2011 10:27 am
by amc
David,

Can I retract my statement about all being well.

What actually happens is this.

If the PUI program #117 hasn't been opened since atrium login, then the button in the first program doesn't load it & change to it's tab - nothing happens.

However, if PUI program 117 has been open since login, then , even if it is since closed, the button in the first program will load it & change to it's tab (as expected). If PUI program 117 is still open, it will change to the correct tab (as expected).

so it looks like it's 50% fixed.

regards

Tony C

Re: opening a pui program in a new tab

Posted: Fri May 27, 2011 3:55 pm
by David
I think I might have some idea.

It seems that if the menu item is not visible (it doesn't really matter if it's actually been used or not), then the Atrium.launchItem() API is not able to call it.

Is that what you're seeing?

Re: opening a pui program in a new tab

Posted: Fri May 27, 2011 7:29 pm
by amc
yes David, you are correct, if the menu is expanded, its starts correctly even if it hasn't been run once.

Is there some switch that will cause the menus to be expanded on startup as they were previously ?

Re: opening a pui program in a new tab

Posted: Tue May 31, 2011 11:19 am
by David
You are right -- this is a problem with 3.0.0 that relates to the fact that the menus are no longer loaded all at once.

We've made a fix for the next update that will allow Atrium.launchItem() to retrieve the menu item details, even if it's not been loaded yet.

Keep an eye on the update check -- we should have an update available in the coming days.