← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18475: tracker|event-capture: capture coordiante - WIP

 

------------------------------------------------------------
revno: 18475
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-03-04 12:34:55 +0100
message:
  tracker|event-capture: capture coordiante - WIP
removed:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/map.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/custom-overlay.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/map.html
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/coordinatecapture/
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/coordinatecapture/map.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.map.textoverlay.js
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.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-apps/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html	2015-02-02 13:42:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html	2015-03-04 11:34:55 +0000
@@ -7,6 +7,13 @@
         <meta name="description" content="DHIS 2">
         <meta name="keywords" content="DHIS 2">        
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+        
+        <script type="text/javascript">
+            window.google = null;
+        </script>
+
+        <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false";></script>
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.map.textoverlay.js"></script>
        
         <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.min.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui.min.js"></script>
@@ -73,7 +80,7 @@
         
         <script type="text/javascript" src="scripts/app.js"></script>        
         <script type="text/javascript" src="scripts/services.js"></script>
-        <script type="text/javascript" src="scripts/directives.js"></script>
+        <script type="text/javascript" src="scripts/directives.js"></script>        
         <script type="text/javascript" src="scripts/controllers.js"></script>        
         <script type="text/javascript" src="scripts/notes-controller.js"></script>        
         <script type="text/javascript" src="scripts/filters.js"></script>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-02-02 13:42:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-03-04 11:34:55 +0000
@@ -10,6 +10,7 @@
                 $timeout,
                 $translate,
                 $anchorScroll,
+                orderByFilter,
                 storage,
                 Paginator,
                 OptionSetService,
@@ -23,7 +24,9 @@
                 CalendarService,
                 GridColumnService,
                 CustomFormService,
+                ECStorageService,
                 ErrorMessageService,
