Program/JavaScript acting differently in Atrium

Use this board to ask questions or have discussions with other Atrium users.
Post Reply
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Program/JavaScript acting differently in Atrium

Post 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});
});
Attachments
timeline.png
timeline.png (93.21 KiB) Viewed 3660 times
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Re: Program/JavaScript acting differently in Atrium

Post 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.
Attachments
AtriumVsProfoundUI.jpg
AtriumVsProfoundUI.jpg (27.14 KiB) Viewed 3651 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: Program/JavaScript acting differently in Atrium

Post 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.
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: Program/JavaScript acting differently in Atrium

Post 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:
  1. Navigate to /www/INSTANCE-NAME/htdocs
  2. 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.)
  3. Put your XML documents here.
  4. 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.)
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Re: Program/JavaScript acting differently in Atrium

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests