source: products/SimpleBlog/trunk/skins/SimpleBlog/simpleblog_portlet_macros.pt @ 1

Last change on this file since 1 was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 10.5 KB
Line 
1<!-- macro used by the portlets to compile a list of available categories -->
2
3<div metal:define-macro="portletCategories"
4     tal:define="cats python:here.simpleblog_tool.getAvailableCategories(here, startpoint)" tal:omit-tag="">
5    <tal:toggle tal:define="global toggle python:toggle or 0"/>
6    <tal:cats tal:repeat="cat python:here.simpleblog_tool.getSortedKeys(cats)">
7        <dd class="" tal:define="oddrow repeat/cat/odd"
8                 tal:condition="repeat/cat/start"
9                 tal:attributes="class python:test(toggle, 'portletItem odd','portletItem even')">
10            <strong i18n:translate="blog_categories">Categories:</strong>
11        </dd>
12        <dd class=""
13            tal:condition="python:cats[cat]>0"
14            tal:define="oddrow repeat/cat/odd;
15                         pss modules/Products.PythonScripts.standard;
16                         quotedCat python:pss.url_quote(cat)"
17            tal:attributes="class python:test(toggle, 'portletItem even','portletItem odd')">
18            <a  href="#"
19                tal:attributes="href string:${startpoint/absolute_url}/SimpleBlogCatSearch?category=${quotedCat};
20                                title cat" title="category"><span tal:content="cat"/></a>
21                        (<span tal:content="python:cats[cat]"/>)
22        </dd><tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/></tal:cats>
23</div>
24
25<!-- macro used by the portlets to compile a list of recent additions -->
26<div metal:define-macro="portletRecent" tal:omit-tag=""><tal:block
27           tal:define="maxResults here/simpleblog_tool/getMaxItemsInPortlet;
28                       recent python:startpoint.getEntries(maxResults=maxResults,skipOnTop=1, join=1)[0];
29                       global showIcons startpoint/getShowIcons;"><tal:toggle
30           tal:define="global toggle python:1"/>
31    <tal:entries tal:repeat="entry recent">
32        <tal:start tal:condition="python:inBlog and not solo">
33        <dd class="" tal:define="oddrow repeat/entry/odd"
34                     tal:condition="repeat/entry/start"
35                     tal:attributes="class python:test(toggle, 'portletItem odd','portletItem even')">
36        <strong i18n:translate="recent_additions">Recent entries:</strong>
37        </dd></tal:start>
38        <dd class=""
39            tal:define="oddrow repeat/entry/odd;
40                        obj entry;
41                        item_type obj/portal_type;
42                        item_type_class python:'contenttype-' + normalizeString(item_type);"
43            tal:attributes="class python:test(toggle, 'portletItem even','portletItem odd')">
44            <a href="#"
45               tal:attributes="href obj/getURL;"
46                               title="entry">
47               <span tal:attributes="class python:showIcons and 'simpleBlogPortletIcons '+item_type_class or ''" tal:content="obj/Title"/>
48            </a><tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/>
49        </dd>
50        <dd class=""
51            tal:define="oddrow repeat/entry/odd;
52                        solo solo|python:0;
53                        className python:test(solo,'portletFooter', 'portletItem')"
54            tal:condition="repeat/entry/end"
55            tal:attributes="class python:test(toggle, className + ' even details', className + ' odd details')">
56            <a href="#" tal:attributes="href string:${startpoint/absolute_url}"
57                           title="more..."
58                           i18n:attributes="title box_morelink"
59                           i18n:translate="box_morelink"
60                           i18n:domain="plone">More...</a>
61        </dd></tal:entries>
62    <tal:no-items tal:condition="not: recent">
63        <dd class="portletItem even">
64            <strong i18n:translate="recent_additions">Recent additions:</strong>
65        </dd>
66        <dd class="portletItem odd">
67            <span i18n:translate="no_published_blog_entries">No blog entries are published.</span>
68            <tal:toggle tal:define="global toggle python:0"/>
69        </dd></tal:no-items></tal:block>
70</div>
71
72
73<div metal:define-macro="portletCalendar"
74     tal:omit-tag=""
75     tal:define="DateTime python:modules['DateTime'].DateTime;
76                 current python:DateTime();
77                 current_day current/day;
78                 yearmonth here/getYearAndMonthToDisplay;
79                 nextYearMax python: current+365;
80                 prevYearMin python: current-365;
81                 year python:yearmonth[0];
82                 month python:yearmonth[1];
83                 prevMonthTime python:here.getPreviousMonth(month, year);
84                 nextMonthTime python:here.getNextMonth(month, year);
85                 weeks python:here.simpleblog_tool.getEventsForCalendar(month=month, year=year, context=here);
86                 anchor_url request/anchor_url | here_url;
87                 query_string python:request.get('orig_query', None);
88                 query_string python: (query_string is None and request.get('QUERY_STRING', None)) or query_string;
89                 url_quote python:modules['Products.PythonScripts.standard'].url_quote;
90                 anchor_method request/anchor_method | template/getId;
91                 translation_service nocall:here/translation_service;
92                 day_msgid nocall:translation_service/day_msgid;
93                 weekday_english nocall:translation_service/weekday_english;
94                 utranslate nocall:here/utranslate;
95                 toLocalizedTime nocall:here/toLocalizedTime;
96                 getEventString nocall:here/getEventString;
97                 published_state python:here.simpleblog_tool.getPublishedState()">
98    <dd class="portletItem">
99    <table cellspacing="0" class="simpleBlogCalendar" id="thePloneCalendar" summary="Calendar" i18n:attributes="summary">
100        <thead>
101            <tr>
102                <th id="calendar-previous">
103                    <a href="#" rel="nofollow"
104                       title="Previous month"
105                       tal:attributes="href python:'%s/%s?%s&amp;month:int=%d&amp;year:int=%d&amp;orig_query=%s' % (anchor_url, anchor_method, query_string, prevMonthTime.month(),prevMonthTime.year(),url_quote(query_string))"
106                       tal:condition="python: yearmonth > (prevYearMin.year(), prevYearMin.month())"
107                       i18n:attributes="title title_previous_month;">&laquo;</a>
108                </th>
109                <th colspan="5">
110                    <span i18n:translate="" tal:omit-tag="">
111                        <span i18n:name="monthname"
112                              tal:define="month_english python:translation_service.month_english(month);"
113                              tal:attributes="id string:calendar-month-$month_english"
114                              tal:content="python: utranslate(translation_service.month_msgid(month), default=month_english)"
115                              tal:omit-tag=""
116                              id="calendar-month-month">monthname</span>
117                        <span i18n:name="year"
118                              tal:content="string:$year"
119                              tal:attributes="id string:calendar-year-$year;"
120                              tal:omit-tag=""
121                              id="calendar-year">year</span>
122                    </span>
123                </th>
124                <th id="calendar-next">
125                    <a href="#" rel="nofollow"
126                       title="Next month"
127                       tal:attributes="href python:'%s/%s?%s&amp;month:int=%d&amp;year:int=%d&amp;orig_query=%s' % (anchor_url, anchor_method, query_string, nextMonthTime.month(),nextMonthTime.year(),url_quote(query_string))"
128                       tal:condition="python: yearmonth &lt; (nextYearMax.year(), nextYearMax.month())"
129                       i18n:attributes="title title_next_month;">&raquo;</a>
130                </th>
131            </tr>
132            <tr tal:define="weekdaynumbers here/portal_calendar/getDayNumbers" class="weekdays">
133                <tal:data tal:repeat="daynumber weekdaynumbers">
134                    <td tal:define="weekday_english python:weekday_english(daynumber,format='a');"
135                        tal:content="python: utranslate(day_msgid(daynumber, format='s'), default=weekday_english)">Su</td>
136                </tal:data>
137            </tr>
138        </thead>
139        <tbody>
140            <tr tal:repeat="week weeks"
141            ><tal:block repeat="day week"
142            ><tal:block define="int_daynumber python: int(day['day']);
143                                day_event day/event;
144                                is_today python: current_day==int_daynumber and current.month()==month and current.year()==year">
145               <td class="event" tal:condition="day_event"
146                      tal:attributes="class python:is_today and 'todayevent' or 'event'"
147                   ><tal:data tal:define="cur_date python:DateTime(year,month,int_daynumber);
148                                          begin python:url_quote((cur_date.latestTime()).ISO());
149                                          end python:url_quote(cur_date.earliestTime().ISO());"
150                              tal:omit-tag=""
151                     ><a href=""
152                         tal:attributes="href python:startpoint.absolute_url()+'/SimpleBlogDaySearch?startdate:date=%s'%(end);
153                                         title python:'\n'.join([toLocalizedTime(cur_date)]+[getEventString(e) for e in day['eventslist']]);"
154                         tal:content="python:int_daynumber or default">
155                      31
156                      </a
157                   ></tal:data>
158                </td
159                ><tal:notdayevent tal:condition="not: day_event"
160               ><td tal:attributes="class python:is_today and 'todaynoevent' or None"
161                    tal:content="python:int_daynumber or default"></td
162               ></tal:notdayevent
163            ></tal:block
164            ></tal:block>
165            </tr>
166        </tbody>
167    </table>
168
169
170    <!-- The sticky notes -->
171    <tal:week repeat="week weeks"><tal:day repeat="day week">
172        <div class="dayPopup"
173             id="dummy"
174             tal:attributes="id python:'day%d%0.2d%0.2d' % (year, month, day['day']) "
175             tal:condition="day/event">
176             <div class="date" tal:content="python:here.toLocalizedTime('%d/%0.2d/%0.2d' % (year, month, day['day']), long_format=1)">
177             2001-04-11
178             </div>
179             <tal:event repeat="anevent day/eventslist">
180             <div class="appointment" tal:content="python: here.getEventString(event=anevent)">an event</div>
181             </tal:event>
182        </div>
183      </tal:day>
184    </tal:week>
185    </dd>
186</div>
Note: See TracBrowser for help on using the repository browser.