← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22196: Modified to have only one audit icon for all data entries / profile attributes instead of an audi...

 

------------------------------------------------------------
revno: 22196
committer: jijukjose <jijukjose@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-08 17:27:49 +0100
message:
  Modified to have only one audit icon for all data entries / profile attributes instead of an audit icon for each data entry / profile attribute
modified:
  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/home.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/audit-history.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
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2016-02-25 09:11:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2016-03-08 16:27:49 +0000
@@ -466,11 +466,6 @@
     margin-left: 2px;
 }
 
-.audit-icon-column {
-    width: 20px !important;
-    text-align: center;
-}
-
 .radio-display-none {
     display: none;
 }

=== 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	2016-03-01 15:11:41 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2016-03-08 16:27:49 +0000
@@ -28,9 +28,7 @@
                 <th>
                     {{'value'| translate}}                    
                 </th>
-                <th class="hideInPrint audit-icon-column" ng-if="currentEvent.event && currentEvent.event !== 'SINGLE_EVENT'">
-                </th>
-            </tr>                        
+            </tr>
         </thead>
         <tbody>
             <tr ng-repeat="eventGridColumn in eventGridColumns" ng-if="eventGridColumn.id !== 'comment' && eventGridColumn.id !== 'uid' && eventGridColumn.id !== 'eventDate' && !hiddenFields[eventGridColumn.id]">
@@ -263,10 +261,7 @@
                         </div>
                     </ng-form>
                 </td>
-                <td ng-if="currentEvent.event && currentEvent.event !== 'SINGLE_EVENT'">
-                    <d2-audit dataelement-id="{{prStDes[eventGridColumn.id].dataElement.id}}" dataelement-name="{{prStDes[eventGridColumn.id].dataElement.displayName}}"  current-event="{{currentEvent.event}}"></d2-audit>
-                </td>
-            </tr>        
+            </tr>
         </tbody>
     </table>
     
@@ -291,9 +286,7 @@
                     <th>
                         {{'value'| translate}}                    
                     </th>
-                    <th class="hideInPrint audit-icon-column" ng-if="currentEvent.event && currentEvent.event !== 'SINGLE_EVENT'">
-                    </th>
-                </tr>                        
+                </tr>
             </thead>
             <tbody>
                 <tr ng-repeat="de in section.programStageDataElements" ng-if="!hiddenFields[de.dataElement.id]">
@@ -533,12 +526,6 @@
                                 {{warningMessages[de.dataElement.id]}}
                             </div>
                         </ng-form>
-                        <!--<span class="hideInPrint audit-icon" ng-if="currentEvent.event && currentEvent.event !== 'SINGLE_EVENT'">
-                            <d2-audit dataelement-id="{{de.dataElement.id}}" dataelement-name="{{prStDes[de.dataElement.id].dataElement.displayName}}"  current-event="{{currentEvent.event}}"></d2-audit>
-                        </span>-->
-                    </td>
-                    <td ng-if="currentEvent.event && currentEvent.event !== 'SINGLE_EVENT'">
-                        <d2-audit dataelement-id="{{de.dataElement.id}}" dataelement-name="{{prStDes[de.dataElement.id].dataElement.displayName}}"  current-event="{{currentEvent.event}}"></d2-audit>
                     </td>
                 </tr>
             </tbody>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2016-02-12 15:42:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2016-03-08 16:27:49 +0000
@@ -26,7 +26,7 @@
         <img src="../images/ajax-loader-bar.gif" alt="{{'in_progress'| translate}}" ng-if="!selectedOrgUnit"/><br>
         {{'loading_metadata'| translate}}
     </div>
-    
+
     <div ng-show="selectedOrgUnit && userAuthority.canAddOrUpdateEvent">
         
         <h3>
@@ -108,7 +108,7 @@
             </div>
         </div>        
         <!-- selection ends -->        
-        
+
         <!-- event grid begins -->
         <div ng-include="'views/eventList.html'"></div>
         <!-- event grid ends -->
@@ -119,6 +119,10 @@
                 <h3>
                     <span ng-if="editingEventInFull">{{'event_details'| translate}}</span>
                     <span ng-if="eventRegistration">{{'new_event'| translate}}</span>
