- Timestamp:
- 03/11/14 22:45:58 (11 years ago)
- Location:
- Dev/trunk/src
- Files:
-
- 1 added
- 2 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/css/model/widgets/ScaleWidget.less
r443 r506 3 3 text-align: center; 4 4 } 5 th { font-weight: normal; } 5 th { 6 font-weight: normal; 7 } 8 .subcode { 9 .dijitTextBox { 10 width: 4em; 11 } 12 } 6 13 .item { 7 14 text-align: left; … … 9 16 max-width: 15em; 10 17 } 11 .min { text-align: right; padding-left: 2em; } 12 .max { text-align: left; padding-right: 2em; } 13 .na { text-align: center; } 18 .minLabel { 19 text-align: right; 20 padding-left: 2em; 21 } 22 .min { 23 .dijitTextBox { 24 width: 4em; 25 } 26 } 27 .max { 28 .dijitTextBox { 29 width: 4em; 30 } 31 } 32 .maxLabel { 33 text-align: left; 34 padding-right: 2em; 35 } 36 .na { 37 text-align: center; 38 } 14 39 15 40 .dijitTextBox { -
Dev/trunk/src/client/qed-client/css/qed.less
r494 r506 32 32 @import "widgets/LineWithActions.less"; 33 33 @import "model/widgets/ScaleWidget.less"; 34 @import "model/widgets/MultipleChoiceWidget.less"; 34 35 @import "model/widgets/QuestionListView.less"; 35 36 @import "model/widgets/QuestionEditor.less"; -
Dev/trunk/src/client/qed-client/model/classes/_Class.js
r493 r506 1 1 define([ 2 2 "./_View", 3 "dojo/_base/array", 3 4 "dojo/_base/declare", 4 5 "dojo/_base/lang", 5 6 "dojo/date/stamp" 6 ], function(_View, declare, lang, stamp) {7 ], function(_View, array, declare, lang, stamp) { 7 8 8 9 var _Class = declare([_View],{ … … 22 23 _doSerialize: function(obj) { 23 24 obj = lang.clone(obj); 24 return this._serialize(obj) || obj; 25 obj = this._serialize(obj) || obj; 26 this._strip(obj); 27 return obj; 25 28 }, 26 29 _serialize: function(obj) { … … 61 64 _formatDate: function(date) { 62 65 return stamp.toISOString(date,{zulu:true,milliseconds:false}); 66 }, 67 _strip: function(obj) { 68 if ( lang.isArray(obj) ) { 69 array.forEach(obj,this._strip,this); 70 } else if ( lang.isObject(obj) ) { 71 for ( var prop in obj ) { 72 if ( obj.hasOwnProperty(prop) ) { 73 var v = obj[prop]; 74 if ( v === null || v === "" || (typeof v === "number" && isNaN(v)) ) { 75 delete obj[prop]; 76 } else { 77 this._strip(v); 78 } 79 } 80 } 81 } 82 63 83 } 64 84 }); -
Dev/trunk/src/client/qed-client/model/widgets/SurveyRunWidget.js
r494 r506 15 15 _getValueAttr: function() { 16 16 var value = this.inherited(arguments); 17 if ( !value.startDate ) { delete value.startDate; }18 if ( !value.endDate ) { delete value.endDate; }19 17 value.respondentCanDeleteOwnResponse = 20 18 value.respondentCanDeleteOwnResponse.length > 0; -
Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputConfigWidget.js
r494 r506 20 20 return declare([_ComplexValueWidget],{ 21 21 type: 'MultipleChoiceInput', 22 baseClass: 'qedMultipleChoiceWidget', 22 23 templateString: template, 23 24 buildRendering: function() { -
Dev/trunk/src/client/qed-client/model/widgets/questions/NumberInputConfigWidget.js
r493 r506 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; }15 12 return value; 16 13 } -
Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputConfigWidget.js
r493 r506 10 10 var value = this.inherited(arguments); 11 11 value.type = this.type; 12 if ( !value.maxLength ) { delete value.maxLength; }13 12 return value; 14 13 } -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/HeaderConfigWidget.html
r461 r506 1 1 <form> 2 2 <label for="text" class="qedLabel">Text</label> 3 <div class="qedField" data-dojo-type="dijit/form/TextBox" name="text"></div> 3 <div class="qedField" data-dojo-type="dijit/form/ValidationTextBox" 4 data-dojo-props="'required': true, placeHolder:'Text'" 5 name="text"></div> 4 6 </form> -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigRowWidget.html
r493 r506 1 1 <form> 2 <div data-dojo-type="dijit/form/ValidationTextBox" 3 data-dojo-props="required: true, placeholder: 'Subcode'" 4 class="subcode" 5 name="subcode"></div> 2 6 <div data-dojo-type="dijit/form/ValidationTextBox" 3 name="text" required="required"4 data-dojo-attach-point="textBox"></div>7 data-dojo-props="required: true, placeholder: 'Item text'" 8 name="text"></div> 5 9 <div data-dojo-type="dijit/form/Button" 6 10 data-dojo-attach-event="onClick:onDestroy">X</div> -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigWidget.html
r493 r506 1 <form >1 <form class="${baseClass}"> 2 2 <div> 3 3 <label class="qedLabel" for="allowMultiple">Allow multiple</label> -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputConfigWidget.html
r461 r506 1 1 <form> 2 <div> 3 <label class="qedLabel" for="text">Subcode</label> 4 <div class="qedField" 5 data-dojo-attach-point="subcodeBox" 6 data-dojo-type="dijit/form/ValidationTextBox" 7 data-dojo-props="required: true, placeholder: 'Subcode'" 8 name="subcode"></div> 9 </div> 2 10 <div> 3 11 <label class="qedLabel" for="text">Item/Question Text</label> -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputConfigRowWidget.html
r443 r506 1 1 <tr> 2 <th class="subcode"> 3 <div data-dojo-type="dijit/form/ValidationTextBox" 4 data-dojo-props="required: true, placeholder: 'Subcode'" 5 name="subcode"></div> 6 </th> 2 7 <th class="item"> 3 8 <div name="text" … … 6 11 data-dojo-props="placeholder: 'Item/Question text'"></div> 7 12 </th> 8 <th class="min ">13 <th class="minLabel"> 9 14 <div name="minLabel" 10 15 required="required" … … 13 18 </th> 14 19 <td> 15 <div disabled="disabled" 20 <div disabled="disabled" class="min" 16 21 data-dojo-type="dijit/form/RadioButton"></div> 17 22 </td> 18 23 <td>...</td> 19 24 <td> 20 <div disabled="disabled" 25 <div disabled="disabled" class="max" 21 26 data-dojo-type="dijit/form/RadioButton"></div> 22 27 </td> 23 <th class="max ">28 <th class="maxLabel"> 24 29 <div name="maxLabel" 25 30 required="required" -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputConfigWidget.html
r461 r506 3 3 <thead> 4 4 <tr> 5 <th class="subcode"></th> 5 6 <th class="item"></th> 6 7 <th data-dojo-attach-point="minLabelNode" 7 class="min ">8 class="minLabel"> 8 9 <div name="minLabel" 9 10 data-dojo-type="dijit/form/TextBox" 10 11 data-dojo-props="placeholder: 'Minimum label'"></div> 11 12 </th> 12 <th data-dojo-attach-point="minNode">13 <th class="min" data-dojo-attach-point="minNode"> 13 14 <div name="min" 14 15 data-dojo-type="dijit/form/NumberTextBox" … … 16 17 </th> 17 18 <th>...</th> 18 <th data-dojo-attach-point="maxNode">19 <th class="max" data-dojo-attach-point="maxNode"> 19 20 <div name="max" 20 21 data-dojo-type="dijit/form/NumberTextBox" 21 22 data-dojo-props="required: true, placeholder: 'Maximum value'"></div> 22 23 </th> 23 <th data-dojo-attach-point="maxLabelNode" class="max ">24 <th data-dojo-attach-point="maxLabelNode" class="maxLabel"> 24 25 <div name="maxLabel" 25 26 data-dojo-type="dijit/form/TextBox" … … 37 38 <tbody data-dojo-attach-point="itemsNode"> 38 39 </tbody> 39 <tbody>40 <tr>41 <td class="item">42 <button data-dojo-type="dijit/form/Button"43 data-dojo-attach-event="onClick:onAddNewItem">Click to add item</button>44 </td>45 </tr>46 </tbody>47 40 </table> 41 <div> 42 <button data-dojo-type="dijit/form/Button" 43 data-dojo-attach-event="onClick:onAddNewItem"> 44 Click to add item</button> 45 </div> 48 46 </form> -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputConfigWidget.html
r461 r506 1 1 <form> 2 <label class="qedLabel" for="text">Item/Question Text</label> 3 <div class="qedField" data-dojo-attach-point="textBox" data-dojo-type="dijit/form/TextBox" data-dojo-props="placeholder: 'Item/Question Text'" name="text"></div> 2 <div> 3 <label class="qedLabel" for="text">Subcode</label> 4 <div class="qedField" 5 data-dojo-attach-point="subcodeBox" 6 data-dojo-type="dijit/form/ValidationTextBox" 7 data-dojo-props="required: true, placeholder: 'Subcode'" 8 name="subcode"></div> 9 </div> 10 <div> 11 <label class="qedLabel" for="text">Item/Question Text</label> 12 <div class="qedField" 13 data-dojo-attach-point="textBox" 14 data-dojo-type="dijit/form/TextBox" 15 data-dojo-props="placeholder: 'Item/Question Text'" 16 name="text"></div> 17 </div> 4 18 </form> -
Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputConfigWidget.html
r461 r506 1 1 <form> 2 <div> 3 <label class="qedLabel" for="text">Subcode</label> 4 <div class="qedField" 5 data-dojo-attach-point="subcodeBox" 6 data-dojo-type="dijit/form/ValidationTextBox" 7 data-dojo-props="required: true, placeholder: 'Subcode'" 8 name="subcode"></div> 9 </div> 2 10 <div> 3 11 <label class="qedLabel" for="text">Item/Question Text</label> -
Dev/trunk/src/client/qed-client/pages/question.js
r503 r506 55 55 return this.inherited(arguments); 56 56 } else { 57 return new Deferred().reject( );57 return new Deferred().reject({error:"Please correct invalid values."}); 58 58 } 59 59 }, -
Dev/trunk/src/client/qed-client/pages/surveyRun.js
r500 r506 3 3 "../app/Path", 4 4 "../app/Router", 5 "../lib/func",6 5 "../model/classes/responses", 7 6 "../model/classes/surveyRuns", … … 17 16 "require", 18 17 "dojo/text!./templates/surveyRun.html" 19 ], function(Content, Path, Router, func,responses, surveyRuns, surveys, LineWithActionsWidget, _ObjectPage, Deferred, array, declare, event, lang, when, require, template) {18 ], function(Content, Path, Router, responses, surveyRuns, surveys, LineWithActionsWidget, _ObjectPage, Deferred, array, declare, event, lang, when, require, template) { 20 19 return declare([_ObjectPage],{ 21 20 contextRequire: require, … … 91 90 return this.inherited(arguments); 92 91 } else { 93 return new Deferred .reject();92 return new Deferred().reject({error:"Please correct invalid values."}); 94 93 } 95 94 }, -
Dev/trunk/src/client/qed-client/response.js
r490 r506 3 3 "./app/Page", 4 4 "./app/Path", 5 "./lib/async",6 5 "./model/classes/responses", 7 6 "./model/classes/surveyRuns", … … 15 14 "./stddeps", 16 15 "dojo/domReady!" 17 ], function(Content, Page, Path, async,responses, surveyRuns, ResponsePage, json, date, locale, hash, parser, request) {16 ], function(Content, Page, Path, responses, surveyRuns, ResponsePage, json, date, locale, hash, parser, request) { 18 17 parser.parse(); 19 18 Content.startup(); -
Dev/trunk/src/client/qed-client/stddeps.js
r490 r506 22 22 'dijit/form/Textarea', 23 23 'dijit/form/TextBox', 24 'dijit/form/ValidationTextBox', 24 25 'dijit/form/TimeTextBox', 25 26 -
Dev/trunk/src/client/qed-client/widgets/ListWidget.js
r502 r506 25 25 _restoreParams: null, 26 26 _onChangeActive: false, 27 _onChangeHandle: null, 27 28 buildRendering: function() { 28 29 this.inherited(arguments); … … 86 87 } 87 88 } 88 //this.own(on(nodeOrWidget,'change',lang.hitch(this,'_handleChange')));89 89 var node = nodeOrWidget.domNode ? nodeOrWidget.domNode : nodeOrWidget; 90 90 if ( hint !== "avatar" && node.id !== id ) { … … 190 190 _handleChange: function(evt) { 191 191 if ( evt.target !== this.domNode ) { 192 if ( this._onChangeActive && !(this.readOnly || this.disabled) ) { 193 this.emit('change',this.get('value')); 194 } 192 this._onChange(); 195 193 if ( evt ) { event.stop(evt); } 196 194 return false; 197 } 198 return true; 199 }, 200 _handleDrop: function() { 201 if ( this._onChangeActive && !(this.readOnly || this.disabled) ) { 202 this.emit('change',this.get('value')); 195 } else { 196 return evt; 197 } 198 }, 199 _handleDrop: function(evt) { 200 this._onChange(); 201 }, 202 _onChange: function(){ 203 if ( this._onChangeActive && 204 !(this.readOnly || this.disabled) ) { 205 if ( this._onChangeHandle ) { 206 this._onChangeHandle.cancel(); 207 } 208 this._onChangeHandle = this.defer(function(){ 209 this._onChangeHandle = null; 210 on.emit(this.domNode,'change',{ 211 target: this.domNode, 212 value: this.get('value'), 213 bubbles: true, 214 cancellable: true 215 }); 216 }); 203 217 } 204 218 } -
Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js
r500 r506 15 15 readOnly: false, 16 16 _onChangeActive: false, 17 _onChangeHandle: null, 17 18 constructor: function() { 18 19 this._listenerMap = {}; … … 98 99 _handleChange: function(evt) { 99 100 if ( evt.target !== this.domNode ) { 100 if ( this._onChangeActive && !(this.readOnly || this.disabled) ) { 101 this.emit('change',this.get('value')); 101 if ( this._onChangeActive && 102 !(this.readOnly || this.disabled) ) { 103 if ( this._onChangeHandle ) { 104 this._onChangeHandle.cancel(); 105 } 106 this._onChangeHandle = this.defer(function(){ 107 this._onChangeHandle = null; 108 on.emit(this.domNode,'change',{ 109 target: this.domNode, 110 value: this.get('value'), 111 bubbles: true, 112 cancellable: true 113 }); 114 }); 102 115 } 103 116 if ( evt ) { event.stop(evt); } 104 117 return false; 118 } else { 119 return evt; 105 120 } 106 return true;107 121 }, 108 122 _handleSubmit: function(evt) { -
Dev/trunk/src/server/config/couchdb-design-docs.js
r501 r506 11 11 12 12 "qed/schemaInfo": { 13 version: " 2"13 version: "3" 14 14 }, 15 15 -
Dev/trunk/src/server/config/couchdb-schema.json
r499 r506 2 2 "$schema": "http://json-schema.org/draft-04/schema#", 3 3 "title": "QED Object Schema", 4 "version": " 2",4 "version": "3", 5 5 "type": "object", 6 6 "oneOf": [ … … 9 9 ], 10 10 "definitions": { 11 "nonEmptyString": { "type": "string", "minLength": 1 }, 11 12 "schemaInfo": { 12 13 "type": "object", 13 14 "properties": { 14 15 "_id": { "type": "string", "pattern": "^schemaInfo$" }, 15 "_rev": { " type": "string" },16 "version": { " type": "string" }16 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 17 "version": { "$ref": "#/definitions/nonEmptyString" } 17 18 }, 18 19 "required": ["_id","version"], … … 33 34 "properties": { 34 35 "type": { "type": "string", "pattern": "^Question$" }, 35 "_id": { " type": "string" },36 "_rev": { " type": "string" },37 "categories": { "type": "array", "items": { " type": "string" } },38 "code": { " type": "string", "minLength": 1},36 "_id": { "$ref": "#/definitions/nonEmptyString" }, 37 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 38 "categories": { "type": "array", "items": { "$ref": "#/definitions/nonEmptyString" } }, 39 "code": { "$ref": "#/definitions/nonEmptyString" }, 39 40 "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } }, 40 "description": { " type": "string" },41 "description": { "$ref": "#/definitions/nonEmptyString" }, 41 42 "publicationDate": { "type": "string", "format": "datetime" }, 42 "title": { " type": "string" },43 "topic": { " type": "string" }43 "title": { "$ref": "#/definitions/nonEmptyString" }, 44 "topic": { "$ref": "#/definitions/nonEmptyString" } 44 45 }, 45 46 "required": ["type","categories","code","content","title"], … … 50 51 "properties": { 51 52 "type": { "type": "string", "pattern": "^Survey$" }, 52 "_id": { " type": "string" },53 "_rev": { " type": "string" },54 "description": { " type": "string" },53 "_id": { "$ref": "#/definitions/nonEmptyString" }, 54 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 55 "description": { "$ref": "#/definitions/nonEmptyString" }, 55 56 "publicationDate": { "type": "string", "format": "datetime" }, 56 57 "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } }, 57 "title": { " type": "string" }58 "title": { "$ref": "#/definitions/nonEmptyString" } 58 59 }, 59 60 "required": ["type","questions","title"], … … 64 65 "properties": { 65 66 "type": { "type": "string", "pattern": "^SurveyRun$" }, 66 "_id": { " type": "string" },67 "_rev": { " type": "string" },68 "description": { " type": "string" },67 "_id": { "$ref": "#/definitions/nonEmptyString" }, 68 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 69 "description": { "$ref": "#/definitions/nonEmptyString" }, 69 70 "endDate": { "type": "string", "format": "datetime" }, 70 "liveName": { " type": "string" },71 "liveName": { "$ref": "#/definitions/nonEmptyString" }, 71 72 "mode": { "type": "string", "enum": [ "open", "closed" ] }, 72 73 "respondentCanDeleteOwnResponse": { "type": "boolean" }, 73 "secret": { " type": "string", "minLength": 1},74 "secret": { "$ref": "#/definitions/nonEmptyString" }, 74 75 "startDate": { "type": "string", "format": "datetime" }, 75 76 "survey": { "$ref": "#/definitions/docs/Survey" }, 76 "title": { " type": "string" }77 }, 78 "required": ["type"," description","mode","secret","survey","title"],77 "title": { "$ref": "#/definitions/nonEmptyString" } 78 }, 79 "required": ["type","mode","secret","survey","title"], 79 80 "additionalProperties": false 80 81 }, … … 83 84 "properties": { 84 85 "type": { "type": "string", "pattern": "^Response$" }, 85 "_id": { " type": "string" },86 "_rev": { " type": "string" },86 "_id": { "$ref": "#/definitions/nonEmptyString" }, 87 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 87 88 "answers": { "type": "object" }, 88 89 "email": { "type": "string", "format": "email" }, 89 90 "publicationDate": { "type": "string", "format": "datetime" }, 90 "secret": { " type": "string", "minLength": 1},91 "surveyRunId": { " type": "string" }91 "secret": { "$ref": "#/definitions/nonEmptyString" }, 92 "surveyRunId": { "$ref": "#/definitions/nonEmptyString" } 92 93 }, 93 94 "required": ["type","answers","secret","surveyRunId"], … … 95 96 } 96 97 }, 97 "content": {98 "content": { 98 99 "any": { 99 100 "type": "object", … … 113 114 "properties": { 114 115 "type": { "type": "string", "pattern": "^Header$" }, 115 "text": { " type": "string" }116 "text": { "$ref": "#/definitions/nonEmptyString" } 116 117 }, 117 118 "required": ["type","text"], … … 122 123 "properties": { 123 124 "type": { "type": "string", "pattern": "^Text$" }, 124 "text": { " type": "string" }125 "text": { "$ref": "#/definitions/nonEmptyString" } 125 126 }, 126 127 "required": ["type","text"], … … 138 139 "properties": { 139 140 "type": { "type": "string", "pattern": "^StringInput$" }, 140 "text": { "type": "string" } 141 }, 142 "required":["type","text"], 141 "subcode": { "$ref": "#/definitions/nonEmptyString" }, 142 "text": { "$ref": "#/definitions/nonEmptyString" } 143 }, 144 "required":["type","subcode"], 143 145 "additionalProperties": false 144 146 }, … … 148 150 "type": { "type": "string", "pattern": "^TextInput$" }, 149 151 "maxLength": { "type": "integer" }, 150 "text": { "type": "string" } 151 }, 152 "required":["type","text"], 152 "subcode": { "$ref": "#/definitions/nonEmptyString" }, 153 "text": { "$ref": "#/definitions/nonEmptyString" } 154 }, 155 "required":["type","subcode"], 153 156 "additionalProperties": false 154 157 }, … … 160 163 "max": { "type": "integer" }, 161 164 "places": { "type": "integer" }, 162 "text": { "type": "string" } 163 }, 164 "required":["type","text"], 165 "subcode": { "$ref": "#/definitions/nonEmptyString" }, 166 "text": { "$ref": "#/definitions/nonEmptyString" } 167 }, 168 "required":["type","subcode"], 165 169 "additionalProperties": false 166 170 }, … … 169 173 "properties": { 170 174 "type": { "type": "string", "pattern": "^ScaleInput$" }, 171 "minLabel": { " type": "string" },175 "minLabel": { "$ref": "#/definitions/nonEmptyString" }, 172 176 "min": { "type": "integer" }, 173 177 "max": { "type": "integer" }, 174 "maxLabel": { " type": "string" },175 "naLabel": { " type": "string" },178 "maxLabel": { "$ref": "#/definitions/nonEmptyString" }, 179 "naLabel": { "$ref": "#/definitions/nonEmptyString" }, 176 180 "items": { "type": "array", "items": { 177 181 "type": "object", 178 182 "properties": { 179 "text": { "type": "string" }, 180 "minLabel": { "type": "string" }, 181 "maxLabel": { "type": "string" } 183 "minLabel": { "$ref": "#/definitions/nonEmptyString" }, 184 "maxLabel": { "$ref": "#/definitions/nonEmptyString" }, 185 "subcode": { "$ref": "#/definitions/nonEmptyString" }, 186 "text": { "$ref": "#/definitions/nonEmptyString" } 182 187 }, 183 "required":[" text"],188 "required":["subcode","text"], 184 189 "additionalProperties": false 185 190 } } … … 196 201 "type": "object", 197 202 "properties": { 198 "text": { "type": "string" } 203 "subcode": { "$ref": "#/definitions/nonEmptyString" }, 204 "text": { "$ref": "#/definitions/nonEmptyString" } 199 205 }, 200 "required": [" text"],206 "required": ["subcode","text"], 201 207 "additionalProperties": false 202 } } 208 } }, 209 "otherItem": { 210 "type": "object", 211 "properties": { 212 "subcode": { "$ref": "#/definitions/nonEmptyString" }, 213 "text": { "$ref": "#/definitions/nonEmptyString" } 214 }, 215 "required": ["subcode","text"], 216 "additionalProperties": false 217 } 203 218 }, 204 219 "required":["type","items"],
Note: See TracChangeset
for help on using the changeset viewer.