Changeset 2934

Show
Ignore:
Timestamp:
12/21/07 19:05:24 (1 year ago)
Author:
osimons
Message:

FullBlogPlugin: Various changes:

  • Added support for restricting a blog feed on category or author.
  • Added RSS icons to interface to simplify.
  • Added a number of attributes to templates to make it easier to style.
  • Changed som layouts to make them better - styling and fixes.
  • Improvements / fixes in styles.
  • New icon for timeline viewing.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fullblogplugin/0.11/tracfullblog/htdocs/css/fullblog.css

    r2928 r2934  
    11/* 
    2 ** Styles for the /blog pages 
     2** Styles for the /blog pages and blog items in macros 
    33*/  
    44 
     
    1616} 
    1717 
    18 #content .metainfo { 
     18.blog-title *:link { 
     19    color: black; 
     20
     21 
     22.blog .metainfo { 
    1923    color: gray; 
    2024    font-size: smaller; 
     
    2226} 
    2327 
    24 .metainfo span
     28.blog ul.metainfo
    2529    padding: 0; 
    2630    margin: 0; 
     31    list-style: none; 
    2732} 
    2833 
     
    7277 
    7378div.sidebar-section ul { 
     79    margin-left: 0; 
    7480    padding-left: 0.5em; 
    75     list-style:none; 
     81    list-style: none; 
     82
     83 
     84div.sidebar-section .metainfo { 
     85    float: right; 
    7686} 
    7787 
     
    8090} 
    8191 
     92div.monthlist li { 
     93    padding-top: 0.3em; 
     94} 
     95 
    8296/* 
    8397** Style used for displaying Blog icon in Timeline 
    8498*/  
    8599 
    86 .timeline dt.blog
     100.timeline dt.blog a
    87101    background-image: url(../blog.png); 
    88102} 
    89103 
     104*/ 
    90105/* 
    91106** Style used for a blog macros 
     
    104119div.blogflash .blog-title { 
    105120    font-size: 1.35em; 
    106     margin-left: inherit
     121    margin-left: 0
    107122} 
     123 
     124div.blogflash span.metaupdated { 
     125    display: none; 
     126} 
     127 
     128div.blogflash li.metadates { 
     129    float: left; 
     130} 
     131 
  • fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_monthlist.html

    r2928 r2934  
    99          <a href="${req.href.blog(name)}">${title}</a> 
    1010          <span class="metainfo"> 
    11             &nbsp;-- Posted on ${format_datetime(time, '%Y-%m-%d %H:%M')} : author 
    12             <a href="${req.href.blog('author', author)}">${author}</a> 
     11            &nbsp;-- Posted on ${format_datetime(time, '%Y-%m-%d %H:%M')} 
     12            : author <a href="${req.href.blog('author', author)}">${author}</a> 
    1313            <py:if test="categories"> 
    1414              : categories 
     
    2626        already exists in the data dictionary. --> 
    2727  <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> 
    2929  </py:if> 
    3030 
  • fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_post.html

    r2928 r2934  
    44  <div py:def="render_blog_post(post, list_mode=False)"> 
    55    <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> 
    78    <div id="blog-body"> 
    89      ${wiki_to_html(context(post.resource), post.body)} 
    910    </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> 
    2329  </div> 
    2430 
  • fullblogplugin/0.11/tracfullblog/templates/fullblog_sidebar.html

    r2791 r2934  
    1919 
    2020    <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"> 
    2132      <py:if test="blog_months"> 
    2233        <p>Browse by time:</p> 
     
    2435          <li py:for="month, count in blog_months"> 
    2536            <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> 
    2739        </ul> 
    2840      </py:if> 
     
    3547        <ul py:if="blog_categories"> 
    3648          <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>  
    3754            <a href="${req.href.blog('category', category)}">${category}</a> 
    38                   (${count})</li> 
     55                  (${count}) 
     56          </li> 
    3957        </ul> 
    4058      </py:if> 
     
    4260    </div> 
    4361 
    44     <div class="sidebar-section"> 
     62    <div class="sidebar-section${not blog_infotext and ' last' or None}"> 
    4563      <py:if test="blog_authors"> 
    4664        <p>Browse by author:</p> 
    4765        <ul> 
    4866          <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>  
    4972            <a href="${req.href.blog('author', author)}">${author}</a> (${count})</li> 
    5073        </ul> 
     
    5376    </div> 
    5477 
    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      
    5978    <div py:if="blog_infotext" id="blog-infotext" class="sidebar-section last"> 
    6079        ${wiki_to_html(context, blog_infotext)} 
  • fullblogplugin/0.11/tracfullblog/web_ui.py

    r2928 r2934  
    310310    def get_timeline_filters(self, req): 
    311311        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')) 
    314313 
    315314    def get_timeline_events(self, req, start, stop, filters): 
    316         if 'blog' in filters or 'blog-details' in filters
     315        if 'blog' in filters
    317316            blog_realm = Resource('blog') 
    318317            if not 'BLOG_VIEW' in req.perm(blog_realm): 
    319318                return 
    320319            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 
    321337            blog_posts = get_blog_posts(self.env, from_dt=start, to_dt=stop, 
    322338                                        all_versions=True) 
    323         if 'blog' in filters: 
    324             # Blog posts 
    325339            for name, version, time, author, title, body, category_list \ 
    326340                    in blog_posts: 
     
    328342                if 'BLOG_VIEW' not in req.perm(bp_resource): 
    329343                    continue 
    330                 if version != 1: 
    331                     continue # Only interested in first version here 
    332344                bp = BlogPost(self.env, name, version=version) 
    333345                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')) 
    347347            # Attachments (will be rendered by attachment module) 
    348348            for event in AttachmentModule(self.env).get_timeline_events( 
     
    358358                bp = BlogPost(self.env, post_name) 
    359359                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')) 
    362361 
    363362    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] 
    366364        if bc: # A blog comment 
    367365            if field == 'url': 
    368366                return context.href.blog(bp.name) + '#comment-%d' % bc.number 
    369367            elif field == 'title': 
    370                 return tag(tag.em('Blog: '+bp.title), ' comment added') 
     368                return tag('Blog: ', tag.em(bp.title), ' comment added') 
    371369            elif field == 'description': 
    372370                return format_to_oneliner(self.env, 
     
    376374                return context.href.blog(bp.name) 
    377375            elif field == 'title': 
    378                 if format == 'rss' and bp.version == 1
     376                if view=='full'
    379377                    return tag(tag.em(bp.title)) 
    380378                else: 
    381                     return tag(tag.em('Blog: '+bp.title), 
     379                    return tag('Blog: ', tag.em(bp.title), 
    382380                            bp.version > 1 and ' edited' or ' created') 
    383381            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) 
    396388                else: 
    397389                    # Any other regular display format