dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38515
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19625: some refactoring; allowing auto scrolling of option list in dropdown when end of list is reached; ...
------------------------------------------------------------
revno: 19625
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-07-13 09:37:11 +0200
message:
some refactoring; allowing auto scrolling of option list in dropdown when end of list is reached; registratin and enrollment fix with regards to the new change in response payload; request to enrollments now mention ou mode
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.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-tracker-capture/components/dataentry/dataentry-controller.js
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/enrollment/enrollment-controller.js
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/registration-controller.js
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/index.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dialog.html
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/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js 2015-06-15 11:04:20 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js 2015-07-13 07:37:11 +0000
@@ -17,7 +17,7 @@
'd2Services',
'd2Controllers',
'ui.select',
- //'infinite-scroll',
+ 'infinite-scroll',
'angularLocalStorage',
'pascalprecht.translate',
'd2HeaderBar'])
@@ -36,5 +36,4 @@
$translateProvider.preferredLanguage('en');
$translateProvider.useSanitizeValueStrategy('escaped');
$translateProvider.useLoader('i18nLoader');
-
});
\ No newline at end of file
=== 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-07-02 07:09:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-07-13 07:37:11 +0000
@@ -244,13 +244,8 @@
url: '../api/programs.json',
type: 'GET',
data:'filter=programType:eq:WITHOUT_REGISTRATION&paging=false&fields=id,name,version,programStages[id,version,programStageSections[id],programStageDataElements[dataElement[id,optionSet[id,version]]]]'
- }).done( function(response) {
- var programs = [];
- _.each( _.values( response.programs ), function ( program ) {
- programs.push(program);
- });
-
- def.resolve( programs );
+ }).done( function(response) {
+ def.resolve( response.programs ? response.programs: [] );
}).fail(function(){
def.resolve( null );
});
@@ -311,29 +306,23 @@
{
return function() {
return $.ajax( {
- url: '../api/programs.json?filter=id:eq:' + id +'&fields=id,name,programType,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,organisationUnits[id,name],programStages[id,name,version],userRoles[id,name]',
- type: 'GET'
- }).done( function( response ){
-
- _.each( _.values( response.programs ), function ( program ) {
-
- var ou = {};
- _.each(_.values( program.organisationUnits), function(o){
- ou[o.id] = o.name;
- });
-
- program.organisationUnits = ou;
-
- var ur = {};
- _.each(_.values( program.userRoles), function(u){
- ur[u.id] = u.name;
- });
-
- program.userRoles = ur;
-
- dhis2.ec.store.set( 'programs', program );
-
- });
+ url: '../api/programs/' + id + '.json',
+ type: 'GET',
+ data: 'fields=id,name,programType,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,organisationUnits[id,name],programStages[id,name,version],userRoles[id,name]'
+ }).done( function( program ){
+ var ou = {};
+ _.each(_.values( program.organisationUnits), function(o){
+ ou[o.id] = o.name;
+ });
+ program.organisationUnits = ou;
+
+ var ur = {};
+ _.each(_.values( program.userRoles), function(u){
+ ur[u.id] = u.name;
+ });
+ program.userRoles = ur;
+
+ dhis2.ec.store.set( 'programs', program );
});
};
}
@@ -361,7 +350,8 @@
var p = d.promise();
dhis2.ec.store.get('programStages', program.programStages[0].id).done(function(obj) {
if(!obj || obj.version !== program.programStages[0].version) {
- promise = promise.then( getProgramStage( program.programStages[0].id ) );
+ //promise = promise.then( getProgramStage( program.programStages[0].id ) );
+ promise = promise.then( getD2Object( program.programStages[0].id, 'programStages', '../api/programStages', 'fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,sortOrder,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,name,type,optionSetValue,numberType,textType,formName,optionSet[id]]]', 'idb' ) );
}
d.resolve();
@@ -387,7 +377,7 @@
return mainPromise;
}
-function getProgramStage( id )
+/*function getProgramStage( id )
{
return function() {
return $.ajax( {
@@ -399,7 +389,7 @@
});
});
};
-}
+}*/
function getOptionSets( programs )
{
@@ -427,7 +417,8 @@
dhis2.ec.store.get('optionSets', prStDe.dataElement.optionSet.id).done(function(obj) {
if( (!obj || obj.version !== prStDe.dataElement.optionSet.version) && optionSetsInPromise.indexOf(prStDe.dataElement.optionSet.id) === -1) {
optionSetsInPromise.push( prStDe.dataElement.optionSet.id );
- promise = promise.then( getOptionSet( prStDe.dataElement.optionSet.id ) );
+ //promise = promise.then( getOptionSet( prStDe.dataElement.optionSet.id ) );
+ promise = promise.then( getD2Object( prStDe.dataElement.optionSet.id, 'optionSets', '../api/optionSets', 'fields=id,name,version,options[id,name,code]', 'idb' ) );
}
d.resolve();
});
@@ -454,7 +445,7 @@
return mainPromise;
}
-function getOptionSet( id )
+/*function getOptionSet( id )
{
return function() {
return $.ajax( {
@@ -466,7 +457,7 @@
});
});
};
-}
+}*/
function getMetaProgramValidations( programs )
{
=== 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-07-01 06:24:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-07-13 07:37:11 +0000
@@ -59,49 +59,54 @@
//listen for rule effect changes
$scope.$on('ruleeffectsupdated', function (event, args) {
if ($rootScope.ruleeffects[args.event]) {
- //Establish which event was affected:
- var affectedEvent = $scope.currentEvent;
- //In most cases the updated effects apply to the current event. In case the affected event is not the current event, fetch the correct event to affect:
- if (args.event !== affectedEvent.event) {
- angular.forEach($scope.currentStageEvents, function (searchedEvent) {
- if (searchedEvent.event === args.event) {
- affectedEvent = searchedEvent;
- }
- });
+ processRuleEffect(args.event);
+ }
+ });
+
+
+ var processRuleEffect = function(event){
+ //Establish which event was affected:
+ var affectedEvent = $scope.currentEvent;
+ //In most cases the updated effects apply to the current event. In case the affected event is not the current event, fetch the correct event to affect:
+ if (event !== affectedEvent.event) {
+ angular.forEach($scope.currentStageEvents, function (searchedEvent) {
+ if (searchedEvent.event === event) {
+ affectedEvent = searchedEvent;
+ }
+ });
+ }
+
+ angular.forEach($rootScope.ruleeffects[event], function (effect) {
+ if (effect.dataElement) {
+ //in the data entry controller we only care about the "hidefield" actions
+ if (effect.action === "HIDEFIELD") {
+ if (effect.dataElement) {
+ if (effect.ineffect && affectedEvent[effect.dataElement.id]) {
+ //If a field is going to be hidden, but contains a value, we need to take action;
+ if (effect.content) {
+ //TODO: Alerts is going to be replaced with a proper display mecanism.
+ alert(effect.content);
+ }
+ else {
+ //TODO: Alerts is going to be replaced with a proper display mecanism.
+ alert($scope.prStDes[effect.dataElement.id].dataElement.formName + "Was blanked out and hidden by your last action");
+ }
+
+ //Blank out the value:
+ affectedEvent[effect.dataElement.id] = "";
+ $scope.saveDatavalueForEvent($scope.prStDes[effect.dataElement.id], null, affectedEvent);
+ }
+
+ $scope.hiddenFields[effect.dataElement.id] = effect.ineffect;
+ }
+ else {
+ $log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
+ }
+ }
}
-
- angular.forEach($rootScope.ruleeffects[args.event], function (effect) {
- if (effect.dataElement) {
- //in the data entry controller we only care about the "hidefield" actions
- if (effect.action === "HIDEFIELD") {
- if (effect.dataElement) {
- if (effect.ineffect && affectedEvent[effect.dataElement.id]) {
- //If a field is going to be hidden, but contains a value, we need to take action;
- if (effect.content) {
- //TODO: Alerts is going to be replaced with a proper display mecanism.
- alert(effect.content);
- }
- else {
- //TODO: Alerts is going to be replaced with a proper display mecanism.
- alert($scope.prStDes[effect.dataElement.id].dataElement.formName + "Was blanked out and hidden by your last action");
- }
-
- //Blank out the value:
- affectedEvent[effect.dataElement.id] = "";
- $scope.saveDatavalueForEvent($scope.prStDes[effect.dataElement.id], null, affectedEvent);
- }
-
- $scope.hiddenFields[effect.dataElement.id] = effect.ineffect;
- }
- else {
- $log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
- }
- }
- }
- });
- }
- });
-
+ });
+ };
+
//check if field is hidden
$scope.isHidden = function (id) {
//In case the field contains a value, we cant hide it.
@@ -116,7 +121,7 @@
$scope.executeRules = function () {
var evs = {all: $scope.allEventsSorted, byStage: $scope.eventsByStageAsc};
- var flag = {debug: true, verbose: true};
+ var flag = {debug: true, verbose: false};
//If the events is displayed in a table, it is necessary to run the rules for all visible events.
if ($scope.currentStage.displayEventsInTable) {
angular.forEach($scope.currentStageEvents, function (event) {
@@ -125,6 +130,8 @@
} else {
TrackerRulesExecutionService.executeRules($scope.allProgramRules, $scope.currentEvent, evs, $scope.prStDes, $scope.selectedTei, $scope.selectedEnrollment, flag);
}
+
+ processRuleEffect($scope.currentEvent);
};
@@ -424,15 +431,11 @@
$scope.saveDatavalueForEvent = function (prStDe, field, eventToSave) {
//Blank out the input-saved class on the last saved due date:
$scope.eventDateSaved = false;
-
- //console.log('the field: ', field);
$scope.currentElement = {};
//check for input validity
- //$scope.outerForm.submitted = true;
$scope.updateSuccess = false;
if (field && field.$invalid) {
- //console.log('form is invalid...');
$scope.currentElement = {id: prStDe.dataElement.id, saved: false};
return false;
}
=== 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 2015-06-15 15:29:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-07-13 07:37:11 +0000
@@ -36,7 +36,7 @@
<ui-select-match allow-clear="true" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} style="width:100%; height:34px; line-height:1.0; padding: 2px 6px; margin-top:5px" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
<ui-select-choices infinite-scroll="addMoreOptions()"
infinite-scroll-distance="2"
- repeat="option.name as option in optionSets[prStDe.dataElement.optionSet.id].options | filter: $select.search | limitTo:20">
+ repeat="option.name as option in optionSets[prStDe.dataElement.optionSet.id].options | filter: $select.search | limitTo:infiniteScroll.currentOptions">
<span ng-bind-html="option.name | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2015-07-13 07:37:11 +0000
@@ -163,7 +163,7 @@
ModalService.showModal({}, modalOptions).then(function(result){
EnrollmentService.cancel($scope.selectedEnrollment).then(function(data){
$scope.selectedEnrollment.status = 'CANCELLED';
- $scope.loadEnrollmentDetails($scope.selectedEnrollment.status);
+ $scope.loadEnrollmentDetails($scope.selectedEnrollment);
});
});
};
=== 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 2015-06-15 15:29:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html 2015-07-13 07:37:11 +0000
@@ -16,7 +16,7 @@
<ui-select-match allow-clear="true" style="width:100%; height:34px; line-height:1.0; padding: 2px 6px; margin-top:5px" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
<ui-select-choices infinite-scroll="addMoreOptions()"
infinite-scroll-distance="2"
- repeat="option.name as option in optionSets[attributesById[attribute.id].optionSet.id].options | filter: $select.search | limitTo:20">
+ repeat="option.name as option in optionSets[attributesById[attribute.id].optionSet.id].options | filter: $select.search | limitTo:infiniteScroll.currentOptions">
<span ng-bind-html="option.name | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2015-06-22 12:07:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2015-07-13 07:37:11 +0000
@@ -142,11 +142,11 @@
return false;
}
- RegistrationService.registerOrUpdate($scope.tei, $scope.optionSets, $scope.attributesById).then(function(response){
+ RegistrationService.registerOrUpdate($scope.tei, $scope.optionSets, $scope.attributesById).then(function(registrationResponse){
- if(response.status === 'SUCCESS'){
+ if(registrationResponse.response && registrationResponse.response.reference && registrationResponse.response.status === 'SUCCESS'){
- $scope.tei.trackedEntityInstance = response.reference;
+ $scope.tei.trackedEntityInstance = registrationResponse.response.reference;
if( $scope.registrationMode === 'PROFILE' ){
reloadProfileWidget();
@@ -162,27 +162,28 @@
enrollment.dateOfEnrollment = $scope.selectedEnrollment.dateOfEnrollment;
enrollment.dateOfIncident = $scope.selectedEnrollment.dateOfIncident === '' ? $scope.selectedEnrollment.dateOfEnrollment : $scope.selectedEnrollment.dateOfIncident;
- EnrollmentService.enroll(enrollment).then(function(data){
- if(data.status !== 'SUCCESS'){
- //enrollment has failed
- var dialogOptions = {
- headerText: 'enrollment_error',
- bodyText: data.description
- };
- DialogService.showDialog({}, dialogOptions);
- return;
- }
- else{
- enrollment.enrollment = data.reference;
+ EnrollmentService.enroll(enrollment).then(function(enrollmentResponse){
+ var r = enrollmentResponse.response && enrollmentResponse.response.importSummaries && enrollmentResponse.response.importSummaries[0] ? enrollmentResponse.response.importSummaries[0] : {};
+ if(r.reference && r.status === 'SUCCESS'){
+ enrollment.enrollment = r.reference;
$scope.selectedEnrollment = enrollment;
var dhis2Events = EventUtils.autoGenerateEvents($scope.tei.trackedEntityInstance, $scope.selectedProgram, $scope.selectedOrgUnit, enrollment);
if(dhis2Events.events.length > 0){
- DHIS2EventFactory.create(dhis2Events).then(function(data){
+ DHIS2EventFactory.create(dhis2Events).then(function(){
notifyRegistrtaionCompletion(destination, $scope.tei.trackedEntityInstance);
});
}else{
notifyRegistrtaionCompletion(destination, $scope.tei.trackedEntityInstance);
- }
+ }
+ }
+ else{
+ //enrollment has failed
+ var dialogOptions = {
+ headerText: 'enrollment_error',
+ bodyText: enrollmentResponse.message
+ };
+ DialogService.showDialog({}, dialogOptions);
+ return;
}
});
}
@@ -194,7 +195,7 @@
else{//update/registration has failed
var dialogOptions = {
headerText: $scope.tei && $scope.tei.trackedEntityInstance ? 'update_error' : 'registration_error',
- bodyText: response.description
+ bodyText: registrationResponse.message
};
DialogService.showDialog({}, dialogOptions);
return;
=== 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-06-23 19:48:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-07-13 07:37:11 +0000
@@ -256,6 +256,7 @@
registration_date=Registration date
register=Register
_register=register
+enrollment_error=Error in enrollment
registration_error=Error in registration
update_error=Error in update
event_creation_error=Error in event creation
=== 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-06-15 15:29:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 2015-07-13 07:37:11 +0000
@@ -90,6 +90,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularjs-nvd3-directives.min.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate.min.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/ng-infinite-scroll.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js 2015-06-15 15:29:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js 2015-07-13 07:37:11 +0000
@@ -19,6 +19,7 @@
'angularLocalStorage',
'ui.select',
'ui.select2',
+ 'infinite-scroll',
'd2HeaderBar',
'ngCsv',
'nvd3ChartDirectives',
@@ -60,10 +61,4 @@
$translateProvider.useSanitizeValueStrategy('escaped');
$translateProvider.useLoader('i18nLoader');
-});
-
-/*.run(function($rootScope){
- setTimeout(function () {
- $rootScope.$apply(function () {});
- }, 1000);
-});*/
+});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-07-02 07:19:49 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-07-13 07:37:11 +0000
@@ -457,7 +457,17 @@
var query = store.get(uid);
query.onsuccess = function(e){
- deferred.resolve(e.target.result);
+ if(e.target.result){
+ deferred.resolve(e.target.result);
+ }
+ else{
+ var t = db.transaction(["ouPartial"]);
+ var s = t.objectStore("ouPartial");
+ var q = s.get(uid);
+ q.onsuccess = function(e){
+ deferred.resolve(e.target.result);
+ };
+ }
};
}
return deferred.promise;
@@ -569,19 +579,19 @@
return promise;
},
getByEntity: function( entity ){
- var promise = $http.get( '../api/enrollments.json?trackedEntityInstance=' + entity + '&paging=false').then(function(response){
+ var promise = $http.get( '../api/enrollments.json?ouMode=ACCESSIBLE&trackedEntityInstance=' + entity + '&paging=false').then(function(response){
return convertFromApiToUser(response.data);
});
return promise;
},
getByEntityAndProgram: function( entity, program ){
- var promise = $http.get( '../api/enrollments.json?trackedEntityInstance=' + entity + '&program=' + program + '&paging=false').then(function(response){
+ var promise = $http.get( '../api/enrollments.json?ouMode=ACCESSIBLE&trackedEntityInstance=' + entity + '&program=' + program + '&paging=false').then(function(response){
return convertFromApiToUser(response.data);
});
return promise;
},
getByStartAndEndDate: function( program, orgUnit, ouMode, startDate, endDate ){
- var promise = $http.get( '../api/enrollments.json?program=' + program + '&orgUnit=' + orgUnit + '&ouMode='+ ouMode + '&startDate=' + startDate + '&endDate=' + endDate + '&paging=false').then(function(response){
+ var promise = $http.get( '../api/enrollments.json?ouMode=ACCESSIBLE&program=' + program + '&orgUnit=' + orgUnit + '&ouMode='+ ouMode + '&startDate=' + startDate + '&endDate=' + endDate + '&paging=false').then(function(response){
return convertFromApiToUser(response.data);
});
return promise;
@@ -929,14 +939,14 @@
return {
getEventsByStatus: function(entity, orgUnit, program, programStatus){
- var promise = $http.get( '../api/events.json?' + 'trackedEntityInstance=' + entity + '&orgUnit=' + orgUnit + '&program=' + program + '&programStatus=' + programStatus + '&paging=false').then(function(response){
+ var promise = $http.get( '../api/events.json?ouMode=ACCESSIBLE&' + 'trackedEntityInstance=' + entity + '&orgUnit=' + orgUnit + '&program=' + program + '&programStatus=' + programStatus + '&paging=false').then(function(response){
return response.data.events;
});
return promise;
},
getEventsByProgram: function(entity, program){
- var url = '../api/events.json?' + 'trackedEntityInstance=' + entity + '&paging=false';
+ var url = '../api/events.json?ouMode=ACCESSIBLE&' + 'trackedEntityInstance=' + entity + '&paging=false';
if(program){
url = url + '&program=' + program;
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-07-02 07:09:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-07-13 07:37:11 +0000
@@ -224,19 +224,7 @@
if(res.length > 0){
return;
}
- var def = $.Deferred();
-
- $.ajax({
- url: '../api/relationshipTypes.json?paging=false&fields=id,name,aIsToB,bIsToA,displayName',
- type: 'GET'
- }).done(function(response) {
- dhis2.tc.store.setAll( 'relationshipTypes', response.relationshipTypes );
- def.resolve();
- }).fail(function(){
- def.resolve();
- });
-
- return def.promise();
+ return getD2Objects('relationshipTypes', 'relationshipTypes', '../api/relationshipTypes.json', 'paging=false&fields=id,name,aIsToB,bIsToA,displayName');
});
}
@@ -245,22 +233,8 @@
dhis2.tc.store.getKeys('trackedEntities').done(function(res){
if(res.length > 0){
return;
- }
-
- var def = $.Deferred();
-
- $.ajax({
- url: '../api/trackedEntities',
- type: 'GET',
- data: 'viewClass=detailed&paging=false'
- }).done(function(response) {
- dhis2.tc.store.setAll( 'trackedEntities', response.trackedEntities );
- def.resolve();
- }).fail(function(){
- def.resolve();
- });
-
- return def.promise();
+ }
+ return getD2Objects('trackedEntities', 'trackedEntities', '../api/trackedEntities.json', 'paging=false&fields=id,name');
});
}
@@ -273,12 +247,7 @@
type: 'GET',
data:'filter=programType:eq:WITH_REGISTRATION&paging=false&fields=id,version,programTrackedEntityAttributes[trackedEntityAttribute[id,optionSet[id,version]]],programStages[id,name,version,minDaysFromStart,standardInterval,periodType,generatedByEnrollmentDate,reportDateDescription,repeatable,autoGenerateEvent,openAfterEnrollment,reportDateToUse,programStageDataElements[dataElement[optionSet[id,version]]]]'
}).done( function(response) {
- var programs = [];
- _.each( _.values( response.programs ), function ( program ) {
- programs.push(program);
- });
-
- def.resolve( programs );
+ def.resolve( response.programs ? response.programs: [] );
}).fail(function(){
def.resolve( null );
});
@@ -336,35 +305,27 @@
{
return function() {
return $.ajax( {
- url: '../api/programs.json',
+ url: '../api/programs/' + id + '.json',
type: 'GET',
- data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,type,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,version,minDaysFromStart,standardInterval,periodType,generatedByEnrollmentDate,reportDateDescription,repeatable,autoGenerateEvent,openAfterEnrollment,reportDateToUse],dataEntryForm[name,style,htmlCode,format],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]]'
- }).done( function( response ){
-
- _.each( _.values( response.programs ), function ( program ) {
-
- var ou = {};
- if(program.organisationUnits){
- _.each(_.values( program.organisationUnits), function(o){
- ou[o.id] = o.name;
- });
- }
-
- program.organisationUnits = ou;
-
- var ur = {};
-
- if(program.userRoles){
- _.each(_.values( program.userRoles), function(u){
- ur[u.id] = u.name;
- });
- }
-
- program.userRoles = ur;
-
- dhis2.tc.store.set( 'programs', program );
-
- });
+ data: 'fields=id,name,type,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,version,minDaysFromStart,standardInterval,periodType,generatedByEnrollmentDate,reportDateDescription,repeatable,autoGenerateEvent,openAfterEnrollment,reportDateToUse],dataEntryForm[name,style,htmlCode,format],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]]'
+ }).done( function( program ){
+ var ou = {};
+ if(program.organisationUnits){
+ _.each(_.values( program.organisationUnits), function(o){
+ ou[o.id] = o.name;
+ });
+ }
+ program.organisationUnits = ou;
+
+ var ur = {};
+ if(program.userRoles){
+ _.each(_.values( program.userRoles), function(u){
+ ur[u.id] = u.name;
+ });
+ }
+ program.userRoles = ur;
+
+ dhis2.tc.store.set( 'programs', program );
});
};
}
@@ -393,7 +354,7 @@
var p = d.promise();
dhis2.tc.store.get('programStages', programStage.id).done(function(obj) {
if(!obj || obj.version !== programStage.version) {
- promise = promise.then( getProgramStage( programStage.id ) );
+ promise = promise.then( getD2Object( programStage.id, 'programStages', '../api/programStages', 'fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,description,formName,type,numberType,textType,optionSetValue,optionSet[id]]]', 'idb' ) );
}
d.resolve();
});
@@ -418,21 +379,6 @@
return mainPromise;
}
-function getProgramStage( id )
-{
- return function() {
- return $.ajax( {
- url: '../api/programStages.json',
- type: 'GET',
- data: 'filter=id:eq:' + id +'&fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,description,formName,type,numberType,textType,optionSetValue,optionSet[id]]]'
- }).done( function( response ){
- _.each( _.values( response.programStages ), function( programStage ) {
- dhis2.tc.store.set( 'programStages', programStage );
- });
- });
- };
-}
-
function getOptionSetsForDataElements( programs )
{
if( !programs ){
@@ -462,7 +408,7 @@
dhis2.tc.store.get('optionSets', prStDe.dataElement.optionSet.id).done(function(obj) {
if( (!obj || obj.version !== prStDe.dataElement.optionSet.version) && optionSetsInPromise.indexOf(prStDe.dataElement.optionSet.id) === -1) {
optionSetsInPromise.push( prStDe.dataElement.optionSet.id );
- promise = promise.then( getOptionSet( prStDe.dataElement.optionSet.id ) );
+ promise = promise.then( getD2Object( prStDe.dataElement.optionSet.id, 'optionSets', '../api/optionSets', 'fields=id,name,version,options[id,name,code]', 'idb' ) );
}
d.resolve();
});
@@ -491,360 +437,6 @@
return mainPromise;
}
-function getOptionSet( id )
-{
- return function() {
- return $.ajax( {
- url: '../api/optionSets.json',
- type: 'GET',
- data: 'filter=id:eq:' + id +'&fields=id,name,version,options[id,name,code]'
- }).done( function( response ){
- _.each( _.values( response.optionSets ), function( optionSet ) {
- dhis2.tc.store.set( 'optionSets', optionSet );
- });
- });
- };
-}
-
-function getMetaProgramRuleVariables( programs )
-{
- if( !programs ){
- return;
- }
-
- var def = $.Deferred();
-
- var programIds = [];
- _.each( _.values( programs ), function ( program ) {
- if( program.id ) {
- programIds.push( program.id );
- }
- });
-
- $.ajax({
- url: '../api/programRuleVariables.json',
- type: 'GET',
- data:'paging=false&fields=id,program[id]'
- }).done( function(response) {
- var programRuleVariables = [];
- _.each( _.values( response.programRuleVariables ), function ( programRuleVariable ) {
- if( programRuleVariable &&
- programRuleVariable.id &&
- programRuleVariable.program &&
- programRuleVariable.program.id &&
- programIds.indexOf( programRuleVariable.program.id ) !== -1) {
-
- programRuleVariables.push( programRuleVariable );
- }
-
- });
-
- def.resolve( {programRuleVariables: programRuleVariables, programs: programs} );
-
- }).fail(function(){
- def.resolve( null );
- });
-
- return def.promise();
-}
-
-function getProgramRuleVariables( data )
-{
- if( !data || !data.programRuleVariables ){
- return;
- }
-
- var mainDef = $.Deferred();
- var mainPromise = mainDef.promise();
-
- var def = $.Deferred();
- var promise = def.promise();
-
- var builder = $.Deferred();
- var build = builder.promise();
-
- _.each( _.values( data.programRuleVariables ), function ( programRuleVariable ) {
- build = build.then(function() {
- var d = $.Deferred();
- var p = d.promise();
- dhis2.tc.store.get('programRuleVariables', programRuleVariable.id).done(function(obj) {
- if(!obj) {
- promise = promise.then( getProgramRuleVariable( programRuleVariable.id ) );
- }
- d.resolve();
- });
-
- return p;
- });
- });
-
- build.done(function() {
- def.resolve();
-
- promise = promise.done( function () {
- mainDef.resolve( data.programs );
- } );
- }).fail(function(){
- mainDef.resolve( null );
- });
-
- builder.resolve();
-
- return mainPromise;
-}
-
-function getProgramRuleVariable( id )
-{
- return function() {
- return $.ajax( {
- url: '../api/programRuleVariables.json',
- type: 'GET',
- data: 'paging=false&filter=id:eq:' + id +'&fields=id,program[id],name,programRuleVariableSourceType,trackedEntityAttribute[id],dataElement[id],programStage[id]'
- }).done( function( response ){
-
- _.each( _.values( response.programRuleVariables ), function ( programRuleVariable ) {
-
- if( programRuleVariable &&
- programRuleVariable.id &&
- programRuleVariable.program &&
- programRuleVariable.program.id ) {
-
- dhis2.tc.store.set( 'programRuleVariables', programRuleVariable );
- }
- });
- });
- };
-}
-
-function getMetaProgramRules( programs )
-{
- if( !programs ){
- return;
- }
-
- var def = $.Deferred();
-
- var programIds = [];
- _.each( _.values( programs ), function ( program ) {
- if( program.id ) {
- programIds.push( program.id );
- }
- });
-
- $.ajax({
- url: '../api/programRules.json',
- type: 'GET',
- data:'paging=false&fields=id,program[id]'
- }).done( function(response) {
- var programRules = [];
- _.each( _.values( response.programRules ), function ( programRule ) {
- if( programRule &&
- programRule.id &&
- programRule.program &&
- programRule.program.id &&
- programIds.indexOf( programRule.program.id ) !== -1) {
-
- programRules.push( programRule );
- }
-
- });
-
- def.resolve( {programRules: programRules, programs: programs} );
-
- }).fail(function(){
- def.resolve( null );
- });
-
- return def.promise();
-}
-
-function getProgramRules( data )
-{
- if( !data || !data.programRules ){
- return;
- }
-
- var mainDef = $.Deferred();
- var mainPromise = mainDef.promise();
-
- var def = $.Deferred();
- var promise = def.promise();
-
- var builder = $.Deferred();
- var build = builder.promise();
-
- _.each( _.values( data.programRules ), function ( programRule ) {
- build = build.then(function() {
- var d = $.Deferred();
- var p = d.promise();
- dhis2.tc.store.get('programRules', programRule.id).done(function(obj) {
- if(!obj) {
- promise = promise.then( getProgramRule( programRule.id ) );
- }
- d.resolve();
- });
-
- return p;
- });
- });
-
- build.done(function() {
- def.resolve();
-
- promise = promise.done( function () {
- mainDef.resolve( data.programs );
- } );
- }).fail(function(){
- mainDef.resolve( null );
- });
-
- builder.resolve();
-
- return mainPromise;
-}
-
-function getProgramRule( id )
-{
- return function() {
- return $.ajax( {
- url: '../api/programRules.json',
- type: 'GET',
- data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,description,condition,program[id],programstage[id],priority,programRuleActions[id,content,location,data,programRuleActionType,programStageSection[id,name],dataElement[id]]'
- }).done( function( response ){
-
- _.each( _.values( response.programRules ), function ( programRule ) {
-
- if( programRule &&
- programRule.id &&
- programRule.program &&
- programRule.program.id ) {
-
- dhis2.tc.store.set( 'programRules', programRule );
- }
- });
- });
- };
-}
-
-function getMetaProgramValidations( programs )
-{
- if( !programs ){
- return;
- }
-
- var def = $.Deferred();
-
- var programIds = [];
- _.each( _.values( programs ), function ( program ) {
- if( program.id ) {
- programIds.push( program.id );
- }
- });
-
- $.ajax({
- url: '../api/programValidations.json',
- type: 'GET',
- data:'paging=false&fields=id,program[id]'
- }).done( function(response) {
- var programValidations = [];
- _.each( _.values( response.programValidations ), function ( programValidation ) {
- if( programValidation &&
- programValidation.id &&
- programValidation.program &&
- programValidation.program.id &&
- programIds.indexOf( programValidation.program.id ) !== -1) {
-
- programValidations.push( programValidation );
- }
-
- });
-
- def.resolve( {programValidations: programValidations, programs: programs} );
-
- }).fail(function(){
- def.resolve( null );
- });
-
- return def.promise();
-}
-
-function getProgramValidations( data )
-{
- if( !data || !data.programValidations ){
- return;
- }
-
- var mainDef = $.Deferred();
- var mainPromise = mainDef.promise();
-
- var def = $.Deferred();
- var promise = def.promise();
-
- var builder = $.Deferred();
- var build = builder.promise();
-
- _.each( _.values( data.programValidations ), function ( programValidation ) {
- build = build.then(function() {
- var d = $.Deferred();
- var p = d.promise();
- dhis2.tc.store.get('programValidations', programValidation.id).done(function(obj) {
- if(!obj) {
- promise = promise.then( getProgramValidation( programValidation.id ) );
- }
- d.resolve();
- });
-
- return p;
- });
- });
-
- build.done(function() {
- def.resolve();
-
- promise = promise.done( function () {
- mainDef.resolve( data.programs );
- } );
- }).fail(function(){
- mainDef.resolve( null );
- });
-
- builder.resolve();
-
- return mainPromise;
-}
-
-function getProgramValidation( id )
-{
- return function() {
- return $.ajax( {
- url: '../api/programValidations.json',
- type: 'GET',
- data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,operator,displayName,rightSide,leftSide,program[id]'
- }).done( function( response ){
-
- _.each( _.values( response.programValidations ), function ( programValidation ) {
-
- if( programValidation &&
- programValidation.id &&
- programValidation.program &&
- programValidation.program.id ) {
- dhis2.tc.store.set( 'programValidations', programValidation );
- }
- });
- });
- };
-}
-
-function getMetaProgramIndicators( programs )
-{
- return getD2MetaObject(programs, 'programIndicators', '../api/programIndicators.json', 'paging=false&fields=id,program[id]');
-}
-
-function getProgramIndicators( programIndicators )
-{
- return checkAndGetD2Objects( programIndicators, 'programIndicators', '../api/programIndicators', 'fields=id,name,code,shortName,expression,displayDescription,rootDate,description,valueType,DisplayName,filter,program[id]');
-}
-
function getMetaTrackeEntityAttributes( programs ){
var def = $.Deferred();
@@ -900,7 +492,7 @@
dhis2.tc.store.get('attributes', teAttribute.id).done(function(obj) {
if((!obj || obj.version !== teAttribute.version) && attributesInPromise.indexOf(teAttribute.id) === -1) {
attributesInPromise.push( teAttribute.id );
- promise = promise.then( getAttribute( teAttribute.id ) );
+ promise = promise.then( getD2Object( teAttribute.id, 'attributes', '../api/trackedEntityAttributes', 'fields=id,name,code,version,description,valueType,optionSetValue,confidential,inherit,sortOrderInVisitSchedule,sortOrderInListNoProgram,displayOnVisitSchedule,displayInListNoProgram,unique,optionSet[id,version]', 'idb' ) );
}
d.resolve();
});
@@ -923,22 +515,6 @@
return mainPromise;
}
-function getAttribute( id )
-{
- return function() {
- return $.ajax( {
- url: '../api/trackedEntityAttributes.json',
- type: 'GET',
- data: 'filter=id:eq:' + id +'&paging=false&fields=id,name,code,version,description,valueType,optionSetValue,confidential,inherit,sortOrderInVisitSchedule,sortOrderInListNoProgram,displayOnVisitSchedule,displayInListNoProgram,unique,optionSet[id,version]'
- }).done( function( response ){
- _.each( _.values( response.trackedEntityAttributes ), function( teAttribute ) {
- dhis2.tc.store.set( 'attributes', teAttribute );
- });
- });
- };
-}
-
-
function getOptionSetsForAttributes( data )
{
if( !data.trackedEntityAttributes ){
@@ -962,7 +538,7 @@
dhis2.tc.store.get('optionSets', teAttribute.optionSet.id).done(function(obj) {
if((!obj || obj.version !== teAttribute.optionSet.version) && optionSetsInPromise.indexOf(teAttribute.optionSet.id) === -1) {
optionSetsInPromise.push(teAttribute.optionSet.id);
- promise = promise.then( getOptionSet( teAttribute.optionSet.id ) );
+ promise = promise.then( getD2Object( teAttribute.optionSet.id, 'optionSets', '../api/optionSets', 'fields=id,name,version,options[id,name,code]', 'idb' ) );
}
d.resolve();
});
@@ -993,25 +569,52 @@
if(res.length > 0){
return;
}
- var def = $.Deferred();
-
- $.ajax({
- url: '../api/organisationUnitLevels.json',
- type: 'GET',
- data:'filter=level:gt:1&fields=id,name,level&paging=false'
- }).done(function(response) {
- if(response.organisationUnitLevels){
- dhis2.tc.store.setAll( 'ouLevels', response.organisationUnitLevels );
- }
- def.resolve();
- }).fail(function(){
- def.resolve();
- });
-
- return def.promise();
+
+ return getD2Objects('ouLevels', 'organisationUnitLevels', '../api/organisationUnitLevels.json', 'filter=level:gt:1&fields=id,name,level&paging=false');
});
}
+
+function getMetaProgramValidations( programs )
+{
+ return getD2MetaObject(programs, 'programValidations', '../api/programValidations.json', 'paging=false&fields=id,program[id]');
+}
+
+function getProgramValidations( programValidations )
+{
+ return checkAndGetD2Objects( programValidations, 'programValidations', '../api/programValidations', 'fields=id,name,displayName,operator,rightSide[expression,description],leftSide[expression,description],program[id]');
+}
+
+function getMetaProgramIndicators( programs )
+{
+ return getD2MetaObject(programs, 'programIndicators', '../api/programIndicators.json', 'paging=false&fields=id,program[id]');
+}
+
+function getProgramIndicators( programIndicators )
+{
+ return checkAndGetD2Objects( programIndicators, 'programIndicators', '../api/programIndicators', 'fields=id,name,code,shortName,expression,displayDescription,rootDate,description,valueType,DisplayName,filter,program[id]');
+}
+
+function getMetaProgramRules( programs )
+{
+ return getD2MetaObject(programs, 'programRules', '../api/programRules.json', 'paging=false&fields=id,program[id]');
+}
+
+function getProgramRules( programRules )
+{
+ return checkAndGetD2Objects( programRules, 'programRules', '../api/programRules', 'fields=id,name,condition,description,program[id],programStage[id],priority,programRuleActions[id,content,location,data,programRuleActionType,programStageSection[id],dataElement[id]]');
+}
+
+function getMetaProgramRuleVariables( programs )
+{
+ return getD2MetaObject(programs, 'programRuleVariables', '../api/programRuleVariables.json', 'paging=false&fields=id,program[id]');
+}
+
+function getProgramRuleVariables( programRuleVariables )
+{
+ return checkAndGetD2Objects( programRuleVariables, 'programRuleVariables', '../api/programRuleVariables', 'fields=id,name,displayName,programRuleVariableSourceType,program[id],programStage[id],dataElement[id]');
+}
+
function getD2MetaObject( programs, objNames, url, filter )
{
if( !programs ){
@@ -1118,7 +721,6 @@
return def.promise();
}
-
function getD2Object( id, store, url, filter, storage )
{
return function() {
@@ -1144,17 +746,4 @@
}
});
};
-}
-
-function uploadLocalData()
-{
- var OfflineECStorageService = angular.element('body').injector().get('OfflineECStorageService');
- setHeaderWaitMessage(i18n_uploading_data_notification);
-
- OfflineECStorageService.uploadLocalData().then(function(){
- dhis2.tc.store.removeAll( 'events' );
- log( 'Successfully uploaded local events' );
- setHeaderDelayMessage( i18n_sync_success );
- selection.responseReceived(); //notify angular
- });
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dialog.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dialog.html 2014-10-22 11:46:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dialog.html 2015-07-13 07:37:11 +0000
@@ -1,10 +1,10 @@
<div class="modal-header">
- <h2>{{dialogOptions.headerText| translate}}</h2>
+ <h2>{{dialogOptions.headerText | translate}}</h2>
</div>
<div class="modal-body">
- <p>{{dialogOptions.bodyText| translate}}</p>
+ <p>{{dialogOptions.bodyText | translate}}</p>
</div>
<div class="modal-footer">
- <button class="btn btn-default" data-ng-click="dialogOptions.ok();">{{dialogOptions.closeButtonText| translate}}</button>
+ <button class="btn btn-default" data-ng-click="dialogOptions.ok();">{{dialogOptions.closeButtonText | 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.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-07-01 06:24:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-07-13 07:37:11 +0000
@@ -405,7 +405,9 @@
newInputField = '<ui-select theme="select2" ' + commonInputFieldProperty + ' >' +
'<ui-select-match style="width:100%;" allow-clear="true" placeholder="' + $translate.instant('select_or_search') + '">{{$select.selected.name || $select.selected}}</ui-select-match>' +
'<ui-select-choices ' +
- 'repeat="option.name as option in optionSets.' + optionSetId + '.options | filter: $select.search | limitTo:20">' +
+ 'infinite-scroll="addMoreOptions()" ' +
+ 'infinite-scroll-distance="2" ' +
+ 'repeat="option.name as option in optionSets.' + optionSetId + '.options | filter: $select.search | limitTo:infiniteScroll.currentOptions">' +
'<span ng-bind-html="option.name | highlight: $select.search"></span>' +
'</ui-select-choices>' +
'</ui-select>';