Merge branch 'bbmaster' of ssh://git.cy55.de/home/git/cybertools into bbmaster
This commit is contained in:
commit
1a58bb60c6
4 changed files with 22 additions and 14 deletions
|
@ -82,6 +82,7 @@ class Report(Template):
|
|||
queryCriteria = None
|
||||
outputFields = ()
|
||||
sortCriteria = ()
|
||||
limits = None
|
||||
|
||||
|
||||
def __init__(self, name):
|
||||
|
|
|
@ -53,6 +53,7 @@ class Row(BaseRow):
|
|||
def getGroupFields(self):
|
||||
return [self.getRawValue(f.name) for f in
|
||||
self.parent.context.fields if 'group' in f.executionSteps]
|
||||
|
||||
@Lazy
|
||||
def displayedColumns(self):
|
||||
return self.parent.context.getActiveOutputFields()
|
||||
|
@ -78,15 +79,17 @@ class GroupHeaderRow(BaseRow):
|
|||
|
||||
class ResultSet(object):
|
||||
|
||||
def __init__(self, context, data, rowFactory=Row, headerRowFactory=GroupHeaderRow,
|
||||
sortCriteria=None, queryCriteria=BaseQueryCriteria()):
|
||||
|
||||
def __init__(self, context, data,
|
||||
rowFactory=Row, headerRowFactory=GroupHeaderRow,
|
||||
sortCriteria=None, queryCriteria=BaseQueryCriteria(),
|
||||
limits=None):
|
||||
self.context = context # the report or report instance
|
||||
self.data = data
|
||||
self.rowFactory = rowFactory
|
||||
self.headerRowFactory = headerRowFactory
|
||||
self.sortCriteria = sortCriteria
|
||||
self.queryCriteria = queryCriteria
|
||||
self.limits = limits
|
||||
self.totals = BaseRow(None, self)
|
||||
|
||||
def getHeaderRow(self, row, columns):
|
||||
|
@ -105,7 +108,8 @@ class ResultSet(object):
|
|||
result = [self.rowFactory(item, self) for item in self.data]
|
||||
result = [row for row in result if self.queryCriteria.check(row)]
|
||||
if self.sortCriteria:
|
||||
result.sort(key=lambda x: [f.getSortValue(x) for f in self.sortCriteria])
|
||||
result.sort(key=lambda x:
|
||||
[f.getSortValue(x) for f in self.sortCriteria])
|
||||
if self.groupColumns:
|
||||
res = []
|
||||
groupValues = [None for f in self.groupColumns]
|
||||
|
@ -117,6 +121,9 @@ class ResultSet(object):
|
|||
res.append(self.getHeaderRow(row, (f,) + f.outputWith))
|
||||
res.append(row)
|
||||
result = res
|
||||
if self.limits:
|
||||
start, stop = self.limits
|
||||
result = result[start:stop]
|
||||
for idx, row in enumerate(result):
|
||||
row.sequenceNumber = idx + 1
|
||||
return result
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</tal:errors>
|
||||
<tr>
|
||||
<tal:field>
|
||||
<td style="padding: 4px; border-top: none; vertical-align: top"
|
||||
<td style="padding: 4px; border-top: none; vertical-align: top; width: 155px"
|
||||
tal:attributes="title field/description">
|
||||
<b tal:content="field/title">...</b><span
|
||||
tal:condition="field/required"> *</span>
|
||||
|
@ -90,7 +90,7 @@
|
|||
tal:define="width field/width|nothing"
|
||||
tal:attributes="name name; id name;
|
||||
style python:
|
||||
('width: %s;;' % (width and str(width)+'px' or '600px')) +
|
||||
('width: %s;;' % (width and str(width)+'px' or '555px')) +
|
||||
'height: 1.5em;;';
|
||||
value data/?name|string:;
|
||||
xxrequired field/required_js;" />
|
||||
|
@ -119,7 +119,7 @@
|
|||
tal:define="width field/width|nothing"
|
||||
tal:attributes="name name;
|
||||
style python:
|
||||
'width: %s' % (width and str(width)+'px' or '600px');
|
||||
'width: %s' % (width and str(width)+'px' or '555px');
|
||||
value data/?name|string:" />
|
||||
</metal:password>
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
|||
tal:attributes="name name;
|
||||
rows python: height or 3;
|
||||
style python:
|
||||
'width: %s' % (width and str(width)+'px' or '600px');"
|
||||
'width: %s' % (width and str(width)+'px' or '545px');"
|
||||
tal:content="data/?name|string:">
|
||||
</textarea>
|
||||
</metal:textarea>
|
||||
|
@ -178,7 +178,7 @@
|
|||
tal:attributes="name name;
|
||||
rows python: height or 3;
|
||||
style python:
|
||||
'width: %s' % (width and str(width)+'px' or '600px');"
|
||||
'width: %s' % (width and str(width)+'px' or '555px');"
|
||||
tal:content="data/?name|string:" />
|
||||
</metal:list>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<td><a tal:define="userUrl view/userUrl|nothing"
|
||||
tal:omit-tag="not:userUrl"
|
||||
tal:attributes="href userUrl"
|
||||
tal:content="view/userTitle" /></td></tr>
|
||||
tal:content="view/userTitle|string:???" /></td></tr>
|
||||
<tr>
|
||||
<td>Timestamp:</td>
|
||||
<td tal:content="view/timeStamp"></td></tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue