source: products/SimpleBlog/branches/plone-2.1/skins/SimpleBlog/SimpleBlog_macros.pt @ 1

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

Building directory structure

File size: 21.3 KB
Line 
1<html xmlns:tal="http://xml.zope.org/namespaces/tal"
2      xmlns:metal="http://xml.zope.org/namespaces/metal"
3      i18n:domain="SimpleBlog">
4<body>
5
6<div metal:define-macro="full" tal:define="showReadMore python:0" class="simpleBlogEntry">
7    <div tal:define="size headerSize | python:1;title obj/title_or_id;
8                         showIcons obj/simpleblog_tool/getShowIcons"
9             class="simpleBlogTitle">
10                <tal:x replace='structure string:<h${size} class="noMargin">'/>
11            <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;">
12                <img alt="" tal:condition="showIcons" src="#" tal:attributes="src string:${obj/portal_url}/${obj/getIcon};alt obj/title" />
13                <span tal:replace="title"/>
14            </a>
15                <tal:x replace="structure string:</h${size}>"/>
16
17    </div>
18    <div class="simpleBlogDescription documentDescription description" tal:content="structure python:obj.Description()">
19        description
20    </div>
21    <div tal:replace="structure python:obj.getBody()" class="simpleBlogBody"/><br/><br/>
22        <tal:tags metal:use-macro="obj/SimpleBlog_macros/macros/technoratiTags"/>
23        <tal:byLine metal:use-macro="obj/SimpleBlog_macros/macros/ByLineFoot"/>
24</div>
25
26<div metal:define-macro="descriptionOnly"  tal:define="showReadMore python:1" class="simpleBlogEntry">
27    <div tal:define="size headerSize | python:1;title obj/title_or_id;
28                         showIcons obj/simpleblog_tool/getShowIcons"
29             class="simpleBlogTitle">
30                <tal:x replace='structure string:<h${size} class="noMargin">'/>
31            <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;">
32                <img alt="" tal:condition="showIcons" src="#" tal:attributes="src string:${obj/portal_url}/${obj/getIcon};alt obj/title" />
33                <span tal:replace="title"/>
34            </a>
35                <tal:x replace="structure string:</h${size}>"/>
36    </div>
37    <div tal:content="structure python:obj.Description()" class="simpleBlogDescriptionOnly">
38        description
39    </div>
40        <tal:tags metal:use-macro="obj/SimpleBlog_macros/macros/technoratiTags"/>
41        <tal:byLine metal:use-macro="obj/SimpleBlog_macros/macros/ByLineFoot"/>
42
43</div>
44
45<div metal:define-macro="titleOnly" tal:define="showReadMore python:1" class="simpleBlogTitle">
46    <tal:block tal:define="size headerSize | python:1;title obj/title_or_id;
47                               showIcons obj/simpleblog_tool/getShowIcons">
48                <tal:x replace='structure string:<h${size} class="noMargin">'/>
49            <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;">
50                <img alt="" tal:condition="showIcons" src="#" tal:attributes="src string:${obj/portal_url}/${obj/getIcon};alt obj/title" />
51                <span tal:replace="title"/>
52            </a>
53                <tal:x replace="structure string:</h${size}>"/>
54    </tal:block>
55        <tal:tags metal:use-macro="obj/SimpleBlog_macros/macros/technoratiTags"/>
56        <tal:byLine metal:use-macro="obj/SimpleBlog_macros/macros/ByLineFoot"/>
57    <p />
58</div>
59
60<div metal:define-macro="ByLine" class="BlogByLine">
61     <span i18n:translate="blog_by_line">
62    Submitted by
63        <a href="" i18n:name="author" tal:attributes="href python:container.portal_membership.getHomeUrl(obj.Creator());" tal:content="obj/Creator">author</a>.
64    on <span i18n:name="date" tal:replace="python:here.toPortalTime(obj.simpleblog_tool.getEntryDate(obj), long_format=1)">Jun 2, 2002 2:42 pm</span>.
65     </span>
66     <span tal:define="cats python:obj.EntryCategory();
67                       pss modules/Products.PythonScripts.standard;"
68           class="simpleBlogBylineCats">
69           <tal:categories tal:repeat="cat cats" tal:condition="cats">
70                <span tal:omit-tag="" tal:condition="not: repeat/cat/start">|&nbsp;</span>
71                <strong><a href="#"
72                           tal:define="quotedCat python:pss.url_quote(cat)"
73                           tal:attributes="href string:${here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}"
74                           title="category"><span  tal:omit-tag="" tal:content="cat"/></a></strong>
75           </tal:categories>
76     </span>
77</div>
78
79
80<div metal:define-macro="technoratiTags"
81      tal:define="cats python:obj.EntryTag();"
82     tal:condition="python:here.isTagsEnabled() and cats"
83     tal:omit-tag="">
84     _____<br/>
85     tags:
86     <span class="simpleBlogBylineCats">
87           <tal:categories tal:repeat="cat cats" tal:condition="cats"><span tal:omit-tag="" tal:condition="not: repeat/cat/start">|&nbsp;
88                      </span><strong><a href="#"
89                           rel="tag"   
90                           tal:define="quotedCat python:cat.lower().replace(' ', '+')"
91                           tal:attributes="href string:http://www.technorati.com/tag/${quotedCat}"><span  tal:omit-tag="" tal:content="cat"/></a></strong>
92           </tal:categories>
93     </span>
94</div>
95
96<div metal:define-macro="ByLineFoot" class="BlogByLine">
97    <tal:x define="allowed python:obj.portal_discussion.isDiscussionAllowedFor(obj);
98                   ccount python:allowed and obj.portal_discussion.getDiscussionFor(obj).replyCount(obj);
99                   tballowed python:here.getAllowTrackback();
100                   tbcount python:len(obj.getTrackbacks())">
101         <span i18n:translate="blog_by_line">
102         <span tal:define="edate python:obj.simpleblog_tool.getEntryDate(obj)"
103               i18n:name="date" tal:replace="python:DateTime(edate).strftime('%A, %B %d, %Y')">Jun 2, 2002 2:42 pm</span>
104         </span>
105         <span tal:define="cats python:obj.EntryCategory();
106                           pss modules/Products.PythonScripts.standard;"
107               tal:omit-tag="">
108               <tal:x tal:condition="cats"> in </tal:x>
109               <tal:categories tal:repeat="cat cats" tal:condition="cats">
110                    <span tal:omit-tag="" tal:condition="not: repeat/cat/start">|&nbsp;</span>
111                    <strong><a href="#"
112                               tal:define="quotedCat python:pss.url_quote(cat)"
113                               tal:attributes="href string:${here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}"
114                               title="category"><span  tal:omit-tag="" tal:content="cat"/></a></strong>
115               </tal:categories>
116         </span>&nbsp;|&nbsp;
117         <strong><a href=""
118            tal:attributes="href obj/absolute_url"
119            i18n:translate="permalink">Permalink</a></strong>&nbsp;|&nbsp;
120         <tal:block condition="allowed">
121         <strong><a href=""
122              tal:attributes="href string:${obj/absolute_url}#comments"
123              tal:content="string:Comments (${ccount})">Comments</a></strong>
124            <tal:x condition="tbcount">&nbsp;|&nbsp;</tal:x>
125         </tal:block>
126         <strong tal:condition="python:tballowed and tbcount">
127            <tal:x tal:replace="string:TrackBack (${tbcount})">TrackBack</tal:x></strong>
128         <div tal:condition="tballowed"> trackback URL: &nbsp;
129               <tal:x replace="string:${obj/absolute_url}/sbtrackback"/>
130         </div>
131
132   </tal:x>
133</div>
134
135<!-- macro for the commandline showing the categories for the current entry and the comments plus actions to read more and add comments -->
136<div tal:condition="not: standardButtons" metal:define-macro="commandLineNonStandard" tal:define="allowed python:obj.portal_discussion.isDiscussionAllowedFor(obj)" class="BlogCommandLine">
137    <tal:comments tal:condition="allowed">
138        <tal:block tal:define="comments python:obj.portal_discussion.getDiscussionFor(obj);
139                                       tb_number python:len(obj.getTrackbacks())">
140            <a href="" tal:attributes="href obj/absolute_url"
141                           i18n:translate="comments">Comments</a>: <span tal:content="python:comments.replyCount(obj)" />&nbsp;
142            |&nbsp;<a href="" tal:attributes="href obj/absolute_url"
143                           i18n:translate="trackbacks">Trackbacks</a>: <span tal:content="tb_number" />&nbsp;
144            <span tal:condition="python:obj.portal_membership.checkPermission('Reply to item', obj)">
145                |&nbsp;<a href="" tal:attributes="href string:${obj/absolute_url}/discussion_reply_form?backurl=${obj/absolute_url}" title="Add new comment"
146                              i18n:translate="add_new_comment"
147                              i18n:attributes="title add_new_comment">Add new comment</a>&nbsp;
148            </span>
149        </tal:block>
150    </tal:comments>
151    <tal:readmore tal:condition="showReadMore | python:0">
152        <span tal:condition="allowed">|</span>
153        <a href="" tal:attributes="href obj/absolute_url" title="Read more"
154                   i18n:attributes="title read_full_blog"
155                   i18n:translate="read_full_blog">Read more</a>
156    </tal:readmore>
157    <span tal:condition="python:obj.portal_membership.checkPermission('Modify portal content', obj)">|
158    <a href="" tal:attributes="href string:${obj/absolute_url}/base_edit" title="Edit"
159           i18n:translate="edit_blog">Edit</a>
160    </span>
161</div>
162
163<div tal:condition="standardButtons" metal:define-macro="commandLine" tal:define="allowed python:obj.portal_discussion.isDiscussionAllowedFor(obj)" class="BlogCommandLine">
164    <div class="simpleBlogLinkButtons">
165        <tal:comments tal:condition="allowed">
166            <tal:block tal:define="comments python:obj.portal_discussion.getDiscussionFor(obj);
167                                               tb_number python:len(obj.getTrackbacks())">
168                <a href="" tal:attributes="href obj/absolute_url"
169                    i18n:translate="comments">Comments</a>: <span tal:content="python:comments.replyCount(obj)" />&nbsp;
170            |&nbsp;<a href="" tal:attributes="href obj/absolute_url"
171                           i18n:translate="trackbacks">Trackbacks</a>: <span tal:content="tb_number" />&nbsp;
172            </tal:block>
173        </tal:comments>
174        <tal:readmore tal:condition="showReadMore | python:0">
175            <span tal:condition="allowed">|</span>
176            <a href="" tal:attributes="href obj/absolute_url" title="Read more">Read more</a>
177        </tal:readmore>
178    </div>
179    <form action=""
180          method="post"
181          tal:condition="python:allowed and here.portal_membership.checkPermission('Reply to item', obj)"
182          tal:attributes="action string:${obj/absolute_url}/discussion_reply_form">         
183        <input type="Hidden" name="backurl" value="" tal:attributes="value obj/absolute_url">
184        <input class="standalone" type="submit" value="Add Comment" i18n:attributes="value add_new_comment"/>
185    </form>
186    <form action=""
187          method="post"
188          tal:condition="python:obj.portal_membership.checkPermission('Modify portal content', obj)"
189          tal:attributes="action string:${obj/absolute_url}/base_edit">         
190          <input class="standalone" type="submit" value="Edit" i18n:attributes="value edit_blog"/>
191    </form>
192</div>
193
194
195
196<!-- macro used by the portlets to compile a list of available categories -->
197<div metal:define-macro="portletCategories"
198     tal:define="cats python:here.simpleblog_tool.getAvailableCategories(here)"
199     tal:omit-tag="">
200    <tal:toggle tal:define="global toggle python:toggle or 0"/>
201    <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')">
202        <strong i18n:translate="blog_categories">Categories:</strong>
203        <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/>
204    </dd>
205    <tal:cats tal:repeat="cat python:here.simpleblog_tool.getSortedKeys(cats)">
206        <dd tal:define="pss modules/Products.PythonScripts.standard;
207                        quotedCat python:pss.url_quote(cat);
208                        category python:'%s (%s)' %(cat,cats[cat])"
209            tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')">
210            <a tal:condition="python:cats[cat]>0"  href="#"
211                           tal:attributes="href string:${here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat};
212                                           title cat"><span tal:content="category"/></a>
213                        <span tal:condition="python:cats[cat]==0" tal:content="category"/>
214            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/>
215        </dd>
216    </tal:cats>
217</div>
218
219<!-- macro used by the portlets to compile a list of recent additions -->
220<div metal:define-macro="portletRecent"
221     tal:define="recent python:here.simpleblog_tool.searchForEntries(here)"
222     tal:omit-tag="">
223     <tal:toggle tal:define="global toggle python:toggle or 0"/>
224     <tal:block tal:condition="recent">
225        <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')">
226            <strong i18n:translate="recent_additions">Recent entries:</strong>
227            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/>
228        </dd>
229        <tal:entries tal:repeat="entry recent">
230        <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')">
231            <a href="#"
232                           tal:attributes="href entry/getURL;"
233                           title="entry">
234                           <img src="#" tal:attributes="src string:${portal_url}/${entry/getIcon};" alt="" />
235                           <span tal:content="python:entry.Title or entry.getId"/>
236                        </a>
237            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/>
238        </dd>
239        </tal:entries>
240        <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')"
241            style="text-align:right;">
242            <a title="More..."
243               tal:attributes="href string:${here/absolute_url}/SimpleBlogFullSearch"
244               i18n:attributes="title box_morelink"
245               i18n:translate="box_morelink"
246               i18n:domain="plone">More...</a>
247            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/>
248        </dd>
249    </tal:block>
250    <dd tal:condition="not: recent"
251        tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')">       
252        <span i18n:translate="no_published_blog_entries">No blog entries are published.</span>
253        <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/>
254    </dd>
255</div>
256
257<div metal:define-macro="portletCalendar"
258     tal:omit-tag=""
259     tal:define="DateTime python:modules['DateTime'].DateTime;
260                 current python:DateTime();
261                 anchor_url request/anchor_url | here_url;
262                 anchor_method request/anchor_method | template/getId;
263                 yearmonth here/getYearAndMonthToDisplay;
264                 nextYearMax python: current+365;
265                 prevYearMin python: current-365;
266                 year python:yearmonth[0];
267                 month python:yearmonth[1];
268                 prevMonthTime python:here.getPreviousMonth(month, year);
269                 nextMonthTime python:here.getNextMonth(month, year);
270                 weeks python:here.simpleblog_tool.getEventsForCalendar(month=month, year=year, context=here);
271                 translation_service nocall:here/translation_service;
272                 day_msgid nocall:translation_service/day_msgid;
273                 weekday_english nocall:translation_service/weekday_english;
274                 utranslate nocall:here/utranslate;
275                 toLocalizedTime nocall:here/toLocalizedTime;
276                 published_state python:here.simpleblog_tool.getPublishedState()"
277    i18n:domain="plone">
278    <!-- The calendar, rendered as a table -->
279
280    <table cellspacing="0" class="simpleBlogCalendar" id="thePloneCalendar" summary="Calendar" i18n:attributes="summary">
281        <thead>
282            <tr>
283                <th id="calendar-previous">
284                    <a href="#" rel="nofollow"
285                       title="Previous month"
286                       tal:attributes="href python:'%s/%s?month:int=%d&amp;year:int=%d' % (anchor_url, anchor_method, prevMonthTime.month(),prevMonthTime.year())"
287                       tal:condition="python: yearmonth > (prevYearMin.year(), prevYearMin.month())"
288                       i18n:attributes="title title_previous_month;">&laquo;</a>
289                </th>
290                <th colspan="5">
291                    <span i18n:translate="" tal:omit-tag="">
292                        <span i18n:name="monthname"
293                              tal:define="month_english python:translation_service.month_english(month);"
294                              tal:attributes="id string:calendar-month-$month_english"
295                              tal:content="python: utranslate(translation_service.month_msgid(month), default=month_english)"
296                              tal:omit-tag=""
297                              id="calendar-month-month">monthname</span>
298                        <span i18n:name="year"
299                              tal:content="string:$year"
300                              tal:attributes="id string:calendar-year-$year;"
301                              tal:omit-tag=""
302                              id="calendar-year">year</span>
303                    </span>
304                </th>
305                <th id="calendar-next">
306                    <a href="#" rel="nofollow"
307                       title="Next month"
308                       tal:attributes="href python:'%s/%s?month:int=%d&amp;year:int=%d' % (anchor_url, anchor_method, nextMonthTime.month(),nextMonthTime.year())"
309                       tal:condition="python: yearmonth &lt; (nextYearMax.year(), nextYearMax.month())"
310                       i18n:attributes="title title_next_month;">&raquo;</a>
311                </th>
312            </tr>
313            <tr tal:define="weekdaynumbers here/portal_calendar/getDayNumbers" class="weekdays">
314                <tal:data tal:repeat="daynumber weekdaynumbers">
315                    <td tal:define="weekday_english python:weekday_english(daynumber,format='a');"
316                        tal:content="python: utranslate(day_msgid(daynumber, format='s'), default=weekday_english)">Su</td>
317                </tal:data>
318            </tr>
319        </thead>
320        <tbody>
321            <tr tal:repeat="week weeks">
322              <tal:block repeat="day week">
323                <tal:block define="daynumber day/day;
324                                   datestring python: '%d%0.2d%0.2d' % (year, month, daynumber);
325                                   javascriptstring string:javascript:%sDay('%s');">
326                  <td class="event" tal:condition="day/event"
327                      tal:attributes="onmouseout  python: javascriptstring % ('hide', datestring);
328                                      onmouseover python: javascriptstring % ('show', datestring);
329                                      class       python:test(current.year()==year and current.month()==month and current.day()==int(daynumber), 'todayevent', 'event')">
330                    <span tal:define="begEndTimes python:here.getBeginAndEndTimes(day=daynumber, month=month, year=year)" tal:omit-tag="">
331                      <span tal:define="begin python:DateTime(begEndTimes[0].timeTime()+86400).ISO();
332                                        end python:DateTime(begEndTimes[1].strftime('%m/%d/%y')).ISO();
333                                        pss python:modules['Products'].PythonScripts.standard" tal:omit-tag="">
334                      <a href="" tal:attributes="href python:here.absolute_url()+'/SimpleBlogDaySearch?startdate=%s'%(pss.url_quote(end))">
335                        <span tal:replace="python: daynumber or default">&nbsp;</span>
336                      </a>
337                      </span>
338                    </span>
339                  </td>
340                  <tal:notdayevent tal:condition="not: day/event">
341                  <td tal:condition="python: current.year()==year and current.month()==month and current.day()==int(daynumber)"
342                      tal:content="python: daynumber or default" class="todaynoevent">
343                    &nbsp;
344                  </td>
345                  <td tal:condition="not: python: current.year()==year and current.month()==month and current.day()==int(daynumber)"
346                      tal:content="python: daynumber or default">
347                    &nbsp;
348                  </td>
349                  </tal:notdayevent>
350                </tal:block>
351              </tal:block>
352            </tr>
353        </tbody>
354    </table>
355
356
357    <!-- The sticky notes -->
358    <tal:week repeat="week weeks"><tal:day repeat="day week">
359        <div class="dayPopup"
360             id="dummy"
361             tal:attributes="id python:'day%d%0.2d%0.2d' % (year, month, day['day']) "
362             tal:condition="day/event">
363             <div class="date" tal:content="python:here.toLocalizedTime('%d/%0.2d/%0.2d' % (year, month, day['day']))">
364             2001-04-11
365             </div>
366             <tal:event repeat="anevent day/eventslist">
367             <div class="appointment" tal:content="python: here.getEventString(event=anevent)">an event</div>
368             </tal:event>
369        </div>
370      </tal:day>
371    </tal:week>
372
373</div>
374
375
376</body>
377</html>
Note: See TracBrowser for help on using the repository browser.