Page 1 of 1
Program/JavaScript acting differently in Atrium
Posted: Wed Dec 30, 2020 8:28 pm
by RichDotsonMTD
I have a program that displays a Timeline widget using data from an XML file in the IFS. The Timeline displays correctly when I call the program from ProfoundUI but does not display when the program is called as a menu option in Atrium. The RPGLE program creates the XML file in the IFS and the Timeline is loaded by executing the following code in the onLoad event and using data from that XML file. The function is currently looking for the XML file in the
/profoundui/htdocs/profoundui folder (location to be changed in later development). It appears that the JavaScript function cannot find the XML in this folder.
Is the "root" folder different when a program is run from Atrium than it is when executed from ProfoundUI?
Code: Select all
var XMLPath = get("id_XMLpath").trim();
$(document).ready(function() {
$('#my-timeline').timelinexml({mode: 'xml', src : XMLPath});
});
Re: Program/JavaScript acting differently in Atrium
Posted: Tue Jan 05, 2021 3:26 pm
by RichDotsonMTD
Just posting what I found in case anyone else runs into this. I ran the JavaScript debugger on the app and found that there is a different "root" folder based on where the program is called from.
When I ran the program from ProfoundUI it was looking for the .xml file in the /profoundui folder.
When I ran the program from Atrium it was looking for the .xml file in the /profoundui/auth folder.
I placed a copy of the .xml file into the /profoundui/auth folder and the widget worked as expected when called from Atrium.
Re: Program/JavaScript acting differently in Atrium
Posted: Tue Jan 05, 2021 4:08 pm
by Scott Klement
Rich,
There are two ways of running the Rich Display controller. It can be called with a web page for sign-on with /profoundui/start (such as
http://your-system/profoundui/start) or it can use the HTTP (browser-based) sign-on by calling it with /profoundui/auth/start (
http://your-system/profoundui/auth/start).
Outside of Atrium. You can use choose to use either URL, depending on your needs.
Atrium will always use the /profoundui/auth/start URL because Atrium has already asked you to sign on and doesn't want to ask you to do it again, so it uses browser authentication to bypass the signon screen.
So this isn't really a difference between Atrium and Rich Display. Its just a choice you were previously making with Rich Display. You could've done it the same way Atrium does. Its up to you.
Re: Program/JavaScript acting differently in Atrium
Posted: Tue Jan 05, 2021 4:24 pm
by Scott Klement
With regards to the actual problem... I'm not familiar with this timeline widget or XML file. This must be something custom of yours.
However, it sounds like it's using a URL for the XML file. (Which would be pretty standard in any web application.) You would run into the same problem with anything that uses a URL (image, video, sound file, link, etc.)
URLs are structured like this:
- URLs that begin with http://, https:// or // are absolute URLs. They use the specified protocol (http or https) if given, and navigate to that server. then request the path given from that server.
- URLs that begin with / start at the top level of the server your page was served from.
- URLs that don't begin with / are relative to the path your page was served from.
That's part of the standard of the way web pages and web browsers work. Since Profound UI (including Rich Display, Genie and Atrium) runs in a web browser, it works that way, too.
Lets apply that to your example. You are storing a URL in an element named id_XMLpath. Therefore, if your web page is served from is
http://your-system/profoundui/start then:
Hopefully all of that made sense and you now understand better.
With that in mind, I would recommend NOT storing your XML documents within the 'profoundui' directory. Instead, I would:
- Navigate to /www/INSTANCE-NAME/htdocs
- Create a new directory beneath htdocs named xml -- MKDIR DIR('/www/INSTANCE-NAME/htdocs/xml') (you can use any name you like, just remember to use that in the application, too.)
- Put your XML documents here.
- Change the id_XMLpath in the application to be set to /xml/1111117.xml (or whatever the file in the xml directory is called)
Since the URL begins with a slash (/xml/xxxx begins with a /) it won't matter if you're using /profoundui/start or /profoundui/auth/start (or anything else.)
Re: Program/JavaScript acting differently in Atrium
Posted: Fri Jan 08, 2021 12:16 pm
by RichDotsonMTD
You are correct. The Timeline/JavaScript/XML is a custom widget that we plan on using to easily display all the "events" that occur for a selected customer order.
I had planned on placing the XML file in a custom folder after I got the application working. During the initial development I was receiving the error 'Syntax error, unrecognized expression: /xml/38_1111117.xml' whenever I included a '/' in the path for the XML file. That is why I placed the XML file in the 'profoundui' folder. Once I had the widget functioning correctly I was going to circle back and work through the "unrecognized expression" error.