KanonConductor
changeset 53:b670bc3d9c6d
use repository avatarplugin.
author | chris |
---|---|
date | Mon, 04 Apr 2011 12:10:22 +0900 |
parents | 303dc4d88e7d |
children | 1515bf4de015 |
files | pluginlist resource/trac-plugins/tracavatarplugin/README.txt resource/trac-plugins/tracavatarplugin/avatar_support_for_trac0.11.7.patch resource/trac-plugins/tracavatarplugin/avatar_support_for_trac0.12.1.patch resource/trac-plugins/tracavatarplugin/setup.py resource/trac-plugins/tracavatarplugin/tracavatar/__init__.py resource/trac-plugins/tracavatarplugin/tracavatar/htdocs/js/avatar.js resource/trac-plugins/tracavatarplugin/tracavatar/web_ui.py |
diffstat | 8 files changed, 2 insertions(+), 256 deletions(-) [+] |
line diff
1.1 --- a/pluginlist Mon Apr 04 12:09:51 2011 +0900 1.2 +++ b/pluginlist Mon Apr 04 12:10:22 2011 +0900 1.3 @@ -6,3 +6,5 @@ 1.4 http://svn.sourceforge.jp/svnroot/shibuya-trac/plugins/reportincludeplugin/trunk/0.12 1.5 http://svn.sourceforge.jp/svnroot/shibuya-trac/plugins/trackanontheme/trunk 1.6 http://svn.sourceforge.jp/svnroot/shibuya-trac/plugins/hudsontracplus/0.11 1.7 +http://svn.sourceforge.jp/svnroot/shibuya-trac/plugins/tracavatarplugin/branches/0.12 1.8 +
2.1 --- a/resource/trac-plugins/tracavatarplugin/README.txt Mon Apr 04 12:09:51 2011 +0900 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,55 +0,0 @@ 2.4 -= TracAvatarプラグイン = 2.5 -2010/08/30 Takashi Okamoto 2.6 - 2.7 -== 概要 == 2.8 -TracAvatarプラグインは、Tracにアバター機能(ユーザのキャラクタ化機能)を追加します。 2.9 -TracAvatarプラグインを利用することにより、タイムラインの変更者やチケットの担当者、 2.10 -報告者、コメント者などユーザ名が表示される部分にキャラクタも一緒に表示されるよう 2.11 -になります。 2.12 - 2.13 - 2.14 -== 事前準備 == 2.15 -(※TracLightningをご利用の方は事前準備は不要です) 2.16 -TracAvatarプラグインは、TracUserManagerプラグインの拡張として実装しています。動作には、 2.17 -予めTracUserManagerプラグインをインストールしておく必要があります。TracUserManager 2.18 -プラグインの動作には、TracAccountManagerプラグインが必要です。 2.19 - 2.20 -$ easy_install 2.21 - 2.22 -TracUserManagerプラグインと 2.23 -TracAccountManagerの導入方法については、下記のURLをご覧ください。 2.24 - 2.25 - * TracAccountManagerPlugin 2.26 - http://trac-hacks.org/wiki/AccountManagerPlugin 2.27 - * TracUserManagerPlugin 2.28 - http://code.optaros.com/trac/oforge 2.29 - 2.30 -== インストール方法 == 2.31 -=== Tracにパッチを当てる === 2.32 -まずは、trac本体に次のパッチを当て、Tracをインストールします。 2.33 -{{{ 2.34 -$ cd trac (Tracのソースディレクトリへ移動) 2.35 -$ patch -p1 < tractavatar_support_for_trac0.11.7.patch 2.36 -$ python setup.py install 2.37 -}}} 2.38 - 2.39 -=== TracAvatarプラグインのインストール === 2.40 -下記の手順でTracAvatarプラグインをインストールします。 2.41 -{{{ 2.42 -$ svn co https://svn.sourceforge.jp/svnroot/shibuya-trac/plugins/tracavatarplugin/branches/0.11 tracavatarplugin 2.43 -$ cd tracavatarplugin 2.44 -$ python setup.py install 2.45 -}}} 2.46 -=== trac.iniの設定 === 2.47 -trac.iniファイルに下記の設定を追加し、TracAvatarプラグインを有効にします。 2.48 - 2.49 -[components] 2.50 -tracavatar.web_ui.* = enabled 2.51 - 2.52 -== 使い方 == 2.53 -タイムラインやチケットのユーザ名が表示される個所にアバターが表示されるようになります。 2.54 -メニューの上の「ユーザ設定」のリンクから「My Profile」タブを開いて、Picture:で選択した画像がアバターになります。 2.55 - 2.56 - 2.57 - 2.58 -
3.1 --- a/resource/trac-plugins/tracavatarplugin/avatar_support_for_trac0.11.7.patch Mon Apr 04 12:09:51 2011 +0900 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,40 +0,0 @@ 3.4 -diff -uNr trac.orig/trac/templates/macros.html trac/trac/templates/macros.html 3.5 ---- trac.orig/trac/templates/macros.html 2010-08-27 09:13:07.250506200 +0900 3.6 -+++ trac/trac/templates/macros.html 2010-08-27 09:17:56.302039000 +0900 3.7 -@@ -36,10 +36,10 @@ 3.8 - - 3.9 - - We take care to not insert any extra space. 3.10 - --> 3.11 -- <py:def function="authorinfo(author, email_map=None)"><py:choose><py:when test="author"><py:with 3.12 -+ <py:def function="authorinfo(author, email_map=None)"><span class="author"><py:choose><py:when test="author"><py:with 3.13 - vars="author = show_email_addresses and email_map and '@' not in author and email_map[author] or author">${ 3.14 - author and format_author(author) or 'anonymous' 3.15 -- }</py:with></py:when><py:otherwise>anonymous</py:otherwise></py:choose></py:def> 3.16 -+ }</py:with></py:when><py:otherwise>anonymous</py:otherwise></py:choose></span></py:def> 3.17 - 3.18 - <!--! Display a sequence of path components. 3.19 - - 3.20 -diff -uNr trac.orig/trac/versioncontrol/templates/dir_entries.html trac/trac/versioncontrol/templates/dir_entries.html 3.21 ---- trac.orig/trac/versioncontrol/templates/dir_entries.html 2010-08-27 09:13:08.381570900 +0900 3.22 -+++ trac/trac/versioncontrol/templates/dir_entries.html 2010-08-27 09:33:42.157138800 +0900 3.23 -@@ -21,7 +21,7 @@ 3.24 - ${change and dateinfo(change.date) or '-'} 3.25 - </td> 3.26 - <td class="change"> 3.27 -- <span class="author" py:if="change">${authorinfo(change.author)}:</span> 3.28 -+ <span py:if="change">${authorinfo(change.author)}:</span> 3.29 - <span class="change" py:choose="" py:with="chgset_context = context('changeset', change.rev)"> 3.30 - <py:when test="not change or 'CHANGESET_VIEW' not in perm(chgset_context.resource)">-</py:when> 3.31 - <py:when test="wiki_format_messages"> 3.32 -diff -uNr trac.orig/trac/web/auth.py trac/trac/web/auth.py 3.33 ---- trac.orig/trac/web/auth.py 2010-08-27 09:13:08.648586200 +0900 3.34 -+++ trac/trac/web/auth.py 2010-08-27 09:18:50.281126400 +0900 3.35 -@@ -85,7 +85,7 @@ 3.36 - 3.37 - def get_navigation_items(self, req): 3.38 - if req.authname and req.authname != 'anonymous': 3.39 -- yield ('metanav', 'login', _('logged in as %(name)s', name=req.authname)) 3.40 -+ yield ('metanav', 'login', tag.span(req.authname,class_='author')) 3.41 - yield ('metanav', 'logout', 3.42 - tag.a(_('Logout'), href=req.href.logout())) 3.43 - else:
4.1 --- a/resource/trac-plugins/tracavatarplugin/avatar_support_for_trac0.12.1.patch Mon Apr 04 12:09:51 2011 +0900 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,36 +0,0 @@ 4.4 ---- trac/ticket/templates.org/ticket.html 2010-12-03 01:29:04.875067300 +0900 4.5 -+++ trac/ticket/templates/ticket.html 2010-12-03 01:15:50.795510900 +0900 4.6 -@@ -139,7 +139,7 @@ 4.7 - </py:for></py:if> 4.8 - </py:if> 4.9 - </span> 4.10 -- <i18n:msg params="date, author">Changed ${dateinfo(change.date)} ago by ${authorinfo(change.author)}</i18n:msg> 4.11 -+ ${dateinfo(change.date)}蜑 <span class="author">${change.author}</span> 4.12 - </h3> 4.13 - <py:if test="not show_editor and comment_version == max_version"> 4.14 - <form py:if="'cnum' in change and can_edit_comment" method="get" action="#comment:${change.cnum}"> 4.15 ---- trac/ticket/templates.org/ticket_box.html 2010-12-03 01:29:04.905067300 +0900 4.16 -+++ trac/ticket/templates/ticket_box.html 2010-12-03 01:08:03.913806700 +0900 4.17 -@@ -28,11 +28,11 @@ 4.18 - <tr> 4.19 - <th id="h_reporter">Reported by:</th> 4.20 - <td headers="h_reporter" class="searchable"> 4.21 -- ${defined('reporter_link') and reporter_link or authorinfo(ticket.reporter)} 4.22 -+ <span class="author">${ticket.reporter}</span> 4.23 - </td> 4.24 - <th id="h_owner">Owned by:</th> 4.25 - <td headers="h_owner"> 4.26 -- ${ticket.owner and (defined('owner_link') and owner_link or authorinfo(ticket.owner)) or ''} 4.27 -+ <span class="author">${ticket.owner}</span> 4.28 - </td> 4.29 - </tr> 4.30 - <tr py:for="row in group(fields, 2, lambda f: f.type != 'textarea')" 4.31 -@@ -60,7 +60,7 @@ 4.32 - <h3 id="comment:description"> 4.33 - Description 4.34 - <span py:if="description_change" class="lastmod" title="$description_change.date"> 4.35 -- <i18n:msg params="author">(last modified by ${authorinfo(description_change.author)})</i18n:msg> 4.36 -+ <i18n:msg params="author"><span class="author">${description_change.author}</span></i18n:msg> 4.37 - (<a href="${href.ticket(ticket.id, action='diff', version=description_change.cnum)}">diff</a>) 4.38 - </span> 4.39 - </h3>
5.1 --- a/resource/trac-plugins/tracavatarplugin/setup.py Mon Apr 04 12:09:51 2011 +0900 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,25 +0,0 @@ 5.4 -#!/usr/bin/env python 5.5 -# -*- coding: utf-8 -*- 5.6 - 5.7 -from setuptools import find_packages, setup 5.8 - 5.9 -setup( 5.10 - name='TracAvatarPlugin', 5.11 - version='0.3', 5.12 - zip_safe = True, 5.13 - packages=find_packages(exclude=['*.tests*']), 5.14 - 5.15 - author = "Takashi Okamoto", 5.16 - author_email='okamototk@user.sourceforge.jp', 5.17 - url="http://sourceforge.jp/projects/shibuya-trac/", 5.18 - description='Avatar Support for Trac', 5.19 - license = "New BSD", 5.20 - 5.21 - entry_points = { 5.22 - 'trac.plugins': [ 5.23 - 'tracavatar.web_ui = tracavatar.web_ui', 5.24 - ] 5.25 - }, 5.26 - package_data={'tracavatar': [ 5.27 -'htdocs/js/avatar.js']}, 5.28 -)
6.1 --- a/resource/trac-plugins/tracavatarplugin/tracavatar/__init__.py Mon Apr 04 12:09:51 2011 +0900 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,1 +0,0 @@ 6.4 -from completeuser.web_ui import *
7.1 --- a/resource/trac-plugins/tracavatarplugin/tracavatar/htdocs/js/avatar.js Mon Apr 04 12:09:51 2011 +0900 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,34 +0,0 @@ 7.4 -$(document).ready(function(){ 7.5 - img_cache = {}; 7.6 - 7.7 - count = 0; 7.8 - e = $("span.author,td.諡蠖楢"); 7.9 - if(e.length==0){ 7.10 - return; 7.11 - } 7.12 - timer = setInterval(function(){ 7.13 - username = $.trim(e[count].innerHTML); 7.14 - if((username!='somebody')&&(username!='anonymous')&&(username!='')){ 7.15 - cache = img_cache[username]; 7.16 - if(cache == undefined){ 7.17 - $.ajax({ 7.18 - url: avatar_request_path, 7.19 - data: {'id': count, 'username': username}, 7.20 - dataType: 'json', 7.21 - type: 'GET', 7.22 - success: function(json){ 7.23 - $(e[json['id']]).prepend('<img src="'+json['url']+'" style="max-width:40px; max-height: 40px; vertical-align:bottom;"/>'); 7.24 - img_cache[json['username']] = json['url']; 7.25 - } 7.26 - }); 7.27 - } else { 7.28 - $(e[count]).prepend('<img src="'+cache+'" style="max-width:40px; max-height: 40px; vertical-align:bottom;"/>'); 7.29 - } 7.30 - } 7.31 - count++; 7.32 - if(count == e.length){ 7.33 - clearInterval(timer); 7.34 - } 7.35 - }, 20); 7.36 -}); 7.37 -
8.1 --- a/resource/trac-plugins/tracavatarplugin/tracavatar/web_ui.py Mon Apr 04 12:09:51 2011 +0900 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,70 +0,0 @@ 8.4 -# -*- coding: utf-8 -*- 8.5 -from trac.core import * 8.6 -from trac.config import Option, BoolOption, Configuration 8.7 -from trac.web.chrome import add_script,add_stylesheet,ITemplateProvider 8.8 -from trac.web.main import IRequestHandler, IRequestFilter 8.9 -from trac.web.api import ITemplateStreamFilter 8.10 -from trac.util.html import Markup 8.11 - 8.12 -from genshi.filters.transform import Transformer 8.13 -from genshi.template import MarkupTemplate 8.14 -import re 8.15 -from json.encoder import JSONEncoder 8.16 - 8.17 -class TracAvatarModule(Component): 8.18 - implements(IRequestHandler, IRequestFilter, ITemplateProvider, ITemplateStreamFilter) 8.19 - 8.20 - def filter_stream(self, req, method, filename, stream, data): 8.21 -# if re.match(r'^/(ticket|newticket|wiki|timeline)', req.path_info): 8.22 - script = "<script type='text/javascript'>\n" 8.23 - script = script + " avatar_request_path = '"+req.base_path + "/tracavatar';" 8.24 - script = script+"</script>" 8.25 - return stream | Transformer('//div[@id="footer"]').before(MarkupTemplate(script).generate()) 8.26 -# else: 8.27 -# return stream 8.28 - 8.29 - # IRequestFilter methods 8.30 - def pre_process_request(self, req, handler): 8.31 - return handler 8.32 - 8.33 - def post_process_request(self, req, template, content_type): 8.34 - return (template, content_type) 8.35 - 8.36 - def post_process_request(self, req, template, data, content_type): 8.37 -# if re.match(r'^/(ticket|newticket|wiki|timeline)', req.path_info): 8.38 - add_script(req, 'tracavatar/js/avatar.js') 8.39 - return (template, data, content_type) 8.40 - 8.41 - # IRequestHandler methods 8.42 - def match_request(self, req): 8.43 - if req.path_info in ('/login/tracavatar', '/tracavatar'): 8.44 - self.log.debug("%s matches %s" % (req.path_info, True)) 8.45 - return True 8.46 - return False 8.47 - 8.48 - def process_request(self, req): 8.49 - id = req.args.get('id') 8.50 - username = req.args.get('username') 8.51 - db = self.env.get_db_cnx() 8.52 - cursor = db.cursor() 8.53 - cursor.execute("SELECT value FROM session_attribute WHERE sid='%s' AND name='picture_href'" % username) 8.54 - row = cursor.fetchone() 8.55 - if row: 8.56 - picture_href = row[0] 8.57 - else: 8.58 - picture_href = req.base_path + "/chrome/tracusermanager/img/no_picture.png" 8.59 - response = JSONEncoder().encode({"id":id, "username": username, "url": picture_href}).encode('utf-8') 8.60 - req.send_response(200) 8.61 - req.send_header('Content-Type', 'application/json; charset=utf-8') 8.62 - req.send_header('Content-Length', len(response.encode("utf-8"))) 8.63 - 8.64 - req.end_headers() 8.65 - req.write(response) 8.66 - 8.67 - # ITemplateProvider methods 8.68 - def get_templates_dirs(self): 8.69 - return [] 8.70 - 8.71 - def get_htdocs_dirs(self): 8.72 - from pkg_resources import resource_filename 8.73 - return [('tracavatar', resource_filename(__name__, 'htdocs'))]