Starting a new browser from RPG

Use this board to ask questions or have discussions with other Rich Displays users.
hbi
Profound User
Posts: 24
Joined: Sun Oct 30, 2011 1:04 pm
First Name: Helge
Last Name: Bichel
Company Name: Helge Bichel
Country: Denmark
Contact:

Starting a new browser from RPG

Post by hbi »

Our green screen env. enables start of a browser sesseion on users PC for showing PDF's from a document archive or PDF's created on the fly when showing print on an outq.
Doing this is in RPG is by issuing:

DoCmdString = 'WEBLINK URL(' + q + ' http://' + %trim(RmtSys)
+ '/docs/' + %trim(IFSlink) + q + ')';
Docmd(docmdstring);

The parm to cmd WEBLINK is just an URL build dynamic since the actual link is created on the fly and doesn't exists permanetly.

The cmd WEBLINK does:
DoCmdString = 'STRPCCMD PCCMD(' + q;
DoCmdString += 'rundll32 url,FileProtocolHandler ';
DoCmdString += %trim(p_request);
DoCmdString += q + ')';
DoCmdMsg = DoCmd(DoCmdString);
where p_request is the sring build by the RPG program.

Of course the STRPCCMD doesn't work when running the RPG program in a Webserver.

I am looking for doing a similar request when running in ProfoundUI webserver. I think it should be possible since Atrium enables links to webpages by specifying 'Web Application' for Action Type when creating a menu item.

Best regards
Helge
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Starting a new browser from RPG

Post by David »

Yes, STRPCCMD won't work unless you are running in a Genie session. This is because this command relies on the 5250 emulator to "scrape" the command from the 5250 stream and run it on the PC.

If you have no 5250 emulator, this doesn't work.

Genie does support STRPCCMD -- it uses a Java Applet in the browser to run the commands on the PC. You can start sessions in Genie and then call rich display applications in the job -- they are fully integrated.

Without Genie, you would have to adjust your programming so that client-side coding in the browser opens the new window:

1. RPG puts out document path into hidden field on the on the screen.

2. The hidden field is given a unique id (the id property) for access by JS code.

3. JS code (this can be setup to run on a button/link click event) reads the path from the hidden field using the "get()" API, and then uses the browser's built-in "window.open()" function to open the document in a new browser window.
hbi
Profound User
Posts: 24
Joined: Sun Oct 30, 2011 1:04 pm
First Name: Helge
Last Name: Bichel
Company Name: Helge Bichel
Country: Denmark
Contact:

Re: Starting a new browser from RPG

Post by hbi »

Thanks for the response.

But this doesn't work well since the path to the document (pdf etc.) doesn't exist when the user request a document view.

For documents residing permanently on System i IFS the recent program creates a IFS link in
/tmp/viewdoc and the new browser instance is started with an url http://mydomain.com/docs/xxxxx.pdf. (http config Alias /docs /tmp/viewdoc).

Another example is viewing spool files. Having a user friendly version of WRKSPLF allows user to email and view output. View like in traditional WRKSPLF (option 5) works also in this program. but a real view is supplied by converting the spoolfile to pdf and then starting a browser http://mydomain.com/docs/spool-on-thef-lly.pdf.

In both cases I don't have a predifined link before the user actually request viewing the document, and in case of spoolfiles I even haven't the pdf.

The sugested solution would require creation of a link, and in case of spoolfiles creation of a pdf, for every item on the overview screen for documents and spoolfiles.
This would not work well since 500+ links/pdf's would be created every day and mayby 50 actually used for viewing the pdf. Pls note the overviewws are also used for other tasks than viewing the pdf.

So what is needed is starting a new browser with a link/pdf created on the fly when user request view for a specific entry.
Maybe an alternate way could be using the HTML container widget taken care of the dynamically created link/pdf/url, but if that would work I must ensure the user can do print, and save the pdf in that window like doing it in a browser.

Hope this long explanation clarifies this very important problem. The solution in our existing green screen 5250 emulator is very simple and well working and I really hope we can do similar when runnig same programs web enabled under ProfoundUI.

Thanks for taking time to read all this. *S*
Brgds
Helge
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Starting a new browser from RPG

Post by David »

If the documents don't exist at the time the user requests the view, the way to do it is to point your link to a CGI program that first genernates the document and then opens it and outputs the contents to the HTTP response in binary mode.

We also have a product, RPGsp, that can be used to easily create RPGLE/CGI programs. Although you could also use something like CGIDEV2 or even just the OS-provided APIs.

Does this help?
hbi
Profound User
Posts: 24
Joined: Sun Oct 30, 2011 1:04 pm
First Name: Helge
Last Name: Bichel
Company Name: Helge Bichel
Country: Denmark
Contact:

Re: Starting a new browser from RPG

Post by hbi »

No, I don't think this helps getting a solution similar to the existing very simple and easy 5250 way of doing it.

Pls notice the Weblink procedure mentioned in start of this topic is also used to initiate other kind of dynamic web requests from within RPG apps.

I think it's still a must being able to either initiate a new browser session at users pc or a PUI session action as a browser.

I thought this was possible in the same way as Atrium enables Web apps by providing a http link in the menu item definition. The menu item shows up in the Atrium framework as http://mydomain.com/profoundui/atruim/menu# , so something must be executed for serving the configured link for the menu item.

I want to do it like that: executing a http link created on the fly.

Brgds
Helge
hbi
Profound User
Posts: 24
Joined: Sun Oct 30, 2011 1:04 pm
First Name: Helge
Last Name: Bichel
Company Name: Helge Bichel
Country: Denmark
Contact:

Re: Starting a new browser from RPG

Post by hbi »

Hi David.

I have digged a litle more into this problem and have a limited solution.

Creating a Rich DSPF with a Hyperlink and having the RPG setting this Hyperlink
with the dynamic created url.

onClick property for the Hyperlink is
var parmurl=get("url1"); postToNewWindow(parmurl); pui.click();

Upon display of this DSPF user clicks the Hyperlink and a new browser is initiated. The DSPF
closes and return the requesting DSPF.

This works, but isn't nice having users to do the extra click.
I tried having the above script as onLoad property, but my IE9 comes up with 'to many popup requests' even if I have alowed popups from this site.

Could we dig a bit further into this for having the PUI environment working as nice as the 5250?

Brgds
Helge
User avatar
Brian
Profound Logic Staff Member
Posts: 286
Joined: Thu Apr 14, 2011 10:23 am
First Name: Brian
Last Name: May
Company Name: Profound Logic Software
Contact:

Re: Starting a new browser from RPG

Post by Brian »

Helge,

I am working on a new feature to help you with this. Give me some time to complete it.

Brian
slmcpherson
New User
Posts: 14
Joined: Tue Nov 26, 2013 11:12 am
First Name: sheri
Last Name: mcpherson
Company Name: winwholesale, inc.
Contact:

Re: Starting a new browser from RPG

Post by slmcpherson »

Brian,
Have you come up with anything on this request? I am definitely interested in what you have come up with. thanks!
Scott Klement
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: Starting a new browser from RPG

Post by Scott Klement »

This is a very old thread, but:

1) Profound UI now (for a long time, actually) has a runPCCommand() API that can be used to run a PC command (similar to the STRPCCMD CL command, but without the length restriction).

2) Profound UI has a pui.download() API and a corresponding exit program that can be used to generate PDF files on the fly and open them.

3) There is a PUIWRKSPLF command included in Profound UI that can be used as a substitute for WRKSPLF when you wish to view the spooled files on your PC screen. It can automatically convert spooled files to PDF or text format and open them on the user's screen for viewing.

All of these are available in both Rich Displays and Genie 5250 displays, and were all added since this thread was discussed.

Does that help?
slmcpherson
New User
Posts: 14
Joined: Tue Nov 26, 2013 11:12 am
First Name: sheri
Last Name: mcpherson
Company Name: winwholesale, inc.
Contact:

Re: Starting a new browser from RPG

Post by slmcpherson »

Thank you Scott, it does help. I was going more toward actually opening another session in a browser that isn't a PDF or spoolfile.

For example, we are rebuilding a Sales Order Entry application using ProfoundUI. Part of that is we allow them to "convert a Sales Order to a Purchase Order". The users want to be able to go right to the Purchase Order that was just created from the Sales Order. What I am hoping is to be able to create some sort of link to that Purchase Order and when they click on it would open a new Genie session tab into the PO. That would eliminate all those files being left open and the possibility "recursive errors" and the user getting lost as to what is opened. Does this make any sense?
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests