Changeset 2928
- Timestamp:
- 12/20/07 19:27:21 (1 year ago)
- Files:
-
- fullblogplugin/0.11/setup.py (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/admin.py (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/htdocs/css/fullblog.css (modified) (3 diffs)
- fullblogplugin/0.11/tracfullblog/macros.py (added)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_archive.html (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_edit.html (modified) (1 diff)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_monthlist.html (added)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_post.html (moved) (moved from fullblogplugin/0.11/tracfullblog/templates/fullblog_macros.html) (3 diffs)
- fullblogplugin/0.11/tracfullblog/templates/fullblog_view.html (modified) (2 diffs)
- fullblogplugin/0.11/tracfullblog/util.py (added)
- fullblogplugin/0.11/tracfullblog/web_ui.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fullblogplugin/0.11/setup.py
r2922 r2928 26 26 'tracfullblog.core = tracfullblog.core', 27 27 'tracfullblog.db = tracfullblog.db', 28 'tracfullblog.macros = tracfullblog.macros', 28 29 'tracfullblog.tags = tracfullblog.tags[tags]', 29 30 'tracfullblog.web_ui = tracfullblog.web_ui']}, fullblogplugin/0.11/tracfullblog/admin.py
r2919 r2928 53 53 54 54 blog_admin['bloginfotext'] = blog_core.get_bloginfotext() 55 blog_admin['numpostsfront'] = self.env.config.get (56 'fullblog', 'num_items_front')55 blog_admin['numpostsfront'] = self.env.config.getint( 56 'fullblog', 'num_items_front') 57 57 58 58 return ('fullblog_admin.html', {'blog_admin': blog_admin}) fullblogplugin/0.11/tracfullblog/htdocs/css/fullblog.css
r2791 r2928 20 20 font-size: smaller; 21 21 text-align: right; 22 } 23 24 .metainfo span { 25 padding: 0; 26 margin: 0; 22 27 } 23 28 … … 48 53 } 49 54 50 #blog-list-title {55 .blog-list-title { 51 56 text-align: center; 52 57 color: gray; 58 padding-bottom: 0.5em; 53 59 } 54 60 … … 81 87 background-image: url(../blog.png); 82 88 } 89 90 /* 91 ** Style used for a blog macros 92 */ 93 94 div.blogflash { 95 background: #F3F3F3 none repeat scroll 0%; 96 border: 2px solid gray; 97 float: right; 98 font-size: 0.8em; 99 margin: 0em; 100 padding: 0.5em 1em; 101 width: 400px; 102 } 103 104 div.blogflash .blog-title { 105 font-size: 1.35em; 106 margin-left: inherit; 107 } fullblogplugin/0.11/tracfullblog/templates/fullblog_archive.html
r2919 r2928 16 16 17 17 <xi:include href="fullblog_sidebar.html" /> 18 <xi:include href="fullblog_macro_monthlist.html" /> 18 19 19 20 <div id="main"> 20 21 <h1>Blog Archive</h1> 21 <p py:if="not blog_archive[0]">No posts.</p>22 <p py:if="not blog_archive[0]">No blog posts.</p> 22 23 <py:if test="blog_archive[0]"> 23 <div class="monthlist" py:for="period, posts in blog_archive"> 24 <h3>${to_unicode("%s %d" % (blog_month_names[period.month-1], period.year))}</h3> 25 <ul> 26 <li py:for="name, version, time, author, title, body, categories in posts"> 27 <a href="${req.href.blog(name)}">${title}</a> 28 <span class="metainfo"> 29 -- Posted on ${format_datetime(time, '%Y-%m-%d %H:%M')} : author 30 <a href="${req.href.blog('author', author)}">${author}</a> 31 <py:if test="categories"> 32 : categories 33 <span py:for="cat in categories"> 34 <a href="${req.href.blog('category', cat)}">${cat}</a> 35 </span> 36 </py:if> 37 </span> 38 </li> 39 </ul> 24 <div py:for="period, posts in blog_archive" py:strip="True"> 25 ${render_monthlist(to_unicode("%s %d" % (blog_month_names[period.month-1], period.year)), posts)} 40 26 </div> 41 27 </py:if> fullblogplugin/0.11/tracfullblog/templates/fullblog_edit.html
r2919 r2928 13 13 <body> 14 14 15 <xi:include href="fullblog_macro s.html" />15 <xi:include href="fullblog_macro_post.html" /> 16 16 17 17 <div id="content" class="blog wiki"> fullblogplugin/0.11/tracfullblog/templates/fullblog_macro_post.html
r2779 r2928 1 <div xmlns="http://www.w3.org/1999/xhtml" 2 xmlns:py="http://genshi.edgewall.org/" py:strip="True"> 1 <div xmlns:py="http://genshi.edgewall.org/" py:strip="True"> 3 2 4 3 <!--! Macro to render a post --> 5 4 <div py:def="render_blog_post(post, list_mode=False)"> 6 <h1 id="blog-title"><a href="${req.href.blog(post.name)}"5 <h1 class="blog-title"><a href="${req.href.blog(post.name)}" 7 6 py:strip="not list_mode">${post.title}</a></h1> 8 7 <div id="blog-body"> … … 10 9 </div> 11 10 <p class="metainfo">Posted on: ${format_datetime(post.publish_time, '%Y-%m-%d %H:%M')} 12 -- Last updated: ${format_datetime(post.version_time, '%Y-%m-%d %H:%M')} <br/>13 Author: <a href="${req.href.blog('author', post.author)}">${post.author}</a> <br />14 Categories: < span py:for="cat in post.category_list" py:if="post.category_list">15 <a href="${req.href.blog('category', cat)}">${cat}</a>16 </span>17 < span py:if="not post.category_list"> (none)</span>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> 18 17 <py:if test="list_mode"> 19 18 <br /> … … 24 23 </div> 25 24 25 <!--! Directly execute the macro on import if 'execute_blog_macro' is set. 26 For this not to throw errors it presumes variables to be called 27 already exists in the data dictionary. --> 28 <py:if test="defined('execute_blog_macro') and execute_blog_macro"> 29 ${render_blog_post(post, list_mode)} 30 </py:if> 31 26 32 </div> fullblogplugin/0.11/tracfullblog/templates/fullblog_view.html
r2919 r2928 13 13 <body> 14 14 15 <xi:include href="fullblog_macro s.html" />15 <xi:include href="fullblog_macro_post.html" /> 16 16 17 17 <div id="content" class="blog wiki"> … … 122 122 123 123 <py:if test="defined('blog_post_list')"> 124 <div id="blog-list-title">${blog_list_title}</div>124 <div class="blog-list-title">${blog_list_title}</div> 125 125 <p py:if="not len(blog_post_list)"> 126 126 No blog posts available. fullblogplugin/0.11/tracfullblog/web_ui.py
r2919 r2928 11 11 # Imports from standard lib 12 12 import datetime 13 import calendar14 13 import re 15 14 from pkg_resources import resource_filename … … 36 35 from model import * 37 36 from core import FullBlogCore 37 from util import map_month_names, parse_period 38 38 39 39 __all__ = ['FullBlogModule'] 40 40 41 # Utility functions42 43 def add_months(thedate, months):44 """ Add <months> months to <thedate>. """45 y, m, d = thedate.timetuple()[:3]46 y2, m2 = divmod(m + months - 1, 12)47 return datetime.datetime(y + y2, m2 + 1, d, tzinfo=thedate.tzinfo)48 49 def map_month_names(month_list):50 """ Returns a list containing the 12 month names. """51 if len(month_list) == 12:52 # A list of 12 names is passed in, use that53 return month_list54 else:55 # Use list from default locale setting56 return [calendar.month_name[i+1] for i in range(12)]57 58 # UI class59 41 60 42 class FullBlogModule(Component): … … 108 90 109 91 # Parse out the path and actions from args 110 path_items = req.args.get('blog_path' ).split('/')92 path_items = req.args.get('blog_path', '').split('/') 111 93 path_items = [item for item in path_items if item] # clean out empties 112 94 action = req.args.get('action', 'view').lower() … … 245 227 # 2007/10 or category/something or author/theuser 246 228 title = category = author = '' 247 try: 248 # Test for year and month values 249 year = int(path_items[0]) 250 month = int(path_items[1]) 251 from_dt = datetime.datetime(year, month, 1, tzinfo=utc) 252 to_dt = add_months(from_dt, months=1) 229 from_dt, to_dt = parse_period(path_items) 230 if from_dt: 253 231 title = "Posts for the month of %s %d" % ( 254 232 blog_month_names[from_dt.month -1], from_dt.year) 255 except ValueError: 256 # Not integers, ignore 257 to_dt = from_dt = None 233 258 234 category = (path_items[0].lower() == 'category' 259 235 and path_items[1]) or ''