+                CurrentSelection,
                 ModalService,
                 DialogService) {
     //selected org unit
@@ -49,7 +52,7 @@
     $scope.currentElement = {id: '', update: false};
     $scope.optionSets = [];
     $scope.proceedSelection = true;
-    $scope.formUnsaved = false;
+    $scope.formUnsaved = false;    
     
     //notes
     $scope.note = {};
@@ -58,13 +61,22 @@
     var userAccount = storage.get('USER_PROFILE');
     var storedBy = userAccount ? userAccount.userName : '';    
     $scope.noteExists = false;
-    storage.remove('SELECTED_OU');   
+    storage.remove('SELECTED_OU');
         
     //watch for selection of org unit from tree
     $scope.$watch('selectedOrgUnit', function() {
         
         if(angular.isObject($scope.selectedOrgUnit)){
             storage.set('SELECTED_OU', $scope.selectedOrgUnit);
+            
+            //get ouLevels
+            ECStorageService.currentStore.open().done(function(){
+                ECStorageService.currentStore.getAll('ouLevels').done(function(response){
+                    var ouLevels = angular.isObject(response) ? orderByFilter(response, '-level').reverse() : [];
+                    CurrentSelection.setOuLevels(orderByFilter(ouLevels, '-level').reverse());
+                });
+            });
+            
             if($scope.optionSets.length < 1){
                 $scope.optionSets = [];
                 OptionSetService.getAll().then(function(optionSets){
@@ -785,15 +797,12 @@
     
     $scope.showMap = function(event){
         var modalInstance = $modal.open({
-            templateUrl: 'views/map.html',
+            templateUrl: '../dhis-web-commons/coordinatecapture/map.html',
             controller: 'MapController',
             windowClass: 'modal-full-window',
             resolve: {
                 location: function () {
                     return {lat: event.coordinate.latitude, lng: event.coordinate.longitude};
-                },
-                geoJsons: function(){
-                    return $scope.geoJsons;
                 }
             }
         });

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js	2015-01-29 17:13:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js	2015-03-04 11:34:55 +0000
@@ -29,7 +29,7 @@
 dhis2.ec.store = new dhis2.storage.Store({
     name: 'dhis2ec',
     adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
-    objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations']
+    objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations', 'ouLevels']
 });
 
 (function($) {
@@ -143,8 +143,7 @@
     
     promise = promise.then( dhis2.ec.store.open );
     promise = promise.then( getCalendarSetting );
-    promise = promise.then( getOrgUnitLevels );
-    //promise = promise.then( getGeoJsonsByLevel );
+    promise = promise.then( getOrgUnitLevels );    
     promise = promise.then( getMetaPrograms );     
     promise = promise.then( getPrograms );     
     promise = promise.then( getProgramStages );
@@ -183,88 +182,27 @@
 
 function getOrgUnitLevels()
 {
-    var def = $.Deferred();
-
-    $.ajax({
-        url: '../api/organisationUnitLevels.json',
-        type: 'GET',
-        data:'filter=level:gt:1&fields=id,name,level&paging=false'
-    }).done( function(response) {      
-        var ouLevels = [];
-        if(response.organisationUnitLevels){
-            ouLevels = _.sortBy(response.organisationUnitLevels, function(ouLevel){
-                return ouLevel.level;
-            });
+    dhis2.ec.store.getKeys( 'ouLevels').done(function(res){        
+        if(res.length > 0){
+            return;
         }
-        def.resolve( ouLevels );
-    }).fail(function(){
-        def.resolve(null);
-    });
-    
-    return def.promise();    
-}
-
-function getGeoJsonsByLevel( ouLevels )
-{
-    if( !ouLevels ){
-        return;
-    }
-
-    var mainDef = $.Deferred();
-    var mainPromise = mainDef.promise();
-
-    var def = $.Deferred();
-    var promise = def.promise();
-
-    var builder = $.Deferred();
-    var build = builder.promise();
-
-    _.each( _.values( ouLevels ), function ( ouLevel ) {
-        if(ouLevel.level){
-            build = build.then(function() {
-                var d = $.Deferred();
-                var p = d.promise();
-                dhis2.ec.store.get('geoJsons', ouLevel.level).done(function(obj) {
-                    if(!obj) {
-                        promise = promise.then( getGeoJson( ouLevel.level ) );
-                    }
-                    d.resolve();
-                });
-
-                return p;
-            });
-        }        
-    });
-
-    build.done(function() {
-        def.resolve();
-        promise = promise.done( function () {
-            mainDef.resolve();
-        });
-    }).fail(function(){
-        mainDef.resolve();
-    });
-
-    builder.resolve();
-
-    return mainPromise;
-}
-
-function getGeoJson( level )
-{
-    return function() {
-        return $.ajax( {
-            url: '../api/organisationUnits.geojson',
+        var def = $.Deferred();
+
+        $.ajax({
+            url: '../api/organisationUnitLevels.json',
             type: 'GET',
-            data: 'level=' + level
-        }).done( function( response ){
-            
-            var geojson = {};
-            geojson = response;
-            geojson.id = level;            
-            dhis2.ec.store.set( 'geoJsons', geojson );
+            data:'filter=level:gt:1&fields=id,name,level&paging=false'
+        }).done(function(response) {
+            if(response.organisationUnitLevels){
+                dhis2.ec.store.setAll( 'ouLevels', response.organisationUnitLevels );
+            }            
+            def.resolve();        
+        }).fail(function(){
+            def.resolve();
         });
-    };
+
+        return def.promise();
+    });    
 }
 
 function getMetaPrograms()

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2015-01-29 17:13:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2015-03-04 11:34:55 +0000
@@ -8,7 +8,7 @@
     var store = new dhis2.storage.Store({
         name: 'dhis2ec',
         adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
-        objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations']
+        objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations', 'ouLevels']
     });
     return{
         currentStore: store
@@ -58,6 +58,19 @@
     };
 })
 
+/* current selections */
+.service('CurrentSelection', function(){
+
+    this.ouLevels = null;     
+    
+    this.setOuLevels = function(ouLevels){
+        this.ouLevels = ouLevels;
+    };
+    this.getOuLevels = function(){
+        return this.ouLevels;
+    };
+})
+
 /* Factory to fetch optionSets */
 .factory('OptionSetService', function($q, $rootScope, ECStorageService) { 
     return {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2014-12-18 11:50:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2015-03-04 11:34:55 +0000
@@ -251,9 +251,15 @@
 }
 
 #polygon-label {
-    background-color: #000000;
-    color: #fff;
-    font-size: 12px;
+    text-align: center;
+    padding: 5px;
+    font-size: 15px;
+}
+
+.polygon-name {
+    padding: 5px;
+    font-size: 15px;
+    position: absolute;
 }
 
 .contextmenu{
@@ -947,4 +953,4 @@
     {
         padding: 11px 0 10px 5px;
     }
-}
\ No newline at end of file
+}

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2015-01-26 17:47:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2015-03-04 11:34:55 +0000
@@ -50,6 +50,9 @@
                            ng-required="false"
                            style="width:99%;"/>
                     <span ng-show="outerForm.latitude.$invalid" class="required">{{'int_required'| translate}} [-90 ... 90]</span>
+                    <span class='pull-right'>
+                        <a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a>
+                    </span>
                 </td>                                            
             </tr>
             <tr ng-if="selectedProgramStage.captureCoordinates">
@@ -65,11 +68,12 @@
                            ng-required="false"
                            style="width:99%;"/>
                     <span ng-show="outerForm.longitude.$invalid" class="required">{{'int_required'| translate}}[-180 ... 180]</span>
-                </td>                                            
+                    <span class='pull-right'>
+                        <a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a>
+                    </span>
+                </td>                                                            
             </tr>
-            <!--<span class='pull-right'>
-                <a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a>
-            </span>-->
+            
             <tr ng-repeat="eventGridColumn in eventGridColumns" ng-if="eventGridColumn.id !== 'comment' && eventGridColumn.id !== 'uid' && eventGridColumn.id !== 'event_date'">
                 <td >
                     {{eventGridColumn.name}}<span ng-if="eventGridColumn.compulsory" class="required">*</span>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html	2015-01-26 17:47:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html	2015-03-04 11:34:55 +0000
@@ -51,9 +51,9 @@
                    style="min-width:128px"/>
                 <span ng-show="outerForm.longitude.$invalid" class="required">{{'int_required'| translate}}[-180 ... 180]</span>
             </span>
-            <!--<span class='pull-right'>
+            <span class='pull-right'>
                 <a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a>
-            </span>-->
+            </span>
         </td>
     </tr>
 </table>

=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/map.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/map.html	2014-11-03 11:11:25 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/map.html	1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-<div class="modal-header page">
-    <h3>
-        {{'point_and_click_for_coordinate'| translate}}
-        <span id='polygon-label' class="pull-right"></span>
-    </h3>
-</div>
-<div class="modal-body page">
-    <d2-google-map location="location" id="map-container" geojsons="geoJsons"></d2-google-map>
-</div>
-<div class="modal-footer page">
-    <button class="big-button grey" data-ng-click="captureCoordinate()">{{'capture'| translate}}</button>
-    <button class="big-button grey" data-ng-click="close()">{{'cancel'| translate}}</button>        
-</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-03-03 16:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-03-04 11:34:55 +0000
@@ -27,7 +27,7 @@
     //get ouLevels
     TCStorageService.currentStore.open().done(function(){
         TCStorageService.currentStore.getAll('ouLevels').done(function(response){
-            var ouLevels = response;
+            var ouLevels = angular.isObject(response) ? orderByFilter(response, '-level').reverse() : [];
             CurrentSelection.setOuLevels(orderByFilter(ouLevels, '-level').reverse());
         });
     });

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-03-03 16:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-03-04 11:34:55 +0000
@@ -675,15 +675,12 @@
     
     $scope.showMap = function(event){
         var modalInstance = $modal.open({
-            templateUrl: 'views/map.html',
+            templateUrl: '../dhis-web-commons/coordinatecapture/map.html',
             controller: 'MapController',
             windowClass: 'modal-full-window',
             resolve: {
                 location: function () {
                     return {lat: event.coordinate.latitude, lng: event.coordinate.longitude};
-                },
-                geoJsons: function(){
-                    return $scope.geoJsons;
                 }
             }
         });

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2015-03-03 16:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2015-03-04 11:34:55 +0000
@@ -13,7 +13,7 @@
         </script>
 
         <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false";></script>
-        <script src="scripts/custom-overlay.js"></script>
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.map.textoverlay.js"></script>
     
         <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.min.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui.min.js"></script>

=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/custom-overlay.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/custom-overlay.js	2015-03-03 16:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/custom-overlay.js	1970-01-01 00:00:00 +0000
@@ -1,101 +0,0 @@
-//adapded from this example http://code.google.com/apis/maps/documentation/javascript/overlays.html#CustomOverlays
-//text overlays
-function TxtOverlay(pos, txt, cls, map) {
-
-    // Now initialize all properties.
-    this.pos = pos;
-    this.txt_ = txt;
-    this.cls_ = cls;
-    this.map_ = map;
-
-    // We define a property to hold the image's
-    // div. We'll actually create this div
-    // upon receipt of the add() method so we'll
-    // leave it null for now.
-    this.div_ = null;
-
-    // Explicitly call setMap() on this overlay
-    this.setMap(map);
-}
-
-TxtOverlay.prototype = new google.maps.OverlayView();
-
-
-
-TxtOverlay.prototype.onAdd = function () {
-
-    // Note: an overlay's receipt of onAdd() indicates that
-    // the map's panes are now available for attaching
-    // the overlay to the map via the DOM.
-
-    // Create the DIV and set some basic attributes.
-    var div = document.createElement('DIV');
-    div.className = this.cls_;
-
-    div.innerHTML = this.txt_;
-
-    // Set the overlay's div_ property to this DIV
-    this.div_ = div;
-    var overlayProjection = this.getProjection();
-    var position = overlayProjection.fromLatLngToDivPixel(this.pos);
-    div.style.left = position.x + 'px';
-    div.style.top = position.y + 'px';
-    // We add an overlay to a map via one of the map's panes.
-
-    var panes = this.getPanes();
-    panes.floatPane.appendChild(div);
-}
-TxtOverlay.prototype.draw = function () {
-
-
-    var overlayProjection = this.getProjection();
-
-    // Retrieve the southwest and northeast coordinates of this overlay
-    // in latlngs and convert them to pixels coordinates.
-    // We'll use these coordinates to resize the DIV.
-    var position = overlayProjection.fromLatLngToDivPixel(this.pos);
-
-
-    var div = this.div_;
-    div.style.left = position.x + 'px';
-    div.style.top = position.y + 'px';
-
-
-
-}
-//Optional: helper methods for removing and toggling the text overlay.  
-TxtOverlay.prototype.onRemove = function () {
-    this.div_.parentNode.removeChild(this.div_);
-    this.div_ = null;
-}
-TxtOverlay.prototype.hide = function () {
-    if (this.div_) {
-        this.div_.style.visibility = "hidden";
-    }
-}
-
-TxtOverlay.prototype.show = function () {
-    if (this.div_) {
-        this.div_.style.visibility = "visible";
-    }
-}
-
-TxtOverlay.prototype.toggle = function () {
-    if (this.div_) {
-        if (this.div_.style.visibility == "hidden") {
-            this.show();
-        }
-        else {
-            this.hide();
-        }
-    }
-}
-
-TxtOverlay.prototype.toggleDOM = function () {
-    if (this.getMap()) {
-        this.setMap(null);
-    }
-    else {
-        this.setMap(this.map_);
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/map.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/map.html	2015-03-03 16:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/map.html	1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
-<div class="modal-header remove-default-padding">
-    <h2>
-        {{'point_and_click_for_coordinate'| translate}}        
-    </h2>
-</div>
-<div class="modal-body remove-default-padding">
-    <div class="align-center">
-        <span id='polygon-label'></span>
-    </div>    
-    <d2-google-map location="location" id="map-container"></d2-google-map>
-</div>
-<div class="modal-footer remove-default-padding">
-    <button class="btn btn-primary" data-ng-click="captureCoordinate()">{{'capture'| translate}}</button>
-    <button class="btn btn-default" data-ng-click="close()">{{'cancel'| translate}}</button>        
-</div>
\ No newline at end of file

=== added directory 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/coordinatecapture'
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/coordinatecapture/map.html'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/coordinatecapture/map.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/coordinatecapture/map.html	2015-03-04 11:34:55 +0000
@@ -0,0 +1,15 @@
+<div class="modal-header remove-default-padding">
+    <h2>
+        {{'point_and_click_for_coordinate'| translate}}        
+    </h2>
+</div>
+<div class="modal-body remove-default-padding">
+    <div class="align-center">
+        <span id='polygon-label'></span>
+    </div>    
+    <d2-google-map location="location" id="map-container"></d2-google-map>
+</div>
+<div class="modal-footer remove-default-padding">
+    <button class="btn btn-primary" data-ng-click="captureCoordinate()">{{'capture'| translate}}</button>
+    <button class="btn btn-default" data-ng-click="close()">{{'cancel'| translate}}</button>        
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js	2015-02-02 13:42:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js	2015-03-04 11:34:55 +0000
@@ -32,8 +32,7 @@
 .controller('MapController',
         function($scope, 
                 $modalInstance,
-                DHIS2URL,
-                geoJsons,
+                DHIS2URL,                
                 location) {
     
     $scope.home = function(){        
@@ -41,7 +40,6 @@
     };
     
     $scope.location = location;
-    $scope.geoJsons = geoJsons;
     
     $scope.close = function () {
         $modalInstance.close();

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-03-03 16:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-03-04 11:34:55 +0000
@@ -346,7 +346,7 @@
         replace: true,
         template: '<div></div>',
         link: function(scope, element, attrs){
-            
+
             var ouLevels = CurrentSelection.getOuLevels();
             
             //remove angular bootstrap ui modal draggable
@@ -459,12 +459,12 @@
                             latLngBounds.extend(new google.maps.LatLng(coordinate[1],coordinate[0]));
                             polygonPoints.extend(new google.maps.LatLng(coordinate[1],coordinate[0]));                            
                         });
-                        var txt = new TxtOverlay(polygonPoints.getCenter(), customTxt, "polygon-name", map);
+                        var txt = new Dhis2TextOverlay(polygonPoints.getCenter(), customTxt, "polygon-name", map);
                         overLays.push(txt);
                     }
                     else if(feature.geometry.type === 'Point'){
                         latLngBounds.extend(new google.maps.LatLng(feature.geometry.coordinates[1],feature.geometry.coordinates[0]));                        
-                        var txt = new TxtOverlay(new google.maps.LatLng(feature.geometry.coordinates[1],feature.geometry.coordinates[0]),customTxt, "polygon-name",map );
+                        var txt = new Dhis2TextOverlay(new google.maps.LatLng(feature.geometry.coordinates[1],feature.geometry.coordinates[0]),customTxt, "polygon-name",map );
                         overLays.push(txt);
                     }
                 });

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.map.textoverlay.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.map.textoverlay.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.map.textoverlay.js	2015-03-04 11:34:55 +0000
@@ -0,0 +1,103 @@
+// https://developers.google.com/maps/documentation/javascript/customoverlays
+/** @constructor */
+function Dhis2TextOverlay(pos, txt, cls, map) {
+
+    // Initialize properties.
+    this.pos = pos;
+    this.txt_ = txt;
+    this.cls_ = cls;
+    this.map_ = map;
+
+    // Div to contain text
+    this.div_ = null;
+
+    // Explicitly call setMap() on this overlay
+    this.setMap(map);
+}
+
+Dhis2TextOverlay.prototype = new google.maps.OverlayView();
+
+
+/**
+ * onAdd is called when the map's panes are ready and the overlay has been
+ * added to the map.
+ */
+Dhis2TextOverlay.prototype.onAdd = function () {
+
+    // Create the DIV and set some basic attributes.
+    var div = document.createElement('DIV');
+    div.className = this.cls_;
+    div.innerHTML = this.txt_;
+
+    // Set the overlay's div_ property to this DIV
+    this.div_ = div;
+    var overlayProjection = this.getProjection();
+    var position = overlayProjection.fromLatLngToDivPixel(this.pos);
+    div.style.left = position.x + 'px';
+    div.style.top = position.y + 'px';
+    
+    // Add the element to the "overlayLayer" pane.
+    var panes = this.getPanes();
+    panes.floatPane.appendChild(div);
+};
+
+Dhis2TextOverlay.prototype.draw = function () {
+
+    // We use the south-west and north-east
+    // coordinates of the overlay to peg it to the correct position and size.
+    // To do this, we need to retrieve the projection from the overlay.
+    var overlayProjection = this.getProjection();
+
+    // Retrieve the southwest and northeast coordinates of this overlay
+    // in latlngs and convert them to pixels coordinates.
+    // We'll use these coordinates to resize the DIV.
+    var position = overlayProjection.fromLatLngToDivPixel(this.pos);
+
+    // Resize the div to fit the indicated dimensions.
+    var div = this.div_;
+    div.style.left = position.x + 'px';
+    div.style.top = position.y + 'px';
+};
+
+// The onRemove() method will be called automatically from the API if
+// we ever set the overlay's map property to 'null'
+Dhis2TextOverlay.prototype.onRemove = function () {
+    this.div_.parentNode.removeChild(this.div_);
+    this.div_ = null;
+};
+
+// Set the visibility to 'hidden' or 'visible'.
+Dhis2TextOverlay.prototype.hide = function () {
+    if (this.div_) {
+        this.div_.style.visibility = "hidden";
+    }
+};
+
+Dhis2TextOverlay.prototype.show = function () {
+    if (this.div_) {
+        this.div_.style.visibility = "visible";
+    }
+};
+
+Dhis2TextOverlay.prototype.toggle = function () {
+    if (this.div_) {
+        if (this.div_.style.visibility === "hidden") {
+            this.show();
+        }
+        else {
+            this.hide();
+        }
+    }
+};
+
+// Detach the map from the DOM via toggleDOM().
+// Note that if we later reattach the map, it will be visible again,
+// because the containing <div> is recreated in the overlay's onAdd() method.
+Dhis2TextOverlay.prototype.toggleDOM = function () {
+    if (this.getMap()) {
+        this.setMap(null);
+    }
+    else {
+        this.setMap(this.map_);
+    }
+};