Changeset 399 for Dev/branches/rest-dojo-ui/client/rft/pages
- Timestamp:
- 08/15/12 18:30:58 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui
- Property svn:ignore
-
old new 1 1 nbproject 2 .project
-
- Property svn:ignore
-
Dev/branches/rest-dojo-ui/client/rft/pages/survey.js
r392 r399 99 99 }, 100 100 _onShowPreview: function() { 101 content.goTo(' surveyAdvanced', {uid: store.getIdentity(this.survey)});101 content.goTo('previewSurvey', {uid: store.getIdentity(this.survey)}); 102 102 } 103 103 }); -
Dev/branches/rest-dojo-ui/client/rft/pages/viewSurvey.html
r398 r399 1 <div data-dojo-type="rft.pages. survey" class="blue">1 <div data-dojo-type="rft.pages.viewSurvey" class="blue"> 2 2 <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'center'" style="height: 500px;"> 3 3 … … 5 5 <h2> 6 6 <span class="rftIcon rftIconSurvey"></span> 7 <span class="headerText" data-rft-attach-point="titleNode">Survey Editor</span>7 <span class="headerText" data-rft-attach-point="titleNode">Survey</span> 8 8 </h2> 9 9 </div> 10 10 11 <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'center'"> 12 <div data-rft-attach-point="questionBrowser"></div> 11 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'" data-rft-attach-point="questionsPane"> 13 12 </div> 14 13 15 <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'right'" style="width: 300px"> 16 <div data-rft-attach-point="surveyListViewNode" class="rftSurveyListView"> 17 </div> 18 19 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'bottom'"> 20 <button data-dojo-type="dijit.form.Button" 21 data-rft-attach-event="onClick:_onShowProperties" 22 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconProperties'"> 23 Properties</button> 24 <button data-dojo-type="dijit.form.Button" 25 data-rft-attach-event="onClick:_onSave" 26 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'"> 27 Save Changes</button> 28 <button data-dojo-type="dijit.form.Button" 29 data-rft-attach-event="onClick:_onDiscard" 30 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'"> 31 Discard changes</button> 32 <button data-dojo-type="dijit.form.Button" 33 data-rft-attach-event="onClick:_onShowPreview" 34 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconPreview'"> 35 Preview</button> 36 </div> 37 </div> 38 </div> 39 40 <div data-dojo-type="dijit.Dialog" 41 title="Survey properties" 42 data-rft-attach-point="propertiesDialog" 43 data-rft-attach-event="onSubmit:_onPropertiesOk"> 44 45 <form data-dojo-type="dijit.form.Form" 46 data-rft-attach-point="propertiesForm"> 47 <label for="title">Title</label> 48 <input data-dojo-type="dijit.form.TextBox" name="title"/><br/> 49 <label for="description">Description</label> 50 <input data-dojo-type="dijit.form.Textarea" name="description"/><br/> 51 </form> 52 53 <div> 14 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"> 54 15 <button data-dojo-type="dijit.form.Button" 55 16 type="submit" 56 data-rft-attach-event="onClick:_on PropertiesOk">57 OK</button>17 data-rft-attach-event="onClick:_onSubmit"> 18 Submit</button> 58 19 <button data-dojo-type="dijit.form.Button" 59 20 type="button" 60 data-rft-attach-event="onClick:_on PropertiesCancel">21 data-rft-attach-event="onClick:_onCancel"> 61 22 Cancel</button> 62 23 </div> 24 63 25 </div> 64 65 26 </div> -
Dev/branches/rest-dojo-ui/client/rft/pages/viewSurvey.js
r398 r399 5 5 'dojo/_base/event', 6 6 'dojo/_base/lang', 7 '../content',8 7 '../store', 9 8 '../ui/_Page', 10 '../ui/lists/QuestionListView', 11 '../ui/TabbedQuestionBrowser' 9 '../ui/content/ContentWidgetFactory' 12 10 ], 13 function(array,declare,Deferred,event,lang,content,store,_Page, 14 QuestionListView,TabbedQuestionBrowser){ 15 return declare('rft.pages.survey',[_Page],{ 11 function(array,declare,Deferred,event,lang,store,_Page,ContentWidgetFactory){ 12 return declare('rft.pages.viewSurvey',[_Page],{ 16 13 survey: null, 17 questionList: null,18 _dataMap: null,19 14 constructor: function(){ 20 15 this._dataMap = {}; … … 22 17 onVisit: function() { 23 18 if ( this.pageArgs.uid ) { 24 this._setupQuestionBrowser();25 this._setupListView();26 19 Deferred.when(store.get(this.pageArgs.uid)) 27 20 .then(lang.hitch(this,function(obj){ 21 var f = new ContentWidgetFactory(); 28 22 this.survey = obj; 29 23 store.query(null,{keys:this.survey.questions,include_docs:true}) 30 .forEach(lang.hitch(this.questionList,'appendItem')); 31 this.refresh(); 24 .forEach(function(question){ 25 array.forEach(question.content,function(item){ 26 var w = f.createViewWidget(item); 27 if ( w !== null ) { 28 w.placeAt(this.questionsPane.containerNode,'last'); 29 w.startup(); 30 } 31 },this); 32 },this); 32 33 })); 33 34 } else { … … 35 36 } 36 37 }, 37 _setupQuestionBrowser: function() { 38 this.questionBrowser = new TabbedQuestionBrowser({ 39 region: 'center', 40 'class': 'blue', 41 selectedActions: { 42 "Include": { 43 callback: lang.hitch(this,this._includeQuestion), 44 icon: "Accept", 45 description: "Include in survey" 46 } 47 }, 48 itemActions: { 49 "Info": { 50 callback: function(item){ item.description && alert(item.description); }, 51 icon: "Inspect", 52 description: "Show item description" 53 } 54 } 55 },this.questionBrowser); 56 this.questionBrowser.startup(); 57 }, 58 _includeQuestion: function(question) { 59 this.questionList.insertItem(question); 60 }, 61 _setupListView: function() { 62 this.questionList = new QuestionListView({ 63 region: 'center' 64 },this.surveyListViewNode); 65 this.questionList.startup(); 66 }, 67 refresh: function() { 68 this.titleNode.innerHTML = this.survey.title || "(set title in properties)"; 69 this.propertiesForm.set('value',this.survey); 70 }, 71 _onShowProperties: function(evt) { 72 this.propertiesDialog.show(); 73 }, 74 _onPropertiesOk: function(evt) { 75 this.propertiesDialog.hide(); 76 lang.mixin(this.survey, this.propertiesForm.get('value')); 77 this.refresh(); 38 _onSubmit: function(evt) { 78 39 event.stop(evt); 79 40 return false; 80 41 }, 81 _onPropertiesCancel: function(evt) { 82 this.propertiesDialog.hide(); 83 this.propertiesForm.set('value',this.survey); 42 _onCancel: function(evt) { 84 43 event.stop(evt); 85 44 return false; 86 },87 _onSave: function(evt) {88 this.survey.questions = array.map(this.questionList.getItems(),function(item){89 return store.getIdentity(item);90 });91 store.put(this.survey)92 .then(function() {93 content.goTo('surveys');94 });95 event.stop(evt);96 return false;97 },98 _onDiscard: function(evt) {99 },100 _onShowPreview: function() {101 content.goTo('surveyAdvanced', {uid: store.getIdentity(this.survey)});102 45 } 103 46 });
Note: See TracChangeset
for help on using the changeset viewer.