Last change
on this file since 400 was
399,
checked in by hendrikvanantwerpen, 13 years ago
|
Added survey viewer page.
Added view.html page to view surveys. Widgets from the questions are
displayed, no answers are saved yet.
The content module is split for index.html and view.html, so viewers
cannot navigate to other pages. Widgets to pre-load are now seperated
in stddeps.js module and shared between run.js & view.js.
|
File size:
1.7 KB
|
Line | |
---|
1 | define([ |
---|
2 | 'dojo/_base/array', |
---|
3 | 'dojo/_base/declare', |
---|
4 | 'dojo/_base/Deferred', |
---|
5 | 'dojo/_base/event', |
---|
6 | 'dojo/_base/lang', |
---|
7 | '../store', |
---|
8 | '../ui/_Page', |
---|
9 | '../ui/content/ContentWidgetFactory' |
---|
10 | ], |
---|
11 | function(array,declare,Deferred,event,lang,store,_Page,ContentWidgetFactory){ |
---|
12 | return declare('rft.pages.viewSurvey',[_Page],{ |
---|
13 | survey: null, |
---|
14 | constructor: function(){ |
---|
15 | this._dataMap = {}; |
---|
16 | }, |
---|
17 | onVisit: function() { |
---|
18 | if ( this.pageArgs.uid ) { |
---|
19 | Deferred.when(store.get(this.pageArgs.uid)) |
---|
20 | .then(lang.hitch(this,function(obj){ |
---|
21 | var f = new ContentWidgetFactory(); |
---|
22 | this.survey = obj; |
---|
23 | store.query(null,{keys:this.survey.questions,include_docs:true}) |
---|
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); |
---|
33 | })); |
---|
34 | } else { |
---|
35 | throw "No valid uid or survey passed!"; |
---|
36 | } |
---|
37 | }, |
---|
38 | _onSubmit: function(evt) { |
---|
39 | event.stop(evt); |
---|
40 | return false; |
---|
41 | }, |
---|
42 | _onCancel: function(evt) { |
---|
43 | event.stop(evt); |
---|
44 | return false; |
---|
45 | } |
---|
46 | }); |
---|
47 | }); |
---|
48 | |
---|
Note: See
TracBrowser
for help on using the repository browser.