← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18776: show map context menu on click/right-click; minor changes enrollment based TEI list

 

------------------------------------------------------------
revno: 18776
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-31 14:18:31 +0200
message:
  show map context menu on click/right-click; minor changes enrollment based TEI list
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties
  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/views/home.html
  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/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties	2015-03-06 10:08:41 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties	2015-03-31 12:18:31 +0000
@@ -101,6 +101,10 @@
 lat_lng=[Latitude Longitude]
 get_from_map=Get from map
 capture=Capture
+zoom_in=Zoom in
+zoom_out=Zoom out
+center_map=Center map
+set_coordinate=Set coordinate
 point_and_click_for_coordinate=Point and click for coordinate
 loading_tree=Loading orgunit tree
 loading_metadata=Loading meta-data

=== 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-03-30 15:34:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-03-31 12:18:31 +0000
@@ -282,11 +282,10 @@
 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
-zoom_map=Zoom map
 zoom_in=Zoom in
 zoom_out=Zoom out
 center_map=Center map
-capture_coordinate=Capture coordinate
+set_coordinate=Set coordinate
 show_active_only=Show only active ones
 all_enrollment=Show with all enrollment status
 active_enrollment=Only those with active enrollment

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2015-03-12 10:55:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2015-03-31 12:18:31 +0000
@@ -61,16 +61,16 @@
         <div class="row top-bar">        
             <div class="col-sm-12">            
                 <span ng-if='!showRegistrationDiv'>
