2
# This program is free software; you can redistribute it and/or modify
3
# it under the terms of the GNU General Public License as published by
4
# the Free Software Foundation; either version 2 of the License, or
5
# (at your option) any later version.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
from loggerhead.zptsupport import zpt
19
templatefunctions = {}
20
def templatefunc(func):
21
templatefunctions[func.__name__] = func
25
_base = os.path.dirname(__file__)
27
return zpt(os.path.join(_base, 'templates', name + '.pt'))
30
templatefunctions['macros'] = _pt('macros').macros
31
templatefunctions['breadcrumbs'] = _pt('breadcrumbs').macros
34
def file_change_summary(url, entry, modified_file_link):
35
return _pt('revisionfilechanges').expand(
36
url=url, entry=entry, modified_file_link=modified_file_link,
40
def revisioninfo(url, branch, entry, modified_file_link=None):
41
from loggerhead import util
42
return _pt('revisioninfo').expand(
43
url=url, change=entry, branch=branch, util=util,
44
modified_file_link=modified_file_link,
48
def collapse_button(group, name, branch, normal='block'):
49
return _pt('collapse-button').expand(
50
group=group, name=name, normal=normal, branch=branch,
54
def collapse_all_button(group, branch, normal='block'):
55
return _pt('collapse-all-button').expand(
56
group=group, normal=normal, branch=branch,
60
def revno_with_nick(entry):
62
extra = ' ' + entry.branch_nick
65
return '(%s%s)'%(entry.revno, extra)
68
def modified_file_link_rev(url, entry, item):
69
return _pt('modified-file-link-rev').expand(
70
url=url, entry=entry, item=item,
74
def modified_file_link_log(url, entry, item):
75
return _pt('modified-file-link-log').expand(
76
url=url, entry=entry, item=item,
80
def search_box(branch, navigation):
81
return _pt('search-box').expand(branch=branch, navigation=navigation,
85
def feed_link(branch, url):
86
return _pt('feed-link').expand(branch=branch, url=url, **templatefunctions)
89
def menu(branch, url, fileview_active=False):
90
return _pt('menu').expand(branch=branch, url=url,
91
fileview_active=fileview_active, **templatefunctions)