9 :organization: Logilab |
9 :organization: Logilab |
10 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
10 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
11 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
11 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
12 """ |
12 """ |
13 #from __future__ import with_statement |
13 #from __future__ import with_statement |
14 |
|
15 __docformat__ = "restructuredtext en" |
14 __docformat__ = "restructuredtext en" |
|
15 _ = unicode |
16 |
16 |
17 from rql import nodes |
17 from rql import nodes |
18 |
18 |
19 from logilab.mtconverter import TransformError, html_escape, xml_escape |
19 from logilab.mtconverter import TransformError, html_escape, xml_escape |
20 |
20 |
21 from cubicweb import NoSelectableObject |
21 from cubicweb import NoSelectableObject |
22 from cubicweb.selectors import yes, empty_rset |
22 from cubicweb.selectors import yes, empty_rset |
23 from cubicweb.view import EntityView, AnyRsetView, View |
23 from cubicweb.view import EntityView, AnyRsetView, View |
24 from cubicweb.common.uilib import cut, printable_value |
24 from cubicweb.common.uilib import cut, printable_value |
25 |
25 |
26 _ = unicode |
|
27 |
26 |
28 class NullView(AnyRsetView): |
27 class NullView(AnyRsetView): |
29 """default view when no result has been found""" |
28 """default view when no result has been found""" |
30 id = 'null' |
29 id = 'null' |
31 __select__ = yes() |
30 __select__ = yes() |
202 id = 'incontext' |
201 id = 'incontext' |
203 |
202 |
204 def cell_call(self, row, col): |
203 def cell_call(self, row, col): |
205 entity = self.entity(row, col) |
204 entity = self.entity(row, col) |
206 desc = cut(entity.dc_description(), 50) |
205 desc = cut(entity.dc_description(), 50) |
207 self.w(u'<a href="%s" title="%s">' % (html_escape(entity.absolute_url()), |
206 self.w(u'<a href="%s" title="%s">' % ( |
208 html_escape(desc))) |
207 html_escape(entity.absolute_url()), html_escape(desc))) |
209 self.w(html_escape(self.view('textincontext', self.rset, row=row, col=col))) |
208 self.w(html_escape(self.view('textincontext', self.rset, |
|
209 row=row, col=col))) |
210 self.w(u'</a>') |
210 self.w(u'</a>') |
211 |
211 |
212 |
212 |
213 class OutOfContextView(EntityView): |
213 class OutOfContextView(EntityView): |
214 id = 'outofcontext' |
214 id = 'outofcontext' |
215 |
215 |
216 def cell_call(self, row, col): |
216 def cell_call(self, row, col): |
217 self.w(u'<a href="%s">' % self.entity(row, col).absolute_url()) |
217 entity = self.entity(row, col) |
218 self.w(html_escape(self.view('textoutofcontext', self.rset, row=row, col=col))) |
218 desc = cut(entity.dc_description(), 50) |
|
219 self.w(u'<a href="%s" title="%s">' % ( |
|
220 html_escape(entity.absolute_url()), html_escape(desc))) |
|
221 self.w(html_escape(self.view('textoutofcontext', self.rset, |
|
222 row=row, col=col))) |
219 self.w(u'</a>') |
223 self.w(u'</a>') |
220 |
224 |
221 |
225 |
222 # list views ################################################################## |
226 # list views ################################################################## |
223 |
227 |