Username in Anonymous-program - from userSpan ?

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
georg.merten
New User
Posts: 17
Joined: Thu Aug 23, 2012 3:24 am
First Name: Georg
Last Name: Merten
Company Name: Kuehne + Nagel
Contact:

Username in Anonymous-program - from userSpan ?

Post by georg.merten »

Hi,

I've created a anonymous progam which is running in an iFrame of my start.html

body of start.html:

Code: Select all

<div id="main">
  <div id="left"><div id="5250"></div>
  <div id="right"><iframe width="210px" height="705px" frameborder="0" src="http://10.32.64.6:8080/profoundui/start?pgm=CDMSOTST/CDMTST01O">   
</iframe></div></div>
</div>   
<span id="userSpan">
That means the user logs into the normal profound session and has always the possibilty to use the anonymous program on the right side of the application.

do you think it is possible to get the username from userSpan ID and work with it in the anonymous program ? Or do you see another possiblity to get the user profile which logged into the profound session?

see attached picture of the login screen to make it more clear...
Attachments
start.jpg
start.jpg (69.54 KiB) Viewed 3456 times
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: Username in Anonymous-program - from userSpan ?

Post by Scott Klement »

There's a currentUser() routine that you can call to get the userid that is signed on to the Profound UI session.
http://www.profoundlogic.com/docs/displ ... User%28%29

Some Genie skins will use this (or, the related, pui["appJob"]["user"]) to create an element named userSpan that shows the user who is signed in, but these userSpans will usually have something extra in them like "Welcome THEUSER" or "Hello THEUSER"... so it's easier to just call currentUser(), that way you don't have to substring off the "Welcome" or "Hello" (or whatever message someone may dream up in the future.)
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: Username in Anonymous-program - from userSpan ?

Post by Scott Klement »

I should clarify that currentUser() will do something different depending on where it's called. If you call it from within the main page (the Genie page) it'll give you the userid of that session. If you call it from the iFrame, it won't give you a real userid, because that session is anonymous.

One solution, from the iframe, you could just call parent.currentUser(), you'll get the userid of the parent window (the Genie window). But -- please don't use this for anything that needs to be secure, because it would be very easy to spoof the userid in this case.

Maybe it's best to take a step back, here... Why do you want the userid in the iframe? What will you use it for?
georg.merten
New User
Posts: 17
Joined: Thu Aug 23, 2012 3:24 am
First Name: Georg
Last Name: Merten
Company Name: Kuehne + Nagel
Contact:

Re: Username in Anonymous-program - from userSpan ?

Post by georg.merten »

cool! parent. is working fine.
I want that the user has during the whole session the possibilty to change defaults from his profile of our application. Like default printer/client/environment...
georg.merten
New User
Posts: 17
Joined: Thu Aug 23, 2012 3:24 am
First Name: Georg
Last Name: Merten
Company Name: Kuehne + Nagel
Contact:

Re: Username in Anonymous-program - from userSpan ?

Post by georg.merten »

does something like child. exist?
next step would be child.pui.click() ?
so that the "user-session" refresh the anonymous session.
parent.pui.click() is working...
georg.merten
New User
Posts: 17
Joined: Thu Aug 23, 2012 3:24 am
First Name: Georg
Last Name: Merten
Company Name: Kuehne + Nagel
Contact:

Re: Username in Anonymous-program - from userSpan ?

Post by georg.merten »

Hi,

meanwhile I wrote a function to refresh the anonymous program.
(it was not possible to refresh it from the user-session)

Code: Select all

function refreshIframe() {
    var ifr = document.getElementsByName('mainFrame')[0];
    ifr.src = ifr.src;
}
Thanks you for inspiration ;)
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: Username in Anonymous-program - from userSpan ?

Post by Scott Klement »

The child frames is an array. So you'd have window.frame[0], window.frame[1], etc (depending on how many iFrames you have)

Does that help?
georg.merten
New User
Posts: 17
Joined: Thu Aug 23, 2012 3:24 am
First Name: Georg
Last Name: Merten
Company Name: Kuehne + Nagel
Contact:

Re: Username in Anonymous-program - from userSpan ?

Post by georg.merten »

yes, thank you!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests