diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..911d8c1
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,10 @@
+{
+ "presets": [
+ [
+ "env",
+ {
+ "modules": false
+ }
+ ]
+ ]
+}
\ No newline at end of file
diff --git a/.bowerrc b/.bowerrc
new file mode 100644
index 0000000..baa91a3
--- /dev/null
+++ b/.bowerrc
@@ -0,0 +1,3 @@
+{
+ "directory": "bower_components"
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..027b5a1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+project_manager.zip
+projectmanager.zip
+node_modules/
+dist/
+dist2/
+
+package-lock.json
\ No newline at end of file
diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 0000000..d6163dc
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/HMIS_Management_node_modules.xml b/.idea/libraries/HMIS_Management_node_modules.xml
new file mode 100644
index 0000000..461f265
--- /dev/null
+++ b/.idea/libraries/HMIS_Management_node_modules.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 8662aa9..28a804d 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,6 @@
-
+
+
+
\ No newline at end of file
diff --git a/.idea/msf_apps.iml b/.idea/msf_apps.iml
index c956989..fcb1220 100644
--- a/.idea/msf_apps.iml
+++ b/.idea/msf_apps.iml
@@ -4,5 +4,6 @@
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 6701cc0..03b2825 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,38 @@
-msf_apps
-========
+# HMIS Management
+
+Web application (Dhis2 App) that simplifies the exchange of data and metadata between different DHIS2 platforms, and other administrative tasks, such as running the analityc process and approving data for aggregated data sets.
+
+DHIS2, a flexible, web-based open source information system to collect and analyze information, is being used by MSF as its HMIS. Health information coming from the projects is the reference point for medical interventions coordination, planning and monitoring and a guarantee for early and effective response in case of emergency.
+
+## Sections
+
+* Import Meta-Data: Import metadata mofications
+* Import / export data: Manual and automatic
+* Import / export individual data.
+* Validation: data validation.
+* Refresh data: Replicates the run analytics function
+* Reset project users' password.
+* Available data: show a table with the number of values introduced by orgunit and period.
+* Metadata monitor: show a table with the status of each project.
+
+## Build
+
+NPM is used as dependency manager. In order to have all dependencies available you must execute
+
+```
+# npm install
+```
+in the app directory.
+
+Then build the app with
+```
+# npm run build-dev //Development version
+# npm run build-prod //Production version
+```
+This will create a `/dist` folder with the app.
+
+Then package the content in `/dist` folder to install the app in the DHIS2 instance.
+
+## License
+
+This app is licensed under GPLv3. Please respect the terms of that license.
diff --git a/app.css b/app.css
new file mode 100644
index 0000000..9f0e7ee
--- /dev/null
+++ b/app.css
@@ -0,0 +1,66 @@
+.dhis2-header {
+ margin-left: 0;
+ margin-right: 0;
+ background-color: #b40303;
+}
+
+.logo-banner img {
+ height: 40px;
+}
+
+.app-title {
+ top: 12px;
+ font-weight: bold;
+ color: #fff;
+ font-size: 16px;
+}
+
+.left-side-menu {
+ background-color: #E8EAEA;
+ height: 200%;
+}
+
+/* Common animations */
+.animation-rotation {
+ -webkit-animation: rotation infinite linear 0.5s;
+ -moz-animation: rotation infinite linear 0.5s;
+ -o-animation: rotation infinite linear 0.5s;
+ animation: rotation infinite linear 0.5s;
+ text-indent: 0;
+}
+
+@-webkit-keyframes rotation {
+ 0% {
+ -webkit-transform:rotate(0deg);
+ }
+ 100% {
+ -webkit-transform:rotate(360deg);
+ }
+}
+
+@-moz-keyframes rotation {
+ 0% {
+ -moz-transform:rotate(0deg);
+ }
+ 100% {
+ -moz-transform:rotate(360deg);
+ }
+}
+
+@-o-keyframes rotation {
+ 0% {
+ -o-transform:rotate(0deg);
+ }
+ 100% {
+ -o-transform:rotate(360deg);
+ }
+}
+
+@keyframes rotation {
+ 0% {
+ transform:rotate(0deg);
+ }
+ 100% {
+ transform:rotate(360deg);
+ }
+}
diff --git a/app.js b/app.js
index 6771728..ce10602 100644
--- a/app.js
+++ b/app.js
@@ -1,51 +1,120 @@
-var appManagerMSF = angular.module("appManagerMSF", ['ngRoute','Dhis2Api','pascalprecht.translate','ui.bootstrap','d2Menu', 'angularFileUpload','angularTreeview','door3.css']);
-appManagerMSF.config(function($routeProvider) {
+/*
+ Copyright (c) 2015.
- $routeProvider.when('/dataapproval', {
- templateUrl: "modules/dataapproval/dataapprovalView.html",
- controller: "dataapprovalController"
- });
- $routeProvider.when('/metadataimport', {
- templateUrl: "modules/metadataimport/metadataimportView.html",
- controller: "metadataimportController"
- });
- $routeProvider.when('/metadataexport', {
- templateUrl: "modules/metadataexport/metadataexportView.html",
- controller: "metadataexportController"
- });
-
- $routeProvider.when('/analytics', {
- templateUrl: "modules/analytics/analyticsView.html",
- controller: "analyticsController"
- });
- $routeProvider.when('/dataimport', {
- templateUrl: "modules/dataimport/dataimportView.html",
- controller: "dataimportController"
- });
- $routeProvider.when('/dataexport', {
- templateUrl: "modules/dataexport/dataexportView.html",
- controller: "dataexportController"
- });
-
- $routeProvider.when('/resetpasswd', {
- templateUrl: "modules/resetpasswd/resetpasswdView.html",
- controller: "resetpasswdController"
- });
-
- $routeProvider.when('/availabledata', {
- templateUrl: "modules/availabledata/availabledataView.html",
- controller: "availabledataController",
- css: "modules/availabledata/availabledataCss.css"
- });
-
- $routeProvider.otherwise({
- redirectTo: '/'
- });
+ This file is part of Project Manager.
+
+ Project Manager is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Project Manager is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Project Manager. If not, see . */
+require('./node_modules/angular/angular.min');
+require('./node_modules/angular-route/angular-route.min');
+require('./node_modules/angular-resource/angular-resource.min');
+require('./node_modules/angular-translate/dist/angular-translate.min');
+require('./node_modules/angular-translate-loader-static-files/angular-translate-loader-static-files.min');
+require('./node_modules/angular-sanitize/angular-sanitize.min');
+require('./node_modules/ng-file-upload/dist/angular-file-upload.min');
+require('./node_modules/ng-file-upload/dist/angular-file-upload-shim.min');
+require('./node_modules/angular-css/angular-css.min');
+
+require('./node_modules/bootstrap/dist/js/bootstrap.min');
+require('./node_modules/bootstrap/dist/css/bootstrap.min.css');
+require('./node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls');
+require('./node_modules/babel-polyfill');
+require('./include/angular.treeview/angular.treeview');
+require('./include/angular.treeview/css/angular.treeview.css');
+
+require('./core/dhis2Api');
+require('./directives/directives.module');
+require('./features/features.module');
+require('./app.css');
+var appManagerMSF = angular.module("appManagerMSF", ['ngRoute','Dhis2Api','Directives', 'Features', 'pascalprecht.translate','ui.bootstrap','d2Menu', 'angularFileUpload','angularTreeview','angularCSS']);
+
+appManagerMSF.config(['$routeProvider', function($routeProvider) {
+
+ $routeProvider.when('/dataapproval', {
+ templateUrl: "features/dataapproval/dataapprovalView.html",
+ controller: "dataapprovalController"
+ });
+ $routeProvider.when('/metadataimport', {
+ template: require('./features/metadataimport/metadataimportView.html'),
+ controller: 'metadataimportController as ctrl',
+ css: require('./features/metadataimport/metadataimportCss.css')
+ });
+ $routeProvider.when('/metadataexport', {
+ template: require('./features/metadataexport/metadataexportView.html'),
+ controller: 'metadataexportController'
+ });
+ $routeProvider.when('/analytics', {
+ template: require('./features/analytics/analyticsView.html'),
+ controller: 'analyticsController as ctrl'
+ });
+ $routeProvider.when('/dataimport', {
+ template: require('./features/dataimport/dataimportView.html'),
+ controller: 'dataimportController'
+ });
+ $routeProvider.when('/validation', {
+ template: require('./features/validation/importeddataView.html'),
+ controller: 'importeddataController as ctrl',
+ css: require('./features/validation/importeddataController.css')
+ });
+ $routeProvider.when('/dataexport', {
+ template: require('./features/dataexport/dataexportView.html'),
+ controller: 'dataexportController',
+ css: require('./features/dataexport/dataexportCss.css')
+ });
+ $routeProvider.when('/trackerdataimport', {
+ template: require('./features/trackerdataimport/trackerDataImportView.html'),
+ controller: 'trackerDataImportController as ctrl',
+ css: require('./features/trackerdataimport/trackerDataImportCss.css')
+ });
+ $routeProvider.when('/trackerdataexport', {
+ template: require('./features/trackerdataexport/trackerDataExportView.html'),
+ controller: 'trackerDataExportController as ctrl'
+ });
+ $routeProvider.when('/resetpasswd', {
+ template: require('./features/resetpasswd/resetpasswdView.html'),
+ controller: 'resetpasswdController as ctrl',
+ css: require('./features/resetpasswd/resetpasswdCss.css')
+ });
+ $routeProvider.when('/availabledata', {
+ template: require('./features/availabledata/availabledataView.html'),
+ controller: 'availabledataController as ctrl',
+ css: require('./features/availabledata/availabledataCss.css')
+ });
+ $routeProvider.when('/hmisadoption', {
+ templateUrl: "features/hmisadoption/hmisadoptionView.html",
+ controller: "hmisadoptionController",
+ css: "features/hmisadoption/hmisadoptionCss.css"
+ });
+ $routeProvider.when('/metadatamonitor', {
+ template: require("./features/metadatamonitor/metadatamonitorView.html"),
+ controller: "metadatamonitorController as ctrl",
+ css: require("./features/metadatamonitor/metadatamonitorCss.css")
+ });
+ $routeProvider.when('/createversion', {
+ template: require("./features/createversion/createversionView.html"),
+ controller: "createversionController as ctrl",
+ css: require("./features/createversion/createversionCss.css")
+ });
+
+ $routeProvider.otherwise({
+ redirectTo: '/'
});
-appManagerMSF.config(function ($translateProvider, urlApi) {
+}]);
+
+appManagerMSF.config(['$translateProvider', 'urlApi', function ($translateProvider, urlApi) {
$translateProvider.useStaticFilesLoader({
prefix: 'languages/',
@@ -64,15 +133,27 @@ appManagerMSF.config(function ($translateProvider, urlApi) {
$translateProvider.fallbackLanguage(['en']);
- jQuery.ajax({ url: urlApi + 'userSettings/keyUiLocale/', contentType: 'text/plain', method: 'GET', dataType: 'text', async: false}).success(function (uiLocale) {
+ jQuery.ajax({
+ url: urlApi + 'userSettings/keyUiLocale/',
+ contentType: 'text/plain',
+ method: 'GET',
+ dataType: 'text',
+ async: false})
+ .done(function (uiLocale) {
if (uiLocale == ''){
+ console.log("no hay language");
$translateProvider.determinePreferredLanguage();
}
else{
+ console.log("assign locale =>" + uiLocale);
$translateProvider.use(uiLocale);
}
}).fail(function () {
+ console.log("fail language");
$translateProvider.determinePreferredLanguage();
});
-
-});
\ No newline at end of file
+}]);
+
+appManagerMSF.config(['uibDatepickerConfig', function (uibDatepickerConfig) {
+ uibDatepickerConfig.startingDay = 1;
+}]);
diff --git a/core/dhis2Api.js b/core/dhis2Api.js
index d506ef6..d5bc843 100644
--- a/core/dhis2Api.js
+++ b/core/dhis2Api.js
@@ -1,196 +1,413 @@
-/*
- * Architeture
- * Helder Yesid Castrillón
- * Hisp Colombia 2014
- *
- * Core Module for using WebApi of dhis2
- * It is the persistence in the FrontEnd
- *
- * */
-var Dhis2Api = angular.module("Dhis2Api", ['ngResource', 'door3.css']);
-
-var urlBase = $.parseJSON( $.ajax({
- type: "GET",
- dataType: "json",
- url: 'manifest.webapp',
- async: false
-}).responseText).activities.dhis.href + '/';
-
-var urlApi = urlBase + '/api/';
-
-//Auxiliary variable to parse the url
-var urlAuxLink = document.createElement('a');
-urlAuxLink.href = urlBase;
-
-//Delete initial and final slash
-var auxBaseUrl = urlAuxLink.pathname;
-if (auxBaseUrl.startsWith("/")) auxBaseUrl = auxBaseUrl.substring(1);
-if (auxBaseUrl.endsWith("/")) auxBaseUrl = auxBaseUrl.substring(0, auxBaseUrl.length - 1);
-
-//Dhis related variables
-window.dhis2 = window.dhis2 || {};
-dhis2.settings = dhis2.settings || {};
-dhis2.settings.baseUrl = auxBaseUrl;
-
-//Create all common variables of the apps
-Dhis2Api.factory("commonvariable", function () {
- var Vari={
- url: urlApi,
- urlbase: urlBase,
- OrganisationUnit:"",
- OrganisationUnitList:[],
- Period:"",
- DataSet:""
- };
-
- return Vari;
-});
-
-Dhis2Api.constant("urlApi", urlApi);
-
-Dhis2Api.factory("userAuthorization", ['$resource','commonvariable',function($resource,commonvariable) {
- return $resource(commonvariable.url + "me/authorization/:menuoption",
- {
- menuoption:'@menuoption'
- },
- { get: { method: "GET", transformResponse: function (response) {return {status: response};} }});
-
-}]);
-
-Dhis2Api.factory("meUser", ['$resource','commonvariable',function($resource,commonvariable) {
- return $resource(commonvariable.url + "me",
- {},
- { get: { method: "GET"} });
-
-}]);
-
-Dhis2Api.factory("TreeOrganisationunit",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource(commonvariable.url+"organisationUnits/:uid",
- {
- uid:'@uid',
- fields:'name,id,children[name,id]'
- },
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("Organisationunit",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"organisationUnits",
- {
- fields:'name,id,level,parent',
- pageSize:'10',
- page:1
- },
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("OrganisationunitLevel",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"organisationUnitLevels",
- {
- fields:'name,id,level',
- pageSize:10
- },
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("Analytics",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"resourceTables/analytics",
- {},
- { post: { method: "POST"} });
-}]);
-
-Dhis2Api.factory("DataMart",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"system/tasks/DATAMART",
- {lastId:'@lastId'},
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("DatasetDAppr",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"dataSets",
- {filter:'approveData:eq:true',
- fields:'id,name,dataElements,periodType'},
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("DataApprovalsState",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"dataApprovals",
- {ds:'@ds',
- pe:'@pe',
- ou:'@ou'},
- { get: { method: "GET"},
- post: { method: "POST"},
- remove: {method:'DELETE'}
- });
-}]);
-
-Dhis2Api.factory("DataApprovalsAccept",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"dataAcceptances",
- {ds:'@ds',
- pe:'@pe',
- ou:'@ou'},
- { post: { method: "POST"},
- remove: {method:'DELETE'}
- });
-}]);
-Dhis2Api.factory("AnaliticsDAppr",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"analytics.json?:dimension1&:dimension2&:dimension3",
- {dimension1:'@dx',
- dimension2:'@pe',
- dimension3:'@ou',
- tableLayout:'true',
- rows:'dx',
- columns:'pe;ou'},
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("DataSetsUID",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"dataSets.json?fields=id&paging=false",
- {},
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("DataExport",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"dataValueSets.json",
- {startDate:'@startDate',
- endDate:'@endDate',
- orgUnit:'@orgUnit',
- children:'@children'},
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("MetaDataExport",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"metadata.json",
- {},
- { get: { method: "GET"} });
-}]);
-
-Dhis2Api.factory("MetaDataExportZip",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"metadata.json.zip",
- {},
- { get: { method: "GET"} });
-}]);
-Dhis2Api.factory("DataSetForm",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.urlbase+"dhis-web-reporting/generateDataSetReport.action",
- {ds:'@id',
- pe:'@pe',
- ou:'@ou'},
- { get: { method: "GET", transformResponse: function (response) {
- return {codeHtml: response};
- }
- }
- });
-}]);
-
-Dhis2Api.factory("DataSetEntryForm",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.urlbase+"dhis-web-dataentry/loadForm.action",
- { dataSetId:'@dataSetId' },
- { get: { method: "GET", transformResponse: function (response) {
- return {codeHtml: response};}
- }
- });
-}]);
-
-Dhis2Api.factory("DataElementGroupsUID",['$resource','commonvariable', function ($resource,commonvariable) {
- return $resource( commonvariable.url+"dataElementGroups.json?fields=id&paging=false",
- {},
- { get: { method: "GET"} });
-}]);
+
+/*
+ Copyright (c) 2015.
+
+ This file is part of Project Manager.
+
+ Project Manager is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Project Manager is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Project Manager. If not, see . */
+
+var Dhis2Api = angular.module("Dhis2Api", ['ngResource']);
+
+// Specify the target api version of DHIS2
+var apiVersion = 29;
+
+var urlBase = window.location.href.split('api/apps/')[0];
+var urlApi = urlBase + 'api/'; /* + apiVersion + "/";*/
+
+//Auxiliary variable to parse the url
+var urlAuxLink = document.createElement('a');
+urlAuxLink.href = urlBase;
+
+//Delete initial and final slash
+var auxBaseUrl = urlAuxLink.pathname;
+if (auxBaseUrl.startsWith("/")) auxBaseUrl = auxBaseUrl.substring(1);
+if (auxBaseUrl.endsWith("/")) auxBaseUrl = auxBaseUrl.substring(0, auxBaseUrl.length - 1);
+
+//Dhis related variables
+window.dhis2 = window.dhis2 || {};
+dhis2.settings = dhis2.settings || {};
+dhis2.settings.baseUrl = auxBaseUrl;
+
+var isOnline = urlBase.indexOf("msf.es") >= 0;
+//isOnline=true;
+
+// Get and save DHIS version
+var version = "";
+$.ajax({ url: urlApi + "system/info", dataType: "json", async: "true", method: "GET" }).done( function (info) {
+ version = info.version;
+});
+
+//Create all common variables of the apps
+Dhis2Api.factory("commonvariable", function () {
+ var Vari={
+ url: urlApi,
+ urlbase: urlBase,
+ isOnline: isOnline,
+ version: version,
+ apiVersion: apiVersion,
+ OrganisationUnit:"",
+ OrganisationUnitList:[],
+ Period:"",
+ DataSet:""
+ };
+
+ return Vari;
+});
+
+Dhis2Api.constant("urlApi", urlApi);
+
+Dhis2Api.factory("userAuthorization", ['$resource','commonvariable',function($resource,commonvariable) {
+ return $resource(commonvariable.url + "me/authorization/:menuoption",
+ {
+ menuoption:'@menuoption'
+ },
+ { get: { method: "GET", transformResponse: function (response) {return {status: response};} }});
+
+}]);
+
+Dhis2Api.factory("meUser", ['$resource','commonvariable',function($resource,commonvariable) {
+ return $resource(commonvariable.url + "me",
+ {},
+ { get: { method: "GET"} });
+
+}]);
+
+Dhis2Api.factory("TreeOrganisationunit",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource(commonvariable.url+"organisationUnits/:uid",
+ {
+ uid:'@uid',
+ fields:'name,id, level, children[name,id, level, parent[id,parent]]'
+ },
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("Organisationunit",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"organisationUnits",
+ {
+ fields: 'name,id,level,parent,children, dataSets[id, name,attributeValues[value,attribute[id,code]]], organisationunits[id, parent],[organisationUnitGroups[id]',
+ paging: false
+ },
+ { get: { method: "GET"} }
+ );
+}]);
+
+Dhis2Api.factory("OrganisationunitLevel",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"organisationUnitLevels",
+ {
+ fields:'name,id,level',
+ pageSize:10
+ },
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("Analytics",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"resourceTables/analytics",
+ {},
+ { post: { method: "POST"} });
+}]);
+
+Dhis2Api.factory("DataMart",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url + "system/tasks/ANALYTICS_TABLE",
+ {lastId:'@lastId'},
+ { get: { method: "GET"} });
+
+}]);
+
+Dhis2Api.factory("DatasetDAppr",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataSets",
+ {filter:'approveData:eq:true',
+ fields:'id,name,dataElements,periodType'},
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("DataApprovalsState",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataApprovals",
+ {ds:'@ds',
+ pe:'@pe',
+ ou:'@ou'},
+ { get: { method: "GET"},
+ post: { method: "POST"},
+ remove: {method:'DELETE'}
+ });
+}]);
+
+Dhis2Api.factory("DataApprovalsAccept",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataAcceptances",
+ {ds:'@ds',
+ pe:'@pe',
+ ou:'@ou'},
+ { post: { method: "POST"},
+ remove: {method:'DELETE'}
+ });
+}]);
+Dhis2Api.factory("AnaliticsDAppr",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"analytics.json?:dimension1&:dimension2&:dimension3",
+ {dimension1:'@dx',
+ dimension2:'@pe',
+ dimension3:'@ou',
+ tableLayout:'true',
+ rows:'dx',
+ columns:'pe;ou'},
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("AnalyticsEngine",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"analytics.json",
+ {});
+}]);
+
+Dhis2Api.factory("DataSetsUID",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataSets.json?fields=id&paging=false",
+ {},
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("DataElement",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataElements.json?fields=id&paging=false",
+ {},
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("DataExport",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataValueSets.json",
+ {startDate:'@startDate',
+ endDate:'@endDate',
+ orgUnit:'@orgUnit',
+ children:'@children'},
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("MetaDataExport",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"metadata.json",
+ {},
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("MetaDataExportZip",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"metadata.json.zip",
+ {},
+ { get: { method: "GET"} });
+}]);
+
+Dhis2Api.factory("DataSetForm",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.urlbase+"dhis-web-reporting/generateDataSetReport.action",
+ {ds:'@id',
+ pe:'@pe',
+ ou:'@ou'},
+ { get: { method: "GET", transformResponse: function (response) {
+ return {codeHtml: response};
+ }
+ }
+ });
+}]);
+
+Dhis2Api.factory("DataSetEntryForm",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.urlbase+"dhis-web-dataentry/loadForm.action",
+ { dataSetId:'@dataSetId' },
+ { get: { method: "GET", transformResponse: function (response) {
+ return {codeHtml: response};}
+ }
+ });
+}]);
+
+Dhis2Api.factory("UsersByUserRole",['$resource','commonvariable', function ($resource,commonvariable) {
+return $resource( commonvariable.url+"userRoles/:idrole",
+{
+ idrole:'idrole',
+ fields: 'id, name, users'
+},
+{ get: { method: "GET"} });
+}]);
+
+
+
+
+Dhis2Api.factory("User",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"users/:iduser",
+ {},
+ {
+ get: {
+ method: "GET",
+ params: {
+ fields: ':all,userCredentials[id,name,username,userInfo,created,userRoles]',
+ paging: false
+ }
+ },
+ put: {
+ method: "PUT",
+ iduser: '@id'
+ }
+ }
+ );
+}]);
+
+Dhis2Api.factory("FilterResource", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+
+ return $resource(commonvariable.url + ":resource",
+ {
+ resource:'@resource',
+ filter:'@filter'
+ },
+ {get: {method: "GET"}});
+
+}]);
+Dhis2Api.factory("DataElementGroupsUID",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataElementGroups.json?fields=id&paging=false",
+ {},
+ { get: { method: "GET"} });
+}]);
+Dhis2Api.factory("DataStore",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"dataStore/:namespace/:key",
+ {
+ namespace:'namespace',
+ key:'key'
+ },
+ { put: { method: "PUT"} });
+}]);
+
+
+Dhis2Api.factory("userDataStore",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"userDataStore/:namespace/:key",
+ {
+ namespace:'namespace',
+ key:'key'
+ },
+ { put: { method: "PUT"} });
+}]);
+
+Dhis2Api.factory("SqlView",['$resource', 'commonvariable', function($resource, commonvariable) {
+ return $resource( commonvariable.url + "sqlViews/:id",
+ {id:'@id'}, {post: {method: "POST"}});
+}]);
+
+Dhis2Api.factory("SqlViewData",['$resource', 'commonvariable', function($resource, commonvariable) {
+ return $resource( commonvariable.url + "sqlViews/:id/data.json?paging=false",
+ {id:'@id'});
+}]);
+
+Dhis2Api.factory("SqlViewRefresh",['$resource', 'commonvariable', function($resource, commonvariable) {
+ return $resource( commonvariable.url + "sqlViews/:id/refresh",
+ {id:'@id'}, {post: {method: "POST"}});
+}]);
+
+
+Dhis2Api.factory("OrganisationUnitGroupSet",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"organisationUnitGroupSets/:groupsetid",
+ {groupsetid: '@groupsetid'});
+}]);
+
+Dhis2Api.factory("OrganisationUnitGroup",['$resource','commonvariable', function ($resource,commonvariable) {
+ return $resource( commonvariable.url+"organisationUnitGroups",
+ {paging: false}
+ );
+}]);
+
+Dhis2Api.factory("MetadataVersion", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.urlbase + "api/metadata/version");
+}]);
+
+Dhis2Api.factory("MetadataSync", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.urlbase + "api/metadata/sync");
+}]);
+
+Dhis2Api.factory("RemoteAvailability", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "synchronization/availability");
+}]);
+
+Dhis2Api.factory("RemoteInstanceUrl", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "systemSettings/keyRemoteInstanceUrl", {}, {
+ get: {
+ method: 'GET',
+ /*transformResponse: function (response) {
+ return {html: response};
+ }*/
+ }
+ });
+}]);
+
+
+
+Dhis2Api.factory("messageConversations", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "messageConversations",
+ {},
+ { post: { method: "POST"} });
+}]);
+
+
+
+
+Dhis2Api.factory("Events",['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "events", {}, {
+ get: {
+ method: 'GET',
+ params: {skipPaging: true, includeDeleted: true}
+ }
+ });
+}]);
+
+Dhis2Api.factory("TrackedEntityInstances",['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "trackedEntityInstances/:uid",
+ {
+ fields:'*,attributes[attribute,value,created]'
+ } );
+}]);
+
+Dhis2Api.factory("Enrollments",['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "enrollments/:uid", {}, {
+ get: {
+ method: 'GET',
+ params: {skipPaging: true}
+ }
+ });
+}]);
+
+Dhis2Api.factory("Programs",['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "programs/:uid");
+}]);
+
+Dhis2Api.factory("JobExecute",['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "jobConfigurations/:uid/execute" );
+}]);
+
+
+
+Dhis2Api.factory("JobConfigurations",['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "jobConfigurations/:name" );
+}]);
+
+Dhis2Api.factory("Jobs",['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "jobConfigurations/:uid" );
+}]);
+
+
+Dhis2Api.factory("Ping", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "system/ping",
+ {},
+ { get: { method: "GET", transformResponse: (data, headerGetter, status ) => ({data: data, headers: headerGetter(), status: status}) }} );
+}]);
+
+Dhis2Api.factory("Info", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "system/info");
+}]);
+
+
+
+Dhis2Api.factory("systemsetting", ['$resource', 'commonvariable', function ($resource, commonvariable) {
+ return $resource( commonvariable.url + "systemSettings");
+}]);
+
+
+
+
+module.exports = Dhis2Api;
\ No newline at end of file
diff --git a/deploy.bat b/deploy.bat
new file mode 100644
index 0000000..71a7d67
--- /dev/null
+++ b/deploy.bat
@@ -0,0 +1,2 @@
+cd "%~dp0"
+xcopy /y /s ".\dist" "C:\Program Files (x86)\DHIS2\DHIS\apps\HMIS_Management" /EXCLUDE:files-excluded.txt
diff --git a/deploy2.bat b/deploy2.bat
new file mode 100644
index 0000000..ad64159
--- /dev/null
+++ b/deploy2.bat
@@ -0,0 +1 @@
+xcopy /y /s "d:\temp" "C:\Program Files (x86)\DHIS2\DHIS\apps\HMIS_Management"
\ No newline at end of file
diff --git a/dhis.js b/dhis.js
deleted file mode 100644
index cf46d52..0000000
--- a/dhis.js
+++ /dev/null
@@ -1,78 +0,0 @@
-(function (jQuery) {
- //TODO: Improve this script loader and bootstrapper
- var dhis2Root;
- var dhis2CoreScripts = [
-// '/dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.min.js',
-// '/dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.plus.min.js',
-// '/dhis-web-commons/javascripts/dhis2/dhis2.util.js',
-// '/dhis-web-commons/javascripts/dhis2/dhis2.period.js',
-// '/dhis-web-commons/javascripts/jQuery/ui/jquery-ui.min.js',
- '/dhis-web-commons/javascripts/dhis2/dhis2.translate.js',
- '/dhis-web-commons/javascripts/dhis2/dhis2.menu.js',
- '/dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js',
-
- ];
- $.ajaxSetup({
- cache: true
- });
- function loadScript(callBack) {
- var script;
- if (dhis2CoreScripts.length > 0) {
- script = dhis2CoreScripts.shift();
- jQuery.getScript(dhis2Root + script, function () {
- loadScript(callBack);
- });
- } else {
- callBack();
- }
- }
- jQuery.get('manifest.webapp').success(function (manifest) {
- var manifest = JSON.parse(manifest);
- dhis2Root = manifest.activities.dhis.href;
- if (!dhis2Root) {
- console.error('Error trying to get the dhis2 url from the manifest');
- }
- window.dhis2 = window.dhis2 || {};
- dhis2.settings = dhis2.settings || {};
- dhis2.settings.baseUrl = dhis2Root.replace(window.location.origin, '').replace(/^\//, ''); //TODO: Perhaps this regex should go into the menu.js
- //Load all the required scripts and then launch the angular app
- loadScript(function (){
- angular.module('appManagerMSF').factory('AppManifest', function () {
- return manifest;
- });
-// jQuery.get(dhis2Root + '/api/systemSettings.json').success(function (systemSettings) {
-// function configureApp(language) {
-// angular.module('PEPFAR.approvals').config(function ($provide, d2ApiProvider, $translateProvider) {
-// $provide.constant('API_ENDPOINT', dhis2Root + '/api');
-// d2ApiProvider.setBaseUrl(dhis2Root + '/api');
-// $translateProvider.use(language);
-// $translateProvider.preferredLanguage(language);
-// });
-// }
-// angular.module('PEPFAR.approvals').factory('systemSettings', function () {
-// return systemSettings;
-// });
-// jQuery.ajax({ url: dhis2Root + '/api/userSettings/keyUiLocale/', contentType: 'text/plain', method: 'GET', dataType: 'text' }).success(function (uiLocale) {
-// configureApp(uiLocale);
-// angular.bootstrap(document, ['PEPFAR.approvals']);
-// }).fail(function () {
-// console.warn('Failed to load uiLocale from userSettings: defaulting to english');
-// configureApp('en');
-// angular.bootstrap(document, ['PEPFAR.approvals']);
-// });
-// });
- });
- //Load the jquery ui stylesheet for the forms
- jQuery('', {
- rel: 'stylesheet',
- type: 'text/css',
- //href: dhis2Root + '/dhis-web-commons/javascripts/jQuery/ui/css/redmond/jquery-ui.css'
- href: dhis2Root + '/dhis-web-commons/font-awesome/css/font-awesome.min.css'
- }).appendTo('head');
- jQuery('', {
- rel: 'stylesheet',
- type: 'text/css',
- href: dhis2Root + '/dhis-web-commons/css/menu.css'
- }).appendTo('head');
- });
-})(jQuery);
\ No newline at end of file
diff --git a/directives/.gitignore b/directives/.gitignore
deleted file mode 100644
index aaab018..0000000
--- a/directives/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/optionset
diff --git a/directives/authorization/authorizationController.js b/directives/authorization/authorizationController.js
index 6747f06..d54c674 100644
--- a/directives/authorization/authorizationController.js
+++ b/directives/authorization/authorizationController.js
@@ -1,3 +1,24 @@
+
+/*
+ Copyright (c) 2015.
+
+ This file is part of Project Manager.
+
+ Project Manager is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Project Manager is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Project Manager. If not, see . */
+
+
+
Dhis2Api.directive('d2Authorization', function(){
return{
restrict: 'E',
diff --git a/directives/authorization/authorizationView.html b/directives/authorization/authorizationView.html
index db7f97f..16d82af 100644
--- a/directives/authorization/authorizationView.html
+++ b/directives/authorization/authorizationView.html
@@ -1,3 +1,23 @@
+
+
+
+
+ *
+ *