+                    <span ng-if="currentEvent.event && currentEvent.event !== 'SINGLE_EVENT'" style="margin-left: 53%">
+                        <d2-audit style="font-size: 15px" name-id-map="prStDes" event-id="{{currentEvent.event}}" data-type="dataElement">
+                        </d2-audit>
+                    </span>
                 </h3>
                 <div class="col-sm-8">
                     <div class="bordered-div">
@@ -128,6 +132,7 @@
                         <div ng-include="'views/buttons-section.html'"></div>
                     </div>                    
                 </div>
+
                 <div class="col-sm-4" ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0">
                     <div class="bordered-div">
                         <div ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0" ng-include="'views/indicators.html'"></div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2016-03-02 14:10:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2016-03-08 16:27:49 +0000
@@ -19,6 +19,7 @@
                 <a href ng-click="model.showEventSearch = !model.showEventSearch" title="{{'search'| translate}}" ng-if="allEventsSorted.length > eventPageSize" class="small-horizonal-spacing"><i class="fa fa-search vertical-center"></i></a>
                 <a href ng-click="model.showLegend = !model.showLegend" title="{{'event_color_legend'| translate}}" class="small-horizonal-spacing"><i class="fa fa-info-circle vertical-center"></i></a>
                 <a href ng-click="toggleEventsTableDisplay()" title="{{showEventsAsTables ? 'toggle_table_view_off' : 'toggle_table_view_on'| translate}}" ng-show="stagesCanBeShownAsTable"><span ng-if="!showEventsAsTables"><i class="fa fa-bars vertical-center"></i></span><span ng-if="showEventsAsTables"><i class="fa fa-square vertical-center"></i></span></a>
+                <d2-audit name-id-map="prStDes" event-id="{{currentEvent.event}}" data-type="dataElement"></d2-audit>
                 <a class="small-horizonal-spacing" href ng-click="expandCollapse(dataentryWidget)">
                     <span ng-show="dataentryWidget.expand"><i class="fa fa-chevron-up vertical-center" title="{{collapseLabel}}"></i></span>
                     <span ng-show="!dataentryWidget.expand"><i class="fa fa-chevron-down vertical-center" title="{{expandLabel}}"></i></span>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2016-03-01 15:11:41 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2016-03-08 16:27:49 +0000
@@ -25,8 +25,6 @@
             </th>
             <th class="" ng-bind="valueLabel">
             </th>
-            <th class="hideInPrint audit-icon-column" ng-if="currentEvent.event">
-            </th>
             <th class="form-narrow-column" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
             </th>
         </tr>
@@ -51,9 +49,6 @@
             
             <td dhis2-compiled-include="components/dataentry/inner-form.html">                
             </td>
-            <td ng-if="currentEvent.event" class="hideInPrint audit-icon-column" align="center">
-                <d2-audit dataelement-id="{{prStDe.dataElement.id}}" dataelement-name="{{prStDe.dataElement.displayName}}" current-event="{{currentEvent.event}}"></d2-audit>
-            </td>
             <td class="form-narrow-column" ng-if="allowProvidedElsewhereExists[currentStage.id]">
                 <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
                     <span>
@@ -86,8 +81,6 @@
                         </th>
                         <th ng-bind="valueLabel">
                         </th>
-                        <th class="hideInPrint audit-icon-column" ng-if="currentEvent.event">
-                        </th>
                         <th class="form-narrow-column" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
                         </th>
                     </tr>
@@ -114,9 +107,6 @@
                             </td>
                             <td dhis2-compiled-include="components/dataentry/section-inner-form.html">
                             </td>
-                            <td class="hideInPrint audit-icon-column" align="center" ng-if="currentEvent.event">
-                                <d2-audit dataelement-id="{{de.dataElement.id}}" dataelement-name="{{prStDes[de.dataElement.id].dataElement.displayName}}" current-event="{{currentEvent.event}}"></d2-audit>
-                            </td>
                             <td class="form-narrow-column" ng-if="allowProvidedElsewhereExists[currentStage.id]">
                                 <div class="align-center" ng-show="prStDes[de.dataElement.id].allowProvidedElsewhere">
                                     <input type="checkbox"

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2015-12-16 09:43:38 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2016-03-08 16:27:49 +0000
@@ -37,7 +37,6 @@
         $scope.optionSets = selections.optionSets;
         $scope.trackedEntityForm = null;
         $scope.customForm = null;
