Last change
on this file since 443 was
443,
checked in by hendrikvanantwerpen, 12 years ago
|
Reorganized for Node --- the SVN gods hate us all!
Lost all historical info on moved files, because SVN is a f *.
Also we have Node now, serving both the static content and forwarding
database requests.
|
File size:
1.5 KB
|
Line | |
---|
1 | define([ |
---|
2 | "../classes/Survey", |
---|
3 | "./questions/Factory", |
---|
4 | "dijit/_Container", |
---|
5 | "dijit/_TemplatedMixin", |
---|
6 | "dijit/_WidgetBase", |
---|
7 | "dijit/_WidgetsInTemplateMixin", |
---|
8 | "dojo/_base/array", |
---|
9 | "dojo/_base/declare", |
---|
10 | "dojo/dom-construct", |
---|
11 | "dojo/text!./templates/SurveyWidget.html" |
---|
12 | ], function(Survey, QuestionWidgetFactory, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, array, declare, domConstruct, template) { |
---|
13 | return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{ |
---|
14 | templateString: template, |
---|
15 | survey: null, |
---|
16 | startup: function() { |
---|
17 | if ( this._started ) { return; } |
---|
18 | this.inherited(arguments); |
---|
19 | if ( this.survey ) { |
---|
20 | this._setSurveyAttr(this.survey); |
---|
21 | } |
---|
22 | }, |
---|
23 | _setSurveyAttr: function(survey) { |
---|
24 | domConstruct.empty(this.domNode); |
---|
25 | this.survey = survey; |
---|
26 | var f = new QuestionWidgetFactory(); |
---|
27 | array.forEach(Survey.Questions.get(this.survey),function(question){ |
---|
28 | array.forEach(question.content || [],function(item,index){ |
---|
29 | // The dot causes values to be grouped in an object! |
---|
30 | item.code = question.code.toString()+'.'+index.toString(); |
---|
31 | var w = f.createViewWidget(item); |
---|
32 | if ( w !== null ) { |
---|
33 | w.placeAt(this.domNode); |
---|
34 | } |
---|
35 | },this); |
---|
36 | },this); |
---|
37 | } |
---|
38 | }); |
---|
39 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.