Skip to content

Commit

Permalink
Issue #418 - UI for setting the geoLocked flag
Browse files Browse the repository at this point in the history
* this flag determines if manual editing of geo info on the device is 
disabled (geoLocked=true) or not (geoLocked=false)
  • Loading branch information
Mark Tiele Westra committed Oct 30, 2013
1 parent 7dffb22 commit 76835b5
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dashboard/app/js/lib/models/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ FLOW.Question = FLOW.BaseModel.extend({
allowSign: DS.attr('boolean', {
defaultValue: false
}),
geoLocked: DS.attr('boolean', {
defaultValue: false
}),
collapseable: DS.attr('boolean', {
defaultValue: false
}),
Expand Down
16 changes: 15 additions & 1 deletion Dashboard/app/js/lib/views/surveys/question-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FLOW.QuestionView = FLOW.View.extend({
allowDecimal: null,
allowMultipleFlag: null,
allowOtherFlag: null,
geoLocked: null,
dependentFlag: false,
dependentQuestion: null,
optionList: null,
Expand Down Expand Up @@ -79,11 +80,19 @@ FLOW.QuestionView = FLOW.View.extend({
}
}.property('this.type').cacheable(),

amGeoType: function () {
if (this.type) {
return this.type.get('value') == 'GEO';
} else {
return false;
}
}.property('this.type').cacheable(),

amNoOptionsType: function () {
var val;
if (!Ember.none(this.type)) {
val = this.type.get('value');
return val == 'GEO' || val == 'FREE_TEXT' || val == 'PHOTO' || val == 'VIDEO' || val == 'BARCODE';
return val == 'FREE_TEXT' || val == 'PHOTO' || val == 'VIDEO' || val == 'BARCODE';
}
}.property('this.type').cacheable(),

Expand Down Expand Up @@ -113,6 +122,7 @@ FLOW.QuestionView = FLOW.View.extend({
this.set('allowDecimal', FLOW.selectedControl.selectedQuestion.get('allowDecimal'));
this.set('allowMultipleFlag', FLOW.selectedControl.selectedQuestion.get('allowMultipleFlag'));
this.set('allowOtherFlag', FLOW.selectedControl.selectedQuestion.get('allowOtherFlag'));
this.set('geoLocked', FLOW.selectedControl.selectedQuestion.get('geoLocked'));
this.set('includeInMap', FLOW.selectedControl.selectedQuestion.get('includeInMap'));
this.set('dependentFlag', FLOW.selectedControl.selectedQuestion.get('dependentFlag'));
this.set('optionList', FLOW.selectedControl.selectedQuestion.get('questionOptionList'));
Expand Down Expand Up @@ -219,6 +229,9 @@ FLOW.QuestionView = FLOW.View.extend({
this.set('allowSign', false);
this.set('allowDecimal', false);
}
if (this.type.get('value') !== 'GEO') {
this.set('geoLocked', false);
}
path = FLOW.selectedControl.selectedSurveyGroup.get('code') + "/" + FLOW.selectedControl.selectedSurvey.get('name') + "/" + FLOW.selectedControl.selectedQuestionGroup.get('code');
FLOW.selectedControl.selectedQuestion.set('text', this.get('text'));
FLOW.selectedControl.selectedQuestion.set('tip', this.get('tip'));
Expand All @@ -234,6 +247,7 @@ FLOW.QuestionView = FLOW.View.extend({
FLOW.selectedControl.selectedQuestion.set('allowDecimal', this.get('allowDecimal'));
FLOW.selectedControl.selectedQuestion.set('allowMultipleFlag', this.get('allowMultipleFlag'));
FLOW.selectedControl.selectedQuestion.set('allowOtherFlag', this.get('allowOtherFlag'));
FLOW.selectedControl.selectedQuestion.set('geoLocked', this.get('geoLocked'));
FLOW.selectedControl.selectedQuestion.set('includeInMap', this.get('includeInMap'));

dependentQuestionAnswer = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<label class="minValNumb">{{t _min_val}}: {{view Ember.TextField valueBinding="view.minVal" size=10 }}</label>
<label class="maxValNumb">{{t _max_val}}: {{view Ember.TextField valueBinding="view.maxVal" size=10 }}</label>
{{/if}}
{{#if view.amGeoType}}
<h1 class="answerNbr">{{t _geo_details}}: </h1>
<label class="labelcheckbox"> {{view Ember.Checkbox checkedBinding="view.geoLocked"}}{{t _disable_manual_geo_edit}} </label>
{{/if}}

{{#if view.amNoOptionsType}}
<p class="noOptions">
Expand Down
9 changes: 9 additions & 0 deletions GAE/src/com/gallatinsystems/survey/domain/Question.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public enum Type {
private Boolean allowMultipleFlag = null;
private Boolean allowOtherFlag = null;
private Boolean collapseable = false;
private Boolean geoLocked = null;
private Boolean immutable = false;
private Long dependentQuestionId;
private String dependentQuestionAnswer;
Expand Down Expand Up @@ -323,4 +324,12 @@ public void setImmutable(Boolean immutable) {
public Boolean getImmutable() {
return immutable;
}

public Boolean getGeoLocked() {
return geoLocked;
}

public void setGeoLocked(Boolean geoLocked) {
this.geoLocked = geoLocked;
}
}
2 changes: 2 additions & 0 deletions GAE/src/locale/en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Device\ id = Device id
Devices = Devices
Devices\ list = Devices list
Disable\ devices = Disable devices
Disable\ manual\ editing\ of\ geo\ values\ on\ device = Disable manual editing of geo values on device
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
Documentation\ and\ user\ guides = Documentation and user guides
Drop\ files\ here\ to\ upload\ or = Drop files here to upload or
Expand Down Expand Up @@ -126,6 +127,7 @@ Free\ Text = Free Text
Generate\ Summary\ Sheets\ for\ each\ Geographic\ Area = Generate Summary Sheets for each Geographic Area
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
Geolocation = Geolocation
Geolocation\ settings = Geolocation settings
Go\ back\ to\ assignment\ list = Go back to assignment list
Go\ back\ to\ survey\ overview = Go back to survey overview
Google\ Earth\ file = Google Earth file
Expand Down
2 changes: 2 additions & 0 deletions GAE/src/locale/ui-strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ _device_id = Device id
_devices = Devices
_devices_list = Devices list
_disable_devices = Disable devices
_disable_manual_geo_edit = Disable manual editing of geo values on device
_do_not_navigate_away = Do not navigate away from this page while the upload is in progress
_documentation_and_user_guides = Documentation and user guides
_drop_files = Drop files here to upload or
Expand Down Expand Up @@ -125,6 +126,7 @@ _find = Find
_free_text = Free Text
_gelocation = Geolocation
_generate_summary_per_geo_area = Generate Summary Sheets for each Geographic Area
_geo_details = Geolocation settings
_go_back_to_assignment_list = Go back to assignment list
_go_back_to_survey_overview = Go back to survey overview
_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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class QuestionDto extends BaseDto implements NamedObject {
private List<Long> questionOptions = null;
private Boolean mandatoryFlag = null;
private Boolean dependentFlag = null;
private Boolean geoLocked = null;
private Long dependentQuestionId;
private String dependentQuestionAnswer;
private Long metricId;
Expand Down Expand Up @@ -369,4 +370,12 @@ public Long getSourceId() {
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}

public Boolean getGeoLocked() {
return geoLocked;
}

public void setGeoLocked(Boolean geoLocked) {
this.geoLocked = geoLocked;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,10 @@ private String marshallQuestion(Question q) {
qXML.setType(FREE_QUESTION_TYPE);
} else if (q.getType().equals(Question.Type.GEO)) {
qXML.setType(GEO_QUESTION_TYPE);
// add locked flag if the geoLocked field is true in the question
if (q.getGeoLocked() != null && q.getGeoLocked()){
qXML.setLocked(q.getGeoLocked().toString());
}
} else if (q.getType().equals(Question.Type.NUMBER)) {
qXML.setType(FREE_QUESTION_TYPE);
if (!hasValidation) {
Expand Down

0 comments on commit 76835b5

Please sign in to comment.