-        $scope.attributes = [];
         $scope.attributesById = CurrentSelection.getAttributesById();
         
         //display only those attributes that belong to the selected program

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2016-03-08 13:58:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2016-03-08 16:27:49 +0000
@@ -9,6 +9,8 @@
             <a class="small-horizonal-spacing" href ng-click="expandCollapse(profileWidget)">
                 <span ng-show="profileWidget.expand"><i class="fa fa-chevron-up" title="{{collapseLabel}}"></i></span>
                 <span ng-show="!profileWidget.expand"><i class="fa fa-chevron-down" title="{{expandLabel}}"></i></span>
+                <d2-audit name-id-map="attributesById" event-id="{{selectedTei.trackedEntityInstance}}" data-type="attribute">
+                </d2-audit>
             </a>
             <a class="small-horizonal-spacing" href ng-click="removeWidget(profileWidget)" title="{{removeLabel}}"><i class="fa fa-times-circle"></i></a>            
         </span>        

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2016-03-08 08:14:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2016-03-08 16:27:49 +0000
@@ -191,8 +191,5 @@
                 </div>
             </ng-form>            
         </td>
-        <td class="hideInPrint audit-icon-column" align="center" ng-if="selectedTeiId">
-            <d2-audit dataelement-id="{{attribute.id}}" dataelement-name="{{attribute.displayName}}" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}}></d2-audit>
-        </td>
     </tr>           
 </table>

=== 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	2016-03-08 13:58:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2016-03-08 16:27:49 +0000
@@ -1921,11 +1921,6 @@
     margin-left: 5px;
 }
 
-.audit-icon-column {
-    width: 20px !important;
-    text-align: center;
-}
-
 .row-with-go-button {
     margin-top: 46%;
     margin-left: 1%;

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/audit-history.html'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/audit-history.html	2016-02-03 10:04:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/audit-history.html	2016-03-08 16:27:49 +0000
@@ -1,31 +1,37 @@
-<div class="modal-header">
-    <h2>{{'audit_history'| translate}} for {{trackedEntity}}</h2>
-</div>
-
-<div class="modal-body">
-    <table class="listTable dhis2-table-striped-border" ng-if="itemList.length > 0">
-        <tr>
-            <th colspan="4">{{'audit_date'| translate}}</th>
-            <th colspan="3">{{'audit_value'| translate}}</th>
-            <th colspan="2">{{'audit_modified'| translate}}</th>
-        </tr>
-        <tr ng-repeat="item in itemList">
-            <td colspan="4">
-                {{item.created}}
-            </td>
-            <td colspan="3">
-                {{item.value}}
-            </td>
-            <td colspan="2">
-                {{item.modifiedBy}}
-            </td>
-        </tr>
-    </table>    
-    <div ng-if="itemList.length === 0">		        
-    	{{'audit_history_unavailable'| translate}} {{trackedEntity}}
-	</div>
-</div>
-
-<div class="modal-footer">
-    <button type="button" class="btn btn-default" data-ng-click="close()">{{'close'| translate}}</button>
+<div>
+    <div class="modal-header">
+        <h2>{{'audit_history'| translate}}</h2>
+    </div>
+
+    <div class="modal-body">
+        <span class="row">
+            <input class="form-control col-md-7" ng-model="searchText" placeholder="Search" type="search" ng-change="searchTheList()" />
+        </span>
+        </br>
+        <table class="listTable dhis2-table-striped-border">
+            <tr>
+                <th ng-if="model.type==='dataElement'" colspan="4">Data Element</th>
+                <th ng-if="model.type==='attribute'" colspan="4">Attribute</th>
+                <th colspan="4"> {{'audit_date' | translate}}</th>
+                <th colspan="4"> {{'audit_value' | translate}}</th>
+                <th colspan="4"> {{'audit_modified' | translate}}</th>
+            </tr>
+            <tbody ng-repeat="(key,values) in listInDisplay">
+            <tr ng-repeat="value in values">
+                <td ng-if="$index===0" rowspan="{{values.length}}" colspan="4">{{key}}</td>
+                <td colspan="4">{{value.created}}</td>
+                <td colspan="4">{{value.value}}</td>
+                <td colspan="4">{{value.modifiedBy}}</td>
+            </tr>
+            </tbody>
+        </table>
+        <div ng-if="itemList.length === 0">
+            {{'audit_history_unavailable'| translate}}
+        </div>
+    </div>
+
+
+    <div class="modal-footer">
+        <button type="button" class="btn btn-default" data-ng-click="close()">{{'close'| translate}}</button>
+    </div>
 </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	2016-01-27 17:55:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js	2016-03-08 16:27:49 +0000
@@ -49,39 +49,91 @@
     $scope.captureCoordinate = function(){
         $scope.location = CurrentSelection.getLocation();
         $modalInstance.close($scope.location);
-    }; 
-})
+    };
+        })
 
 //Controller for audit history
