=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-12-21 16:42:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-12-30 12:59:32 +0000
@@ -135,6 +135,7 @@
$scope.resetOu = false;
$scope.selectedProgramStage = null;
+ $scope.currentStage = null;
$scope.allProgramRules = [];
$scope.dhis2Events = [];
$scope.currentEvent = {};
@@ -181,8 +182,8 @@
//because this is single event, take the first program stage
$scope.selectedProgramStage = $scope.selectedProgram.programStages[0];
+ $scope.currentStage = $scope.selectedProgramStage;
-
angular.forEach($scope.selectedProgramStage.programStageSections, function(section){
section.open = true;
});
@@ -515,7 +516,7 @@
};
$scope.showEventRegistration = function(){
- $scope.displayCustomForm = $scope.customForm ? true:false;
+ $scope.displayCustomForm = $scope.customForm ? true : false;
$scope.currentEvent = {};
$scope.eventRegistration = !$scope.eventRegistration;
$scope.currentEvent = angular.copy($scope.newDhis2Event);
@@ -1145,7 +1146,19 @@
return '';
};
- $scope.downloadFile = function(eventUid, dataElementUid, e) {
+ $scope.downloadFile = function(eventUid, dataElementUid, e) {
+ eventUid = eventUid ? eventUid : $scope.currentEvent.event ? $scope.currentEvent.event : null;
+ if( !eventUid || !dataElementUid){
+
+ var dialogOptions = {
+ headerText: 'error',
+ bodyText: 'missing_file_identifier'
+ };
+
+ DialogService.showDialog({}, dialogOptions);
+ return;
+ }
+
$window.open('../api/events/files?eventUid=' + eventUid +'&dataElementUid=' + dataElementUid, '_blank', '');
if(e){
e.stopPropagation();
@@ -1154,6 +1167,16 @@
};
$scope.deleteFile = function(dataElement){
+
+ if( !dataElement ){
+ var dialogOptions = {
+ headerText: 'error',
+ bodyText: 'missing_file_identifier'
+ };
+ DialogService.showDialog({}, dialogOptions);
+ return;
+ }
+
var modalOptions = {
closeButtonText: 'cancel',
actionButtonText: 'remove',
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2015-12-03 11:30:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2015-12-30 12:59:32 +0000
@@ -23,7 +23,7 @@
var updateModel = function () {
- var update = attrs.d2FileInputInstant;
+ var update = scope.d2FileInput.eventDate ? true : false;
FileService.upload(element[0].files[0]).then(function(data){
@@ -31,7 +31,7 @@
scope.d2FileInput[de] = data.response.fileResource.id;
scope.d2FileInputCurrentName[de] = data.response.fileResource.name;
- if( update === 'true' ){
+ if( update ){
if(!scope.d2FileInputName[scope.d2FileInput.event]){
scope.d2FileInputName[scope.d2FileInput.event] = [];
}
=== 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-12-23 08:56:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2015-12-30 12:59:32 +0000
@@ -603,6 +603,9 @@
return e;
},
refreshList: function(eventList, currentEvent){
+ if(!eventList || !eventList.length){
+ return;
+ }
var continueLoop = true;
for(var i=0; i< eventList.length && continueLoop; i++){
if(eventList[i].event === currentEvent.event ){
=== 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 2015-12-14 10:14:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-12-30 12:59:32 +0000
@@ -226,7 +226,7 @@
ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
- d2-file-input-instant="false"
+ d2-file-input-ps="currentStage"
d2-file-input="currentEvent"
d2-file-input-current-name="currentFileNames"
d2-file-input-name="fileNames">
@@ -498,7 +498,7 @@
ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
- d2-file-input-instant="false"
+ d2-file-input-ps="currentStage"
d2-file-input="currentEvent"
d2-file-input-current-name="currentFileNames"
d2-file-input-name="fileNames">
=== 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-12-30 02:55:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-12-30 12:59:32 +0000
@@ -442,10 +442,34 @@
commonInputFieldProperty + ' >';
}
else if (prStDe.dataElement.valueType === "LONG_TEXT") {
- newInputField = '';
+ commonInputFieldProperty + '>';
+ }
+ else if (prStDe.dataElement.valueType === "FILE_RESOURCE") {
+ newInputField = '\n\
+ \n\
+ {{fileNames[currentEvent.event][' + fieldId + ']}}\n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ \n\
+ ';
}
else {
newInputField = '