70 else: |
70 else: |
71 displaycols = range(len(self.rset.syntax_tree().children[0].selection)) |
71 displaycols = range(len(self.rset.syntax_tree().children[0].selection)) |
72 return displaycols |
72 return displaycols |
73 |
73 |
74 def call(self, title=None, subvid=None, displayfilter=None, headers=None, |
74 def call(self, title=None, subvid=None, displayfilter=None, headers=None, |
75 displaycols=None, displayactions=None, actions=(), |
75 displaycols=None, displayactions=None, actions=(), divid=None, |
76 cellvids=None, cellattrs=None): |
76 cellvids=None, cellattrs=None): |
77 """Dumps a table displaying a composite query |
77 """Dumps a table displaying a composite query |
78 |
78 |
79 :param title: title added before table |
79 :param title: title added before table |
80 :param subvid: cell view |
80 :param subvid: cell view |
91 rqlstdescr = rqlst.get_description()[0] # XXX missing Union support |
91 rqlstdescr = rqlst.get_description()[0] # XXX missing Union support |
92 mainindex = self.main_var_index() |
92 mainindex = self.main_var_index() |
93 hidden = True |
93 hidden = True |
94 if not subvid and 'subvid' in req.form: |
94 if not subvid and 'subvid' in req.form: |
95 subvid = req.form.pop('subvid') |
95 subvid = req.form.pop('subvid') |
96 divid = req.form.get('divid') or 'rs%s' % make_uid(id(rset)) |
96 divid = divid or req.form.get('divid') or 'rs%s' % make_uid(id(rset)) |
97 actions = list(actions) |
97 actions = list(actions) |
98 if mainindex is None: |
98 if mainindex is None: |
99 displayfilter, displayactions = False, False |
99 displayfilter, displayactions = False, False |
100 else: |
100 else: |
101 if displayfilter is None and 'displayfilter' in req.form: |
101 if displayfilter is None and 'displayfilter' in req.form: |
206 elif coltype is not None and self.schema.eschema(coltype).is_final(): |
206 elif coltype is not None and self.schema.eschema(coltype).is_final(): |
207 column.append_renderer(self.finalview, colindex) |
207 column.append_renderer(self.finalview, colindex) |
208 else: |
208 else: |
209 column.append_renderer(subvid or 'incontext', colindex) |
209 column.append_renderer(subvid or 'incontext', colindex) |
210 |
210 |
211 |
|
212 if cellattrs and colindex in cellattrs: |
211 if cellattrs and colindex in cellattrs: |
213 for name, value in cellattrs[colindex].iteritems(): |
212 for name, value in cellattrs[colindex].iteritems(): |
214 column.add_attr(name,value) |
213 column.add_attr(name,value) |
215 # add column |
214 # add column |
216 columns.append(column) |
215 columns.append(column) |
289 form_params = ('actualrql',) |
288 form_params = ('actualrql',) |
290 # should not be displayed in possible view since it expects some specific |
289 # should not be displayed in possible view since it expects some specific |
291 # parameters |
290 # parameters |
292 title = None |
291 title = None |
293 |
292 |
294 def call(self, title=None, subvid=None, headers=None, |
293 def call(self, title=None, subvid=None, headers=None, divid=None, |
295 displaycols=None, displayactions=None): |
294 displaycols=None, displayactions=None): |
296 """Dumps a table displaying a composite query""" |
295 """Dumps a table displaying a composite query""" |
297 actrql = self.req.form['actualrql'] |
296 actrql = self.req.form['actualrql'] |
298 self.ensure_ro_rql(actrql) |
297 self.ensure_ro_rql(actrql) |
299 displaycols = self.displaycols(displaycols) |
298 displaycols = self.displaycols(displaycols) |
300 if displayactions is None and 'displayactions' in self.req.form: |
299 if displayactions is None and 'displayactions' in self.req.form: |
301 displayactions = True |
300 displayactions = True |
|
301 if divid is None and 'divid' in self.req.form: |
|
302 divid = self.req.form['divid'] |
302 self.w(u'<div class="section">') |
303 self.w(u'<div class="section">') |
303 if not title and 'title' in self.req.form: |
304 if not title and 'title' in self.req.form: |
304 # pop title so it's not displayed by the table view as well |
305 # pop title so it's not displayed by the table view as well |
305 title = self.req.form.pop('title') |
306 title = self.req.form.pop('title') |
306 if title: |
307 if title: |
315 facets = list(self.vreg.possible_vobjects('facets', self.req, self.rset, |
316 facets = list(self.vreg.possible_vobjects('facets', self.req, self.rset, |
316 context='tablefilter', |
317 context='tablefilter', |
317 filtered_variable=mainvar)) |
318 filtered_variable=mainvar)) |
318 |
319 |
319 if facets: |
320 if facets: |
320 divid = self.req.form.get('divid', 'filteredTable') |
|
321 self.generate_form(divid, baserql, facets, |
321 self.generate_form(divid, baserql, facets, |
322 vidargs={'displaycols': displaycols, |
322 vidargs={'displaycols': displaycols, |
323 'displayactions': displayactions, |
323 'displayactions': displayactions, |
324 'displayfilter': True}) |
324 'displayfilter': True}) |
325 actions = self.show_hide_actions(divid, False) |
325 actions = self.show_hide_actions(divid, False) |
327 if not subvid and 'subvid' in self.req.form: |
327 if not subvid and 'subvid' in self.req.form: |
328 subvid = self.req.form.pop('subvid') |
328 subvid = self.req.form.pop('subvid') |
329 self.view('table', self.req.execute(actrql), |
329 self.view('table', self.req.execute(actrql), |
330 'noresult', w=self.w, displayfilter=False, subvid=subvid, |
330 'noresult', w=self.w, displayfilter=False, subvid=subvid, |
331 displayactions=displayactions, displaycols=displaycols, |
331 displayactions=displayactions, displaycols=displaycols, |
332 actions=actions, headers=headers) |
332 actions=actions, headers=headers, divid=divid) |
333 self.w(u'</div>\n') |
333 self.w(u'</div>\n') |
334 |
334 |
335 |
335 |
336 class EditableInitiableTableView(InitialTableView): |
336 class EditableInitiableTableView(InitialTableView): |
337 id = 'editable-initialtable' |
337 id = 'editable-initialtable' |