Hi Hannan, You need to use version 2.20.
On Mon, Oct 5, 2015 at 1:43 PM, Hannan Khan <hann...@gmail.com> wrote: > I am facing the same problem: One script following the manual is: > > <!DOCTYPE html> > <html> > <head> > <link rel="stylesheet" type="text/css" href=" > http://dhis2-cdn.org/v219/ext/resources/css/ext-plugin-gray.css" /> > <script src="http://dhis2-cdn.org/v219/ext/ext-all.js"></script> > <script src="http://dhis2-cdn.org/v219/plugin/chart.js"></script> > > <script> > var base = "http://103.247.238.82:8080/dhismohfw/"; > > // Login - if OK, call the setLinks function > > Ext.onReady( function() { > Ext.Ajax.request({ > url: base + "dhis-web-commons-security/login.action", > method: "POST", > params: { j_username: "view", j_password: "DGHS1234" }, > crossDomain: true, > success: setLinks > }); > }); > > function setLinks() { > > // Referring to an existing chart through the id parameter, render > to "chart1" div > > DHIS.getChart({ url: base, el: "chart1", id: "SYELB2ltOpL" }); > > // Full chart configuration, render to "chart2" div > > DHIS.getChart({ > url: base, > el: "chart2", > type: "stackedBar", > columns: [ // Chart series > {dimension: "de", items: [{id: "Fnsa8A43USl"}, {id: > "CRZkTTALRSb"}]} > ], > rows: [ // Chart categories > {dimension: "pe", items: [{id: "LAST_12_MONTHS"}]} > ], > filters: [ > {dimension: "ou", items: [{id: "USER_ORGUNIT"}]} > ], > // All following options are optional > crossDomain: true, > showData: false, > targetLineValue: 70, > baseLineValue: 20, > showTrendLine: true, > hideLegend: true, > title: "My chart title", > domainAxisTitle: "Periods", > rangeAxisTitle: "Percent" > }); > } > </script> > </head> > > <body> > <div id="chart1"></div> > <div id="chart2"></div> > </body> > </html> > > generating the error "XMLHttpRequest cannot load > http://103.247.238.82:8080/dhismohfw/dhis-web-commons-security/login.action. > Response for preflight is invalid (redirect)" > > If i use code as Jan suggests: > > <!DOCTYPE html> > <html> > <head> > <link rel="stylesheet" type="text/css" href=" > http://dhis2-cdn.org/v219/ext/resources/css/ext-plugin-gray.css" /> > <script src="http://dhis2-cdn.org/v219/ext/ext-all.js"></script> > <script src="http://dhis2-cdn.org/v219/plugin/chart.js"></script> > </head> > <body> > <div id="chart1"></div> > <script> > var url = "http://103.248.238.82:8080/dhismohfw/", > username = "view", > password = "DGHS1234"; > > Ext.onReady(function() { > > DHIS.getChart({ > url: url, > el: "chart1", > id: "SYELB2ltOpL", > crossDomain: true, > username: username, > password: password > }); > > }); > </script> > > </body> > </html> > > then the following error occurs. > > GET > http://103.248.238.82:8080/dhismohfw/api/me/user-account.jsonp?callback=Ext.data.JsonP.callback1&_dc=1444041788222 > net::ERR_CONNECTION_TIMED_OUTExt.Element.addMethods.appendTo @ > ext-all.js:15Ext.Element.addMethods.appendChild @ > ext-all.js:15Ext.define.request @ ext-all.js:15a @ > chart.js:1DV.plugin.getChart @ chart.js:1(anonymous function) @ > testchart1.html:16(anonymous function) @ ext-all.js:15b @ ext-all.js:15 > ext-all.js:15 GET > http://103.248.238.82:8080/dhismohfw/api/organisationUnits.jsonp?userOnly=t…[id,name]&paging=false&callback=Ext.data.JsonP.callback2&_dc=1444041788230 > net::ERR_CONNECTION_TIMED_OUTExt.Element.addMethods.appendTo @ > ext-all.js:15Ext.Element.addMethods.appendChild @ > ext-all.js:15Ext.define.request @ ext-all.js:15a @ > chart.js:1DV.plugin.getChart @ chart.js:1(anonymous function) @ > testchart1.html:16(anonymous function) @ ext-all.js:15b @ ext-all.js:15 > ext-all.js:15 GET > http://103.248.238.82:8080/dhismohfw/api/dimensions.jsonp?links=false&paging=false&callback=Ext.data.JsonP.callback3&_dc=1444041788231 > net::ERR_CONNECTION_TIMED_OUTExt.Element.addMethods.appendTo @ > ext-all.js:15Ext.Element.addMethods.appendChild @ > ext-all.js:15Ext.define.request @ ext-all.js:15a @ > chart.js:1DV.plugin.getChart @ chart.js:1(anonymous function) @ > testchart1.html:16(anonymous function) @ ext-all.js:15b @ ext-all.js:15 > > Please help me to solve this. > > On Fri, Oct 2, 2015 at 8:18 PM, Guy Ekani <constyek...@yahoo.fr> wrote: > >> Thank's Jan ! >> >> It's working with https://dhis2-cdn.org/v217/plugin/table.js on Google >> Chrome, >> >> But not Displaying in Mozilla Firefox ! >> >> May God Bless you all >> >> ========================= >> EKANI Guy >> >> >> >> >> >> >> >> >> Le Vendredi 2 octobre 2015 15h08, Jan Henrik Øverland < >> janhenrik.overl...@gmail.com> a écrit : >> >> >> You need to add exactly >> >> http://localhost:8082 >> >> (without the final /) to the CORS whitelist. >> >> On Fri, Oct 2, 2015 at 4:50 PM, Guy Ekani <constyek...@yahoo.fr> wrote: >> >> Now I have the following errors in DHIS-Live 2.20(19682)/PosgreSQL : >> >> Table.html:1 XMLHttpRequest cannot load >> http://localhost:8082/api/me/user-account.json. The request was >> redirected to ' >> http://localhost:8082/dhis-web-commons/security/login.action;jsessionid=pz57xiqk2xlcc1jy8sjv8pm7', >> which is disallowed for cross-origin requests that require preflight. >> >> Table.html:1 XMLHttpRequest cannot load >> http://localhost:8082/api/dimensions.json?fields=id,name&paging=false. >> The request was redirected to ' >> http://localhost:8082/dhis-web-commons/security/login.action;jsessionid=30ih6480fdr61a2t4ppd2c674', >> which is disallowed for cross-origin requests that require preflight. >> >> Table.html:1 XMLHttpRequest cannot load >> http://localhost:8082/api/legendSets.json?fields=id,name,legends[id,name,startValue,endValue,color]&paging=false&_dc=1443793668223. >> The request was redirected to ' >> http://localhost:8082/dhis-web-commons/security/login.action;jsessionid=1ll1s8lo6k26hq9q2eprb9px8', >> which is disallowed for cross-origin requests that require preflight. >> >> Table.html:1 XMLHttpRequest cannot load >> http://localhost:8082/api/organisationUnits.json?userOnly=true&fields=id,name,children[id,name]&paging=false. >> The request was redirected to ' >> http://localhost:8082/dhis-web-commons/security/login.action;jsessionid=1jsyr9wmynlpg196nnj4jskfj6', >> which is disallowed for cross-origin requests that require preflight. >> >> ========================= >> EKANI Guy >> >> >> >> >> >> >> >> >> Le Vendredi 2 octobre 2015 14h01, Jan Henrik Øverland < >> janhenrik.overl...@gmail.com> a écrit : >> >> >> Hi Guy, >> >> The 2.20 plugin does the authentication for you (as long as you provide >> the crossDomain, username and password) so you can remove the login code. >> This will work (replace password): >> >> <!DOCTYPE html> >> <html> >> >> <head> >> <link rel="stylesheet" type="text/css" href=" >> http://dhis2-cdn.org/v220/ext/resources/css/ext-plugin-gray.css"/> >> <script src="https://dhis2-cdn.org/v220/ext/ext-all.js"></script> >> <script src="https://dhis2-cdn.org/v220/plugin/table.js"></script> >> </head> >> >> <body> >> <div id="table1"></div> >> >> <script> >> var url = "http://localhost:8082", >> username = "ekani.guy", >> password = "xxxxxxxxx"; >> >> Ext.onReady(function() { >> >> DHIS.getTable({ >> url: url, >> el: "table1", >> id: "fqk6tunwRLp", >> crossDomain: true, >> username: username, >> password: password >> }); >> >> }); >> </script> >> </body> >> >> </html> >> >> >> >> >> On Fri, Oct 2, 2015 at 3:45 PM, Guy Ekani <constyek...@yahoo.fr> wrote: >> >> Thanks Jan, >> >> I migrated to DHIS-Live 2.20(19682), But I'm always getting the error : >> >> XMLHttpRequest cannot load >> http://localhost:8082/dhis-web-commons-security/login.action. The >> request was redirected to ' >> http://localhost:8082/dhis-web-commons/security/login.action;jsessionid=irhqgxqywe5v1kb27d5obvhec?failed=true', >> which is disallowed for cross-origin requests that require preflight. >> >> and >> >> Blocking of a multi-query origins (Cross-Origin Request): the "Same >> Origin" policy does not refer to the remote resource on http: // localhost: >> 8082 / web-dhis-commons-security / login.action . Reason: the header CORS >> "Access-Control-Allow-Origin" is missing. Reason: Failed to CORS request. >> >> Sincerely, >> >> ========================= >> EKANI Guy >> >> >> >> >> >> >> >> >> Le Vendredi 2 octobre 2015 8h56, Jan Henrik Øverland < >> janhenrik.overl...@gmail.com> a écrit : >> >> >> Hi Guy, >> >> A fix is needed both in the Ext version we are (still) using and in the >> plugins to make this work. Unfortunately I have only had the time to update >> trunk and 2.20 so far. >> >> If it is OK for you to upgrade to 2.20 it will work right away if you add >> the following to your plugin configuration: >> >> DHIS.getTable({ >> ... >> ... >> >> crossDomain: true, >> username: <portal user>, >> password: <portal user password> >> }); >> >> Will try to find some time to backport it to 2.19 and 2.18 as well. >> >> And by the way, you say that you run >> >> - DHIS Live *2.18* >> - https://dhis2-cdn.org/*v215*/plugin/table.js >> >> Make sure that the plugin version matches the DHIS2 version. >> >> Jan >> >> >> >> On Fri, Oct 2, 2015 at 10:37 AM, Guy Ekani <constyek...@yahoo.fr> wrote: >> >> Thank You Lars, >> >> I tried a example, Please let me give you my configuration : >> - DHIS Live 2.18 (18179) on Windows 7 >> - Database = PostGreSQL 9.3 >> >> *- Remote acces - CORE White Liste * >> - http://localhost:8082/ >> - https://localhost:8082/ <http://localhost:8082/> >> - http://127.0.0.1/ <http://localhost:8082/> >> >> *- My script* >> <!DOCTYPE html> >> <html> >> <head> >> <link rel="stylesheet" type="text/css" href=" >> http://dhis2-cdn.org/v215/ext/resources/css/ext-plugin-gray.css" /> >> <script src="https://dhis2-cdn.org/v215/ext/ext-all.js"></script> >> <script src="https://dhis2-cdn.org/v215/plugin/table.js"></script> >> >> <script> >> var base = "http://localhost:8082"; >> >> // Login - if OK, call the setLinks function >> >> Ext.onReady( function() { >> Ext.Ajax.request({ >> url: base + "dhis-web-commons-security/login.action", >> method: "POST", >> params: { j_username: "ekani.guy", j_password: "xxxxx" }, >> success: setLinks >> }); >> }); >> >> function setLinks() { >> >> // Referring to an existing table through the id parameter, render >> to "table1" div >> >> DHIS.getTable({ url: base, el: "table1", id: "fqk6tunwRLp" }); >> >> } >> </script> >> </head> >> >> <body> >> <div id="table1"></div> >> </body> >> </html> >> >> *- console error on web browser* >> 1.XMLHttpRequest cannot load >> http://localhost:8082/dhis-web-commons-security/login.action. The >> request was redirected to ' >> http://localhost:8082/dhis-web-commons/security/login.action;jsessionid=yvbsx7nvigeft54069fvllae?failed=true', >> which is disallowed for cross-origin requests that require preflight. >> >> 2.XMLHttpRequest cannot load >> http://localhost:8082/dhis-web-commons/security/login.action. No >> 'Access-Control-Allow-Origin' header is present on the requested resource. >> Origin 'null' is therefore not allowed access. >> >> Sincerely, >> >> ========================= >> EKANI Guy >> >> >> >> >> >> >> >> >> Le Jeudi 1 octobre 2015 19h11, Lars Helge Øverland <larshe...@gmail.com> >> a écrit : >> >> >> Hi Guy, >> >> for starters I recommend that you start reading up on how to use the >> analytics plugins here: >> >> https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s23.html >> >> Using these you can embed pivots, charts and maps in web portals with >> live data from DHIS 2. >> >> You can also have a look at the Web portal demo here: >> >> https://apps.dhis2.org/portal/index.html >> >> https://apps.dhis2.org/portal/chart.html >> >> regards, >> >> Lars >> >> >> On Mon, Sep 28, 2015 at 5:31 PM, Guy Ekani <constyek...@yahoo.fr> wrote: >> >> Hello Everyone, >> >> Could someone can share tips on how to build a Web Portal with DHIS2 Data >> >> Sincerely, >> >> ========================= >> EKANI Guy >> >> >> >> >> >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~dhis2-users >> Post to : dhis2-us...@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~dhis2-users >> More help : https://help.launchpad.net/ListHelp >> >> >> >> >> -- >> Lars Helge Øverland >> Lead developer, DHIS 2 >> University of Oslo >> Skype: larshelgeoverland >> http://www.dhis2.org <https://www.dhis2.org/> >> >> >> >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~dhis2-devs >> Post to : dhis2-devs@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~dhis2-devs >> More help : https://help.launchpad.net/ListHelp >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~dhis2-users >> Post to : dhis2-us...@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~dhis2-users >> More help : https://help.launchpad.net/ListHelp >> >> >
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp