dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31136
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15838: bug fix in even capture custom form rendering
------------------------------------------------------------
revno: 15838
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Wed 2014-06-25 07:30:24 +0200
message:
bug fix in even capture custom form rendering
modified:
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html
dhis-2/dhis-web/dhis-web-event-capture/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-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-06-13 06:12:21 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-06-25 05:30:24 +0000
@@ -1,5 +1,6 @@
<!DOCTYPE html>
-<html manifest="event-capture.appcache" ng-app="eventCapture">
+<!--<html manifest="event-capture.appcache" ng-app="eventCapture">-->
+<html ng-app="eventCapture">
<head>
<title>Event Capture</title>
@@ -45,7 +46,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
- <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>
+ <!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>-->
<script type="text/javascript" src="../dhis-web-commons/ouwt/ouwt.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-06-24 12:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-06-25 05:30:24 +0000
@@ -202,52 +202,60 @@
programStageDataElements[prStDe.dataElement.id] = prStDe;
});
- var inputRegex = /<input(.*)\/>/g,
+ var inputRegex = /<input.*?\/>/g,
styleRegex = /style="[^"]*"/,
idRegex = /id="[^"]*"/,
match,
- inputFields = [];
+ inputFields = [];
while (match = inputRegex.exec(htmlCode)) {
- inputFields.push(match[0]);
+ inputFields.push(match[0]);
}
for(var i=0; i<inputFields.length; i++){
var inputField = inputFields[i];
- var deId = '', style = '', newInputField;
-
- if(match = idRegex.exec(inputFields[i])){
- deId = match[0].substring(4, match[0].length-1).split("-")[1];
-
+ var deId = '', style = '', newInputField;
+ if(match = idRegex.exec(inputFields[i])){
+
+ deId = match[0].substring(4, match[0].length-1).split("-")[1];
+
if(match = styleRegex.exec(inputFields[i]) ){
style = match[0];
}
if(programStageDataElements[deId].dataElement.type == "int"){
- newInputField = '<input type="number" name="'+ deId +'"' + style + 'ng-model="currentEvent.' + deId + '"' +
- 'ng-required="programStageDataElements.' + deId + '.compulsory">';
+ newInputField = '<input type="number" name="'+ deId +'" ' +
+ style +
+ ' ng-model="currentEvent.' + deId + '"' +
+ ' ng-required="programStageDataElements.' + deId + '.compulsory">';
}
if(programStageDataElements[deId].dataElement.type == "string"){
- newInputField = '<input type="text" name="'+ deId +'"' + style + 'ng-model="currentEvent.' + deId + '"' +
- 'ng-required="programStageDataElements.' + deId + '.compulsory"' +
- 'typeahead="option for option in programStageDataElements.'+deId+'.dataElement.optionSet.options | filter:$viewValue | limitTo:20"' +
- 'typeahead-open-on-focus ng-required="programStageDataElements.'+deId+'.compulsory" name="foo">';
+ newInputField = '<input type="text" name="'+ deId +'" ' +
+ style +
+ ' ng-model="currentEvent.' + deId + '" ' +
+ ' ng-required="programStageDataElements.' + deId + '.compulsory"' +
+ ' typeahead="option for option in programStageDataElements.'+deId+'.dataElement.optionSet.options | filter:$viewValue | limitTo:20"' +
+ ' typeahead-open-on-focus ng-required="programStageDataElements.'+deId+'.compulsory">';
}
if(programStageDataElements[deId].dataElement.type == "bool"){
- newInputField = '<select name="'+ deId +'"' + style + 'ng-model="currentEvent.' + deId + '"' +
- 'ng-required="programStageDataElements.' + deId + '.compulsory">' +
+ newInputField = '<select name="'+ deId +'" ' +
+ style + ' ng-model="currentEvent.' + deId + '" ' +
+ ' ng-required="programStageDataElements.' + deId + '.compulsory">' +
'option value="">{{\'please_select\'| translate}}</option>' +
'<option value="0">{{\'no\'| translate}}</option>' +
'<option value="1">{{\'yes\'| translate}}</option>';
}
if(programStageDataElements[deId].dataElement.type == "date"){
- newInputField = '<input type="text" name="'+ deId +'"' + style + ' ng-model="currentEvent.' + deId + '"' +
- 'ng-date ' +
- 'ng-required="programStageDataElements.' + deId + '.compulsory">';
+ newInputField = '<input type="text" name="'+ deId +'" ' +
+ style + ' ng-model="currentEvent.' + deId + '"' +
+ ' ng-date' +
+ ' ng-required="programStageDataElements.' + deId + '.compulsory">';
}
if(programStageDataElements[deId].dataElement.type == "trueOnly"){
- newInputField = '<input type="checkbox" name="'+ deId +'"' + style + 'ng-model="currentEvent.' + deId + '"' +
- 'ng-required="programStageDataElements.' + deId + '.compulsory">';
+ newInputField = '<input type="checkbox" name="'+ deId +'" ' +
+ style +
+ ' ng-model="currentEvent.' + deId + '"' +
+ ' ng-required="programStageDataElements.' + deId + '.compulsory">';
}
newInputField = //'<ng-form name="innerForm">' +