My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 2215 attachment: twoWeeksView.txt (1.9 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//Basic translation
if (lang === 'fr'){
buttonTwoweeks= 'Deux semaines';
}
if (lang === 'en'){
buttonTwoweeks= 'two weeks';
}

var calendarOptions = {
//Put options and callbacks here
header: {
left: 'prev,next today',
center: 'title',
right: 'month,twoweeks,agendaWeek,agendaDay'
},
buttonText: {
twoweeks: buttonTwoweeks
}
}
var defaults = {
columnFormat: {
twoweeks: generateWeekColumnFormat, //add for two weeks view default
},
defaultButtonText: {
twoweeks: 'twoweeks'
}
};
var langOptionHash = {
en: {
columnFormat: {
twoweeks: 'ddd M/D' //add for two weeks view default
}
}
};
//Create a two weeks view which stand on the one week view functions
fcViews.twoweeks = TwoWeeksView;
function TwoWeeksView(element, calendar) {
var t = this;
// exports
t.incrementDate = incrementDate;
t.render = render;
// imports in agenda view
AgendaView.call(t, element, calendar, 'twoweeks');
//Choose to increment one per one week
function incrementDate(date, delta) {
return date.clone().stripTime().add('weeks', delta).startOf('twoweeks');
}
//Display the title (date of beginning of the two weeks - date of ending of the two weeks)
function render(date) {
t.intervalStart = date.clone().stripTime().startOf('week');
t.intervalEnd = t.intervalStart.clone().add('weeks', 2);

t.start = t.skipHiddenDays(t.intervalStart);
t.end = t.skipHiddenDays(t.intervalEnd, -1, true);

t.title = calendar.formatRange(
t.start,
t.end.clone().subtract(1), // make inclusive by subtracting 1 ms
t.opt('titleFormat'),
' \u2014 ' // emphasized dash
);
//Display 2 weeks cells in the same row and one day per col
t.renderAgenda(2*(t.getCellsPerWeek()));
}
}

;;
Powered by Google Project Hosting