Changeset 199
- Timestamp:
- 01/23/06 15:24:09
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
SimpleBlog/branches/plone-2.1/skins/SimpleBlog/SimpleBlog_macros.pt
r198 r199 195 195 196 196 <!-- macro used by the portlets to compile a list of available categories --> 197 <div metal:define-macro="portletCategories" tal:define="cats python:here.simpleblog_tool.getAvailableCategories(here)" tal:omit-tag=""> 197 <div metal:define-macro="portletCategories" 198 tal:define="cats python:here.simpleblog_tool.getAvailableCategories(here)" 199 tal:omit-tag=""> 198 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> 199 205 <tal:cats tal:repeat="cat python:here.simpleblog_tool.getSortedKeys(cats)"> 200 <div tal:define="oddrow repeat/cat/odd" tal:condition="repeat/cat/start" tal:attributes="class python:test(toggle, 'portletContent content odd','portletContent content even')"> 201 <strong i18n:translate="blog_categories">Categories:</strong> 202 </div> 203 <div tal:define="oddrow repeat/cat/odd; 204 pss modules/Products.PythonScripts.standard; 205 quotedCat python:pss.url_quote(cat)" 206 tal:attributes="class python:test(toggle, 'portletContent content even','portletContent content odd')"> 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')"> 207 210 <a tal:condition="python:cats[cat]>0" href="#" 208 211 tal:attributes="href string:${here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}; 209 title cat" 210 title="category"><span tal:content="cat"/></a> 211 <span tal:condition="python:cats[cat]==0" tal:content="cat"/> 212 (<span tal:content="python:cats[cat]"/>) 213 </div> 214 <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 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> 215 216 </tal:cats> 216 217 </div> 217 218 218 219 <!-- macro used by the portlets to compile a list of recent additions --> 219 <div metal:define-macro="portletRecent" tal:define="recent python:here.simpleblog_tool.searchForEntries(here)"> 220 <tal:toggle tal:define="global toggle python:0"/> 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> 221 229 <tal:entries tal:repeat="entry recent"> 222 <div tal:define="oddrow repeat/entry/odd" 223 tal:condition="repeat/entry/start" 224 tal:attributes="class python:test(toggle, 'portletContent content odd','portletContent content even')"> 225 226 227 <tal:frontpage tal:define="fp python:here.simpleblog_tool.getFrontPage(here)"> 228 <a tal:condition="python:fp!=None" href="#" tal:attributes="href fp/absolute_url;title fp/title_or_id" title=""><strong><span tal:replace="fp/title_or_id"/>:</strong></a> 229 <strong tal:condition="python:fp==None" i18n:translate="recent_additions">Recent additions:</strong> 230 </tal:frontpage> 231 </div> 232 <div tal:define="oddrow repeat/entry/odd" 233 tal:attributes="class python:test(toggle, 'portletContent content even','portletContent content odd')"> 230 <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')"> 234 231 <a href="#" 235 232 tal:attributes="href entry/getURL;" … … 238 235 <span tal:content="python:entry.Title or entry.getId"/> 239 236 </a> 240 </div> 241 <div tal:define="oddrow repeat/entry/odd" 242 tal:condition="repeat/entry/end" 243 tal:attributes="class python:test(toggle, 'portletMore portletContent content odd','portletMore portletContent content even')"> 244 <a href="#" tal:attributes="href string:${here/absolute_url}/SimpleBlogFullSearch" 245 title="more..." 246 i18n:attributes="title box_morelink" 247 i18n:translate="box_morelink" 248 i18n:domain="plone">More...</a> 249 </div> 250 <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 251 </tal:entries> 252 <div class="portletContent content even" tal:condition="not: recent"> 253 <strong i18n:translate="recent_additions">Recent additions:</strong> 254 </div> 255 <div class="portletContent content odd" tal:condition="not: recent"> 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 class="portletContent content odd" tal:condition="not: recent"> 256 251 <span i18n:translate="no_published_blog_entries">No blog entries are published.</span> 257 <tal:toggle tal:define="global toggle python:0"/> 258 </div> 252 </dd> 259 253 </div> 260 254 … … 263 257 tal:define="DateTime python:modules['DateTime'].DateTime; 264 258 current python:DateTime(); 265 month python:request.get('month', DateTime().month()); 266 year python:request.get('year', DateTime().year()); 259 anchor_url request/anchor_url | here_url; 260 anchor_method request/anchor_method | template/getId; 261 yearmonth here/getYearAndMonthToDisplay; 262 nextYearMax python: current+365; 263 prevYearMin python: current-365; 264 year python:yearmonth[0]; 265 month python:yearmonth[1]; 267 266 prevMonthTime python:here.getPreviousMonth(month, year); 268 267 nextMonthTime python:here.getNextMonth(month, year); 269 268 weeks python:here.simpleblog_tool.getEventsForCalendar(month=month, year=year, context=here); 270 anchor_url request/anchor_url | here_url; 271 anchor_method request/anchor_method | template/getId; 269 translation_service nocall:here/translation_service; 270 day_msgid nocall:translation_service/day_msgid; 271 weekday_english nocall:translation_service/weekday_english; 272 utranslate nocall:here/utranslate; 273 toLocalizedTime nocall:here/toLocalizedTime; 272 274 published_state python:here.simpleblog_tool.getPublishedState()" 273 275 i18n:domain="plone"> … … 278 280 <tr> 279 281 <th id="calendar-previous"> 280 <a href="#" tal:attributes="href python:'%s/%s?month:int=%d&year:int=%d' % (anchor_url, anchor_method, prevMonthTime.month(),prevMonthTime.year())">«</a> 282 <a href="#" rel="nofollow" 283 title="Previous month" 284 tal:attributes="href python:'%s/%s?month:int=%d&year:int=%d' % (anchor_url, anchor_method, prevMonthTime.month(),prevMonthTime.year())" 285 tal:condition="python: yearmonth > (prevYearMin.year(), prevYearMin.month())" 286 i18n:attributes="title title_previous_month;">«</a> 281 287 </th> 282 <th colspan="5" 283 tal:define="date string:$month/1/$year;"> 288 <th colspan="5"> 284 289 <span i18n:translate="" tal:omit-tag=""> 285 <span i18n:name="monthname"> 286 <span i18n:translate="" 287 tal:define="monthstring python:DateTime(date).strftime('%B').capitalize();" 288 tal:attributes="id string:calendar-month-$monthstring" 289 tal:content="string:$monthstring" 290 id="calendar-month-month"> </span> 291 </span> 290 <span i18n:name="monthname" 291 tal:define="month_english python:translation_service.month_english(month);" 292 tal:attributes="id string:calendar-month-$month_english" 293 tal:content="python: utranslate(translation_service.month_msgid(month), default=month_english)" 294 tal:omit-tag="" 295 id="calendar-month-month">monthname</span> 292 296 <span i18n:name="year" 293 tal:define="year python:DateTime(date).year()"294 297 tal:content="string:$year" 295 298 tal:attributes="id string:calendar-year-$year;" 296 id="calendar-year"> </span> 299 tal:omit-tag="" 300 id="calendar-year">year</span> 297 301 </span> 298 </th> 299 <th id="calendar-next" tal:on-error="string:"> 300 <a href="#" tal:attributes="href python:'%s/%s?month:int=%d&year:int=%d' % (anchor_url, anchor_method, nextMonthTime.month(),nextMonthTime.year())">»</a> 302 </th> 303 <th id="calendar-next"> 304 <a href="#" rel="nofollow" 305 title="Next month" 306 tal:attributes="href python:'%s/%s?month:int=%d&year:int=%d' % (anchor_url, anchor_method, nextMonthTime.month(),nextMonthTime.year())" 307 tal:condition="python: yearmonth < (nextYearMax.year(), nextYearMax.month())" 308 i18n:attributes="title title_next_month;">»</a> 301 309 </th> 302 310 </tr> 303 <tr tal:define="weekdays here/portal_calendar/getDays" class="weekdays"> 304 <tal:block repeat="weekday weekdays"> 305 <td i18n:translate="" tal:content="weekday">Su</td> 306 </tal:block> 311 <tr tal:define="weekdaynumbers here/portal_calendar/getDayNumbers" class="weekdays"> 312 <tal:data tal:repeat="daynumber weekdaynumbers"> 313 <td tal:define="weekday_english python:weekday_english(daynumber,format='a');" 314 tal:content="python: utranslate(day_msgid(daynumber, format='s'), default=weekday_english)">Su</td> 315 </tal:data> 307 316 </tr> 308 317 </thead> SimpleBlog/branches/plone-2.1/skins/SimpleBlog/portlet_simpleblog.pt
r198 r199 7 7 <!-- local portlets, they will only show up inside a SimpleBlog --> 8 8 <div metal:define-macro="portletBlogFull_local" tal:omit-tag=""> 9 <!-- not the best way to do this but I have no idea how to fill the css_slot for this case where 10 the portlet is not in one of simpleblog's templates --> 11 <!--link rel="stylesheet" type="text/css" media="screen" href="" 12 tal:attributes="href string:$portal_url/SimpleBlogCSS.css" /--> 13 <div class="portlet" 14 tal:define="fp python:here.simpleblog_tool.getFrontPage(here)" 15 tal:condition="python:fp!=None"> 16 <h5> 17 <a tal:attributes="href fp/absolute_url; 18 title fp/title_or_id" 19 tal:content="fp/title_or_id"/> 20 </h5> 21 <div class="portletBody"> 22 <div metal:use-macro="here/SimpleBlog_macros/macros/portletCalendar"/> 23 <div metal:use-macro="here/SimpleBlog_macros/macros/portletRecent"/> 24 <div metal:use-macro="here/SimpleBlog_macros/macros/portletCategories"/> 25 </div> 26 </div> 9 <tal:toggle tal:define="global toggle python:0"/> 10 <dl class="portlet" id="portlet-simpleblog" 11 tal:define="fp python:here.simpleblog_tool.getFrontPage(here)" 12 tal:condition="python:fp!=None"> 13 <dt class="portletHeader"> 14 <a tal:attributes="href fp/absolute_url; 15 title fp/title_or_id" 16 tal:content="fp/title_or_id"/> 17 </dt> 18 <dd class="portletItem"> 19 <div metal:use-macro="here/SimpleBlog_macros/macros/portletCalendar"/> 20 <div metal:use-macro="here/SimpleBlog_macros/macros/portletRecent"/> 21 <div metal:use-macro="here/SimpleBlog_macros/macros/portletCategories"/> 22 </dd> 23 </dl> 27 24 </div> 28 25 29 26 <div metal:define-macro="portletBlogRecent_local" tal:omit-tag=""> 30 <div class="portlet" tal:condition="python: here.meta_type in ['Blog', 'BlogEntry', 'BlogFolder']"> 31 <h5>Blog</h5> 32 <div class="portletBody"> 33 <div metal:use-macro="here/SimpleBlog_macros/macros/portletRecent"/> 34 </div> 35 </div> 27 <tal:toggle tal:define="global toggle python:0"/> 28 <dl class="portlet" id="portlet-simpleblog" 29 tal:define="fp python:here.simpleblog_tool.getFrontPage(here)" 30 tal:condition="python: here.meta_type in ['Blog', 'BlogEntry', 'BlogFolder']"> 31 <dt class="portletHeader"> 32 <a tal:attributes="href fp/absolute_url; 33 title fp/title_or_id" 34 tal:content="fp/title_or_id"/> 35 </dt> 36 <dd class="portletItem"> 37 <div metal:use-macro="here/SimpleBlog_macros/macros/portletRecent"/> 38 </dd> 39 </dl> 36 40 </div> 37 41 … … 40 44 tal:define="fp python:here.simpleblog_tool.getFrontPage(here);" 41 45 tal:condition="python:fp!=None"> 42 <div class="portlet" 43 tal:define="fpPath python:'/'.join(fp.getPhysicalPath()); 44 results python:here.portal_catalog.searchResults(path=fpPath, meta_type='Discussion Item', sort_on='created', sort_order='reverse')[:5];" 45 tal:condition="results"> 46 <h5 i18n:translate="recent_comments">Recent Comments</h5> 47 <div class="portletBody"> 48 <tal:block tal:repeat="item results"> 49 <div class="portletContent odd" 50 tal:attributes="class python:test(repeat['item'].index % 2, 'portletContent even', 'portletContent odd')"> 46 <tal:toggle tal:define="global toggle python:0"/> 47 <dl class="portlet" id="portlet-simpleblog" 48 tal:define="fpPath python:'/'.join(fp.getPhysicalPath()); 49 results python:here.portal_catalog.searchResults(path=fpPath, meta_type='Discussion Item', sort_on='created', sort_order='reverse')[:5]; 50 toLocalizedTime nocall:here/toLocalizedTime;" 51 tal:condition="results"> 52 <dt class="portletHeader"> 53 <a tal:attributes="href fp/absolute_url; 54 title fp/title_or_id" 55 tal:content="fp/title_or_id"/> 56 </dt> 57 <tal:comments tal:repeat="item results"> 58 <dd tal:define="oddrow repeat/item/odd" 59 tal:attributes="class python:test(oddrow, 'portletItem even', 'portletItem odd')"> 60 <tal:block tal:define="result_url item/getURL; 61 url string:$result_url/view;"> 62 <a href="#" 63 tal:attributes="href url"> 64 <img src="#" height="16" width="16" alt="" 65 tal:on-error="structure python:path('here/linkOpaque.gif')" 66 tal:replace="structure python:path('here/%s' % item.getIcon)" /></a> <a 67 href="#" tal:attributes="href url; title item/Description" 68 tal:content="python:item.Title or item.getId" /> 69 <span class="discreet" 70 tal:define="modificationDate item/ModificationDate; 71 modificationDate python:toLocalizedTime(modificationDate)" 72 tal:content="string:(${item/Creator}) $modificationDate"> 73 creator 08/19/2001 03:01 AM </span> 74 </tal:block> 75 </dd> 76 </tal:comments> 77 </dl> 78 <dd class="portletFooter"> 79 <a href="#" 80 class="portletMore" 81 i18n:translate="box_morelink" 82 i18n:domain="plone" 83 tal:attributes="href string:${fp/absolute_url}/search?path=${fpPath}&meta_type=Discussion+Item&sort_on=created&sort_order=reverse;"> 84 More...</a> 85 </dd> 86 </div> 51 87 52 <tal:block tal:define="result_url item/getURL;53 url string:$result_url/view;">54 <a href="#"55 tal:attributes="href url">56 <img src="#" height="16" width="16" alt=""57 tal:on-error="structure python:path('here/linkOpaque.gif')"58 tal:replace="structure python:path('here/%s' % item.getIcon)" /></a> <a59 href="#" tal:attributes="href url; title item/Description"60 tal:content="python:item.Title or item.getId" />61 <span class="discreet"62 tal:define="modificationDate item/ModificationDate;63 modificationDate python:here.toLocalizedTime(modificationDate)"64 tal:content="string:(${item/Creator}) $modificationDate">65 creator 08/19/2001 03:01 AM </span>66 </tal:block>67 </div>68 </tal:block>69 <div class="portletContent odd">70 71 <a href="#"72 class="portletMore"73 i18n:translate="box_morelink"74 i18n:domain="plone"75 tal:attributes="href string:${fp/absolute_url}/search?path=${fpPath}&meta_type=Discussion+Item&sort_on=created&sort_order=reverse;">76 More...</a>77 78 </div>79 </div>80 </div>81 </div>82 83 84 <!-- global portlets, similar as above but this version show up everywhere -->85 <div metal:define-macro="portletBlogFull_global" tal:omit-tag="">86 <!-- not the best way to do this but I have no idea how to fill the css_slot for this case where87 the portlet is not in one of simpleblog's templates -->88 <link rel="stylesheet" type="text/css" media="screen" href="" tal:attributes="href string:$portal_url/SimpleBlogCSS.css" />89 <div class="portlet">90 <h5>Blog</h5>91 <div class="portletBody">92 <div metal:use-macro="here/SimpleBlog_macros/macros/portletCalendar"/>93 <div metal:use-macro="here/SimpleBlog_macros/macros/portletRecent"/>94 <div metal:use-macro="here/SimpleBlog_macros/macros/portletCategories"/>95 </div>96 </div>97 </div>98 99 <div metal:define-macro="portletBlogRecent_global" tal:omit-tag="">100 <div class="portlet">101 <h5>Blog</h5>102 <div class="portletBody">103 <div metal:use-macro="here/SimpleBlog_macros/macros/portletRecent"/>104 </div>105 </div>106 </div>107 88 </body> 108 89 </html>
