"Variablizing" a library.

Use this board to ask questions or have discussions with other Genie users.
Post Reply
Wayne C.
Experienced User
Posts: 139
Joined: Mon Aug 16, 2010 12:04 pm
First Name: Wayne
Last Name: Colasinski
Company Name: Sofworx / Tantara Transport
Contact:

"Variablizing" a library.

Post by Wayne C. »

In using the File Upload widget. I've coded the "target directory" in the following manner:

script: '/www/puidev/htdocs/profoundui/userdata/images/shipmnts/' + getFormattedPro("D_1_6", "I_1_10", "D_1_18");

This works fine. "puidev" is our development library and when we do one of our in-house releases (in which I have to copy over the entire "screens" file to the production library), I have to go to each of the screen renderings that has a directory in it and manually change "puidev" to "profoundui". Without actually changing the DDS to include the library name, is there a way to "variable-ize" the library so that I don't have to go back and manually change a library name?

I looked in the Genie forum, but I didn't see this item addressed. I saw the "Detecting Genie" item in the online documentation:
D PUI0002300 PR ExtPgm('PUI0002300')
D isGenie N
D GenieLib 10A Options(*NoPass)
D GenieSkin 50A Options(*NoPass)
D DocRoot 128A Options(*NoPass)
D UserAgent 128A Options(*NoPass)

I see that the library name is available, but it seems that I would have to add "GenieLib" to the DDS. What is the best way or how do most users handle this? Thanks for any help.
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: "Variablizing" a library.

Post by Scott Klement »

I think you used the same name for the "document root" that you did for the "library" -- which is what most customers do -- but technically, what you are working with is actually the document root, it is not the library name.

So what you want your IFS path to be is this (pseudo-code):

Code: Select all

THE_DOCUMENT_ROOT + "/profoundui/userdata/images/shipmnts/" + THE_REST
The document root should be "/www/puidev/htdocs" or "/www/profoundui/htdocs" or whatever.

I'm assuming that you are uploading to this directory because you are using images or something that will be displayed in an image widget. Is that correct? Please be aware that anything you put in an IFS directory beneath the document root (i.e. within the "htdocs" subdirectory or any of it's subdirectories) is available for anyone to download without signing on to your system. For this reason, it's not commonplace for people to upload to a directory like that except for non-confidential images.

To do this in Genie, you would want to put the document root on the screen (perhaps in a non-display field) and retrieve it with the get() API. So your property would be something like this:

Code: Select all

script: get("D_x_x") + '/profoundui/userdata/images/shipmnts/' + getFormattedPro("D_1_6", "I_1_10", "D_1_18");
Of course, replace "D_x_x" with the actual ID of the field.
Wayne C.
Experienced User
Posts: 139
Joined: Mon Aug 16, 2010 12:04 pm
First Name: Wayne
Last Name: Colasinski
Company Name: Sofworx / Tantara Transport
Contact:

Re: "Variablizing" a library.

Post by Wayne C. »

Thanks for the reply Scott. I guess we'll get the document root on the screens somewhere.
The "shpmnts" folder will contain one folder per shipment and those folders will contain pictures and documents pertaining to that shipment. We have enabled users to view those pictures / documents while viewing shipments in order entry.

Is "/www/puidev" or "/www/profoundui" better as the document root? (Eliminated htdocs from the document root)

and...

THE_DOCUMENT_ROOT + "/shipmnts/" + THE_REST

script: get("D_x_x") + '/shipmnts/' + getFormattedPro("D_1_6", "I_1_10", "D_1_18");

Is this any better or safer?
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: "Variablizing" a library.

Post by Scott Klement »

Is "/www/puidev" or "/www/profoundui" better as the document root? (Eliminated htdocs from the document root)
It shouldn't make much difference if it's called "puidev" or "profoundui" -- that's up to you. Sounds like you have "puidev" for development, and "profoundui" for runtime... which seems good to me. You should include "htdocs" as part of the document root, otherwise you'll give non-signed-in users access to stuff like the logs and configuration.
THE_DOCUMENT_ROOT + "/shipmnts/" + THE_REST
script: get("D_x_x") + '/shipmnts/' + getFormattedPro("D_1_6", "I_1_10", "D_1_18");
Is this any better or safer?
Not sure that I understand what you're asking? the one with THE_DOCUMENT_ROOT is just pseudo-code... it won't actually work...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest