← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18757: Make ouwt.js usable in external apps by introducing a global base path variable

 

------------------------------------------------------------
revno: 18757
committer: Mark Polak <markpo@xxxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-03-30 18:22:29 +0200
message:
  Make ouwt.js usable in external apps by introducing a global base path variable
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2015-03-02 09:46:10 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2015-03-30 16:22:29 +0000
@@ -15,7 +15,8 @@
  * selection.setMultipleSelectionAllowed function to change this.
  */
 
-var organisationUnitTreePath = "../dhis-web-commons/ouwt/";
+var dhis2BaseUrl = "..";
+var organisationUnitTreePath = dhis2BaseUrl + "/dhis-web-commons/ouwt/";
 var organisationUnits = {};
 
 var selection = new Selection();
@@ -272,7 +273,7 @@
         format = format || "json";
 
         return $.ajax( {
-            url: '../dhis-web-commons-ajax-json/getOrganisationUnitTree.action',
+            url: dhis2BaseUrl + '/dhis-web-commons-ajax-json/getOrganisationUnitTree.action',
             data: {
                 versionOnly: versionOnly,
                 offlineLevel: offlineLevel
@@ -673,7 +674,7 @@
         }
         else {
             $.ajax( {
-                url: '../dhis-web-commons-ajax-json/getOrganisationUnitTree.action',
+                url: dhis2BaseUrl + '/dhis-web-commons-ajax-json/getOrganisationUnitTree.action',
                 data: { byName: name }
             } ).done(function( data ) {
                 if( data.realRoot === undefined ) {
@@ -708,11 +709,11 @@
 
 function Subtree() {
     this.ajaxGetChildren = function( parentId ) {
-        return $.post( '../dhis-web-commons-ajax-json/getOrganisationUnitTree.action?parentId=' + parentId);
+        return $.post( dhis2BaseUrl + '/dhis-web-commons-ajax-json/getOrganisationUnitTree.action?parentId=' + parentId);
     };
 
     this.ajaxGetLeaf = function( parentId ) {
-        return $.post( '../dhis-web-commons-ajax-json/getOrganisationUnitTree.action?leafId=' + parentId);
+        return $.post( dhis2BaseUrl + '/dhis-web-commons-ajax-json/getOrganisationUnitTree.action?leafId=' + parentId);
     };
 
     this.toggle = function( unitId ) {
@@ -979,15 +980,15 @@
     }
 
     function getToggleExpand() {
-        return getToggleImage().attr( "src", "../images/colapse.png" ).attr( "alt", "[+]" );
+        return getToggleImage().attr( "src", dhis2BaseUrl + "/images/colapse.png" ).attr( "alt", "[+]" );
     }
 
     function getToggleCollapse() {
-        return getToggleImage().attr( "src", "../images/expand.png" ).attr( "alt", "[-]" );
+        return getToggleImage().attr( "src", dhis2BaseUrl + "/images/expand.png" ).attr( "alt", "[-]" );
     }
 
     function getToggleBlank() {
-        return getToggleImage().attr( "src", "../images/transparent.gif" ).removeAttr( "alt" );
+        return getToggleImage().attr( "src", dhis2BaseUrl + "/images/transparent.gif" ).removeAttr( "alt" );
     }
 
     function getToggleImage() {