source: Dev/trunk/src/client/qed-client/model/classes/surveyRuns.js @ 532

Last change on this file since 532 was 492, checked in by hendrikvanantwerpen, 11 years ago
  • Enable/disable buttons on content change.
  • One place to do date formatting, because it was going wrong again.
  • Serialize questions in survey properly.
  • _ComplexValueMixin consumes submit events, but does trigger outer forms if present.
  • Trigger dialog show/hide for login only after previous effect is finished.
  • Check that documents are actually valid, not just that validator returned a result.
  • Validate email and timestamp formats.
  • Prepared for live runs.
File size: 1.2 KB
Line 
1define([
2    "./_Class",
3    "./surveys",
4    "dojo/_base/declare"
5], function(_Class, surveys, declare) {
6
7    var SurveyRuns = declare([_Class],{
8        _collection: 'surveyRuns',
9        _type: 'SurveyRun',
10        create: function() {
11            var obj = {
12                type: this._type,
13                description: "",
14                mode: "open",
15                survey: null,
16                title: ""
17            };
18            return obj;
19        },
20        _deserialize: function(obj) {
21            if (obj.endDate) {
22                obj.endDate = this._parseDate(obj.endDate);
23            }
24            if (obj.startDate) {
25                obj.startDate = this._parseDate(obj.startDate);
26            }
27            if (obj.survey) {
28                obj.survey = surveys._doDeserialize(obj.survey);
29            }
30        },
31        _serialize: function(obj) {
32            if (obj.endDate) {
33                obj.endDate = this._formatDate(obj.endDate);
34            }
35            if (obj.startDate) {
36                obj.startDate = this._formatDate(obj.startDate);
37            }
38            if (obj.survey) {
39                obj.survey = surveys._doSerialize(obj.survey);
40            }
41        }
42    });
43
44    return new SurveyRuns();
45
46});
Note: See TracBrowser for help on using the repository browser.