85 return i |
85 return i |
86 except KeyError: # XXX possible? |
86 except KeyError: # XXX possible? |
87 continue |
87 continue |
88 return None |
88 return None |
89 |
89 |
90 def displaycols(self, displaycols): |
90 def displaycols(self, displaycols, headers): |
91 if displaycols is None: |
91 if displaycols is None: |
92 if 'displaycols' in self._cw.form: |
92 if 'displaycols' in self._cw.form: |
93 displaycols = [int(idx) for idx in self._cw.form['displaycols']] |
93 displaycols = [int(idx) for idx in self._cw.form['displaycols']] |
|
94 elif headers is not None: |
|
95 displaycols = range(len(headers)) |
94 else: |
96 else: |
95 displaycols = range(len(self.cw_rset.syntax_tree().children[0].selection)) |
97 displaycols = range(len(self.cw_rset.syntax_tree().children[0].selection)) |
96 return displaycols |
98 return displaycols |
97 |
99 |
98 def call(self, title=None, subvid=None, displayfilter=None, headers=None, |
100 def call(self, title=None, subvid=None, displayfilter=None, headers=None, |
125 displayfilter = True |
127 displayfilter = True |
126 if req.form['displayfilter'] == 'shown': |
128 if req.form['displayfilter'] == 'shown': |
127 hidden = False |
129 hidden = False |
128 if displayactions is None and 'displayactions' in req.form: |
130 if displayactions is None and 'displayactions' in req.form: |
129 displayactions = True |
131 displayactions = True |
130 displaycols = self.displaycols(displaycols) |
132 displaycols = self.displaycols(displaycols, headers) |
131 fromformfilter = 'fromformfilter' in req.form |
133 fromformfilter = 'fromformfilter' in req.form |
132 # if fromformfilter is true, this is an ajax call and we only want to |
134 # if fromformfilter is true, this is an ajax call and we only want to |
133 # replace the inner div, so don't regenerate everything under the if |
135 # replace the inner div, so don't regenerate everything under the if |
134 # below |
136 # below |
135 if not fromformfilter: |
137 if not fromformfilter: |
295 def call(self, title=None, subvid=None, headers=None, divid=None, |
297 def call(self, title=None, subvid=None, headers=None, divid=None, |
296 displaycols=None, displayactions=None, mainindex=None): |
298 displaycols=None, displayactions=None, mainindex=None): |
297 """Dumps a table displaying a composite query""" |
299 """Dumps a table displaying a composite query""" |
298 actrql = self._cw.form['actualrql'] |
300 actrql = self._cw.form['actualrql'] |
299 self._cw.ensure_ro_rql(actrql) |
301 self._cw.ensure_ro_rql(actrql) |
300 displaycols = self.displaycols(displaycols) |
302 displaycols = self.displaycols(displaycols, headers) |
301 if displayactions is None and 'displayactions' in self._cw.form: |
303 if displayactions is None and 'displayactions' in self._cw.form: |
302 displayactions = True |
304 displayactions = True |
303 if divid is None and 'divid' in self._cw.form: |
305 if divid is None and 'divid' in self._cw.form: |
304 divid = self._cw.form['divid'] |
306 divid = self._cw.form['divid'] |
305 self.w(u'<div class="section">') |
307 self.w(u'<div class="section">') |