[web/basecomponents] remove EtypeRestrictionComponent
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 17 Feb 2014 14:10:53 +0100
changeset 9552 1358f8ef1b5b
parent 9551 cbc46f94081d
child 9553 be9b12f42d76
[web/basecomponents] remove EtypeRestrictionComponent Closes #3119951
doc/3.19.rst
web/views/basecomponents.py
--- a/doc/3.19.rst	Fri Feb 14 12:03:20 2014 +0100
+++ b/doc/3.19.rst	Mon Feb 17 14:10:53 2014 +0100
@@ -148,3 +148,7 @@
 ----------------------
 
 * session.hijack_user mechanism has been dropped.
+
+* EtypeRestrictionComponent has been removed, its functionality has been
+  replaced by facets a while ago.
+
--- a/web/views/basecomponents.py	Fri Feb 14 12:03:20 2014 +0100
+++ b/web/views/basecomponents.py	Mon Feb 17 14:10:53 2014 +0100
@@ -200,57 +200,6 @@
         self.w(u'</div>')
 
 
-class EtypeRestrictionComponent(component.Component):
-    """displays the list of entity types contained in the resultset
-    to be able to filter accordingly.
-    """
-    __regid__ = 'etypenavigation'
-    __select__ = multi_etypes_rset() | match_form_params(
-        '__restrtype', '__restrtypes', '__restrrql')
-    cw_property_defs = VISIBLE_PROP_DEF
-    # don't want user to hide this component using an cwproperty
-    site_wide = True
-    visible = False # disabled by default
-
-    def call(self):
-        _ = self._cw._
-        self.w(u'<div id="etyperestriction">')
-        restrtype = self._cw.form.get('__restrtype')
-        restrtypes = self._cw.form.get('__restrtypes', '').split(',')
-        restrrql = self._cw.form.get('__restrrql')
-        if not restrrql:
-            rqlst = self.cw_rset.syntax_tree()
-            restrrql = rqlst.as_string(self._cw.encoding, self.cw_rset.args)
-            restrtypes = self.cw_rset.column_types(0)
-        else:
-            rqlst = parse(restrrql)
-        html = []
-        on_etype = False
-        etypes = sorted((display_name(self._cw, etype).capitalize(), etype)
-                        for etype in restrtypes)
-        for elabel, etype in etypes:
-            if etype == restrtype:
-                html.append(u'<span class="selected">%s</span>' % elabel)
-                on_etype = True
-            else:
-                rqlst.save_state()
-                for select in rqlst.children:
-                    select.add_type_restriction(select.selection[0].variable, etype)
-                newrql = rqlst.as_string(self._cw.encoding, self.cw_rset.args)
-                url = self._cw.build_url(rql=newrql, __restrrql=restrrql,
-                                         __restrtype=etype, __restrtypes=','.join(restrtypes))
-                html.append(u'<span><a href="%s">%s</a></span>' % (
-                        xml_escape(url), elabel))
-                rqlst.recover()
-        if on_etype:
-            url = self._cw.build_url(rql=restrrql)
-            html.insert(0, u'<span><a href="%s">%s</a></span>' % (
-                    url, _('Any')))
-        else:
-            html.insert(0, u'<span class="selected">%s</span>' % _('Any'))
-        self.w(u'&#160;|&#160;'.join(html))
-        self.w(u'</div>')
-
 # contextual components ########################################################