web/views/tableview.py
changeset 2381 caad2367d940
parent 2234 1fbcf202882d
parent 2312 af4d8f75c5db
child 2650 18aec79ec3a3
equal deleted inserted replaced
2374:ea1a44e4ad62 2381:caad2367d940
     8 """
     8 """
     9 __docformat__ = "restructuredtext en"
     9 __docformat__ = "restructuredtext en"
    10 
    10 
    11 from simplejson import dumps
    11 from simplejson import dumps
    12 
    12 
    13 from logilab.mtconverter import html_escape
    13 from logilab.mtconverter import xml_escape
    14 
    14 
    15 from cubicweb.selectors import nonempty_rset, match_form_params
    15 from cubicweb.selectors import nonempty_rset, match_form_params
    16 from cubicweb.utils import make_uid
    16 from cubicweb.utils import make_uid
    17 from cubicweb.view import EntityView, AnyRsetView
    17 from cubicweb.view import EntityView, AnyRsetView
    18 from cubicweb.common.uilib import toggle_action, limitsize, htmlescape
    18 from cubicweb.common.uilib import toggle_action, limitsize, htmlescape
    53         """
    53         """
    54         self.req.add_js( ('cubicweb.ajax.js', 'cubicweb.formfilter.js'))
    54         self.req.add_js( ('cubicweb.ajax.js', 'cubicweb.formfilter.js'))
    55         # drop False / None values from vidargs
    55         # drop False / None values from vidargs
    56         vidargs = dict((k, v) for k, v in vidargs.iteritems() if v)
    56         vidargs = dict((k, v) for k, v in vidargs.iteritems() if v)
    57         self.w(u'<form method="post" cubicweb:facetargs="%s" action="">' %
    57         self.w(u'<form method="post" cubicweb:facetargs="%s" action="">' %
    58                html_escape(dumps([divid, 'table', False, vidargs])))
    58                xml_escape(dumps([divid, 'table', False, vidargs])))
    59         self.w(u'<fieldset id="%sForm" class="%s">' % (divid, hidden and 'hidden' or ''))
    59         self.w(u'<fieldset id="%sForm" class="%s">' % (divid, hidden and 'hidden' or ''))
    60         self.w(u'<input type="hidden" name="divid" value="%s" />' % divid)
    60         self.w(u'<input type="hidden" name="divid" value="%s" />' % divid)
    61         filter_hiddens(self.w, facets=','.join(wdg.facet.id for wdg in fwidgets), baserql=baserql)
    61         filter_hiddens(self.w, facets=','.join(wdg.facet.id for wdg in fwidgets), baserql=baserql)
    62         self.w(u'<table class="filter">\n')
    62         self.w(u'<table class="filter">\n')
    63         self.w(u'<tr>\n')
    63         self.w(u'<tr>\n')
   176 
   176 
   177     def render_actions(self, divid, actions):
   177     def render_actions(self, divid, actions):
   178         box = MenuWidget('', 'tableActionsBox', _class='', islist=False)
   178         box = MenuWidget('', 'tableActionsBox', _class='', islist=False)
   179         label = '<img src="%s" alt="%s"/>' % (
   179         label = '<img src="%s" alt="%s"/>' % (
   180             self.req.datadir_url + 'liveclipboard-icon.png',
   180             self.req.datadir_url + 'liveclipboard-icon.png',
   181             html_escape(self.req._('action(s) on this selection')))
   181             xml_escape(self.req._('action(s) on this selection')))
   182         menu = PopupBoxMenu(label, isitem=False, link_class='actionsBox',
   182         menu = PopupBoxMenu(label, isitem=False, link_class='actionsBox',
   183                             ident='%sActions' % divid)
   183                             ident='%sActions' % divid)
   184         box.append(menu)
   184         box.append(menu)
   185         for url, label, klass, ident in actions:
   185         for url, label, klass, ident in actions:
   186             menu.append(BoxLink(url, label, klass, ident=ident, escape=True))
   186             menu.append(BoxLink(url, label, klass, ident=ident, escape=True))