-                    {{selectedProgram.trackedEntity.name}} {{'search'| translate}}
+                    {{selectedProgram.trackedEntity.name}} {{'search'| translate}}                    
+                    <span class="btn-group horizonal-spacing" ng-show="selectedProgram">
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ALL'" title="{{'all_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("ALL")'><i class="fa fa-list mouse-pointer"></i></label>
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ACTIVE'" title="{{'active_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("ACTIVE")'><i class="fa fa-circle-o mouse-pointer"></i></label>
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'COMPLETED'" title="{{'completed_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("COMPLETED")'><i class="fa fa-check mouse-pointer"></i></label>
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'CANCELLED'" title="{{'cancelled_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("CANCELLED")'><i class="fa fa-times mouse-pointer"></i></label>
+                    </span>
                     <span class="small-horizonal-spacing" ng-if="pager.total">
                         ({{'total'| translate}}:  {{pager.total}})
                     </span>
-                    <span class="btn-group horizonal-spacing" ng-show="selectedProgram">
-                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ALL'" title="{{'all_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("ALL")'><i class="fa fa-check-square mouse-pointer"></i></label>
-                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ACTIVE'" title="{{'active_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("ACTIVE")'><i class="fa fa-spinner fa-spin mouse-pointer"></i></label>
-                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'COMPLETED'" title="{{'completed_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("COMPLETED")'><i class="fa fa-circle-o mouse-pointer"></i></label>
-                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'CANCELLED'" title="{{'cancelled_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("CANCELLED")'><i class="fa fa-times mouse-pointer"></i></label>
-                    </span>
                 </span>
                 <span ng-if='showRegistrationDiv'>
                     {{selectedProgram.trackedEntity.name}} {{'register'| translate}}

=== 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-12 10:55:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-03-31 12:18:31 +0000
@@ -332,6 +332,7 @@
         template: '<div></div>',
         link: function(scope, element, attrs){
 
+            var contextMenuDisplayed = false;
             var ouLevels = CurrentSelection.getOuLevels();
             
             //remove angular bootstrap ui modal draggable
@@ -358,7 +359,7 @@
                 strokeWeight: 2,
                 strokeOpacity: 0.4,
                 fillOpacity: 0.4,
-                fillColor: 'green'
+                fillColor: '#99cc99'
             };            
             
             var map = new google.maps.Map(document.getElementById(attrs.id), mapOptions);
@@ -379,13 +380,13 @@
             contextMenuOptions.classNames={menu:'map_context_menu', menuSeparator:'map_context_menu_separator'};
 
             //create an array of MapContextMenuItem objects            
-            var menuItems=[];            
+            var menuItems=[];
+            menuItems.push({className: 'map_context_menu_item', eventName: 'captureCoordinate', label: '<i class="fa fa-map-marker"></i>   ' + $translate('set_coordinate')});
+            menuItems.push({});            
             menuItems.push({className: 'map_context_menu_item', eventName: 'zoom_in', id: 'zoomIn', label: '<i class="fa fa-search-plus"></i>   ' + $translate('zoom_in')});
             menuItems.push({className: 'map_context_menu_item', eventName: 'zoom_out', id: 'zoomOut', label: '<i class="fa fa-search-minus"></i>   ' + $translate('zoom_out')});
             menuItems.push({}); 
-            menuItems.push({className: 'map_context_menu_item', eventName: 'centerMap', label: '<i class="fa fa-crosshairs"></i>   ' + $translate('center_map')});
-            menuItems.push({});
-            menuItems.push({className: 'map_context_menu_item', eventName: 'captureCoordinate', label: '<i class="fa fa-map-marker"></i>   ' + $translate('capture_coordinate')});
+            menuItems.push({className: 'map_context_menu_item', eventName: 'centerMap', label: '<i class="fa fa-crosshairs"></i>   ' + $translate('center_map')});            
             contextMenuOptions.menuItems=menuItems;
             var mapContextMenu = new MapContextMenu(map, contextMenuOptions);   
             
@@ -516,11 +517,24 @@
                 }
             }
             
+            function showHideContextMenu(event, allowDisable){
+                if(contextMenuDisplayed){
+                    mapContextMenu.hide();
+                    contextMenuDisplayed = false;
+                }
+                else{
+                    mapContextMenu.show(event);
+                    if(allowDisable){
+                        enableDisableZoom();
+                    }
+                }
+            }
+            
             //get lable for current polygon
             map.data.addListener('mouseover', function(e) {
                 $("#polygon-label").text( e.feature.k.name );
                 map.data.revertStyle();
-                map.data.overrideStyle(e.feature, {fillOpacity: 0.8});
+                map.data.overrideStyle(e.feature, {fillOpacity: 0.2});
             });
             
             //remove polygon label
@@ -529,31 +543,32 @@
                 map.data.revertStyle();
             });
             
-            //drill-down based on polygons assigned to orgunits
+            //context menu based on polygons assigned to orgunits
             map.data.addListener('rightclick', function(e){
-                mapContextMenu.show(e);
-                enableDisableZoom();
+                showHideContextMenu(e, true);
+            });            
+
+            map.data.addListener('click', function(e) {
+                showHideContextMenu(e, true);                
             });
             
-            //drill-down based on points assigned to orgunits
+            //context menu based on points assigned to orgunits
             google.maps.event.addListener(marker, 'rightclick', function(e){
-                mapContextMenu.show(e);
-                enableDisableZoom();
-            });
-            
-            //capturing coordinate from anywhere in the map - incase no polygons are defined
+                showHideContextMenu(e, true);
+            });
+            
+            google.maps.event.addListener(marker, 'click', function(e){
+                showHideContextMenu(e, true);
+            });
+            
+            //context menu anywhere in the map - incase no polygons are defined
             google.maps.event.addListener(map, 'rightclick', function(e){                
-                mapContextMenu.show(e);
+                showHideContextMenu(e, false);
             });            
             
-            //remove context menu onclick
-            map.data.addListener('click', function(e) {                
-                mapContextMenu.hide();
-            });
-            
             google.maps.event.addListener(map, 'click', function(e){                
-                mapContextMenu.hide();
-            }); 
+                showHideContextMenu(e, false);
+            });
             
             //listen for the clicks on mapContextMenu
             google.maps.event.addListener(mapContextMenu, 'menu_item_selected', function(e, latLng, eventName){              
@@ -577,9 +592,11 @@
                         
                         break;
                     case 'centerMap':
+                        contextMenuDisplayed = true;
                         map.panTo(latLng);
                         break;
                     case 'captureCoordinate':
+                        contextMenuDisplayed = true;
                         applyMarker(e);
                         break;
                 }