Page 1 of 1

Can I add an arbitrary parameter into LANSA Web plugin page? (RESOLVED)

Posted: Tue Oct 15, 2019 7:37 pm
by Taku Izumi
Hi,

I created my web page according to this site (https://docs.lansa.com/14/en/lansa017/i ... 1_0205.htm).

Can I want to add an arbitrary parameter (for example: employeenumber=A0000) to the page?

If it possible, please let me know it.

Best regards,
Taku

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Posted: Wed Oct 16, 2019 12:23 am
by jyoung
Are you referring to QueryString Parameters?

If so, then check out https://docs.lansa.com/14/en/lansa017/i ... 1_0290.htm

Joe

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Posted: Wed Oct 16, 2019 11:11 am
by JamesDuignan
Hi Taku,

To add the parameters onto the url you will want to use the PRIM_WEB.history.add method. This allows you to add name value pairs to the url.
https://docs.lansa.com/14/en/lansa016/p ... ry_add.htm

For example:

Code: Select all

Evtroutine Handling(#EmpList.ItemGotSelection)

#SYS_WEB.History.Add( ("EMPID=&1").Substitute( #xEmployeeIdentification ) )

Endroutine
Then to access the parameters you can access the instance of the parameter name that you want from a PRIM_WEB.URLChangedEvent
https://docs.lansa.com/14/en/lansa016/p ... meters.htm
https://docs.lansa.com/14/en/lansa016/p ... hanged.htm

For example:

Code: Select all

Evtroutine Handling(#SYS_WEB.URLChanged)

If (#SYS_WEB.URLParameters<EMPID> *IsNot *NULL)

#Empdetail.ShowEmployee( #SYS_WEB.URLParameters<EMPID>.value )

Endif

Endroutine
Regards,
James

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Posted: Wed Oct 16, 2019 6:27 pm
by Taku Izumi
Hi,

Thank you for the tips.
I explain what I want to do again.
I would like to add a parameter to below HTML source.

Code: Select all

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8" />
      <meta name="mobile-web-app-capable" content="yes">
      <meta name="apple-mobile-web-app-capable" content="yes">
      <meta name="apple-touch-fullscreen" content="yes">
      <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
   </head>
   <body>
      <script>
         (function(){ window["LANSA"] = {nonce: ""}; })();
      </script>
      <script src="/dcxpgmlib/lansa_14_2_4_1/lansa.js"></script>
      <script>
         (function(LANSA){
            if(!LANSA){document.write("Failed to load /dcxpgmlib/lansa_14_2_4_1/lansa.js");return}
            LANSA.init({part:"dem",sys:"dcxpgmlib",ver:"631280881",lang:{def:"JPN",code:{"JPN":"ja-JP","ENG":"en-US"}},slz:0,md:1,splash:{limg:"spin",mtxt:{"JPN":"ロード中...","ENG":"ロード中..."}}});
            LANSA.showPage("MYLOGIN");
         }(window["LANSA"]))
      </script>
      <noscript>This page requires JavaScript.</noscript>
   </body>
</html>
For example, instead of the following URL, I want to use a HTML file.


http:// webserver /dcxpgmlib /dem /mylogin.html ?employeenumber=a0000

Best regards,
Taku

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Posted: Thu Oct 17, 2019 10:42 am
by dannyoorburg
Hi Taku,

When you say:

"I would like to add a parameter to below HTML source."

What does that even mean?

Can you try to explain what you're trying to achieve?

Cheers,
Danny

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Posted: Thu Oct 17, 2019 3:18 pm
by Dominik
I just spoke to Taku about this; he is attempting to call LANSA.Init() and LANSA.showPage() internal functions manually, rather than using the generated HTML page that LANSA creates (he took that documentation page to indicate that its fine to do this yourself).
He was hoping that if he passed parameters into the Init function or showPage function, they would be accessible in his web page.

I explained to him that he cannot pass parameters into those functions; and that if he wants to retrieve an employee number for example he should take it from the browser storage, or supplied from a server module (session data), or from the URL as indicated from a previous response.

However it should be noted that when taking the value from a URL parameter, or even browser storage, a hacker could just edit the value passed in to potentially bypass security (i.e. dont use it to pass in the currently logged in emplyee)