Page 1 of 2

Adding a "Favorites" hyper link to all screens

Posted: Sun Jan 17, 2016 11:42 am
by rasaro
Hello,

I am looking for a way to add a "Favorites" hyperlink that is available in the header area on all screens (Genie and Profound UI Rich Displays). An example would be very helpful.

Thanks, Rick

Re: Adding a "Favorites" hyper link to all screens

Posted: Mon Jan 18, 2016 11:57 am
by Scott Klement
Atrium has a "favorites" feature. Also, your browser has a "favorites" or "bookmarks" feature. Can you explain why you'd prefer to write your own and what it'd do differently?

Also, are you running everything in a Genie session? (Rich Displays and 5250 displays?) If so, what is your plan to deal with keeping the session active, rather than breaking it? Or, don't you mind breaking it?

Re: Adding a "Favorites" hyper link to all screens

Posted: Mon Jan 18, 2016 12:36 pm
by rasaro
Scott, all of our users log into our menu system. The menu system has options that they process for their daily work. We have always allowed them to access their favorite menu options using the Esc attention key. In Genie and the Rich UI the Esc key does not work. So I created a Favorites hyperlink coded to fire off your new pui.runAttnProgram() API.

This link work great on our Menu system screen which I already converted the DDS source. Now I would like to add this capability globally to all of the other screens that they use (Genie and Profound UI Rich).

So for example, a user is in the invoice entry program and are entering an invoice for a vendor but they forgot to enter the vendor master record first. Well, instead of getting out of the invoice entry program, they use their favorites link and pull up the vendor maintenance program and enter the vendor, exit this program and they can finish entering the invoice.

Thanks.

Re: Adding a "Favorites" hyper link to all screens

Posted: Mon Jan 18, 2016 2:42 pm
by Scott Klement
Rick,

Thanks for that explanation, that helps a lot! Your original question sounded like you wanted a traditional HTML hyperlink, which would open a new web page when you click it, which would create all sorts of interesting challenges. Now that I know the goal is to run the "Attention Key" in a Profound UI window, that really changes things a lot.

I still need more information, however, on how you're running this. Are you running this all in Genie, such that it'd make sense to put this hyperlink into your Genie skin? Or do you run your Rich Displays in a separate environment?

-SK

Re: Adding a "Favorites" hyper link to all screens

Posted: Mon Jan 18, 2016 3:28 pm
by rasaro
Right now we are strictly Genie except for the attached menu system source which I converted the DDS for. But we will want this same hyperlink for Profound UI Rich displays going forward. So the Favorites hyperlink on the MN010C1 screen, we would want on all screens. Thanks.

Re: Adding a "Favorites" hyper link to all screens

Posted: Wed Jan 20, 2016 10:56 am
by Scott Klement
Rick,

I'm not asking you which displays you've converted so far.

I'm asking you whether you plan to run your Rich Displays in the same Genie skin where you are running your 5250 applications, or whether you plan to run them somewhere else. Genie is capable of running both Rich Displays and 5250 displays. But, Rich Displays aren't required to run inside Genie, they can run outside of Genie as well.

So, what are your plans here? Do you plan to run everything in the same Genie skin so that the hyperlink can be put in the Genie skin and will therefore always be available on all screens?

Re: Adding a "Favorites" hyper link to all screens

Posted: Wed Jan 20, 2016 12:15 pm
by rasaro
Oh, ok. Yes, we will be running everything through the same Genie skin.

Re: Adding a "Favorites" hyper link to all screens

Posted: Wed Jan 20, 2016 6:22 pm
by Scott Klement
Okay, so there are many ways of doing something like this, but my idea would be to just add a hyperlink (using HTML) to your Genie skin. The hyperlink would run some JavaScript that could run the pui.runAttnProgram() API if you are in a Rich Display, or press the "attn" key if you are in Genie.

To start, I would edit the start.html file in your Genie skin, and tell it to bring in a new JavaScript file by adding a <script> tag. I would add this beneath the other <script> tags that are already there. Then, I would add an HTML <a> (hyperlink) tag to the same file that runs the JavaScript code.

Obviously, different customers Genie skins are different, and I don't know precisely what yours looks like, so you may have to adapt this code a little bit to fit your environment, but this should be fairly close... in the start.html file, you'd add these tags so it looks like this (this is an excerpt):
rickmenu1.png
rickmenu1.png (37.77 KiB) Viewed 2716 times
Then you'd create the JavaScript file. Since the URL points to /profoundui/userdata/custom/js, you'd place this file in the IFS under the /www/YOUR-HTTP-INSTANCE/htdocs/profoundui/userdata/custom/js directory. The filename I used was, of course, MISD.js -- but you can call it anything you like, just make sure you use the same filename on the <script> tag that you use for the actual file on disk.

Then the code in the MISD.js file would look something like this:

Code: Select all

if (typeof MISD == "undefined") MISD = {};

MISD.startMenu = function() {

   var screenType = pui.getDisplayType();
   if (screenType == "rdf") {
      pui.runAttnProgram();
   }
   else {
      pressKey("attn");
   }

}
Now, because of the "onclick" that I put on the hyperlink, when you click the link it will run that JavaScript function. The JavaScript asks PUI for the display type, and if it's a Rich Display File (rdf) it will call the pui.runAttnProgram() API. Otherwise it's a 5250 screen, so it will just press the attention key.

This is only meant as an example, of course, you'll want to tweak it to fit your needs, environment, etc.

You can learn more about HTML here:
http://www.w3schools.com/html/

You can learn more about JavaScript here:
http://www.w3schools.com/js/

Good luck

Re: Adding a "Favorites" hyper link to all screens

Posted: Wed Jan 27, 2016 12:01 pm
by rasaro
Scott, this works great. Do you know of a way to only show this hyperlink if the user is logged in to the system? Not a big deal if we can't. It doesn't do anything when a user clicks on it unless they are logged in. Thanks.

Re: Adding a "Favorites" hyper link to all screens

Posted: Fri Jan 29, 2016 5:48 pm
by Scott Klement
maybe in the "onload" event for your signon screen you could hide the hyperlink? and make it visible again in the "onsubmit"? Then it wouldn't show up in the signon screen, but would show everywhere else.

To do that,

1) you'll need to add an "id" to your HTML tag... so where it currently says "<a href=...." change it to "<a id="RickMenuLink" href=...."

2) In the 'onload' event do: getObj("RickMenuLink").style.visibility="hidden";

3) In the 'onsubmit' event do: getObj("RickMenuLink").style.visibility="visible";