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