Mercurial > bitten > bitten-test
diff bitten/trac_ext/web_ui.py @ 35:67631e1d4d45
Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
author | cmlenz |
---|---|
date | Wed, 22 Jun 2005 13:32:46 +0000 |
parents | |
children | 16b30ffc5fb9 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/bitten/trac_ext/web_ui.py @@ -0,0 +1,61 @@ +# -*- coding: iso8859-1 -*- +# +# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de> +# +# Bitten is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# Trac is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Author: Christopher Lenz <cmlenz@gmx.de> + +import re + +from trac.core import * +from trac.web.chrome import INavigationContributor +from trac.web.main import IRequestHandler + + +class BuildModule(Component): + + implements(INavigationContributor, IRequestHandler) + + build_cs = """ +<?cs include:"header.cs" ?> + <div id="ctxtnav" class="nav"></div> + <div id="content"> + <h1>Build Status</h1> + <p>Not yet implemented</p> + </div> +<?cs include:"footer.cs" ?> +""" + + # INavigationContributor methods + + def get_active_navigation_item(self, req): + return 'build' + + def get_navigation_items(self, req): + yield 'mainnav', 'build', '<a href="%s">Build Status</a>' \ + % self.env.href.build() + + # IRequestHandler methods + + def match_request(self, req): + match = re.match(r'/build(:?/(\w+))?', req.path_info) + if match: + if match.group(1): + req.args['id'] = match.group(1) + return True + + def process_request(self, req): + return req.hdf.parse(self.build_cs), None