dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #12264
Re: Embed viz in DHIS2 2.22
Thanks, I'll try it out.
On the 2.25 version it's working with a catch - even with my url
whitelisted in DHIS2 Setting page, I get a "Control-Allow-Origin' header is
present on the requested resource. Origin 'http://xxxxx is therefore not
allowed access."
>From my own browser I can disable cors (using a chrome extension), but
that's not really sustainable. Any pointers there?
Thanks,
Martin
On Jan 18, 2017 9:45 PM, "Jan Henrik Øverland" <jan@xxxxxxxxx> wrote:
> Hi Martin,
>
> We have obviously not been able to keep the cdn/docs up to date for all
> versions. Sorry about that.
>
> I have put up the 2.22 chart plugin here: https://dhis2-cdn.org
>
> To make this work, please add your client domain to the CORS whitelist in
> your 2.22 instance (system settings).
>
> Then there were some parts missing in the html. Please try:
>
> <html>
> <head>
> <link rel="stylesheet" href="http://dhis2-cdn.org/v22
> 2/ext/resources/css/ext-plugin-gray.css" />
> <script src="http://dhis2-cdn.org/v222/ext/ext-all.js"></script>
> <script src="http://dhis2-cdn.org/v222/plugin/chart.js"></script>
> </head>
>
> <body>
> <div id="chart1" style="width:700px; height:400px"></div>
> <script>
>
> var crossDomain = true;
> var url = 'myInstance';
> var username = 'myUsername';
> var password = 'myPassord';
>
> Ext.onReady(function() {
>
> DHIS.getChart({
> "crossDomain": crossDomain,
> "url": url,
> "username": username,
> "password": password,
>
> "id": "DkPKc1EUmC2",
> "el": "chart1"
> });
>
> });
> </script>
> </body>
> </html>
>
> Hope this helps.
>
> Jan
>
>
>
>
> On 18 January 2017 at 16:49, Martin Van Aken <martin@xxxxxxxxxxxxxxxx>
> wrote:
>
>> Hello,
>> I've a DHIS2 2.22 running with some chart we did. I want to embed one in
>> an external page. When I ask for "Embed" I got code like this:
>>
>> <html>
>> <head>
>> <link rel="stylesheet" href="http://dhis2-cdn.org/v22
>> 2/ext/resources/css/ext-plugin-gray.css" />
>> <script src="http://dhis2-cdn.org/v222/ext/ext-all.js"></script>
>> <script src="http://dhis2-cdn.org/v222/plugin/chart.js"></script>
>> </head>
>> <body>
>> <div id="chart1" style="width:700px; height:400px"></div>
>> <script>
>>
>> Ext.onReady(function() {
>>
>> DHIS.getChart({
>> "id": "nIn1JofuIm3"
>> });
>>
>> });
>> </script>
>> </body>
>> </html>
>>
>> I get several problems there - first of all on the CDN the v222 does not
>> exists at all. Going on http://dhis2-cdn.org/ looks like nothing exists
>> between 2.21 & 2.25.
>>
>> The second thing is I don't understand how this can work without any
>> reference to the server I'm running on.
>>
>> I did some test in the play with success, but that's with the 2.25 (and
>> looks like a quite different API). Any help for a version between 2.21 &
>> 2.25?
>>
>> Thanks,
>>
>> Martin
>>
>> --
>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>
>> Mobile : +32 486 899 652
>>
>> Follow me on Twitter : @martinvanaken <http://twitter.com/martinvanaken>
>> Call me on Skype : vanakenm
>> Hang out with me : martin@xxxxxxxxxxxxxxxx
>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>> Company website : www.joyouscoding.com
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Jan Henrik Øverland
> Software developer, DHIS 2
> University of Oslo
> http://www.dhis2.org <https://www.dhis2.org/>
>
References