Changeset 2934
- Timestamp:
- 12/21/07 19:05:24 (1 year ago)
- Files:
-
- fullblogplugin/0.11/tracfullblog/htdocs/blog.png (modified) (previous)
- fullblogplugin/0.11/tracfullblog/htdocs/css/fullblog.css (modified) (6 diffs)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_monthlist.html (modified) (2 diffs)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_post.html (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_sidebar.html (modified) (5 diffs)
- fullblogplugin/0.11/tracfullblog/web_ui.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fullblogplugin/0.11/tracfullblog/htdocs/css/fullblog.css
r2928 r2934 1 1 /* 2 ** Styles for the /blog pages 2 ** Styles for the /blog pages and blog items in macros 3 3 */ 4 4 … … 16 16 } 17 17 18 #content .metainfo { 18 .blog-title *:link { 19 color: black; 20 } 21 22 .blog .metainfo { 19 23 color: gray; 20 24 font-size: smaller; … … 22 26 } 23 27 24 . metainfo span{28 .blog ul.metainfo { 25 29 padding: 0; 26 30 margin: 0; 31 list-style: none; 27 32 } 28 33 … … 72 77 73 78 div.sidebar-section ul { 79 margin-left: 0; 74 80 padding-left: 0.5em; 75 list-style:none; 81 list-style: none; 82 } 83 84 div.sidebar-section .metainfo { 85 float: right; 76 86 } 77 87 … … 80 90 } 81 91 92 div.monthlist li { 93 padding-top: 0.3em; 94 } 95 82 96 /* 83 97 ** Style used for displaying Blog icon in Timeline 84 98 */ 85 99 86 .timeline dt.blog {100 .timeline dt.blog a { 87 101 background-image: url(../blog.png); 88 102 } 89 103 104 */ 90 105 /* 91 106 ** Style used for a blog macros … … 104 119 div.blogflash .blog-title { 105 120 font-size: 1.35em; 106 margin-left: inherit;121 margin-left: 0; 107 122 } 123 124 div.blogflash span.metaupdated { 125 display: none; 126 } 127 128 div.blogflash li.metadates { 129 float: left; 130 } 131 fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_monthlist.html
r2928 r2934 9 9 <a href="${req.href.blog(name)}">${title}</a> 10 10 <span class="metainfo"> 11 -- Posted on ${format_datetime(time, '%Y-%m-%d %H:%M')} : author12 <a href="${req.href.blog('author', author)}">${author}</a>11 -- Posted on ${format_datetime(time, '%Y-%m-%d %H:%M')} 12 : author <a href="${req.href.blog('author', author)}">${author}</a> 13 13 <py:if test="categories"> 14 14 : categories … … 26 26 already exists in the data dictionary. --> 27 27 <py:if test="defined('execute_blog_macro') and execute_blog_macro"> 28 ${render_monthlist(heading, posts)}28 <div class="blog">${render_monthlist(heading, posts)}</div> 29 29 </py:if> 30 30 fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_post.html
r2928 r2934 4 4 <div py:def="render_blog_post(post, list_mode=False)"> 5 5 <h1 class="blog-title"><a href="${req.href.blog(post.name)}" 6 py:strip="not list_mode">${post.title}</a></h1> 6 py:strip="not list_mode">${post.title}</a> 7 </h1> 7 8 <div id="blog-body"> 8 9 ${wiki_to_html(context(post.resource), post.body)} 9 10 </div> 10 <p class="metainfo">Posted on: ${format_datetime(post.publish_time, '%Y-%m-%d %H:%M')} 11 -- Last updated: ${format_datetime(post.version_time, '%Y-%m-%d %H:%M')} <br/> 12 Author: <a href="${req.href.blog('author', post.author)}">${post.author}</a> <br /> 13 Categories: <py:for each="cat in post.category_list"> 14 <a href="${req.href.blog('category', cat)}">${cat}</a> 15 </py:for> 16 <py:if test="not post.category_list"> (none)</py:if> 17 <py:if test="list_mode"> 18 <br /> 19 <a href="${req.href.blog(post.name)}"> 20 Comments</a> (${len(post.get_comments())}) 21 </py:if> 22 </p> 11 <ul class="metainfo"> 12 <li class="metadates">Posted: ${format_datetime(post.publish_time, '%Y-%m-%d %H:%M')} 13 <span class="metaupdated"> 14 (Updated: ${format_datetime(post.version_time, '%Y-%m-%d %H:%M')}) 15 </span> 16 </li> 17 <li class="metaauthor">Author: 18 <a href="${req.href.blog('author', post.author)}">${post.author}</a> </li> 19 <li class="metacategories">Categories: 20 <py:for each="cat in post.category_list"> 21 <a href="${req.href.blog('category', cat)}">${cat}</a> 22 </py:for> 23 <py:if test="not post.category_list"> (none)</py:if> 24 </li> 25 <li py:if="list_mode"> 26 <a href="${req.href.blog(post.name)}">Comments</a> (${len(post.get_comments())}) 27 </li> 28 </ul> 23 29 </div> 24 30 fullblogplugin/0.11/tracfullblog/templates/fullblog_sidebar.html
r2791 r2934 19 19 20 20 <div class="sidebar-section"> 21 <p> 22 <span class="metainfo"> 23 <a href="${req.href.timeline(blog='on', view='full', format='rss')}"> 24 <img src="${chrome.htdocs_location}/feed.png" /> 25 </a> 26 </span> 27 Archive: <a href="${req.href.blog('archive')}">All posts</a> (${blog_total}) 28 </p> 29 </div> 30 31 <div class="sidebar-section"> 21 32 <py:if test="blog_months"> 22 33 <p>Browse by time:</p> … … 24 35 <li py:for="month, count in blog_months"> 25 36 <a href="${req.href.blog(month[0], month[1])}" 26 >${to_unicode("%s %d" % (blog_month_names[month[1]-1], month[0]))}</a> (${count})</li> 37 >${to_unicode("%s %d" % (blog_month_names[month[1]-1], month[0]))}</a> (${count}) 38 </li> 27 39 </ul> 28 40 </py:if> … … 35 47 <ul py:if="blog_categories"> 36 48 <li py:for="category, count in blog_categories"> 49 <span class="metainfo"> 50 <a href="${req.href.timeline(category=category, blog='on', view='full', format='rss')}"> 51 <img src="${chrome.htdocs_location}/feed.png" /> 52 </a> 53 </span> 37 54 <a href="${req.href.blog('category', category)}">${category}</a> 38 (${count})</li> 55 (${count}) 56 </li> 39 57 </ul> 40 58 </py:if> … … 42 60 </div> 43 61 44 <div class="sidebar-section ">62 <div class="sidebar-section${not blog_infotext and ' last' or None}"> 45 63 <py:if test="blog_authors"> 46 64 <p>Browse by author:</p> 47 65 <ul> 48 66 <li py:for="author, count in blog_authors"> 67 <span class="metainfo"> 68 <a href="${req.href.timeline(author=author, blog='on', view='full', format='rss')}"> 69 <img src="${chrome.htdocs_location}/feed.png" /> 70 </a> 71 </span> 49 72 <a href="${req.href.blog('author', author)}">${author}</a> (${count})</li> 50 73 </ul> … … 53 76 </div> 54 77 55 <div class="sidebar-section${not blog_infotext and ' last' or None}">56 <p>Archive: <a href="${req.href.blog('archive')}">All posts</a> (${blog_total})</p>57 </div>58 59 78 <div py:if="blog_infotext" id="blog-infotext" class="sidebar-section last"> 60 79 ${wiki_to_html(context, blog_infotext)} fullblogplugin/0.11/tracfullblog/web_ui.py
r2928 r2934 310 310 def get_timeline_filters(self, req): 311 311 if 'BLOG_VIEW' in req.perm('blog', id=None): 312 yield ('blog', _('Blog posts')) 313 yield ('blog-details', _('Blog details')) 312 yield ('blog', _('Blog details')) 314 313 315 314 def get_timeline_events(self, req, start, stop, filters): 316 if 'blog' in filters or 'blog-details' in filters:315 if 'blog' in filters: 317 316 blog_realm = Resource('blog') 318 317 if not 'BLOG_VIEW' in req.perm(blog_realm): 319 318 return 320 319 add_stylesheet(req, 'tracfullblog/css/fullblog.css') 320 321 if 'blog' in filters and req.args.get('view', '').lower() == 'full': 322 # Full style blog posts 323 category = req.args.get('category', '') 324 author = req.args.get('author', '') 325 blog_posts = get_blog_posts(self.env, from_dt=start, to_dt=stop, 326 author=author, category=category, all_versions=False) 327 for name, version, time, author, title, body, category_list \ 328 in blog_posts: 329 bp_resource = blog_realm(id=name) 330 if 'BLOG_VIEW' not in req.perm(bp_resource): 331 continue 332 bp = BlogPost(self.env, name) # Use last version 333 yield ('blog', bp.publish_time, bp.author, 334 (bp_resource, bp, None, 'full')) 335 elif 'blog' in filters: 336 # Blog posts 321 337 blog_posts = get_blog_posts(self.env, from_dt=start, to_dt=stop, 322 338 all_versions=True) 323 if 'blog' in filters:324 # Blog posts325 339 for name, version, time, author, title, body, category_list \ 326 340 in blog_posts: … … 328 342 if 'BLOG_VIEW' not in req.perm(bp_resource): 329 343 continue 330 if version != 1:331 continue # Only interested in first version here332 344 bp = BlogPost(self.env, name, version=version) 333 345 yield ('blog', bp.version_time, bp.version_author, 334 (bp_resource, bp, None)) 335 if 'blog-details' in filters: 336 # Blog posts 337 for name, version, time, author, title, body, category_list \ 338 in blog_posts: 339 bp_resource = blog_realm(id=name, version=version) 340 if 'BLOG_VIEW' not in req.perm(bp_resource): 341 continue 342 if version == 1 and 'blog' in filters: 343 continue # First version handled above 344 bp = BlogPost(self.env, name, version=version) 345 yield ('blog', bp.version_time, bp.version_author, 346 (bp_resource, bp, None)) 346 (bp_resource, bp, None, 'detail')) 347 347 # Attachments (will be rendered by attachment module) 348 348 for event in AttachmentModule(self.env).get_timeline_events( … … 358 358 bp = BlogPost(self.env, post_name) 359 359 bc = BlogComment(self.env, post_name, number=number) 360 yield ('blog', time, author, (bp_resource, bp, bc)) 361 360 yield ('blog', time, author, (bp_resource, bp, bc, 'detail')) 362 361 363 362 def render_timeline_event(self, context, field, event): 364 bp_resource, bp, bc = event[3] 365 format = context.req.args.get('format', '').lower() 363 bp_resource, bp, bc, view = event[3] 366 364 if bc: # A blog comment 367 365 if field == 'url': 368 366 return context.href.blog(bp.name) + '#comment-%d' % bc.number 369 367 elif field == 'title': 370 return tag( tag.em('Blog: '+bp.title), ' comment added')368 return tag('Blog: ', tag.em(bp.title), ' comment added') 371 369 elif field == 'description': 372 370 return format_to_oneliner(self.env, … … 376 374 return context.href.blog(bp.name) 377 375 elif field == 'title': 378 if format == 'rss' and bp.version == 1:376 if view=='full': 379 377 return tag(tag.em(bp.title)) 380 378 else: 381 return tag( tag.em('Blog: '+bp.title),379 return tag('Blog: ', tag.em(bp.title), 382 380 bp.version > 1 and ' edited' or ' created') 383 381 elif field == 'description': 384 if format.lower() == 'rss': 385 if bp.version == 1: 386 # In RSS, render first version in full view 387 return format_to_html(self.env, 388 context.from_request(context.req, 389 resource=bp_resource, absurls=True), 390 bp.body) 391 else: 392 return format_to_html(self.env, 393 context.from_request(context.req, 394 resource=bp_resource, absurls=True), 395 bp.version_comment) 382 if view == 'full': 383 # Full blog view 384 return format_to_html(self.env, 385 context.from_request(context.req, 386 resource=bp_resource, absurls=True), 387 bp.body) 396 388 else: 397 389 # Any other regular display format
