web/views/basecomponents.py
branchstable
changeset 2312 af4d8f75c5db
parent 2218 b5d00053a7fe
child 2313 2940c2341ae4
equal deleted inserted replaced
2311:f178182b1305 2312:af4d8f75c5db
    13 
    13 
    14 from rql import parse
    14 from rql import parse
    15 
    15 
    16 from cubicweb.selectors import yes, two_etypes_rset, match_form_params
    16 from cubicweb.selectors import yes, two_etypes_rset, match_form_params
    17 from cubicweb.schema import display_name
    17 from cubicweb.schema import display_name
    18 from cubicweb.common.uilib import html_escape, toggle_action
    18 from cubicweb.common.uilib import xml_escape, toggle_action
    19 from cubicweb.web import component
    19 from cubicweb.web import component
    20 from cubicweb.web.htmlwidgets import (MenuWidget, PopupBoxMenu, BoxSeparator,
    20 from cubicweb.web.htmlwidgets import (MenuWidget, PopupBoxMenu, BoxSeparator,
    21                                       BoxLink)
    21                                       BoxLink)
    22 
    22 
    23 VISIBLE_PROP_DEF = {
    23 VISIBLE_PROP_DEF = {
    45 <fieldset>
    45 <fieldset>
    46 <input type="text" id="rql" name="rql" value="%s"  title="%s" tabindex="%s" accesskey="q" class="searchField" />
    46 <input type="text" id="rql" name="rql" value="%s"  title="%s" tabindex="%s" accesskey="q" class="searchField" />
    47 <input type="submit" value="" class="rqlsubmit" tabindex="%s" />
    47 <input type="submit" value="" class="rqlsubmit" tabindex="%s" />
    48 </fieldset>
    48 </fieldset>
    49 ''' % (not self.propval('visible') and 'hidden' or '',
    49 ''' % (not self.propval('visible') and 'hidden' or '',
    50        self.build_url('view'), html_escape(rql), req._('full text or RQL query'), req.next_tabindex(),
    50        self.build_url('view'), xml_escape(rql), req._('full text or RQL query'), req.next_tabindex(),
    51         req.next_tabindex()))
    51         req.next_tabindex()))
    52         if self.req.search_state[0] != 'normal':
    52         if self.req.search_state[0] != 'normal':
    53             self.w(u'<input type="hidden" name="__mode" value="%s"/>'
    53             self.w(u'<input type="hidden" name="__mode" value="%s"/>'
    54                    % ':'.join(req.search_state[1]))
    54                    % ':'.join(req.search_state[1]))
    55         self.w(u'</form></div>')
    55         self.w(u'</form></div>')
   200                     select.add_type_restriction(select.selection[0], etype)
   200                     select.add_type_restriction(select.selection[0], etype)
   201                 newrql = rqlst.as_string(self.req.encoding, self.rset.args)
   201                 newrql = rqlst.as_string(self.req.encoding, self.rset.args)
   202                 url = self.build_url(rql=newrql, __restrrql=restrrql,
   202                 url = self.build_url(rql=newrql, __restrrql=restrrql,
   203                                      __restrtype=etype, __restrtypes=','.join(restrtypes))
   203                                      __restrtype=etype, __restrtypes=','.join(restrtypes))
   204                 html.append(u'<span><a href="%s">%s</a></span>' % (
   204                 html.append(u'<span><a href="%s">%s</a></span>' % (
   205                         html_escape(url), elabel))
   205                         xml_escape(url), elabel))
   206                 rqlst.recover()
   206                 rqlst.recover()
   207         if on_etype:
   207         if on_etype:
   208             url = self.build_url(rql=restrrql)
   208             url = self.build_url(rql=restrrql)
   209             html.insert(0, u'<span><a href="%s">%s</a></span>' % (
   209             html.insert(0, u'<span><a href="%s">%s</a></span>' % (
   210                     url, _('Any')))
   210                     url, _('Any')))