Skip to main content

'Patching' dsp javascript

  • June 10, 2022
  • 2 replies
  • 0 views

Iain Sharp
Forum|alt.badge.img+5
Is there any way to run two different javascript/webapps folders in the same way one can have two uar files, one with the whole system and one with a patch? 
We run a training system next to our live systems, with the next patch implemented, for UAT purposes. I have just released a DSP in which I changed a webtrigger, and therefore the associated script in the webapps/uniface/dspjs folder, and it broke the live system. 

I am aware I can do it by having an entirely different ini file, and a copy of all the webapps code in another location, but I'd prefer if there were a magic way of including a second path at ASN level, or even (possibly) programmatically. (say in GetState/SetState?) 

Regards, 
Iain

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------

2 replies

Forum|alt.badge.img
  • Participating Frequently
  • June 10, 2022
Is there any way to run two different javascript/webapps folders in the same way one can have two uar files, one with the whole system and one with a patch? 
We run a training system next to our live systems, with the next patch implemented, for UAT purposes. I have just released a DSP in which I changed a webtrigger, and therefore the associated script in the webapps/uniface/dspjs folder, and it broke the live system. 

I am aware I can do it by having an entirely different ini file, and a copy of all the webapps code in another location, but I'd prefer if there were a magic way of including a second path at ASN level, or even (possibly) programmatically. (say in GetState/SetState?) 

Regards, 
Iain

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------
Hello Iain,

Yes, we have also the problem, we are thinking to add the javascript file in the uar file.
We actually use, in our test environment ,the following solution :

1) Modify the asn setting to use an USP to load the javascript file:

    [WEB]
    $JS_BASE_URL = MYUSP.loadjs? ; then the url is http://localhost:8080/uniface/wrd/MYUSP.myloadjs?javascriptfile.js


    [FILES]
    dspjs*.js $RES:dspjs\\*.js ; it remove the 'dspjs' prefix add in the usp

2)  Create  an USP (MYUSP) with  :
 
  operation loadjs
        Variables
            string sJsFile,sContent
            endVariables
            sJsFile=$concat("dspjs",$valuepart($webinfo("input"))[2])
           fileload sJsFile,sContent
          $webinfo("output")=sContent
          return 0
      end​

Note : - use fileload and not lfileload
              - The name of javascript that we prefix  with 'dspjs'  (in the usp)  to limit redirection to this kind of file.

Sure it will take longer but it seems to work.

Gilles.

------------------------------
Hortion Gilles
Dedalus Healthcare France
Artigues Pres Bordeaux FR
------------------------------

Iain Sharp
Forum|alt.badge.img+5
  • Author
  • Inspiring
  • June 10, 2022
Hello Iain,

Yes, we have also the problem, we are thinking to add the javascript file in the uar file.
We actually use, in our test environment ,the following solution :

1) Modify the asn setting to use an USP to load the javascript file:

    [WEB]
    $JS_BASE_URL = MYUSP.loadjs? ; then the url is http://localhost:8080/uniface/wrd/MYUSP.myloadjs?javascriptfile.js


    [FILES]
    dspjs*.js $RES:dspjs\\*.js ; it remove the 'dspjs' prefix add in the usp

2)  Create  an USP (MYUSP) with  :
 
  operation loadjs
        Variables
            string sJsFile,sContent
            endVariables
            sJsFile=$concat("dspjs",$valuepart($webinfo("input"))[2])
           fileload sJsFile,sContent
          $webinfo("output")=sContent
          return 0
      end​

Note : - use fileload and not lfileload
              - The name of javascript that we prefix  with 'dspjs'  (in the usp)  to limit redirection to this kind of file.

Sure it will take longer but it seems to work.

Gilles.

------------------------------
Hortion Gilles
Dedalus Healthcare France
Artigues Pres Bordeaux FR
------------------------------
Well, that's going to take some wrapping my head around, but thank you. 
Iain

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------