New Web Browser Tab
-
- Profound User
- Posts: 26
- Joined: Wed Jun 24, 2015 9:33 am
- First Name: Robert
- Last Name: Mullis
- Company Name: UFCW
- Contact:
New Web Browser Tab
I have a screen that has a subfile list of "groups". When I click on a "group" in the list, a program specific to that "group" is opened. I would like to open this program in a new tab in my browser. Is this possible and if so how? Also, does the new tab carry over the library list and userid of the previous tab?
Thanks in advance,
Robert
Thanks in advance,
Robert
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: New Web Browser Tab
The Profound UI environment uses what's called a "Single Page Application". This means that each time you start a session, there is only one web page shown. Each time a display changes, it uses DHTML to modify the web page. This allows for the fastest performance and the most RPG-like behavior.
Unfortunately, this also means that in order to open a new browser tab, you have to start a new Profound UI session. That session will start over with regards to signing on to the system, setting up it's library list, and so forth.
One easy way to solve the sign-on issue is to use browser authentication. To do that, start your sessions with an /auth/ URL like this:
http://YOUR-SERVER:PORT/profoundui/auth/start
Using /auth/ like this causes the browser to prompt you for sign on information rather than showing the sign-on screen. The advantage to that is that the browser will remember your sign on until you close the browser. You can, therefore, launch as many sessions as you want without signing on again.
With that in mind, you can launch a new session in a new window with JavaScript. For example, add a button to your screen and set the "onclick" event to code like this:
Now comes the tricky part... making it run a different program in the new session. To do that, I would recommend creating a CL program that is set as the user's "initial program". You can pass parameters to that CL program to tell it what to start. For example, the CL program may look like this:
So this program will call an RPG program named 'DFTPGM' if no parameters are passed to it. Or, if a parameter is passed, it will call a program with whatever program name is given in the parameter. Many more things could be done in this CL program, of course... For example, it could validate that the program is in a list of allowed programs. And/or it could have code to set up the library list, etc. I'm sure you can modify it to suit your needs.
Anyway, set the user's intiial program to the above program. For example, if this program is called STARTPUI then the initial program could look like this: Now that user starts his session at http://YOUR-SERVER:PORT/profoundui/auth/start and it will run DFTPGM.
Then DFTPGM has a Rich Display containing a button that opens a new tab. In that new tab you want to run PGM2, so you set the 'onclick' for the button to:
This starts PGM2 in the new tab.. because you used /auth/, it does not ask for the userid/password again, but automatically logs on with the same userid/password as before.
Hope that helps!
Unfortunately, this also means that in order to open a new browser tab, you have to start a new Profound UI session. That session will start over with regards to signing on to the system, setting up it's library list, and so forth.
One easy way to solve the sign-on issue is to use browser authentication. To do that, start your sessions with an /auth/ URL like this:
http://YOUR-SERVER:PORT/profoundui/auth/start
Using /auth/ like this causes the browser to prompt you for sign on information rather than showing the sign-on screen. The advantage to that is that the browser will remember your sign on until you close the browser. You can, therefore, launch as many sessions as you want without signing on again.
With that in mind, you can launch a new session in a new window with JavaScript. For example, add a button to your screen and set the "onclick" event to code like this:
Code: Select all
window.open("/profoundui/auth/start");
Code: Select all
PGM PARM(&TEMP)
DCL VAR(&TEMP) TYPE(*CHAR) LEN(10)
DCL VAR(&PGM) TYPE(*CHAR) LEN(10)
CHGVAR VAR(&PGM) VALUE(&TEMP)
MONMSG MSGID(CPF0000) EXEC(DO)
CHGVAR VAR(&PGM) VALUE(DFTPGM)
ENDDO
CALL PGM(&PGM)
MONMSG MSGID(CPF0000) EXEC(DO)
DSPJOBLOG OUTPUT(*PRINT)
MONMSG CPF0000
ENDDO
ENDPGM
Anyway, set the user's intiial program to the above program. For example, if this program is called STARTPUI then the initial program could look like this: Now that user starts his session at http://YOUR-SERVER:PORT/profoundui/auth/start and it will run DFTPGM.
Then DFTPGM has a Rich Display containing a button that opens a new tab. In that new tab you want to run PGM2, so you set the 'onclick' for the button to:
Code: Select all
window.open("/profoundui/auth/start?p1=PGM2&l1=10");
Hope that helps!
-
- Profound User
- Posts: 26
- Joined: Wed Jun 24, 2015 9:33 am
- First Name: Robert
- Last Name: Mullis
- Company Name: UFCW
- Contact:
Re: New Web Browser Tab
Hi Scott. Thanks for your help.
I have a couple of questions. First, I used the /auth/ URL you listed with my server and port number. All I get is a PUI message saying my session ended with two buttons, one for "New Session" and one for "Close"'. Am I missing something? Second, if I wanted to pass two parms on my second call, the first 1 char long and the second as 15 char, what would that look like?
I have a couple of questions. First, I used the /auth/ URL you listed with my server and port number. All I get is a PUI message saying my session ended with two buttons, one for "New Session" and one for "Close"'. Am I missing something? Second, if I wanted to pass two parms on my second call, the first 1 char long and the second as 15 char, what would that look like?
- Glenn
- Profound Logic Staff Member
- Posts: 124
- Joined: Mon Apr 14, 2014 4:08 pm
- First Name: Glenn
- Last Name: Hopwood
- Company Name: Profound Logic Software
- State / Province: Ohio
- Country: United States
- Contact:
Re: New Web Browser Tab
Robert,
For your first question.. Did you modify Scott's example CL to point at your normal/expected initial program instead of 'DFTPGM'?
The answer to your second question is 'yes', you can pass 2 parameters. More info here: http://www.profoundlogic.com/docs/displ ... +Interface
The format would be something like this:
Glenn
For your first question.. Did you modify Scott's example CL to point at your normal/expected initial program instead of 'DFTPGM'?
The answer to your second question is 'yes', you can pass 2 parameters. More info here: http://www.profoundlogic.com/docs/displ ... +Interface
The format would be something like this:
Code: Select all
window.open("/profoundui/auth/start?p1=PGM2&l1=10&p2=parm2&l2=<Length of parm>");
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: New Web Browser Tab
Robert,
When you launch a Rich Display session and the program never reaches a statement where it asks the user for input (such as an EXFMT or READ statement against a Rich Display screen) it will do what you've described and immediately go to the "Session Ended" screen.
If you haven't done so already, please take a few minutes to familiarize yourself with the CL program I posted. It's a pretty short/simple program, so should be easy to understand. But, there are some clues there, for example, this:
That code says that if any errors occur running the program you've specified, it will print the job log (so that will be in the spool somehwhere) and end. So that would be a situation where you'd see the symptom you've described -- an error calling the program would cause it to end without displaying a screen. (Of course, this is not the only possible cause.)
You might look in the spool for a job log, if one is there it should tell you what the error was.
Hope that helps you find the problem...
When you launch a Rich Display session and the program never reaches a statement where it asks the user for input (such as an EXFMT or READ statement against a Rich Display screen) it will do what you've described and immediately go to the "Session Ended" screen.
If you haven't done so already, please take a few minutes to familiarize yourself with the CL program I posted. It's a pretty short/simple program, so should be easy to understand. But, there are some clues there, for example, this:
Code: Select all
CALL PGM(&PGM)
MONMSG MSGID(CPF0000) EXEC(DO)
DSPJOBLOG OUTPUT(*PRINT)
MONMSG CPF0000
ENDDO
You might look in the spool for a job log, if one is there it should tell you what the error was.
Hope that helps you find the problem...
-
- New User
- Posts: 15
- Joined: Wed Aug 18, 2010 10:43 am
- First Name: Darlene
- Last Name: Cutter
- Company Name: Grand Rapids Label Company
- Contact:
Re: New Web Browser Tab
I've been wanting to do something like this for a long time . . . so thanks for the info on how to accomplish it! I do have one question though. I am able to log in like we normally do using "//ourserver:port/profoundui/start" and logging in without using the "/auth/start" and not passing paramaters. This calls our default program. Then from our main screen, I am able to use the window.open example that you provided using "//ourserver:port/profoundui/auth/start?. . ." passing paramaters and it seems to be working just fine. Will this cause any issues since I'm mixing the 2 log in options?
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: New Web Browser Tab
Hi Darlene,
The only purpose behind using /auth/ is to prevent the user from having to sign in a second time. Otherwise, it will work fine.
Once you've done one session that uses browser authentication (i.e. the visual designer, genie admin, Atrium, or a URL using /auth/) the browser will remember it and won't ask you to sign in again until you close the browser and re-open it.
However, if you do close the browser and re-open it, then try your scenario (running /profoundui/start followed by /profoundui/auth/start) you'll see that it asks you to sign in twice. The users might think it's strange to have to sign in twice like that... If you use /auth/ for the whole process, they'll only have to sign-in once.
If you don't mind signing in twice, then there's no problems with the scenario you described.
The only purpose behind using /auth/ is to prevent the user from having to sign in a second time. Otherwise, it will work fine.
Once you've done one session that uses browser authentication (i.e. the visual designer, genie admin, Atrium, or a URL using /auth/) the browser will remember it and won't ask you to sign in again until you close the browser and re-open it.
However, if you do close the browser and re-open it, then try your scenario (running /profoundui/start followed by /profoundui/auth/start) you'll see that it asks you to sign in twice. The users might think it's strange to have to sign in twice like that... If you use /auth/ for the whole process, they'll only have to sign-in once.
If you don't mind signing in twice, then there's no problems with the scenario you described.
-
- New User
- Posts: 15
- Joined: Wed Aug 18, 2010 10:43 am
- First Name: Darlene
- Last Name: Cutter
- Company Name: Grand Rapids Label Company
- Contact:
Re: New Web Browser Tab
Thanks Scott . . . I see what you mean about the double log in.
I'm also having an issue when I use Chrome instead of IE. When I use Chrome, the ampersands in the url are getting changed from & to & which doesn't work to open the program I want it to.
In my screen I am using this code: window.open(get("Program")); "Program" contains the url string with 2 paramaters that I am passing to my initial program.
In IE, it works great and opens a new window with the url of:
//server:port/profoundui/auth/start?p1=2&l1=10&p2=6084&l2=100
In Chrome, it opens a new window with the url of:
//server:port/profoundui/auth/start?p1=2&l1=10&p2=6084&l2=100
Do you know why it would be adding amp; for each ampersand?
I'm also having an issue when I use Chrome instead of IE. When I use Chrome, the ampersands in the url are getting changed from & to & which doesn't work to open the program I want it to.
In my screen I am using this code: window.open(get("Program")); "Program" contains the url string with 2 paramaters that I am passing to my initial program.
In IE, it works great and opens a new window with the url of:
//server:port/profoundui/auth/start?p1=2&l1=10&p2=6084&l2=100
In Chrome, it opens a new window with the url of:
//server:port/profoundui/auth/start?p1=2&l1=10&p2=6084&l2=100
Do you know why it would be adding amp; for each ampersand?
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: New Web Browser Tab
Darlene,
That happens when you output data to a label or output field on the display. Since & has a special meaning in HTML, it changes it to & so that the user will see the & character on the screen.
When you retrieve the value with get(), it of course will contain the escaped value. It's funny that you say it doesn't do this in IE11 -- it does this for me in all web browsers.
Try changing your URL ("Program") widget to a textbox instead of an outputfield/label widget. If the field is hidden, it shouldn't matter whether it's an output field or text box. If it's visible, then add the PR CSS class to protect it from the user entering anything. See if that helps.
Alternately, you could use a find/replace to decode the & back to &. But this only does ampersands and not all of the possible entities, and therefore I consider it to be a hack. I would use the above method instead.
That happens when you output data to a label or output field on the display. Since & has a special meaning in HTML, it changes it to & so that the user will see the & character on the screen.
When you retrieve the value with get(), it of course will contain the escaped value. It's funny that you say it doesn't do this in IE11 -- it does this for me in all web browsers.
Try changing your URL ("Program") widget to a textbox instead of an outputfield/label widget. If the field is hidden, it shouldn't matter whether it's an output field or text box. If it's visible, then add the PR CSS class to protect it from the user entering anything. See if that helps.
Alternately, you could use a find/replace to decode the & back to &. But this only does ampersands and not all of the possible entities, and therefore I consider it to be a hack. I would use the above method instead.
Code: Select all
window.open(get("Program").replace(/&/g, "&"));
-
- New User
- Posts: 15
- Joined: Wed Aug 18, 2010 10:43 am
- First Name: Darlene
- Last Name: Cutter
- Company Name: Grand Rapids Label Company
- Contact:
Re: New Web Browser Tab
Scott,
Thanks so much again!! I switched it to a textbox and it worked great!
Thanks so much again!! I switched it to a textbox and it worked great!
Who is online
Users browsing this forum: No registered users and 4 guests