20 """ |
20 """ |
21 |
21 |
22 __docformat__ = "restructuredtext en" |
22 __docformat__ = "restructuredtext en" |
23 _ = unicode |
23 _ = unicode |
24 |
24 |
|
25 from warnings import warn |
|
26 |
25 from logilab.common.deprecation import class_deprecated, class_renamed |
27 from logilab.common.deprecation import class_deprecated, class_renamed |
26 from logilab.mtconverter import xml_escape |
28 from logilab.mtconverter import xml_escape |
27 |
29 |
28 from cubicweb import Unauthorized, role, tags |
30 from cubicweb import Unauthorized, role, tags |
29 from cubicweb.uilib import js, domid |
31 from cubicweb.uilib import js, domid |
219 _('navtop'), _('navbottom'), |
221 _('navtop'), _('navbottom'), |
220 _('navcontenttop'), _('navcontentbottom'), |
222 _('navcontenttop'), _('navcontentbottom'), |
221 _('ctxtoolbar')), |
223 _('ctxtoolbar')), |
222 help=_('context where this component should be displayed')), |
224 help=_('context where this component should be displayed')), |
223 } |
225 } |
|
226 visible = True |
|
227 order = 0 |
224 context = 'left' |
228 context = 'left' |
225 contextual = False |
229 contextual = False |
226 title = None |
230 title = None |
227 |
231 |
228 # XXX support kwargs for compat with old boxes which gets the view as |
232 # XXX support kwargs for compat with old boxes which gets the view as |
229 # argument |
233 # argument |
230 def render(self, w, **kwargs): |
234 def render(self, w, **kwargs): |
|
235 if hasattr(self, 'call'): |
|
236 warn('[3.10] should not anymore implements call on %s, see new CtxComponent api' |
|
237 % self.__class__, DeprecationWarning) |
|
238 self.w = w |
|
239 def wview(__vid, rset=None, __fallback_vid=None, **kwargs): |
|
240 self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs) |
|
241 self.wview = wview |
|
242 self.call(**kwargs) |
|
243 return |
231 getlayout = self._cw.vreg['components'].select |
244 getlayout = self._cw.vreg['components'].select |
232 try: |
245 try: |
233 # XXX ensure context is given when the component is reloaded through |
246 # XXX ensure context is given when the component is reloaded through |
234 # ajax |
247 # ajax |
235 context = self.cw_extra_kwargs['context'] |
248 context = self.cw_extra_kwargs['context'] |