- Timestamp:
- 03/05/14 22:44:48 (11 years ago)
- Location:
- Dev/trunk/src/client/qed-client/model/classes
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/model/classes
-
Property
svn:ignore
set to
### begin grunt-svn-ignore managed ignores
### edits will be overwritten when grunt svn-ignore is run
Question.js
Response.js
Survey.js
SurveyRun.js
### end grunt-svn-ignore managed ignores
-
Property
svn:ignore
set to
-
Dev/trunk/src/client/qed-client/model/classes/surveyRuns.js
r486 r487 1 define(['dojo/_base/lang','dojo/date/locale','dojo/date/stamp'],function(lang,locale,stamp){ 2 var SurveyRun = { 3 create: function(){ 4 return { type:'SurveyRun' }; 1 define([ 2 "./_Class", 3 "./surveys", 4 "dojo/_base/declare", 5 "dojo/date/stamp" 6 ], function(_Class, surveys, declare, stamp) { 7 8 var SurveyRuns = declare([_Class],{ 9 _collection: 'surveyRuns', 10 _type: 'SurveyRun', 11 create: function() { 12 var obj = { 13 type: this._type, 14 description: "", 15 mode: "open", 16 survey: null, 17 title: "" 18 }; 19 return obj; 5 20 }, 6 StartDate: { 7 get: function(sr) { 8 var d; 9 if ( sr.startDate ) { 10 d = lang.isString(sr.startDate) ? stamp.fromISOString(sr.startDate) : sr.startDate; 11 } 12 return d; 13 }, 14 set: function(sr,d) { 15 if ( d ) { 16 sr.startDate = lang.isString(d) ? stamp.toISOString(d) : d; 17 } 21 _deserialize: function(obj) { 22 if (obj.endDate) { 23 obj.endDate = stamp.fromISOString(obj.endDate); 24 } 25 if (obj.startDate) { 26 obj.startDate = stamp.fromISOString(obj.startDate); 27 } 28 if (obj.survey) { 29 obj.survey = surveys._doDeserialize(obj.survey); 18 30 } 19 31 }, 20 EndDate: { 21 get: function(sr) { 22 var d; 23 if ( sr.endDate ) { 24 d = lang.isString(sr.endDate) ? stamp.fromISOString(sr.endDate) : sr.endDate; 25 } 26 return d; 27 }, 28 set: function(sr,d) { 29 if ( d ) { 30 sr.endDate = lang.isString(d) ? stamp.toISOString(d) : d; 31 } 32 _serialize: function(obj) { 33 if (obj.endDate) { 34 obj.endDate = stamp.toISOString(obj.endDate); 32 35 } 33 }, 34 DisplayTitle: { 35 get: function(sr) { 36 var t = "Run of '"+sr.survey.title+"'"; 37 if ( sr.startDate ) { 38 t += " from "+locale.format(SurveyRun.StartDate.get(sr)); 39 } 40 if ( sr.endDate ) { 41 t += " until "+locale.format(SurveyRun.EndDate.get(sr)); 42 } 43 return t; 36 if (obj.startDate) { 37 obj.startDate = stamp.toISOString(obj.startDate); 44 38 } 45 }, 46 Survey: { 47 get: function(sr) { 48 return sr.survey || null; 49 }, 50 set: function(sr,s) { 51 sr.survey = s; 52 return sr; 39 if (obj.survey) { 40 obj.survey = surveys._doSerialize(obj.survey); 53 41 } 54 42 } 55 }; 56 return SurveyRun; 43 }); 44 45 return new SurveyRuns(); 46 57 47 });
Note: See TracChangeset
for help on using the changeset viewer.