dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38003
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19415: event-capture: fetching program rule variables
------------------------------------------------------------
revno: 19415
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-06-16 11:57:57 +0200
message:
event-capture: fetching program rule variables
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js
--
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/event-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-06-16 09:46:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-06-16 09:57:57 +0000
@@ -32,7 +32,7 @@
dhis2.ec.store = new dhis2.storage.Store({
name: 'dhis2ec',
adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
- objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations', 'programRules', 'ouLevels']
+ objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations', 'programRules', 'programRuleVariables', 'ouLevels']
});
(function($) {
@@ -154,6 +154,8 @@
promise = promise.then( getProgramValidations );
promise = promise.then( getMetaProgramRules );
promise = promise.then( getProgramRules );
+ promise = promise.then( getMetaProgramRuleVariables );
+ promise = promise.then( getProgramRuleVariables );
promise = promise.then( getOptionSets );
promise.done( function() {
//Enable ou selection after meta-data has downloaded
@@ -488,6 +490,16 @@
return getD2Objects( programRules, 'programRules', '../api/programRules', 'fields=id,name,condition,description,program[id],programRuleActions[id,content,programRuleActionType,programStageSection[id,name],dataElement[id]]');
}
+function getMetaProgramRuleVariables( programs )
+{
+ return getD2MetaObject(programs, 'programRuleVariables', '../api/programRuleVariables.json', 'paging=false&fields=id,program[id]');
+}
+
+function getProgramRuleVariables( programRuleVariables )
+{
+ return getD2Objects( programRuleVariables, 'programRuleVariables', '../api/programRuleVariables', 'fields=id,name,program[id],dataElement[id]');
+}
+
function getD2MetaObject( programs, objNames, url, filter )
{
if( !programs ){
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2015-06-16 09:46:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2015-06-16 09:57:57 +0000
@@ -10,7 +10,7 @@
var store = new dhis2.storage.Store({
name: 'dhis2ec',
adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
- objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations', 'programRules', 'ouLevels']
+ objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations', 'programRules', 'programRuleVariables', 'ouLevels']
});
return{
currentStore: store