47f01417c4b50c6eafa475d89b420e3c8a475c60
[Plinn.git] / skins / generic / calendar_macros.pt
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3 <html xmlns="http://www.w3.org/1999/xhtml">
4
5 <head>
6 <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7 <title>Calendar macros</title>
8 </head>
9
10 <body i18n:domain="plinn">
11 <pre>month macro</pre>
12 <div metal:define-macro="month"
13 tal:define="nextStart python:calTool.getNextMonth(year, month) ;
14 previousStart python:calTool.getPreviousMonth(year, month) ;
15 weeks python:calTool.getWeeksList(objects, sortBy, month=month, year=year)">
16 <div tal:define="navAnchor string:topNav" tal:omit-tag="">
17 <div metal:define-slot="cal_header" tal:omit-tag="">
18 <div metal:use-macro="here/calendar_macros/macros/calNavigation">
19 calNavigation
20 </div>
21 </div>
22 </div>
23 <table class="calendar_table">
24 <tr>
25 <th colspan="7">
26 <h1><span tal:content="python:calTool.getMonthName(month)" tal:omit-tag="" i18n:translate="">Month</span> <span tal:content="year">2004</span></h1>
27 </th>
28 </tr>
29 <tr>
30 <th tal:content="day" tal:repeat="day python:calTool.getDays(9)" i18n:translate="">Monday</th>
31 </tr>
32 <tr tal:repeat="week weeks">
33 <td tal:attributes="class python: calTool.isToday(year, month, dayInfo['day']) and 'today' or not dayInfo['day'] and 'disabled' or nothing" tal:repeat="dayInfo week">
34 <div tal:content="python:dayInfo['day'] and dayInfo['day'] or nothing">1</div>
35 <ul tal:condition="dayInfo/objects">
36 <li tal:repeat="ob dayInfo/objects">
37 <a href="."
38 tal:attributes="href python:link_func(ob);
39 title python:buildDate(indexIsCallable and getattr(ob, sortBy)() or getattr(ob, sortBy)).Time()"
40 tal:content="ob/title_or_id">title_or_id
41 </a>
42 </li>
43 </ul>
44 </td>
45 </tr>
46 </table>
47 <div tal:define="navAnchor string:bottomNav" tal:omit-tag="">
48 <div metal:define-slot="cal_footer" tal:omit-tag="">
49 <div metal:use-macro="here/calendar_macros/macros/calNavigation">
50 calNavigation
51 </div>
52 </div>
53 </div>
54 </div>
55 <hr />
56 <pre>week macro</pre>
57 <div metal:define-macro="week"
58 tal:define="weekInfo python: calTool.getWeek(objects, sortBy, year=year, month=month, day=day) ;
59 week weekInfo/week ;
60 previousStart weekInfo/previousStartDay ;
61 nextStart weekInfo/nextStartDay ;
62 dayNames python: calTool.getDays(letters=3) ;
63 weekAndNames python:[ (week[i], dayNames[i]) for i in range(7) ] ;
64 weekTable python:calTool.getWeekTable(week, sortBy, indexIsCallable) ;
65 matrix weekTable/weekMatrix ;
66 dispRRange python:request.get('disp_reel_range', 0) ;
67 display_range python:dispRRange and weekTable['range'] or calTool.getDisplayRange()">
68 <div tal:define="navAnchor string:topNav" tal:omit-tag="">
69 <div metal:define-slot="cal_header" tal:omit-tag="">
70 <div metal:use-macro="here/calendar_macros/macros/calNavigation">
71 calNavigation
72 </div>
73 </div>
74 </div>
75 <table class="week_table" cellspacing="0">
76 <tr>
77 <td style="border : none">
78 <a href="." title="Click to see hidden items" i18n:attributes="title"
79 tal:attributes="href string:${request/URL0}?disp_reel_range:int=1#topNav"
80 tal:condition="python: not dispRRange and weekTable['range'][0] < calTool.getDisplayRange()[0]">
81 <img src="eye_up.gif" alt="Click to see hidden items" height="20" width="20" border="0"
82 tal:attributes="src here/eye_up.gif/absolute_url"
83 i18n:attributes="alt" /></a>
84 </td>
85 <th tal:repeat="day weekAndNames" i18n:translate=""
86 ><span tal:content="python:day[1]" i18n:name="dayName" i18n:translate=""
87 >Mon</span>&nbsp;<span tal:content="python:calTool.getMonthName(day[0]['month'])+'_abbr'" i18n:name="monthName" i18n:translate=""
88 >May</span>&nbsp;<span tal:content="python:day[0]['day']" i18n:name="dayNumber"
89 >24</span></th>
90 </tr>
91 <tr>
92 <td class="hourLabel">
93 <div tal:repeat="quartIndex python:range(display_range[0], display_range[1])">
94 <span tal:replace="python:((quartIndex + 1) % 4) == 0 and ( str(quartIndex/4 + 1).zfill(2) + ':00') or nothing">10:00</span>
95 </div>
96 </td>
97 <td tal:repeat="dayIndex python:range(7)"
98 tal:attributes="class python: calTool.isToday(year, month, week[dayIndex]['day']) and 'today' or nothing">
99 <div tal:condition="isEventCalendar"
100 tal:repeat="quartIndex python:range(display_range[0], display_range[1])"
101 tal:attributes="class python:(quartIndex + 1) % 4 == 0 and 'hour_row' or (quartIndex + 1) % 2 == 0 and 'half_hour_row' or nothing">
102 <div tal:repeat="ob python:matrix[dayIndex][quartIndex]" tal:omit-tag="">
103 <div class="event"
104 tal:attributes="style python:'height : ' + str(calTool.getEventHeight(ob)*15) + 'px'">
105 <a href="."
106 tal:attributes="href python:link_func(ob);
107 title python:'%s - %s' % ( calTool.buildDate(ob.start()).Time(), calTool.buildDate(ob.end()).Time() )"
108 tal:content="ob/title_or_id">title_or_id</a>
109 </div>
110 </div>
111 </div>
112 <div tal:condition="not:isEventCalendar"
113 tal:repeat="quartIndex python:range(display_range[0], display_range[1])"
114 tal:attributes="class python:(quartIndex + 1) % 4 == 0 and 'hour_row' or (quartIndex + 1) % 2 == 0 and 'half_hour_row' or nothing">
115 <div tal:define="objects python:matrix[dayIndex][quartIndex]" tal:omit-tag="">
116 <ul tal:condition="objects">
117 <li tal:repeat="ob objects"><a href="."
118 tal:attributes="href python:link_func(ob);
119 title python:buildDate(indexIsCallable and getattr(ob, sortBy)() or getattr(ob, sortBy)).Time()"
120 tal:content="ob/title_or_id">title_or_id</a></li>
121 </ul>
122 </div>
123 </div>
124 </td>
125 <tr tal:condition="python: not dispRRange and weekTable['range'][1] > calTool.getDisplayRange()[1]">
126 <td class="hourLabel" style="border : none"
127 tal:attributes="colspan python:8">
128 <a href="." title="Click to see hidden items" i18n:attributes="title"
129 tal:attributes="href string:${request/URL0}?disp_reel_range:int=1#navBottom">
130 <img src="eye_down.gif" alt="Click to see hidden items" height="20" width="20" border="0"
131 tal:attributes="src here/eye_down.gif/absolute_url"
132 i18n:attributes="alt" />
133 </a>
134 </td>
135 <td tal:replace="nothing"></td>
136 </tr>
137 </table>
138 <div tal:define="navAnchor string:navBottom" tal:omit-tag="">
139 <div metal:define-slot="cal_footer" tal:omit-tag="">
140 <div metal:use-macro="here/calendar_macros/macros/calNavigation">
141 calNavigation
142 </div>
143 </div>
144 </div>
145 </div>
146 <hr />
147 <pre>calNavigation macro</pre>
148 <div metal:define-macro="calNavigation">
149 <a name="anchor" tal:attributes="name navAnchor"></a>
150 <table class="cal_navigation" cellspacing="0"
151 tal:define="previousYear previousStart/year ;
152 previousMonth previousStart/month ;
153 previousDay previousStart/day|nothing;
154 nextYear nextStart/year ;
155 nextMonth nextStart/month ;
156 nextDay nextStart/day|nothing">
157 <tr>
158 <td class="arrow">
159 <a title="Previous" href="."
160 tal:attributes="href python:'%s?year:int=%d&month:int=%d' % (request['URL0'], previousYear, previousMonth) + (previousDay and '&day:int=%d' % previousDay['day'] or '') + '#%s' % navAnchor"
161 i18n:attributes="title"><img src="arrow_l.gif" alt="Previous" height="25" width="25" tal:attributes="src here/arrow_l.gif/absolute_url" border="0" i18n:attributes="alt" /></a>
162 </td>
163 <td>
164 <a href="." tal:attributes="class python:display == 'week' and 'selected' or nothing;
165 href string:${request/URL0}?display=week#${navAnchor}" i18n:translate=""
166 >Week</a><a href="." tal:attributes="class python:display == 'month' and 'selected' or nothing ;
167 href string:${request/URL0}?display=month#${navAnchor}" i18n:translate=""
168 >Month</a>
169 </td>
170 <td class="arrow">
171 <a title="Next" href="."
172 tal:attributes="href python:'%s?year:int=%d&month:int=%d' % (request['URL0'], nextYear, nextMonth) + (nextDay and '&day:int=%d' % nextDay['day'] or '') + '#%s' % navAnchor"
173 i18n:attributes="title"><img src="arrow_r.gif" alt="Next" height="25" width="25" border="0" tal:attributes="src here/arrow_r.gif/absolute_url" i18n:attributes="alt" /></a>
174 </td>
175 </tr>
176 </table>
177 </div>
178 </body>
179
180 </html>