tracのversionに応じたディレクトリ構成に変更
@@ -1,17 +0,0 @@ | ||
1 | -#!/usr/bin/env python | |
2 | - | |
3 | -from setuptools import setup | |
4 | - | |
5 | -PACKAGE = 'NewWikiPageButton' | |
6 | -VERSION = '1.0' | |
7 | - | |
8 | -setup(name=PACKAGE, | |
9 | -version=VERSION, | |
10 | -packages=['newwikipagebutton'], | |
11 | -entry_points={'trac.plugins': '%s = newwikipagebutton' % PACKAGE}, | |
12 | -package_data={'newwikipagebutton': [ 'htdocs/*.js','htdocs/*.css','htdocs/*.png','htdocs/images/*.png','htdocs/images/*.gif','templates/*.js']}, | |
13 | -author = "Tomohito Ozaki", | |
14 | -author_email = "ozaki@yuroyoro.com", | |
15 | -description = "", | |
16 | -url = "http://d.hatena.ne.jp/yuroyoro/", | |
17 | -) |
@@ -1,3 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | |
2 | -# NewWikipageButton module | |
3 | -from newwikipagebutton import * |
@@ -1,56 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | |
2 | -# NewWikiPageButton plugin | |
3 | -import re | |
4 | - | |
5 | -from trac.core import * | |
6 | -from trac.web.chrome import ITemplateProvider, add_stylesheet, add_script | |
7 | -from trac.web.api import IRequestFilter, IRequestHandler | |
8 | -from trac.util import escape, Markup | |
9 | -from trac.perm import IPermissionRequestor | |
10 | - | |
11 | -from pkg_resources import resource_filename | |
12 | - | |
13 | - | |
14 | -class NewWikiPageButtonPlugin(Component): | |
15 | - implements( IRequestHandler ,ITemplateProvider ,IRequestFilter) | |
16 | - | |
17 | - # ITemplateProvider methods | |
18 | - | |
19 | - def get_templates_dirs(self): | |
20 | - yield resource_filename(__name__, 'templates') | |
21 | - | |
22 | - def get_htdocs_dirs(self): | |
23 | - yield 'newwikipagebutton', resource_filename(__name__, 'htdocs') | |
24 | - | |
25 | - | |
26 | - # IRequestHandler methods | |
27 | - | |
28 | - def match_request(self, req): | |
29 | - return re.match(r'^/NewWikiPageButton/newwikipagebutton.js', req.path_info) is not None | |
30 | - | |
31 | - def process_request(self, req): | |
32 | - | |
33 | - if re.match(r'^/NewWikiPageButton/newwikipagebutton.js',req.path_info) : | |
34 | - if 'WIKI_CREATE' in req.perm('wiki') or 'WIKI_ADMIN' in req.perm('wiki'): | |
35 | - | |
36 | - return 'newwikipagebutton.js',{},'text/plain' | |
37 | - | |
38 | - | |
39 | - # IRequestFilter methods | |
40 | - | |
41 | - def post_process_request(self, req, template, data, content_type): | |
42 | - path = req.path_info | |
43 | - | |
44 | - def uses_newwikipagebutton(req): | |
45 | - if template == 'wiki_view.html' : | |
46 | - return True | |
47 | - return False | |
48 | - | |
49 | - if uses_newwikipagebutton(req) : | |
50 | - add_script(req, '/NewWikiPageButton/newwikipagebutton.js') | |
51 | - | |
52 | - return template, data, content_type | |
53 | - | |
54 | - def pre_process_request(self, req, handler): | |
55 | - return handler | |
56 | - |
@@ -1,13 +0,0 @@ | ||
1 | - | |
2 | -$(document).ready(function(){ | |
3 | - | |
4 | - html = '<form><input type="button" value="新しいページを作成する" name="newwikipagebutton" id = "newwikipagebutton"/></form>' | |
5 | - | |
6 | - $("form#attachfile").after(html); | |
7 | - $("input#newwikipagebutton").click(function(){ | |
8 | - ret = prompt("新しいページ名", ""); | |
9 | - if( ret){ | |
10 | - location.href= location.href + "/" + ret; | |
11 | - } | |
12 | - }); | |
13 | -}); |
@@ -1 +0,0 @@ | ||
1 | -newwikipagebutton |
@@ -1,3 +0,0 @@ | ||
1 | -[trac.plugins] | |
2 | -NewWikiPageButton = newwikipagebutton | |
3 | - |
@@ -1 +0,0 @@ | ||
1 | - |
@@ -1,8 +0,0 @@ | ||
1 | -setup.py | |
2 | -NewWikiPageButton.egg-info/PKG-INFO | |
3 | -NewWikiPageButton.egg-info/SOURCES.txt | |
4 | -NewWikiPageButton.egg-info/dependency_links.txt | |
5 | -NewWikiPageButton.egg-info/entry_points.txt | |
6 | -NewWikiPageButton.egg-info/top_level.txt | |
7 | -newwikipagebutton/__init__.py | |
8 | -newwikipagebutton/newwikipagebutton.py | |
\ No newline at end of file |
@@ -1,28 +0,0 @@ | ||
1 | -Copyright (c) 2008,2009 Tomohito Ozaki(yuroyoro). | |
2 | -All rights reserved. | |
3 | - | |
4 | -Redistribution and use in source and binary forms, with or without | |
5 | -modification, are permitted provided that the following conditions | |
6 | -are met: | |
7 | - | |
8 | - 1. Redistributions of source code must retain the above copyright | |
9 | - notice, this list of conditions and the following disclaimer. | |
10 | - 2. Redistributions in binary form must reproduce the above copyright | |
11 | - notice, this list of conditions and the following disclaimer in | |
12 | - the documentation and/or other materials provided with the | |
13 | - distribution. | |
14 | - 3. The name of the author may not be used to endorse or promote | |
15 | - products derived from this software without specific prior | |
16 | - written permission. | |
17 | - | |
18 | -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | |
19 | -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
20 | -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
21 | -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
22 | -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
23 | -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
24 | -GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
25 | -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | |
26 | -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
27 | -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
28 | -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
@@ -0,0 +1,8 @@ | ||
1 | +setup.py | |
2 | +NewWikiPageButton.egg-info/PKG-INFO | |
3 | +NewWikiPageButton.egg-info/SOURCES.txt | |
4 | +NewWikiPageButton.egg-info/dependency_links.txt | |
5 | +NewWikiPageButton.egg-info/entry_points.txt | |
6 | +NewWikiPageButton.egg-info/top_level.txt | |
7 | +newwikipagebutton/__init__.py | |
8 | +newwikipagebutton/newwikipagebutton.py | |
\ No newline at end of file |
@@ -0,0 +1 @@ | ||
1 | +newwikipagebutton |
@@ -0,0 +1,3 @@ | ||
1 | +[trac.plugins] | |
2 | +NewWikiPageButton = newwikipagebutton | |
3 | + |
@@ -0,0 +1 @@ | ||
1 | + |
@@ -0,0 +1,28 @@ | ||
1 | +Copyright (c) 2008,2009 Tomohito Ozaki(yuroyoro). | |
2 | +All rights reserved. | |
3 | + | |
4 | +Redistribution and use in source and binary forms, with or without | |
5 | +modification, are permitted provided that the following conditions | |
6 | +are met: | |
7 | + | |
8 | + 1. Redistributions of source code must retain the above copyright | |
9 | + notice, this list of conditions and the following disclaimer. | |
10 | + 2. Redistributions in binary form must reproduce the above copyright | |
11 | + notice, this list of conditions and the following disclaimer in | |
12 | + the documentation and/or other materials provided with the | |
13 | + distribution. | |
14 | + 3. The name of the author may not be used to endorse or promote | |
15 | + products derived from this software without specific prior | |
16 | + written permission. | |
17 | + | |
18 | +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | |
19 | +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
20 | +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
21 | +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
22 | +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
23 | +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
24 | +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
25 | +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | |
26 | +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
27 | +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
28 | +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
@@ -0,0 +1,56 @@ | ||
1 | +# -*- coding: utf-8 -*- | |
2 | +# NewWikiPageButton plugin | |
3 | +import re | |
4 | + | |
5 | +from trac.core import * | |
6 | +from trac.web.chrome import ITemplateProvider, add_stylesheet, add_script | |
7 | +from trac.web.api import IRequestFilter, IRequestHandler | |
8 | +from trac.util import escape, Markup | |
9 | +from trac.perm import IPermissionRequestor | |
10 | + | |
11 | +from pkg_resources import resource_filename | |
12 | + | |
13 | + | |
14 | +class NewWikiPageButtonPlugin(Component): | |
15 | + implements( IRequestHandler ,ITemplateProvider ,IRequestFilter) | |
16 | + | |
17 | + # ITemplateProvider methods | |
18 | + | |
19 | + def get_templates_dirs(self): | |
20 | + yield resource_filename(__name__, 'templates') | |
21 | + | |
22 | + def get_htdocs_dirs(self): | |
23 | + yield 'newwikipagebutton', resource_filename(__name__, 'htdocs') | |
24 | + | |
25 | + | |
26 | + # IRequestHandler methods | |
27 | + | |
28 | + def match_request(self, req): | |
29 | + return re.match(r'^/NewWikiPageButton/newwikipagebutton.js', req.path_info) is not None | |
30 | + | |
31 | + def process_request(self, req): | |
32 | + | |
33 | + if re.match(r'^/NewWikiPageButton/newwikipagebutton.js',req.path_info) : | |
34 | + if 'WIKI_CREATE' in req.perm('wiki') or 'WIKI_ADMIN' in req.perm('wiki'): | |
35 | + | |
36 | + return 'newwikipagebutton.js',{},'text/plain' | |
37 | + | |
38 | + | |
39 | + # IRequestFilter methods | |
40 | + | |
41 | + def post_process_request(self, req, template, data, content_type): | |
42 | + path = req.path_info | |
43 | + | |
44 | + def uses_newwikipagebutton(req): | |
45 | + if template == 'wiki_view.html' : | |
46 | + return True | |
47 | + return False | |
48 | + | |
49 | + if uses_newwikipagebutton(req) : | |
50 | + add_script(req, '/NewWikiPageButton/newwikipagebutton.js') | |
51 | + | |
52 | + return template, data, content_type | |
53 | + | |
54 | + def pre_process_request(self, req, handler): | |
55 | + return handler | |
56 | + |
@@ -0,0 +1,3 @@ | ||
1 | +# -*- coding: utf-8 -*- | |
2 | +# NewWikipageButton module | |
3 | +from newwikipagebutton import * |
@@ -0,0 +1,13 @@ | ||
1 | + | |
2 | +$(document).ready(function(){ | |
3 | + | |
4 | + html = '<form><input type="button" value="新しいページを作成する" name="newwikipagebutton" id = "newwikipagebutton"/></form>' | |
5 | + | |
6 | + $("form#attachfile").after(html); | |
7 | + $("input#newwikipagebutton").click(function(){ | |
8 | + ret = prompt("新しいページ名", ""); | |
9 | + if( ret){ | |
10 | + location.href= location.href + "/" + ret; | |
11 | + } | |
12 | + }); | |
13 | +}); |
@@ -0,0 +1,17 @@ | ||
1 | +#!/usr/bin/env python | |
2 | + | |
3 | +from setuptools import setup | |
4 | + | |
5 | +PACKAGE = 'NewWikiPageButton' | |
6 | +VERSION = '1.0' | |
7 | + | |
8 | +setup(name=PACKAGE, | |
9 | +version=VERSION, | |
10 | +packages=['newwikipagebutton'], | |
11 | +entry_points={'trac.plugins': '%s = newwikipagebutton' % PACKAGE}, | |
12 | +package_data={'newwikipagebutton': [ 'htdocs/*.js','htdocs/*.css','htdocs/*.png','htdocs/images/*.png','htdocs/images/*.gif','templates/*.js']}, | |
13 | +author = "Tomohito Ozaki", | |
14 | +author_email = "ozaki@yuroyoro.com", | |
15 | +description = "", | |
16 | +url = "http://d.hatena.ne.jp/yuroyoro/", | |
17 | +) |