Last change
on this file since 509 was
508,
checked in by hendrikvanantwerpen, 11 years ago
|
- Server handles the new flat response format correctly.
- Client widgets and survey rendering creates a flat structure.
- Fixed logic error in checking if questions in survey are published.
- Restrict accepted properties in answers and reject empty strings as properties.
|
File size:
1.2 KB
|
Line | |
---|
1 | define([ |
---|
2 | "../../widgets/_ComplexValueWidget", |
---|
3 | "./questions/Factory", |
---|
4 | "dojo/_base/array", |
---|
5 | "dojo/_base/declare", |
---|
6 | "dojo/dom-construct", |
---|
7 | "dojo/text!./templates/SurveyRenderWidget.html" |
---|
8 | ], function(_ComplexValueWidget, QuestionWidgetFactory, array, declare, domConstruct, template) { |
---|
9 | return declare([_ComplexValueWidget],{ |
---|
10 | templateString: template, |
---|
11 | survey: null, |
---|
12 | startup: function() { |
---|
13 | if ( this._started ) { return; } |
---|
14 | this.inherited(arguments); |
---|
15 | if ( this.survey ) { |
---|
16 | this._setSurveyAttr(this.survey); |
---|
17 | } |
---|
18 | }, |
---|
19 | _setSurveyAttr: function(survey) { |
---|
20 | domConstruct.empty(this.domNode); |
---|
21 | this.survey = survey; |
---|
22 | var f = new QuestionWidgetFactory(); |
---|
23 | array.forEach(this.survey.questions,function(question){ |
---|
24 | array.forEach(question.content || [], function(item){ |
---|
25 | item.code = question.code; |
---|
26 | var w = f.createViewWidget(item); |
---|
27 | if ( w !== null ) { |
---|
28 | w.placeAt(this.domNode); |
---|
29 | w.startup(); |
---|
30 | } |
---|
31 | },this); |
---|
32 | },this); |
---|
33 | } |
---|
34 | }); |
---|
35 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.