6ec8d46d1855cfa9ba51c628b15a803873d84ffa
[tine20] / tine20 / Calendar / js / Printer / MonthView.js
1 Tine.Calendar.Printer.MonthViewRenderer = Ext.extend(Tine.Calendar.Printer.BaseRenderer, {
2     paperHeight: 155,
3     useHtml2Canvas: false,
4
5     generateBody: function(view) {
6         var daysHtml = this.splitDays(view.store, view.dateMesh[0], view.dateMesh.length),
7             body = [];
8         
9         // try to force landscape -> opera only atm...
10         body.push('<style type="text/css">', 
11             '@page {',
12                 'size:landscape',
13             '}',
14             '@media print {thead {display: table-header-group;}}',
15         '</style>');
16         
17         // day headers
18         var dayNames = [];
19         for(var i = 0; i < 7; i++){
20             var d = view.startDay+i;
21             if(d > 6){
22                 d = d-7;
23             }
24             dayNames.push("<th class='cal-print-monthview-daycell'><span>", view.dayNames[d], "</span></th>");
25         }
26         
27         body.push(
28         '<table class="cal-print-monthview">',
29             '<thead>',
30                 '<tr><th colspan="7" class="cal-print-title">', this.getTitle(view), '</th></tr>',
31                 '<tr>', dayNames.join("\n"), '</tr>',
32             '</thead>',
33             '<tbody>',
34                 this.generateCalRows(daysHtml, 7, true),
35             '</tbody>');
36             
37         return body.join("\n");
38
39     },
40     
41     getTitle: function(view) {
42         return view.dateMesh[10].format('F Y');
43     },
44     
45     dayHeadersTpl: new Ext.XTemplate(
46         '<tr>',
47             '<tpl for=".">',
48                 '<th>\{{dataIndex}\}</th>',
49             '</tpl>',
50         '</tr>'
51     )
52 });