author | Aurelien Campeas <aurelien.campeas@logilab.fr> |
Wed, 09 May 2012 17:15:44 +0200 | |
changeset 8394 | b8b23af60019 |
parent 8190 | 2a3c1b787688 |
child 8632 | fa044b9157d7 |
permissions | -rw-r--r-- |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6996
diff
changeset
|
1 |
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4466
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
0 | 18 |
"""inline help system, using ReST file in products `wdoc` directory |
19 |
||
20 |
""" |
|
21 |
__docformat__ = "restructuredtext en" |
|
22 |
||
23 |
from itertools import chain |
|
24 |
from os.path import join |
|
25 |
from bisect import bisect_right |
|
1016
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
984
diff
changeset
|
26 |
from datetime import date |
0 | 27 |
|
28 |
from logilab.common.changelog import ChangeLog |
|
4466
8b0ca7904820
moved generic datetime manipulation function to lgc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
29 |
from logilab.common.date import strptime, todate |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6996
diff
changeset
|
30 |
from logilab.common.registry import yes |
0 | 31 |
from logilab.mtconverter import CHARSET_DECL_RGX |
32 |
||
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6996
diff
changeset
|
33 |
from cubicweb.predicates import match_form_params |
984 | 34 |
from cubicweb.view import StartupView |
4023
eae23c40627a
drop common subpackage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4004
diff
changeset
|
35 |
from cubicweb.uilib import rest_publish |
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
36 |
from cubicweb.web import NotFound, action |
0 | 37 |
_ = unicode |
38 |
||
39 |
# table of content management ################################################# |
|
40 |
||
41 |
try: |
|
42 |
from xml.etree.ElementTree import parse |
|
43 |
except ImportError: |
|
44 |
from elementtree.ElementTree import parse |
|
45 |
||
46 |
def build_toc_index(node, index): |
|
47 |
try: |
|
48 |
nodeidx = node.attrib['resource'] |
|
49 |
assert not nodeidx in index, nodeidx |
|
50 |
index[nodeidx] = node |
|
51 |
except KeyError: |
|
52 |
pass |
|
53 |
for child in node: |
|
54 |
build_toc_index(child, index) |
|
55 |
child.parent = node |
|
56 |
||
57 |
def get_insertion_point(section, index): |
|
58 |
if section.attrib.get('insertafter'): |
|
59 |
snode = index[section.attrib['insertafter']] |
|
60 |
node = snode.parent |
|
61 |
idx = node.getchildren().index(snode) + 1 |
|
62 |
elif section.attrib.get('insertbefore'): |
|
63 |
snode = index[section.attrib['insertbefore']] |
|
64 |
node = snode.parent |
|
65 |
idx = node.getchildren().index(snode) |
|
6420
4c14be06e557
[views/wdoc] do not crash on malconstructed stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5424
diff
changeset
|
66 |
elif 'appendto' in section.attrib: |
0 | 67 |
node = index[section.attrib['appendto']] |
68 |
idx = None |
|
6420
4c14be06e557
[views/wdoc] do not crash on malconstructed stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5424
diff
changeset
|
69 |
else: |
4c14be06e557
[views/wdoc] do not crash on malconstructed stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5424
diff
changeset
|
70 |
node, idx = None, None |
0 | 71 |
return node, idx |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
72 |
|
0 | 73 |
def build_toc(config): |
74 |
alltocfiles = reversed(tuple(config.locate_all_files('toc.xml'))) |
|
75 |
maintoc = parse(alltocfiles.next()).getroot() |
|
76 |
maintoc.parent = None |
|
77 |
index = {} |
|
78 |
build_toc_index(maintoc, index) |
|
79 |
# insert component documentation into the tree according to their toc.xml |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
80 |
# file |
0 | 81 |
for fpath in alltocfiles: |
82 |
toc = parse(fpath).getroot() |
|
83 |
for section in toc: |
|
84 |
node, idx = get_insertion_point(section, index) |
|
6420
4c14be06e557
[views/wdoc] do not crash on malconstructed stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5424
diff
changeset
|
85 |
if node is None: |
4c14be06e557
[views/wdoc] do not crash on malconstructed stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5424
diff
changeset
|
86 |
continue |
0 | 87 |
if idx is None: |
88 |
node.append(section) |
|
89 |
else: |
|
90 |
node.insert(idx, section) |
|
91 |
section.parent = node |
|
92 |
build_toc_index(section, index) |
|
93 |
return index |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
94 |
|
1149 | 95 |
def title_for_lang(node, lang): |
6996
86214f0da14f
[wdoc] fallback to english title when no translation found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6459
diff
changeset
|
96 |
fallback_title = None |
0 | 97 |
for title in node.findall('title'): |
6996
86214f0da14f
[wdoc] fallback to english title when no translation found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6459
diff
changeset
|
98 |
title_lang = title.attrib['{http://www.w3.org/XML/1998/namespace}lang'] |
86214f0da14f
[wdoc] fallback to english title when no translation found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6459
diff
changeset
|
99 |
if title_lang == lang: |
0 | 100 |
return unicode(title.text) |
6996
86214f0da14f
[wdoc] fallback to english title when no translation found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6459
diff
changeset
|
101 |
if title_lang == 'en': |
86214f0da14f
[wdoc] fallback to english title when no translation found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6459
diff
changeset
|
102 |
fallback_title = unicode(title.text) |
86214f0da14f
[wdoc] fallback to english title when no translation found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6459
diff
changeset
|
103 |
return fallback_title |
0 | 104 |
|
105 |
def subsections(node): |
|
106 |
return [child for child in node if child.tag == 'section'] |
|
107 |
||
108 |
# help views ################################################################## |
|
109 |
||
110 |
class InlineHelpView(StartupView): |
|
731
ac4a94e50b60
some more s/__selectors__/__select__ but still more to come
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
692
diff
changeset
|
111 |
__select__ = match_form_params('fid') |
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
112 |
__regid__ = 'wdoc' |
0 | 113 |
title = _('site documentation') |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
114 |
|
0 | 115 |
def call(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
116 |
fid = self._cw.form['fid'] |
3733
c3feb6a33f58
remove some warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3655
diff
changeset
|
117 |
vreg = self._cw.vreg |
c3feb6a33f58
remove some warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3655
diff
changeset
|
118 |
for lang in chain((self._cw.lang, vreg.property_value('ui.language')), |
c3feb6a33f58
remove some warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3655
diff
changeset
|
119 |
vreg.config.available_languages()): |
0 | 120 |
rid = '%s_%s.rst' % (fid, lang) |
3733
c3feb6a33f58
remove some warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3655
diff
changeset
|
121 |
resourcedir = vreg.config.locate_doc_file(rid) |
0 | 122 |
if resourcedir: |
123 |
break |
|
124 |
else: |
|
125 |
raise NotFound |
|
3733
c3feb6a33f58
remove some warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3655
diff
changeset
|
126 |
self.tocindex = build_toc(vreg.config) |
0 | 127 |
try: |
128 |
node = self.tocindex[fid] |
|
129 |
except KeyError: |
|
130 |
node = None |
|
131 |
else: |
|
132 |
self.navigation_links(node) |
|
133 |
self.w(u'<div class="hr"></div>') |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
134 |
self.w(u'<h1>%s</h1>' % (title_for_lang(node, self._cw.lang))) |
0 | 135 |
data = open(join(resourcedir, rid)).read() |
136 |
self.w(rest_publish(self, data)) |
|
137 |
if node is not None: |
|
138 |
self.subsections_links(node) |
|
139 |
self.w(u'<div class="hr"></div>') |
|
140 |
self.navigation_links(node) |
|
141 |
||
142 |
def navigation_links(self, node): |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
143 |
req = self._cw |
0 | 144 |
parent = node.parent |
145 |
if parent is None: |
|
146 |
return |
|
147 |
brothers = subsections(parent) |
|
148 |
self.w(u'<div class="docnav">\n') |
|
149 |
previousidx = brothers.index(node) - 1 |
|
150 |
if previousidx >= 0: |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
151 |
self.navsection(brothers[previousidx], 'prev') |
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
152 |
self.navsection(parent, 'up') |
0 | 153 |
nextidx = brothers.index(node) + 1 |
154 |
if nextidx < len(brothers): |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
155 |
self.navsection(brothers[nextidx], 'next') |
0 | 156 |
self.w(u'</div>\n') |
157 |
||
158 |
navinfo = {'prev': ('', 'data/previous.png', _('i18nprevnext_previous')), |
|
159 |
'next': ('', 'data/next.png', _('i18nprevnext_next')), |
|
160 |
'up': ('', 'data/up.png', _('i18nprevnext_up'))} |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
161 |
|
0 | 162 |
def navsection(self, node, navtype): |
163 |
htmlclass, imgpath, msgid = self.navinfo[navtype] |
|
164 |
self.w(u'<span class="%s">' % htmlclass) |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
165 |
self.w(u'%s : ' % self._cw._(msgid)) |
0 | 166 |
self.w(u'<a href="%s">%s</a>' % ( |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
167 |
self._cw.build_url('doc/'+node.attrib['resource']), |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
168 |
title_for_lang(node, self._cw.lang))) |
0 | 169 |
self.w(u'</span>\n') |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
170 |
|
0 | 171 |
def subsections_links(self, node, first=True): |
172 |
sub = subsections(node) |
|
173 |
if not sub: |
|
174 |
return |
|
175 |
if first: |
|
176 |
self.w(u'<div class="hr"></div>') |
|
177 |
self.w(u'<ul class="docsum">') |
|
178 |
for child in sub: |
|
179 |
self.w(u'<li><a href="%s">%s</a>' % ( |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
180 |
self._cw.build_url('doc/'+child.attrib['resource']), |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
181 |
title_for_lang(child, self._cw.lang))) |
0 | 182 |
self.subsections_links(child, False) |
183 |
self.w(u'</li>') |
|
184 |
self.w(u'</ul>\n') |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
185 |
|
0 | 186 |
|
187 |
||
188 |
class InlineHelpImageView(StartupView): |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
189 |
__regid__ = 'wdocimages' |
731
ac4a94e50b60
some more s/__selectors__/__select__ but still more to come
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
692
diff
changeset
|
190 |
__select__ = match_form_params('fid') |
0 | 191 |
binary = True |
192 |
templatable = False |
|
193 |
content_type = 'image/png' |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
194 |
|
0 | 195 |
def call(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
196 |
fid = self._cw.form['fid'] |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
197 |
for lang in chain((self._cw.lang, self._cw.vreg.property_value('ui.language')), |
4087 | 198 |
self._cw.vreg.config.available_languages()): |
0 | 199 |
rid = join('images', '%s_%s.png' % (fid, lang)) |
4087 | 200 |
resourcedir = self._cw.vreg.config.locate_doc_file(rid) |
0 | 201 |
if resourcedir: |
202 |
break |
|
203 |
else: |
|
204 |
raise NotFound |
|
205 |
self.w(open(join(resourcedir, rid)).read()) |
|
206 |
||
207 |
||
208 |
class ChangeLogView(StartupView): |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
209 |
__regid__ = 'changelog' |
0 | 210 |
title = _('What\'s new?') |
211 |
maxentries = 25 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1364
diff
changeset
|
212 |
|
0 | 213 |
def call(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
214 |
rid = 'ChangeLog_%s' % (self._cw.lang) |
0 | 215 |
allentries = [] |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
216 |
title = self._cw._(self.title) |
0 | 217 |
restdata = ['.. -*- coding: utf-8 -*-', '', title, '='*len(title), ''] |
218 |
w = restdata.append |
|
1364
3acc823121b6
can't compare date and datetime
sylvain.thenault@logilab.fr
parents:
1149
diff
changeset
|
219 |
today = date.today() |
4089
ff92c7d692bf
typos, api update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4087
diff
changeset
|
220 |
for fpath in self._cw.vreg.config.locate_all_files(rid): |
0 | 221 |
cl = ChangeLog(fpath) |
222 |
encoding = 'utf-8' |
|
223 |
# additional content may be found in title |
|
224 |
for line in (cl.title + cl.additional_content).splitlines(): |
|
225 |
m = CHARSET_DECL_RGX.search(line) |
|
226 |
if m is not None: |
|
227 |
encoding = m.group(1) |
|
228 |
continue |
|
229 |
elif line.startswith('.. '): |
|
230 |
w(unicode(line, encoding)) |
|
231 |
for entry in cl.entries: |
|
232 |
if entry.date: |
|
1364
3acc823121b6
can't compare date and datetime
sylvain.thenault@logilab.fr
parents:
1149
diff
changeset
|
233 |
edate = todate(strptime(entry.date, '%Y-%m-%d')) |
0 | 234 |
else: |
1364
3acc823121b6
can't compare date and datetime
sylvain.thenault@logilab.fr
parents:
1149
diff
changeset
|
235 |
edate = today |
0 | 236 |
messages = [] |
237 |
for msglines, submsgs in entry.messages: |
|
238 |
msgstr = unicode(' '.join(l.strip() for l in msglines), encoding) |
|
239 |
msgstr += u'\n\n' |
|
240 |
for submsglines in submsgs: |
|
241 |
msgstr += ' - ' + unicode(' '.join(l.strip() for l in submsglines), encoding) |
|
242 |
msgstr += u'\n' |
|
243 |
messages.append(msgstr) |
|
1132 | 244 |
entry = (edate, messages) |
0 | 245 |
allentries.insert(bisect_right(allentries, entry), entry) |
246 |
latestdate = None |
|
247 |
i = 0 |
|
1132 | 248 |
for edate, messages in reversed(allentries): |
249 |
if latestdate != edate: |
|
3460
e4843535db25
[api] some more _cw / __regid__, automatic tests now pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
250 |
fdate = self._cw.format_date(edate) |
0 | 251 |
w(u'\n%s' % fdate) |
1132 | 252 |
w('~' * len(fdate)) |
1364
3acc823121b6
can't compare date and datetime
sylvain.thenault@logilab.fr
parents:
1149
diff
changeset
|
253 |
latestdate = edate |
0 | 254 |
for msg in messages: |
255 |
w(u'* %s' % msg) |
|
256 |
i += 1 |
|
257 |
if i > self.maxentries: |
|
258 |
break |
|
259 |
w('') # blank line |
|
260 |
self.w(rest_publish(self, '\n'.join(restdata))) |
|
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
261 |
|
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
262 |
|
3818
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
263 |
class HelpAction(action.Action): |
4004
c52619c738a5
api renaming update
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
3890
diff
changeset
|
264 |
__regid__ = 'help' |
3818
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
265 |
__select__ = yes() |
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
266 |
|
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
267 |
category = 'footer' |
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
268 |
order = 0 |
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
269 |
title = _('Help') |
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
270 |
|
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
271 |
def url(self): |
4045
f4a52abb6f4f
cw 3.6 api update
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
4023
diff
changeset
|
272 |
return self._cw.build_url('doc/main') |
3818
9522e51d8644
[web ui] move help from header to footer
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3495
diff
changeset
|
273 |
|
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
274 |
class ChangeLogAction(action.Action): |
3655
af86ab65a282
3.6 updates
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3503
diff
changeset
|
275 |
__regid__ = 'changelog' |
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
276 |
__select__ = yes() |
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
277 |
|
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
278 |
category = 'footer' |
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
279 |
order = 1 |
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
280 |
title = ChangeLogView.title |
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
281 |
|
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
282 |
def url(self): |
3655
af86ab65a282
3.6 updates
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3503
diff
changeset
|
283 |
return self._cw.build_url('changelog') |
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
284 |
|
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
285 |
|
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
286 |
class AboutAction(action.Action): |
3655
af86ab65a282
3.6 updates
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3503
diff
changeset
|
287 |
__regid__ = 'about' |
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
288 |
__select__ = yes() |
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
289 |
|
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
290 |
category = 'footer' |
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
291 |
order = 2 |
6459
7f46ec158c48
[i18n] uniformize footer capitalization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6420
diff
changeset
|
292 |
title = _('About this site') |
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
293 |
|
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
294 |
def url(self): |
3655
af86ab65a282
3.6 updates
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3503
diff
changeset
|
295 |
return self._cw.build_url('doc/about') |
3495
438576c5b1d1
[ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
296 |