source: watchlistplugin/0.12/tracwatchlist/nav.py

Last change on this file was 15264, checked in by Ryan J Ollos, 8 years ago

Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date Author Rev URL
File size: 1.7 KB
Line 
1# -*- coding: utf-8 -*-
2"""
3= Watchlist Plugin for Trac =
4Plugin Website:  http://trac-hacks.org/wiki/WatchlistPlugin
5Trac website:    http://trac.edgewall.org/
6
7Copyright (c) 2008-2010 by Martin Scharrer <martin@scharrer-online.de>
8All rights reserved.
9
10The i18n support was added by Steffen Hoffmann <hoff.st@web.de>.
11
12This program is free software: you can redistribute it and/or modify
13it under the terms of the GNU General Public License as published by
14the Free Software Foundation, either version 3 of the License, or
15(at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20GNU General Public License for more details.
21
22For a copy of the GNU General Public License see
23<http://www.gnu.org/licenses/>.
24
25$Id: nav.py 15264 2016-02-11 04:22:34Z rjollos $
26"""
27
28__url__      = ur"$URL: //trac-hacks.org/svn/watchlistplugin/0.12/tracwatchlist/nav.py $"[6:-2]
29__author__   = ur"$Author: rjollos $"[9:-2]
30__revision__ = int("0" + ur"$Rev: 15264 $"[6:-2].strip('M'))
31__date__     = ur"$Date: 2016-02-11 04:22:34 +0000 (Thu, 11 Feb 2016) $"[7:-2]
32
33from  genshi.builder        import  tag
34from  trac.core             import  *
35from  trac.web.chrome       import  INavigationContributor
36from  tracwatchlist.translation   import  _
37
38
39class WatchlistNavigation(Component):
40    """Navigation entries for the Trac WatchlistPlugin."""
41    implements( INavigationContributor )
42
43
44    ### methods for INavigationContributor
45    def get_active_navigation_item(self, req):
46        if req.path_info.startswith("/watchlist"):
47            return 'watchlist'
48        return ''
49
50
51    def get_navigation_items(self, req):
52        user = req.authname
53        if user and user != 'anonymous':
54            yield ('mainnav', 'watchlist', tag.a(_("Watchlist"),
55                   href=req.href("watchlist")))
56
57# EOF
Note: See TracBrowser for help on using the repository browser.