=== 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-03-04 12:38:52 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html 2015-03-05 15:48:50 +0000 @@ -13,6 +13,7 @@ + === 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 2015-03-04 11:34:55 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css 2015-03-05 15:48:50 +0000 @@ -907,6 +907,15 @@ pointer-events: none; } +.disabled-context-menu-item { + pointer-events: none; + color: #dddddd; + cursor: none; +} +.enable-context-menu-item { + cursor:pointer; +} + @media print { #header, #leftBar, .not-printable { display: none; === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-02-12 10:51:40 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-03-05 15:48:50 +0000 @@ -275,4 +275,9 @@ value_must_be_between=Value must be between locate_organisation_unit_by_name=Locate organisation unit by name dashboard_layout_not_saved=Dashboard layout not saved -ou_search_scope=Orgunit scope to use \ No newline at end of file +ou_search_scope=Orgunit scope to use +zoom_map=Zoom map +zoom_in=Zoom in +zoom_out=Zoom out +center_map=Center map +capture_coordinate=Capture coordinate \ No newline at end of file === 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-04 11:34:55 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 2015-03-05 15:48:50 +0000 @@ -14,6 +14,7 @@ + @@ -94,7 +95,7 @@ - + === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-03-03 16:55:58 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-03-05 15:48:50 +0000 @@ -859,7 +859,6 @@ } } - .org-unit-tree { margin-left: -5px; color: #000; @@ -947,4 +946,31 @@ padding: 5px; font-size: 15px; position: absolute; +} + +.map_context_menu{ + background-color:white; + border:1px solid gray; + z-index: 1000; +} +.map_context_menu_item{ + padding:3px 6px; +} +.map_context_menu_item:hover{ + background-color:#CCCCCC; +} +.map_context_menu_separator{ + background-color:gray; + height:1px; + margin:0; + padding:0; +} + +.disabled-context-menu-item { + pointer-events: none; + color: #dddddd; + cursor: none; +} +.enable-context-menu-item { + cursor:pointer; } \ No newline at end of file === modified 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 2015-03-04 11:34:55 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/coordinatecapture/map.html 2015-03-05 15:48:50 +0000 @@ -11,5 +11,5 @@
\ 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.directives.js' --- 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 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js 2015-03-05 15:48:50 +0000 @@ -253,21 +253,6 @@ }; }) -/*.directive('d2Sortable', function() { - - return { - restrict: 'A', - link: function(scope, element, attrs){ - element.sortable({ - connectWith: ".connectedSortable", - placeholder: "ui-state-highlight", - tolerance: "pointer", - handle: '.handle' - }); - } - }; -})*/ - .directive('d2Sortable', function($timeout) { return { @@ -340,7 +325,7 @@ }; }) -.directive('d2GoogleMap', function ($parse, $http, CurrentSelection) { +.directive('d2GoogleMap', function ($parse, $http, $translate, CurrentSelection) { return { restrict: 'E', replace: true, @@ -350,7 +335,7 @@ var ouLevels = CurrentSelection.getOuLevels(); //remove angular bootstrap ui modal draggable - $(".modal-content").draggable({ disabled: true }); + $(".modal-content").draggable({ disabled: true }); //get a default center var latCenter = 12.31, lngCenter = 51.48; @@ -365,7 +350,7 @@ //default map configurations var mapOptions = { - zoom: 3, + zoom: 4, center: new google.maps.LatLng(latCenter, lngCenter), mapTypeId: google.maps.MapTypeId.ROADMAP }, @@ -388,20 +373,40 @@ } } - var currentLayer, currentGeojson, currentGeojsonFeatures; - - function getGeoJsonByOuLevel(initialize, event){ - + var currentLayer = 0, currentGeojson, currentGeojsonFeatures; + + var contextMenuOptions={}; + contextMenuOptions.classNames={menu:'map_context_menu', menuSeparator:'map_context_menu_separator'}; + + //create an array of MapContextMenuItem objects + var menuItems=[]; + menuItems.push({className: 'map_context_menu_item', eventName: 'zoom_in', id: 'zoomIn', label: ' ' + $translate('zoom_in')}); + menuItems.push({className: 'map_context_menu_item', eventName: 'zoom_out', id: 'zoomOut', label: ' ' + $translate('zoom_out')}); + menuItems.push({}); + menuItems.push({className: 'map_context_menu_item', eventName: 'centerMap', label: ' ' + $translate('center_map')}); + menuItems.push({}); + menuItems.push({className: 'map_context_menu_item', eventName: 'captureCoordinate', label: ' ' + $translate('capture_coordinate')}); + contextMenuOptions.menuItems=menuItems; + var mapContextMenu = new MapContextMenu(map, contextMenuOptions); + + function getGeoJsonByOuLevel(initialize, event, mode){ var url = ''; - if(currentLayer >= ouLevels.length-1 || initialize){ + if(initialize){ currentLayer = 0; url = '../api/organisationUnits.geojson?level=' + ouLevels[currentLayer].level; } else{ - currentLayer++; - url = '../api/organisationUnits.geojson?level=' + ouLevels[currentLayer].level + '&parent=' + event.feature.D; + if(mode === 'IN'){ + currentLayer++; + url = '../api/organisationUnits.geojson?level=' + ouLevels[currentLayer].level + '&parent=' + event.feature.D; + } + if(mode === 'OUT'){ + currentLayer--; + var parents = event.feature.k.parentGraph.substring(1,event.feature.k.parentGraph.length-1).split('/'); + url = '../api/organisationUnits.geojson?level=' + ouLevels[currentLayer].level + '&parent=' + parents[parents.length-2]; + } } - + $http.get( url ).then(function(response){ currentGeojson = response.data; currentGeojsonFeatures = map.data.addGeoJson(currentGeojson); @@ -434,11 +439,11 @@ }); } - function centerMap(){ + function centerMap(){ if(currentGeojson && currentGeojson.features){ var latLngBounds = getMapCenter(currentGeojson); map.fitBounds(latLngBounds); - map.panToBounds(latLngBounds); + map.panToBounds(latLngBounds); } } @@ -476,6 +481,41 @@ getGeoJsonByOuLevel(true, null); } + function zoomMap(event, mode){ + + for(var i = 0; i < currentGeojsonFeatures.length; i++){ + map.data.remove(currentGeojsonFeatures[i]); + } + + for(var i=0; i