Changeset 492 for Dev/trunk/src/client/qed-client/pages
- Timestamp:
- 03/09/14 14:23:42 (11 years ago)
- Location:
- Dev/trunk/src/client/qed-client/pages
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/pages/_ObjectPage.js
r491 r492 11 11 classStore: null, 12 12 constructor: function() { 13 if ( !this.classStore ) { throw new Error("Subclasses must specify a classStore."); } 13 if ( !this.classStore ) { 14 throw new Error("Subclasses must specify a classStore."); 15 } 16 }, 17 startup: function() { 18 if ( this._started ) { return; } 19 this.inherited(arguments); 20 this.markClean(); 14 21 }, 15 22 _load: function() { -
Dev/trunk/src/client/qed-client/pages/question.js
r490 r492 29 29 }, 30 30 _handlePropertiesChange: function() { 31 if ( this.propertiesForm.validate() ) { 32 lang.mixin(this.object,this.propertiesForm.get('value')); 33 } 31 lang.mixin(this.object,this.propertiesForm.get('value')); 34 32 this.markDirty(); 33 this._refresh(); 35 34 }, 36 35 _handleContentChange: function() { 37 if ( this.contentList.validate() ) { 38 this.object.content = this.contentList.get('value'); 39 } 36 this.object.content = this.contentList.get('value'); 40 37 this.markDirty(); 38 this._refresh(); 41 39 }, 42 40 _save: function() { 43 if ( this.propertiesForm.validate() && this.contentList.validate() ) { 44 lang.mixin(this.object,this.propertiesForm.get('value')); 45 this.object.content = this.contentList.get('value'); 41 if ( this._isValid ) { 46 42 return this.inherited(arguments); 47 43 } else { … … 68 64 return false; 69 65 }, 66 markDirty: function() { 67 this._isValid = this.propertiesForm.validate() && 68 this.contentList.validate(); 69 this.saveBtn.set('disabled',!this._isValid); 70 this.saveAndCloseBtn.set('disabled',!this._isValid); 71 this.discardBtn.set('label','Discard & Close'); 72 this.inherited(arguments); 73 }, 74 markClean: function() { 75 this._isValid = true; 76 this.saveBtn.set('disabled',true); 77 this.saveAndCloseBtn.set('disabled',true); 78 this.discardBtn.set('label','Close'); 79 this.inherited(arguments); 80 }, 70 81 _ignore: function(evt) { 71 82 if ( evt ) { event.stop( evt ); } -
Dev/trunk/src/client/qed-client/pages/response.js
r490 r492 40 40 this.submitButton.set('disabled',false); 41 41 this.continueButton.set('disabled',false); 42 this.cancelButton.set('disabled',false); 42 var canDelete = (this.response && 43 this.response._surveyRun.respondentCanDeleteOwnResponse); 44 this.cancelButton.set('disabled',canDelete||false); 43 45 this.surveyWidget.set('disabled', false); 44 46 }, -
Dev/trunk/src/client/qed-client/pages/survey.js
r491 r492 23 23 this._setupQuestionBrowser(); 24 24 this._setupListView(); 25 this.questionList.on('change',lang.hitch(this,'_handleQuestionsChange')); 25 26 this._load(); 26 27 }, … … 58 59 _refresh: function() { 59 60 this.titleNode.innerHTML = this.object.title || "(set title in properties)"; 60 this.properties Dialog.set('value',{survey:this.object});61 this.propertiesForm.set('value',{survey:this.object}); 61 62 this.questionList.set('value', 62 63 this.object.questions); 63 64 }, 64 _save: function() {65 this.object.questions = this.questionList.get('value');66 return this.inherited(arguments);67 },68 65 _includeQuestion: function(question) { 69 66 this.questionList.appendItem(question); 67 }, 68 _handleQuestionsChange: function() { 69 this.object.questions = this.questionList.get('value'); 70 this.markDirty(); 71 this._refresh(); 70 72 }, 71 73 _onShowProperties: function(evt) { … … 76 78 _onPropertiesOk: function(evt) { 77 79 this.propertiesDialog.hide(); 78 lang.mixin(this.object, this.properties Dialog.get('value').survey);80 lang.mixin(this.object, this.propertiesForm.get('value').survey); 79 81 this.markDirty(); 80 82 this._refresh(); … … 84 86 _onPropertiesCancel: function(evt) { 85 87 this.propertiesDialog.hide(); 86 this.properties Dialog.set('value',{survey:this.object});88 this.propertiesForm.set('value',{survey:this.object}); 87 89 if ( evt ) { event.stop(evt); } 88 90 return false; … … 109 111 preview: true 110 112 }); 113 }, 114 markDirty: function() { 115 this.saveBtn.set('disabled',false); 116 this.saveAndCloseBtn.set('disabled',false); 117 this.discardBtn.set('label','Discard & Close'); 118 this.inherited(arguments); 119 }, 120 markClean: function() { 121 this.saveBtn.set('disabled',true); 122 this.saveAndCloseBtn.set('disabled',true); 123 this.discardBtn.set('label','Close'); 124 this.inherited(arguments); 111 125 } 112 126 }); -
Dev/trunk/src/client/qed-client/pages/surveyRun.js
r490 r492 74 74 }, 75 75 _onPropChange: function(e) { 76 if ( this.surveyRunWidget.validate() ) { 77 lang.mixin(this.object,this.surveyRunWidget.get('value')); 76 if ( this._updateObject() ) { 78 77 this._refreshURL(); 79 78 } … … 90 89 }, 91 90 _save: function() { 92 if ( this.surveyRunWidget.validate() ) { 93 lang.mixin(this.object,this.surveyRunWidget.get('value')); 91 if ( this._updateObject() ) { 94 92 return this.inherited(arguments); 95 93 } else { 96 94 return new Deferred.reject(); 97 95 } 96 }, 97 _updateObject: function() { 98 var valid = this.surveyRunWidget.validate(); 99 if ( valid ) { 100 lang.mixin(this.object,this.surveyRunWidget.get('value')); 101 } 102 return valid; 98 103 }, 99 104 _onSave: function(evt) { … … 115 120 if ( evt ) { event.stop(evt); } 116 121 return false; 122 }, 123 markDirty: function() { 124 this.saveBtn.set('disabled',false); 125 this.saveAndCloseBtn.set('disabled',false); 126 this.discardBtn.set('label','Discard & Close'); 127 this.inherited(arguments); 128 }, 129 markClean: function() { 130 this.saveBtn.set('disabled',true); 131 this.saveAndCloseBtn.set('disabled',true); 132 this.discardBtn.set('label','Close'); 133 this.inherited(arguments); 117 134 } 118 135 }); -
Dev/trunk/src/client/qed-client/pages/templates/question.html
r490 r492 18 18 <button data-dojo-type="dijit/form/Button" 19 19 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'" 20 data-dojo-attach-point="saveBtn" 20 21 data-dojo-attach-event="onClick:_onSave"> 21 22 Save</button> 22 23 <button data-dojo-type="dijit/form/Button" 23 24 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'" 25 data-dojo-attach-point="saveAndCloseBtn" 24 26 data-dojo-attach-event="onClick:_onSaveAndClose"> 25 27 Save & Close</button> 26 28 <button data-dojo-type="dijit/form/Button" 27 29 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'" 30 data-dojo-attach-point="discardBtn" 28 31 data-dojo-attach-event="onClick:_onDiscard"> 29 32 Discard & Close</button> -
Dev/trunk/src/client/qed-client/pages/templates/survey.html
r491 r492 23 23 <button data-dojo-type="dijit/form/Button" 24 24 data-dojo-attach-event="onClick:_onSave" 25 data-dojo-attach-point="saveBtn" 25 26 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'"> 26 27 Save</button> 27 28 <button data-dojo-type="dijit/form/Button" 28 29 data-dojo-attach-event="onClick:_onSaveAndClose" 30 data-dojo-attach-point="saveAndCloseBtn" 29 31 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'"> 30 32 Save & Close</button> 31 33 <button data-dojo-type="dijit/form/Button" 32 34 data-dojo-attach-event="onClick:_onDiscardAndClose" 35 data-dojo-attach-point="discardBtn" 33 36 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'"> 34 37 Discard & Close</button> … … 41 44 42 45 <div data-dojo-type="dijit/Dialog" 43 title="Survey properties" 44 data-dojo-attach-point="propertiesDialog" 45 data-dojo-attach-event="onSubmit:_onPropertiesOk"> 46 <fieldset class="qedFieldset"> 47 <div data-dojo-type="../model/widgets/SurveyWidget" data-dojo-props="name:'survey'"></div> 48 </fieldset> 49 <button data-dojo-type="dijit/form/Button" 50 type="submit" 51 data-dojo-attach-event="onClick:_onPropertiesOk"> 52 OK</button> 53 <button data-dojo-type="dijit/form/Button" 54 type="button" 55 data-dojo-attach-event="onClick:_onPropertiesCancel"> 56 Cancel</button> 46 data-dojo-props="'title':'Survey properties'" 47 data-dojo-attach-point="propertiesDialog"> 48 <form data-dojo-type="dijit/form/Form" 49 data-dojo-attach-point="propertiesForm" 50 data-dojo-attach-event="onSubmit:_onPropertiesOk"> 51 <fieldset class="qedFieldset"> 52 <div data-dojo-type="../model/widgets/SurveyWidget" data-dojo-props="name:'survey'"></div> 53 </fieldset> 54 <button data-dojo-type="dijit/form/Button" 55 type="submit" 56 data-dojo-attach-event="onClick:_onPropertiesOk"> 57 OK</button> 58 <button data-dojo-type="dijit/form/Button" 59 type="button" 60 data-dojo-attach-event="onClick:_onPropertiesCancel"> 61 Cancel</button> 62 </form> 57 63 </div> 58 64 -
Dev/trunk/src/client/qed-client/pages/templates/surveyRun.html
r490 r492 55 55 class="blue" 56 56 data-dojo-props="baseClass: 'rftBlockButton', iconClass: 'rftIcon rftIconSave'" 57 data-dojo-attach-point="saveBtn" 57 58 data-dojo-attach-event="onClick:_onSave">Save</button> 58 59 <button data-dojo-type="dijit/form/Button" 59 60 class="blue" 60 61 data-dojo-props="baseClass: 'rftBlockButton', iconClass: 'rftIcon rftIconSave'" 62 data-dojo-attach-point="saveAndCloseBtn" 61 63 data-dojo-attach-event="onClick:_onSaveAndClose">Save & Close</button> 62 64 <button data-dojo-type="dijit/form/Button" 63 65 class="blue" 64 66 data-dojo-props="baseClass: 'rftBlockButton', iconClass: 'rftIcon rftIconClose'" 67 data-dojo-attach-point="discardBtn" 65 68 data-dojo-attach-event="onClick:_onDiscard">Discard & Close</button> 66 69 </div>
Note: See TracChangeset
for help on using the changeset viewer.