-.controller('AuditHistoryController', function( $scope, $modalInstance, $modal, AuditHistoryDataService,
-                                                              dataElementId, dataElementName, currentEvent, dataType, selectedTeiId,
-                                                              DateUtils ) {
-
-    $scope.close = function() {
+.controller('AuditHistoryController', function ($scope, $modalInstance, $modal, AuditHistoryDataService, DateUtils,
+                                                    eventId, dataType, nameIdMap) {
+
+    $scope.itemList = {};
+
+    $scope.model = {type: dataType};
+
+    $scope.close = function () {
         $modalInstance.close();
     };
 
-    $scope.trackedEntity = dataElementName;
-
-    AuditHistoryDataService.getAuditHistoryData(dataElementId, dataType, dataElementName, currentEvent, selectedTeiId).then(function( data ) {
-
-        $scope.itemList = [];
-
-        var reponseData = data.trackedEntityDataValueAudits ? data.trackedEntityDataValueAudits : data.trackedEntityAttributeValueAudits;
-        if( reponseData ) {
-            angular.forEach(reponseData, function( dataValue ) {
+    $scope.$watch("itemList", function (itemList) {
+        $scope.listInDisplay = itemList;
+    });
+
+    $scope.searchTheList = function () {
+        var searchStr = $scope.searchText;
+        var filteredItemList = {};
+        for (var item in $scope.itemList) {
+            for (var index = 0; index < $scope.itemList[item].length; index++) {
+                var element = $scope.itemList[item][index];
+                if (!isSubString(item, searchStr) && !isSubString(element.created, searchStr) && !isSubString(element.value, searchStr) && !isSubString(element.modifiedBy, searchStr)) {
+                } else {
+                    if (!filteredItemList[item]) {
+                        filteredItemList[item] = [];
+                    }
+                    filteredItemList[item].push(element);
+                }
+            }
+        }
+        $scope.listInDisplay = filteredItemList;
+    }
+
+    function isSubString(str, subStr) {
+        return str.toLowerCase().indexOf(subStr.toLowerCase()) > -1;
+    }
+
+
+    AuditHistoryDataService.getAuditHistoryData(eventId, dataType).then(function (data) {
+
+        $scope.itemList = {};
+
+        var reponseData = data.trackedEntityDataValueAudits ? data.trackedEntityDataValueAudits :
+            data.trackedEntityAttributeValueAudits ? data.trackedEntityAttributeValueAudits : null;
+        if (reponseData) {
+            for (var index = 0; index < reponseData.length; index++) {
+
+                var dataValue = reponseData[index];
+
                 /*The true/false values are displayed as Yes/No*/
                 if (dataValue.value === "true") {
                     dataValue.value = "Yes";
                 } else if (dataValue.value === "false") {
                     dataValue.value = "No";
                 }
-                $scope.itemList.push({created: DateUtils.formatToHrsMinsSecs(dataValue.created), value: dataValue.value, auditType: dataValue.auditType,
-                    modifiedBy:dataValue.modifiedBy});
-            });
+                if (dataType === "attribute") {
+                    if (nameIdMap[dataValue.trackedEntityAttribute.id] && nameIdMap[dataValue.trackedEntityAttribute.id].displayName) {
+                        var attributeName = nameIdMap[dataValue.trackedEntityAttribute.id].displayName;
+                        if (!$scope.itemList[attributeName]) {
+                            $scope.itemList[attributeName] = [];
+                        }
+                        $scope.itemList[attributeName].push({
+                            created: DateUtils.formatToHrsMinsSecs(dataValue.created), value: dataValue.value,
+                            auditType: dataValue.auditType, modifiedBy: dataValue.modifiedBy
+                        });
+                    }
+                } else if (dataType === "dataElement") {
+                    if (nameIdMap[dataValue.dataElement.id] && nameIdMap[dataValue.dataElement.id].dataElement) {
+                        var dataElementName = nameIdMap[dataValue.dataElement.id].dataElement.displayName;
+                        if (!$scope.itemList[dataElementName]) {
+                            $scope.itemList[dataElementName] = [];
+                        }
+                        $scope.itemList[dataElementName].push({
+                            created: DateUtils.formatToHrsMinsSecs(dataValue.created), value: dataValue.value,
+                            auditType: dataValue.auditType, modifiedBy: dataValue.modifiedBy
+                        });
+                    }
+                }
+            }
         }
     });
-
 })
 .controller('InputController', function( $scope) {
     $scope.inputObj = {isAuditIconPresent:false};

=== 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	2016-03-01 15:11:41 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2016-03-08 16:27:49 +0000
@@ -387,69 +387,40 @@
                 });                 
             }
         }
-    };    
+    };
 })
