← Back to team overview

dhis2-devs team mailing list archive

Re: Apps and Menu's (Relative) Location

 

Thanks Mark,

I saw that line, and I've played around with it, but it doesn't seem to
make a difference. Let me describe my process:

Here is my setup information:
[image: Inline image 1]
The App base URL confuses me, because it seems it should be hardcoded.
Every time I would install *any* app it would only be accessible from the
above URL (/api/apps).

I created the index.html page with just the barebones default values from
the web tutorial:

[image: Inline image 3]

(I went ahead and removed the dhis from the baseURL)

I then upload my test app:[image: Inline image 2]

When I go to it, none of the relative paths are working correctly. So I
update the index.html to reflect the css files actual location:

[image: Inline image 5]

But I left the javascript section alone. If I reload the app, I now get the
following errors from the js files:

[image: Inline image 6]

Those are the four js files. I then go ahead and fix their relative paths
too, as they are looking for this from my api/apps folder when they should
be in the dhis root.

[image: Inline image 7]

And now I am back to this error:
[image: Inline image 8]

It doesn't seem to do anything if I change the baseURL to any number of
things:

[image: Inline image 9][image: Inline image 12][image: Inline image 11][image:
Inline image 10]

The error will always be the same, 404, and the location it is looking for
the file will never differ: api/apps/dhis-web-commons/menu/ It doesn't seem
as if the dhis2.settings.baseUrl is having any affect.



Timothy Harding
RPCV Vanuatu
Skype: hardingt@xxxxxxxxx
+1 (541) 632-6623

On Tue, Apr 21, 2015 at 2:45 AM, Mark Polak <markpo@xxxxxxxxxx> wrote:

> Hey Timothy,
>
> Have you added the baseUrl config above where you include dhis2.menu.js
> and dhis2.menu.ui.js?
>
> This should set a base url for  where the menu script will look to find
> your files. (By default this is set to .. which is likely the reason it
> looks in the wrong place)
>
> You will have to change  “dhis” in the example below to your “root” path.
> In your i assume that would be “/“ since you’re serving from the localhost
> root and not a “dhis” subfolder.
>
> <script>
>  window.dhis2 = window.dhis2 || {};
>  dhis2.settings = dhis2.settings || {};
>  dhis2.settings.baseUrl = 'dhis’; //Change this where you want it to look. I guess in your case '/' should work.
> </script>
>
>
>
> Kind regards,
>
> Mark Polak
> mark@xxxxxxxxxxxxxxx
> markpo@xxxxxxxxxx
> +47 970 36 752
>
> On 21 Apr 2015, at 05:40, Timothy Harding <hardingt@xxxxxxxxx> wrote:
>
> Hello,
>
> I'm just getting started out with the app development and I started with
> the tutorial found here:
> https://www.dhis2.org/doc/snapshot/en/developer/html/ch02s07.html
>
> I had to modify the scripts locations because instead of looking here:
> localhost:8080/
> It goes searching here:
> localhost:8080/api/apps
>
> That worked fine (I had to strangely add three ../ to get it to go to the
> right place) e.g.
> <link type="text/css" rel="stylesheet" href="../../../
> dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
> vs
> <link type="text/css" rel="stylesheet" href="./
> dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
>
> So the troubles comes in when it loads the file:
> ./dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js
>
> LINE 954 url : "../dhis-web-commons/menu/getHelpPageLinkModule.action",
>
> It is set to a relative path, but assumes I am in a different working
> directory. Because of that, I get a blank page, no menu, and one of these
> in the console log:
>
> <Screen Shot 2015-04-20 at 8.39.42 PM.png>
>
> Is there a good/sanctioned method to change the js working directory,
> should I rather just be including a copy of all these JS files in my app,
> or some other process?
>
> Timothy Harding
> RPCV Vanuatu
> Skype: hardingt@xxxxxxxxx
> +1 (541) 632-6623
>  _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>
>

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image


Follow ups

References