source: Dev/trunk/src/qed-client/model/classes/SurveyRun.js @ 443

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.4 KB
Line 
1define(['dojo/_base/lang','dojo/date/locale','dojo/date/stamp'],function(lang,locale,stamp){
2    var SurveyRun = {
3        create: function(){
4            return { type:'SurveyRun' };
5        },
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        },
15        EndDate: {
16            get: function(sr) {
17                var d;
18                if ( sr.endDate ) {
19                    d = lang.isString(sr.endDate) ? stamp.fromISOString(sr.endDate) : sr.endDate;
20                }
21                return d;
22            }
23        },
24        DisplayTitle: {
25            get: function(sr) {
26                var t = "Run of '"+sr.survey.title+"'";
27                if ( sr.startDate ) {
28                    t += " from "+locale.format(SurveyRun.StartDate.get(sr));
29                }
30                if ( sr.endDate ) {
31                    t += " until "+locale.format(SurveyRun.EndDate.get(sr));
32                }
33                return t;
34            }
35        },
36        Survey: {
37            get: function(sr) {
38                return sr.survey || null;
39            },
40            set: function(sr,s) {
41                sr.survey = s;
42                return sr;
43            }
44        }
45    };
46    return SurveyRun;
47});
Note: See TracBrowser for help on using the repository browser.