source: products/SimpleBlog/branches/plone-2.5/skins/SimpleBlog/simpleblog_portlet_macros.pt

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

Building directory structure

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