- Timestamp:
- 03/09/14 19:25:40 (11 years ago)
- Location:
- Dev/trunk/src
- Files:
-
- 1 added
- 1 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/model/classes/_Class.js
r492 r493 34 34 save: function(obj) { 35 35 return this._store.put(this._doSerialize(obj)) 36 .otherwise(lang.hitch(this,'_deserializeError')); 36 .then(lang.hitch(this,'_doDeserialize'), 37 lang.hitch(this,'_deserializeError')); 37 38 }, 38 39 remove: function(objOrId,rev) { -
Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorToolkit.js
r487 r493 30 30 { type: "Header" }, 31 31 { type: "Text" }, 32 { type: "Image" },33 { type: "ExternalMedia" },34 32 { type: "Divider" } 35 33 ], … … 44 42 "Header": "Header", 45 43 "Text": "Text", 46 "Image": "Image",47 "ExternalMedia": "External media",48 44 "Divider": "Divider", 49 45 "StringInput": "Text line", … … 56 52 "Header": "Header", 57 53 "Text": "TextBox", 58 "Image": "Image",59 "ExternalMedia": "External",60 54 "Divider": "Divider", 61 55 "StringInput": "Text", -
Dev/trunk/src/client/qed-client/model/widgets/SurveyRunWidget.js
r492 r493 17 17 if ( !value.startDate ) { delete value.startDate; } 18 18 if ( !value.endDate ) { delete value.endDate; } 19 value.respondentCanDeleteOwnResponse = value.respondentCanDeleteOwnResponse[0] === true; 19 value.respondentCanDeleteOwnResponse = 20 value.respondentCanDeleteOwnResponse.length > 0; 20 21 return value; 22 }, 23 _setValueAttr: function(value) { 24 value.respondentCanDeleteOwnResponse = 25 value.respondentCanDeleteOwnResponse ? ["on"] : []; 26 this.inherited(arguments); 21 27 } 22 28 }); -
Dev/trunk/src/client/qed-client/model/widgets/SurveySummary.js
r490 r493 19 19 this.titleNode.innerHTML = survey.title || ""; 20 20 domAttr.set(this.titleNode, "href", survey && surveys.getObjectPath(survey)); 21 this.descriptionNode.innerHTML = survey.description ;21 this.descriptionNode.innerHTML = survey.description || ""; 22 22 this.questionsNode.innerHTML = survey.questions.length; 23 23 } -
Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputConfigWidget.js
r490 r493 52 52 _getValueAttr: function() { 53 53 var value = this.inherited(arguments); 54 value.allowMultiple = value.allowMultiple && value.allowMultiple.length > 0;54 value.allowMultiple = value.allowMultiple.length > 0; 55 55 value.type = this.type; 56 56 return value; 57 },58 _setValueAttr: function(value) {59 value.allowMultiple = value.allowMultiple === true ? ["on"] : [];60 this.inherited(arguments);61 57 }, 62 58 onAddItem: function(evt) { -
Dev/trunk/src/client/qed-client/model/widgets/questions/NumberInputConfigWidget.js
r443 r493 10 10 var value = this.inherited(arguments); 11 11 value.type = this.type; 12 if ( !value.min ) { delete value.min; } 13 if ( !value.max ) { delete value.max; } 14 if ( !value.places ) { delete value.places; } 12 15 return value; 13 16 } -
Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputConfigWidget.js
r443 r493 10 10 var value = this.inherited(arguments); 11 11 value.type = this.type; 12 if ( !value.maxLength ) { delete value.maxLength; } 12 13 return value; 13 14 } -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigRowWidget.html
r461 r493 1 1 <form> 2 <div data-dojo-type="dijit/form/ValidationTextBox" name="text" required="required" data-dojo-attach-point="textBox"></div><div data-dojo-type="dijit/form/Button" data-dojo-attach-event="onClick:onDestroy">X</div> 2 <div data-dojo-type="dijit/form/ValidationTextBox" 3 name="text" required="required" 4 data-dojo-attach-point="textBox"></div> 5 <div data-dojo-type="dijit/form/Button" 6 data-dojo-attach-event="onClick:onDestroy">X</div> 3 7 </form> -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigWidget.html
r461 r493 6 6 <div data-dojo-attach-point="itemsNode"> 7 7 </div> 8 <div data-dojo-type="dijit/form/Button" data-dojo-attach-event="onClick:onAddItem">Add item</div> 8 <div data-dojo-type="dijit/form/Button" 9 data-dojo-attach-event="onClick:onAddItem">Add item</div> 9 10 </form> -
Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRunWidget.html
r492 r493 25 25 <input type="text" name="respondentCanDeleteOwnResponse" 26 26 class="qedField" 27 data-dojo-type="dijit/form/CheckBox" 28 data-dojo-props="'value':true" /> 27 data-dojo-type="dijit/form/CheckBox" /> 29 28 </div> 30 29 -
Dev/trunk/src/client/qed-client/pages/question.js
r492 r493 25 25 _refresh: function() { 26 26 this.titleNode.innerHTML = this.object.title || ""; 27 this.propertiesForm.set('value',this.object );28 this.contentList.set('value',this.object.content );27 this.propertiesForm.set('value',this.object,null); 28 this.contentList.set('value',this.object.content,null); 29 29 }, 30 30 _handlePropertiesChange: function() { 31 lang.mixin(this.object,this.propertiesForm.get('value'));31 this._updateObject(); 32 32 this.markDirty(); 33 33 this._refresh(); 34 34 }, 35 35 _handleContentChange: function() { 36 this. object.content = this.contentList.get('value');36 this._updateObject(); 37 37 this.markDirty(); 38 38 this._refresh(); 39 39 }, 40 _updateObject: function() { 41 var pValid = this.propertiesForm.validate(); 42 if ( pValid ) { 43 lang.mixin(this.object,this.propertiesForm.get('value')); 44 } 45 var cValid = this.contentList.validate(); 46 if ( cValid ) { 47 this.object.content = this.contentList.get('value'); 48 } 49 this._isValid = pValid && cValid; 50 return this._isValid; 51 }, 40 52 _save: function() { 41 if ( this._ isValid) {53 if ( this._updateObject() ) { 42 54 return this.inherited(arguments); 43 55 } else { … … 65 77 }, 66 78 markDirty: function() { 67 this._isValid = this.propertiesForm.validate() &&68 this.contentList.validate();69 79 this.saveBtn.set('disabled',!this._isValid); 70 80 this.saveAndCloseBtn.set('disabled',!this._isValid); … … 73 83 }, 74 84 markClean: function() { 75 this._isValid = true;76 85 this.saveBtn.set('disabled',true); 77 86 this.saveAndCloseBtn.set('disabled',true); -
Dev/trunk/src/client/qed-client/pages/survey.js
r492 r493 59 59 _refresh: function() { 60 60 this.titleNode.innerHTML = this.object.title || "(set title in properties)"; 61 this.propertiesForm.set('value',{survey:this.object}); 62 this.questionList.set('value', 63 this.object.questions); 61 this.propertiesForm.set('value',{survey:this.object},null); 62 this.questionList.set('value',this.object.questions,null); 64 63 }, 65 64 _includeQuestion: function(question) { -
Dev/trunk/src/client/qed-client/pages/surveyRun.js
r492 r493 22 22 templateString: template, 23 23 classStore: surveyRuns, 24 _isValid: false, 24 25 startup: function() { 25 26 if ( this._started ) { return; } … … 30 31 _refresh: function() { 31 32 this.titleNode.innerHTML = this.object.title || ""; 32 this.surveySummaryWidget.set('value',this.object.survey );33 this.surveyRunWidget.set('value',this.object );33 this.surveySummaryWidget.set('value',this.object.survey,null); 34 this.surveyRunWidget.set('value',this.object,null); 34 35 this._refreshURL(); 35 36 this._loadResponses(); … … 96 97 }, 97 98 _updateObject: function() { 98 var valid = this.surveyRunWidget.validate();99 if ( valid ) {99 this._isValid = this.surveyRunWidget.validate(); 100 if ( this._isValid ) { 100 101 lang.mixin(this.object,this.surveyRunWidget.get('value')); 101 102 } 102 return valid;103 return this._isValid; 103 104 }, 104 105 _onSave: function(evt) { … … 122 123 }, 123 124 markDirty: function() { 124 this.saveBtn.set('disabled', false);125 this.saveAndCloseBtn.set('disabled', false);125 this.saveBtn.set('disabled',!this._isValid); 126 this.saveAndCloseBtn.set('disabled',!this._isValid); 126 127 this.discardBtn.set('label','Discard & Close'); 127 128 this.inherited(arguments); -
Dev/trunk/src/client/qed-client/widgets
- Property svn:ignore
-
old new 1 1 2 ### begin grunt-svn-ignore managed ignores3 ### edits will be overwritten when grunt svn-ignore is run4 _ComplexValueMixin.js5 ### end grunt-svn-ignore managed ignores
-
- Property svn:ignore
-
Dev/trunk/src/server/config/couchdb-schema.json
r492 r493 99 99 "type": "object", 100 100 "oneOf": [ 101 { "$ref": "#/definitions/content/Header" }, 101 102 { "$ref": "#/definitions/content/Text" }, 103 { "$ref": "#/definitions/content/Divider" }, 102 104 { "$ref": "#/definitions/content/StringInput" }, 103 { "$ref": "#/definitions/content/ScaleInput" } 105 { "$ref": "#/definitions/content/TextInput" }, 106 { "$ref": "#/definitions/content/NumberInput" }, 107 { "$ref": "#/definitions/content/ScaleInput" }, 108 { "$ref": "#/definitions/content/MultipleChoiceInput" } 104 109 ] 105 110 }, 111 "Header": { 112 "type": "object", 113 "properties": { 114 "type": { "type": "string", "pattern": "Header" }, 115 "text": { "type": "string" } 116 }, 117 "required": ["type","text"], 118 "additionalProperties": false 119 }, 106 120 "Text": { 107 121 "type": "object", … … 113 127 "additionalProperties": false 114 128 }, 129 "Divider": { 130 "type": "object", 131 "properties": { 132 "type": { "type": "string", "pattern": "Divider" } 133 }, 134 "additionalProperties": false 135 }, 115 136 "StringInput": { 116 137 "type": "object", 117 138 "properties": { 118 139 "type": { "type": "string", "pattern": "StringInput" }, 140 "text": { "type": "string" } 141 }, 142 "required":["type","text"], 143 "additionalProperties": false 144 }, 145 "TextInput": { 146 "type": "object", 147 "properties": { 148 "type": { "type": "string", "pattern": "TextInput" }, 149 "maxLength": { "type": "integer" }, 150 "text": { "type": "string" } 151 }, 152 "required":["type","text"], 153 "additionalProperties": false 154 }, 155 "NumberInput": { 156 "type": "object", 157 "properties": { 158 "type": { "type": "string", "pattern": "NumberInput" }, 159 "min": { "type": "integer" }, 160 "max": { "type": "integer" }, 161 "places": { "type": "integer" }, 119 162 "text": { "type": "string" } 120 163 }, … … 144 187 "required":["type","min","max","items"], 145 188 "additionalProperties": false 189 }, 190 "MultipleChoiceInput": { 191 "type": "object", 192 "properties": { 193 "type": { "type": "string", "pattern": "MultipleChoiceInput" }, 194 "allowMultiple": { "type": "boolean" }, 195 "items": { "type": "array", "items": { 196 "type": "object", 197 "properties": { 198 "text": { "type": "string" } 199 }, 200 "required": ["text"], 201 "additionalProperties": false 202 } } 203 }, 204 "required":["type","items"], 205 "additionalProperties": false 146 206 } 147 207 } -
Dev/trunk/src/server/util/validator.js
r492 r493 22 22 }); 23 23 24 module.exports = tv4.validateResult.bind(tv4); 24 module.exports = function() { 25 var result = tv4.validateResult.apply(tv4,arguments); 26 if ( result.missing.length > 0 ) { 27 result.valid = false; 28 } 29 return result; 30 };
Note: See TracChangeset
for help on using the changeset viewer.