-
 .directive('d2Audit', function () {
     return {
         restrict: 'E',
-        template: '<span class="hideInPrint audit-icon" title="{{\'audit_history\' | translate}}"><i class="glyphicon glyphicon-user" data-ng-click="showAuditHistory()" ng-if="showAuditIcon()"></i></span>',
-        scope:{
-            dataElementId: '@dataelementId',
-            dataElementName: '@dataelementName',
-            currentEvent:'@',
-            type:'@',
-            selectedTeiId:'@',
-            isAuditIconPresent:'=?'
+        template: '<span class="hideInPrint audit-icon" title="{{\'audit_history\' | translate}}" data-ng-click="showAuditHistory()">' +
+        '<i class="glyphicon glyphicon-user""></i>' +
+        '</span>',
+        scope: {
+            eventId: '@',
+            type: '@',
+            nameIdMap: '='
         },
-        controller:function($scope, $modal) {
-            if (!$scope.dataElementId) {
-                return;
-            }
-
-            $scope.showAuditIcon = function() {
-                if ($scope.currentEvent && $scope.currentEvent !== 'SINGLE_EVENT') {
-                    $scope.isAuditIconPresent = true;
-                    return true;
-                }
-                if ($scope.type === "attribute" && $scope.selectedTeiId) {
-                    $scope.isAuditIconPresent = true;
-                    return true;
-                }
-                $scope.isAuditIconPresent = false;
-                return false;
-            }
-
-            $scope.showAuditHistory = function() {
-
+        controller: function ($scope, $modal) {
+            $scope.showAuditHistory = function () {
                 $modal.open({
                     templateUrl: "../dhis-web-commons/angular-forms/audit-history.html",
                     controller: "AuditHistoryController",
                     resolve: {
-                        dataElementId: function () {
-                            return $scope.dataElementId;
-                        },
-                        dataElementName: function () {
-                            return $scope.dataElementName;
-                        },
-                        dataType: function() {
+                        eventId: function () {
+                            return $scope.eventId;
+                        },
+                        dataType: function () {
                             return $scope.type;
                         },
-                        currentEvent: function() {
-                            return $scope.currentEvent;
-                        },
-                        selectedTeiId: function() {
-                            return $scope.selectedTeiId;
+                        nameIdMap: function () {
+                            return $scope.nameIdMap;
                         }
                     }
                 })
-
             }
-
-        }
+        },
     };
 })
-
 .directive('d2RadioButton', function (){  
     return {
         restrict: 'E',

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2016-02-12 15:42:21 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2016-03-08 16:27:49 +0000
@@ -384,7 +384,6 @@
                                     ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
                                     ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
                                     ' blur-or-change="saveDatavalue(prStDes.' + fieldId + ')"' +
-                                    ' class="input-with-audit"' +
                                     ' ng-required="{{true}}"></span><span class="not-for-screen"><input type="text" value={{currentEvent.' + fieldId + '}}></span>';
                             }
                             else {
@@ -405,7 +404,7 @@
                                         ' ng-disabled="isHidden(prStDes.' + fieldId + '.dataElement.id) || selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\' || currentEvent.editingNotAllowed"' +
                                         ' ng-required="{{prStDes.' + fieldId + '.compulsory}}" ';
 
-                                    var auditField = '<d2-audit is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="{{prStDes.' + fieldId + '.dataElement.id}}" dataelement-name="{{prStDes[prStDes.' + fieldId + '.dataElement.id].dataElement.displayName}}" current-event="{{currentEvent.event}}"></d2-audit>';
+                                    
                                     //check if dataelement has optionset
                                     if (prStDe.dataElement.optionSetValue) {
                                         var optionSetId = prStDe.dataElement.optionSet.id;
@@ -508,7 +507,7 @@
                                     return;
                                 }
                                 
-                                newInputField += auditField;
+                                
                             }
                             newInputField = newInputField + ' <span ng-messages="outerForm.' + fieldId + '.$error" class="required" ng-if="interacted(outerForm.' + fieldId + ')" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"></span>';
 
@@ -578,17 +577,16 @@
                                         'repeat="option.displayName as option in optionSets.' + optionSetId + '.options | filter: $select.search | limitTo:maxOptionSize">' +
                                         '<span ng-bind-html="option.displayName | highlight: $select.search"></span>' +
                                         '</ui-select-choices>' +
-                                        '</ui-select><d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}}></d2-audit></span>';
+                                        '</ui-select></span>';
                                 }
                                 else {
                                     //check attribute type and generate corresponding angular input field
                                     if (att.valueType === "NUMBER" ) {
-                                        newInputField = '<span  ng-controller="InputController"><input type="number" ng-class="{\'input-with-audit\':inputObj.isAuditIconPresent}"' +
+                                        newInputField = '<span  ng-controller="InputController"><input type="number"' +
                                             ' d2-number-validator ' +
                                             ' number-type="' + att.valueType + '" ' +
                                             ' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
                                             commonInputFieldProperty + ' >' +
-                                            '<d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}}></d2-audit>' +
                                             '</span>';
                                     }
                                     else if (att.valueType === "BOOLEAN") {
@@ -603,29 +601,28 @@
                                                         ' </d2-radio-button>';
                                     }
                                     else if (att.valueType === "DATE") {
-                                        newInputField = '<span ng-controller="InputController"><input  type="text" ng-class="{\'input-with-audit\':inputObj.isAuditIconPresent}"' +
+                                        newInputField = '<span ng-controller="InputController"><input  type="text"' +
                                             ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
                                             ' max-date=" ' + attMaxDate + ' " ' +
                                             ' d2-date' +
                                             ' blur-or-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
                                             commonInputFieldProperty + ' >'+
-                                            '<d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit>'+
                                             '</span>';
                                     }
                                     else if (att.valueType === "TRUE_ONLY") {
                                         newInputField = '<span><input type="checkbox" ' +
                                             ' ng-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
-                                            commonInputFieldProperty + ' ><d2-audit class="hideInPrint" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit></span>';
+                                            commonInputFieldProperty + ' ></span>';
                                     }
                                     else if (att.valueType === "EMAIL") {
-                                        newInputField = '<span ng-controller="InputController"><input type="email" ng-class="{\'input-with-audit\':inputObj.isAuditIconPresent}"' +
+                                        newInputField = '<span ng-controller="InputController"><input type="email"' +
                                             ' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
-                                            commonInputFieldProperty + ' ><d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit></span>';
+                                            commonInputFieldProperty + ' ></span>';
                                     }
                                     else if (att.valueType === "TRACKER_ASSOCIATE") {
-                                        newInputField = '<span ng-controller="InputController"><input type="text" ng-class="{\'input-with-audit\':inputObj.isAuditIconPresent}"' +
+                                        newInputField = '<span ng-controller="InputController"><input type="text"' +
                                             ' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
-                                            commonInputFieldProperty + ' ><d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit></span>' +
+                                            commonInputFieldProperty + ' ></span>' +
                                             '<span class="hideInPrint"><a href ng-class="{true: \'disable-clicks\', false: \'\'} [editingDisabled]" ng-click="getTrackerAssociate(attributesById.' + attId + ', selectedTei.' + attId + ')" title="{{\'add\' | translate}} {{attributesById.' + attId + '.displayName}}" ' +
                                             '<i class="fa fa-external-link fa-2x vertical-center"></i> ' +
                                             '</a> ' +
@@ -636,12 +633,12 @@
                                     else if (att.valueType === "LONG_TEXT") {
                                         newInputField = '<span><textarea row ="3" ' +
                                             ' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
-                                            commonInputFieldProperty + ' ></textarea><d2-audit class="hideInPrint" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit></span>';
+                                            commonInputFieldProperty + ' ></textarea></span>';
                                     }
                                     else {
                                         newInputField = '<span ng-controller="InputController"><input type="text" ' +
                                             ' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
-                                            commonInputFieldProperty + '><d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit></span>';
+                                            commonInputFieldProperty + '></span>';
                                     }
                                 }
                             }
@@ -661,7 +658,7 @@
                             if (programId === 'enrollmentDate') {
                                 fieldName = 'dateOfEnrollment';
                                 var enMaxDate = trackedEntityForm.selectEnrollmentDatesInFuture ? '' : 0;
-                                newInputField = '<span ng-controller="InputController"><input type="text" ng-class="{\'input-with-audit\':inputObj.isAuditIconPresent}"' +
+                                newInputField = '<span ng-controller="InputController"><input type="text"' +
                                     ' name="' + fieldName + '"' +
                                     ' element-id="' + i + '"' +
                                     this.getAttributesAsString(attributes) +
@@ -671,12 +668,12 @@
                                     ' ng-disabled="\'' + target + '\' === \'PROFILE\'"' +
                                     ' d2-date' +
                                     ' max-date="' + enMaxDate + '"' +
-                                    ' ng-required="true"><d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit></span>';
+                                    ' ng-required="true"></span>';
                             }
                             if (programId === 'dateOfIncident' && trackedEntityForm.displayIncidentDate) {
                                 fieldName = 'dateOfIncident';
                                 var inMaxDate = trackedEntityForm.selectIncidentDatesInFuture ? '' : 0;
-                                newInputField = '<span ng-controller="InputController"><input type="text" ng-class="{\'input-with-audit\':inputObj.isAuditIconPresent}"' +
+                                newInputField = '<span ng-controller="InputController"><input type="text"' +
                                     ' name="' + fieldName + '"' +
                                     ' element-id="' + i + '"' +
                                     this.getAttributesAsString(attributes) +
@@ -685,7 +682,7 @@
                                     ' ng-model="selectedEnrollment.dateOfIncident" ' +
                                     ' ng-disabled="\'' + target + '\' === \'PROFILE\'"' +
                                     ' d2-date ' +
-                                    ' max-date="' + inMaxDate + '"><d2-audit class="hideInPrint" is-audit-icon-present="inputObj.isAuditIconPresent" dataelement-id="'+att.id+'" dataelement-name="'+att.displayName+'" data-type="attribute" selected-tei-id={{selectedTei.trackedEntityInstance}} ></d2-audit></span>';
+                                    ' max-date="' + inMaxDate + '"></span>';
                             }
                         }
 
@@ -2097,21 +2094,15 @@
             return this.location;
         };
     })
-    .service('AuditHistoryDataService', function( $http, DialogService ) {
-        this.getAuditHistoryData = function( dataElementID, dataType, dataElementName, currentEvent, selectedTeiId ) {
+
+    .service('AuditHistoryDataService', function( $http, DialogService) {
+        this.getAuditHistoryData = function(dataId, dataType ) {
             var url="";
             if (dataType === "attribute") {
-                if (!selectedTeiId) {
-                    url = '../api/audits/trackedEntityAttributeValue.json?tea=' + dataElementID;
-                } else {
-                    url = '../api/audits/trackedEntityAttributeValue.json?tea=' + dataElementID+'&tei='+selectedTeiId;
-                }
+                url="../api/audits/trackedEntityAttributeValue?tei="+dataId+"&skipPaging=true";
+                
             } else {
-                if (!currentEvent) {
-                    url = '../api/audits/trackedEntityDataValue.json?de=' + dataElementID;
-                } else {
-                    url = '../api/audits/trackedEntityDataValue.json?de=' + dataElementID+'&psi='+currentEvent;
-                }
+                url="../api/audits/trackedEntityDataValue?psi="+dataId+"&skipPaging=true";
             }
 
             var promise = $http.get(url).then(function( response ) {