Skip to content

Commit 76835b5

Browse files
author
Mark Tiele Westra
committed
Issue #418 - UI for setting the geoLocked flag
* this flag determines if manual editing of geo info on the device is disabled (geoLocked=true) or not (geoLocked=false)
1 parent 7dffb22 commit 76835b5

File tree

8 files changed

+48
-1
lines changed

8 files changed

+48
-1
lines changed

Dashboard/app/js/lib/models/models.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ FLOW.Question = FLOW.BaseModel.extend({
107107
allowSign: DS.attr('boolean', {
108108
defaultValue: false
109109
}),
110+
geoLocked: DS.attr('boolean', {
111+
defaultValue: false
112+
}),
110113
collapseable: DS.attr('boolean', {
111114
defaultValue: false
112115
}),

Dashboard/app/js/lib/views/surveys/question-view.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ FLOW.QuestionView = FLOW.View.extend({
1111
allowDecimal: null,
1212
allowMultipleFlag: null,
1313
allowOtherFlag: null,
14+
geoLocked: null,
1415
dependentFlag: false,
1516
dependentQuestion: null,
1617
optionList: null,
@@ -79,11 +80,19 @@ FLOW.QuestionView = FLOW.View.extend({
7980
}
8081
}.property('this.type').cacheable(),
8182

83+
amGeoType: function () {
84+
if (this.type) {
85+
return this.type.get('value') == 'GEO';
86+
} else {
87+
return false;
88+
}
89+
}.property('this.type').cacheable(),
90+
8291
amNoOptionsType: function () {
8392
var val;
8493
if (!Ember.none(this.type)) {
8594
val = this.type.get('value');
86-
return val == 'GEO' || val == 'FREE_TEXT' || val == 'PHOTO' || val == 'VIDEO' || val == 'BARCODE';
95+
return val == 'FREE_TEXT' || val == 'PHOTO' || val == 'VIDEO' || val == 'BARCODE';
8796
}
8897
}.property('this.type').cacheable(),
8998

@@ -113,6 +122,7 @@ FLOW.QuestionView = FLOW.View.extend({
113122
this.set('allowDecimal', FLOW.selectedControl.selectedQuestion.get('allowDecimal'));
114123
this.set('allowMultipleFlag', FLOW.selectedControl.selectedQuestion.get('allowMultipleFlag'));
115124
this.set('allowOtherFlag', FLOW.selectedControl.selectedQuestion.get('allowOtherFlag'));
125+
this.set('geoLocked', FLOW.selectedControl.selectedQuestion.get('geoLocked'));
116126
this.set('includeInMap', FLOW.selectedControl.selectedQuestion.get('includeInMap'));
117127
this.set('dependentFlag', FLOW.selectedControl.selectedQuestion.get('dependentFlag'));
118128
this.set('optionList', FLOW.selectedControl.selectedQuestion.get('questionOptionList'));
@@ -219,6 +229,9 @@ FLOW.QuestionView = FLOW.View.extend({
219229
this.set('allowSign', false);
220230
this.set('allowDecimal', false);
221231
}
232+
if (this.type.get('value') !== 'GEO') {
233+
this.set('geoLocked', false);
234+
}
222235
path = FLOW.selectedControl.selectedSurveyGroup.get('code') + "/" + FLOW.selectedControl.selectedSurvey.get('name') + "/" + FLOW.selectedControl.selectedQuestionGroup.get('code');
223236
FLOW.selectedControl.selectedQuestion.set('text', this.get('text'));
224237
FLOW.selectedControl.selectedQuestion.set('tip', this.get('tip'));
@@ -234,6 +247,7 @@ FLOW.QuestionView = FLOW.View.extend({
234247
FLOW.selectedControl.selectedQuestion.set('allowDecimal', this.get('allowDecimal'));
235248
FLOW.selectedControl.selectedQuestion.set('allowMultipleFlag', this.get('allowMultipleFlag'));
236249
FLOW.selectedControl.selectedQuestion.set('allowOtherFlag', this.get('allowOtherFlag'));
250+
FLOW.selectedControl.selectedQuestion.set('geoLocked', this.get('geoLocked'));
237251
FLOW.selectedControl.selectedQuestion.set('includeInMap', this.get('includeInMap'));
238252

239253
dependentQuestionAnswer = "";

Dashboard/app/js/templates/navSurveys/question-view.handlebars

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
<label class="minValNumb">{{t _min_val}}: {{view Ember.TextField valueBinding="view.minVal" size=10 }}</label>
4747
<label class="maxValNumb">{{t _max_val}}: {{view Ember.TextField valueBinding="view.maxVal" size=10 }}</label>
4848
{{/if}}
49+
{{#if view.amGeoType}}
50+
<h1 class="answerNbr">{{t _geo_details}}: </h1>
51+
<label class="labelcheckbox"> {{view Ember.Checkbox checkedBinding="view.geoLocked"}}{{t _disable_manual_geo_edit}} </label>
52+
{{/if}}
4953

5054
{{#if view.amNoOptionsType}}
5155
<p class="noOptions">

GAE/src/com/gallatinsystems/survey/domain/Question.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public enum Type {
5050
private Boolean allowMultipleFlag = null;
5151
private Boolean allowOtherFlag = null;
5252
private Boolean collapseable = false;
53+
private Boolean geoLocked = null;
5354
private Boolean immutable = false;
5455
private Long dependentQuestionId;
5556
private String dependentQuestionAnswer;
@@ -323,4 +324,12 @@ public void setImmutable(Boolean immutable) {
323324
public Boolean getImmutable() {
324325
return immutable;
325326
}
327+
328+
public Boolean getGeoLocked() {
329+
return geoLocked;
330+
}
331+
332+
public void setGeoLocked(Boolean geoLocked) {
333+
this.geoLocked = geoLocked;
334+
}
326335
}

GAE/src/locale/en.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Device\ id = Device id
8989
Devices = Devices
9090
Devices\ list = Devices list
9191
Disable\ devices = Disable devices
92+
Disable\ manual\ editing\ of\ geo\ values\ on\ device = Disable manual editing of geo values on device
9293
Do\ not\ navigate\ away\ from\ this\ page\ while\ the\ upload\ is\ in\ progress = Do not navigate away from this page while the upload is in progress
9394
Documentation\ and\ user\ guides = Documentation and user guides
9495
Drop\ files\ here\ to\ upload\ or = Drop files here to upload or
@@ -126,6 +127,7 @@ Free\ Text = Free Text
126127
Generate\ Summary\ Sheets\ for\ each\ Geographic\ Area = Generate Summary Sheets for each Geographic Area
127128
Generates\ a\ printable\ survey\ form\ in\ excel\ that\ can\ be\ used\ to\ conduct\ a\ paper-based\ survey.\ must\ be\ saved\ as\ an\ .xls\ or\ .xlsx = Generates a printable survey form in excel that can be used to conduct a paper-based survey. must be saved as an .xls or .xlsx
128129
Geolocation = Geolocation
130+
Geolocation\ settings = Geolocation settings
129131
Go\ back\ to\ assignment\ list = Go back to assignment list
130132
Go\ back\ to\ survey\ overview = Go back to survey overview
131133
Google\ Earth\ file = Google Earth file

GAE/src/locale/ui-strings.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ _device_id = Device id
9393
_devices = Devices
9494
_devices_list = Devices list
9595
_disable_devices = Disable devices
96+
_disable_manual_geo_edit = Disable manual editing of geo values on device
9697
_do_not_navigate_away = Do not navigate away from this page while the upload is in progress
9798
_documentation_and_user_guides = Documentation and user guides
9899
_drop_files = Drop files here to upload or
@@ -125,6 +126,7 @@ _find = Find
125126
_free_text = Free Text
126127
_gelocation = Geolocation
127128
_generate_summary_per_geo_area = Generate Summary Sheets for each Geographic Area
129+
_geo_details = Geolocation settings
128130
_go_back_to_assignment_list = Go back to assignment list
129131
_go_back_to_survey_overview = Go back to survey overview
130132
_google_earth_applet_text_ = Exports a Google Earth file that shows the location and survey data for every surveyed point in your dashboard. can be opened in Google Earth, and must be saved as a .kmz file

GAE/src/org/waterforpeople/mapping/app/gwt/client/survey/QuestionDto.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class QuestionDto extends BaseDto implements NamedObject {
4040
private List<Long> questionOptions = null;
4141
private Boolean mandatoryFlag = null;
4242
private Boolean dependentFlag = null;
43+
private Boolean geoLocked = null;
4344
private Long dependentQuestionId;
4445
private String dependentQuestionAnswer;
4546
private Long metricId;
@@ -369,4 +370,12 @@ public Long getSourceId() {
369370
public void setSourceId(Long sourceId) {
370371
this.sourceId = sourceId;
371372
}
373+
374+
public Boolean getGeoLocked() {
375+
return geoLocked;
376+
}
377+
378+
public void setGeoLocked(Boolean geoLocked) {
379+
this.geoLocked = geoLocked;
380+
}
372381
}

GAE/src/org/waterforpeople/mapping/app/web/SurveyAssemblyServlet.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,10 @@ private String marshallQuestion(Question q) {
592592
qXML.setType(FREE_QUESTION_TYPE);
593593
} else if (q.getType().equals(Question.Type.GEO)) {
594594
qXML.setType(GEO_QUESTION_TYPE);
595+
// add locked flag if the geoLocked field is true in the question
596+
if (q.getGeoLocked() != null && q.getGeoLocked()){
597+
qXML.setLocked(q.getGeoLocked().toString());
598+
}
595599
} else if (q.getType().equals(Question.Type.NUMBER)) {
596600
qXML.setType(FREE_QUESTION_TYPE);
597601
if (!hasValidation) {

0 commit comments

Comments
 (0)