Commit 5409c21d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update the view check_validate to remove flex configuration for hidden column...

Update the view check_validate to remove flex configuration for hidden column in grid and to improve the coding.
parent 0a4a5d30
......@@ -59,10 +59,11 @@
row.id = str(A(row.id, _href=script))
pass
#.........................................................................
#
# configure the Ext.data.Array for the statistics
#
cfg = dict(sorters=['project'])
cfg = dict(sorters=['project'], data=[])
cfg['fields'] = [{'name': 'records', 'type': 'int'},
{'name': 'ok', 'type': 'int'},
......@@ -70,20 +71,25 @@
{'name': 'validated', 'type': 'int'},
{'name': 'error', 'type': 'int'}]
cfg['data'] = []
for project in counters:
counter = counters[project]
error = counter.found - counter.ok - counter.validated
cfg['data'].append([counter.found, counter.ok, project, counter.validated, error])
record = [counter.found,
counter.ok,
project,
counter.validated,
error]
cfg['data'].append(record)
pass
cfg_statStore = json.dumps(cfg)
#.........................................................................
#
# configure the Ext.data.Array for the logs
#
cfg = dict(groupField='txt',
cfg = dict(data=[],
groupField='txt',
sorters=['txt', 'title'])
cfg['fields'] = [{'name': 'category', 'type': 'string'},
......@@ -94,22 +100,22 @@
{'name': 'txt', 'type': 'string'},
{'name': 'year', 'type': 'int'}]
cfg['data'] = []
for row in logs:
for txt in row.txt:
cfg['data'].append([row.category,
row.id,
','.join(row.ids),
row.project,
row.title,
txt,
row.year])
record = [row.category,
row.id,
','.join(row.ids),
row.project,
row.title,
txt,
row.year]
cfg['data'].append(record)
pass
pass
cfg_logsStore = json.dumps(cfg)
#.........................................................................
#
# configure the field name for the Ext.form.Panel
#
......@@ -136,6 +142,7 @@
publications_fields = json.dumps(items)
#.........................................................................
#
# the title of the HTML page
#
......@@ -170,15 +177,17 @@
response.write(P(title, _style="".join(style)))
#.........................................................................
#
# the DIV block, one for each grid
#
divlogs = id(cfg_logsStore)
divstat = id(cfg_statStore)
divlogs = "grid-%s" % id(cfg_logsStore)
divstat = "grid-%s" % id(cfg_statStore)
response.write(DIV(_id="grid-%s" % divstat))
response.write(DIV(_id="grid-%s" % divlogs))
response.write(DIV(_id=divstat))
response.write(DIV(_id=divlogs))
#.........................................................................
#
# the HTML page footer: processing time of the request
#
......@@ -195,28 +204,6 @@
}}
<script type="text/javascript">
var cfgLogsStore = {{=XML(cfg_logsStore)}},
cfgStatStore = {{=XML(cfg_statStore)}},
fields = {{=XML(publications_fields)}},
trCategory = '{{=T("Category")}}',
trCollection = '{{=T("Collection")}}',
trDuplicate = '{{=T("Duplicate")}}',
trError = '{{=T("Error")}}',
trId = '{{=T("Id")}}',
trInvalid = '{{=T("Invalid")}}',
trProject = '{{=T("Project")}}',
trRecord = '{{=T("Record")}}',
trRecords = '{{=T("Records")}}',
trStatistics = '{{=T("Statistics")}}',
trStatusOK = '{{=T("Status OK")}}',
trTitle = '{{=T("Title")}}',
trUpdate = '{{=T("Update")}}',
trValidated = '{{=T("Validated")}}',
trYear = '{{=T("Year")}}',
urlRead = '{{=URL("publications", "read")}}',
urlUpdate = '{{=URL("publications", "update")}}',
gridLog, gridStat;
/**
* handler to instantiate the form allowing to modify a publication record.
*
......@@ -300,6 +287,28 @@
return 'Total';
}
var cfgLogsStore = {{=XML(cfg_logsStore)}},
cfgStatStore = {{=XML(cfg_statStore)}},
fields = {{=XML(publications_fields)}},
trCategory = '{{=T("Category")}}',
trCollection = '{{=T("Collection")}}',
trDuplicate = '{{=T("Duplicate")}}',
trError = '{{=T("Error")}}',
trId = '{{=T("Id")}}',
trInvalid = '{{=T("Invalid")}}',
trProject = '{{=T("Project")}}',
trRecord = '{{=T("Record")}}',
trRecords = '{{=T("Records")}}',
trStatistics = '{{=T("Statistics")}}',
trStatusOK = '{{=T("Status OK")}}',
trTitle = '{{=T("Title")}}',
trUpdate = '{{=T("Update")}}',
trValidated = '{{=T("Validated")}}',
trYear = '{{=T("Year")}}',
urlRead = '{{=URL("publications", "read")}}',
urlUpdate = '{{=URL("publications", "update")}}',
gridLog, gridStat;
//
// instantiate the grid showing the statistics
//
......@@ -307,31 +316,51 @@
title: trStatistics,
store: Ext.create('Ext.data.ArrayStore', cfgStatStore),
columns: [
{xtype: 'rownumberer'},
{text: trProject, dataIndex: 'project', flex: 2, summaryRenderer: rTotal},
{text: trRecords, dataIndex: 'records', flex: 1, summaryType: 'sum'},
{text: trStatusOK, dataIndex: 'ok', flex: 1, summaryType: 'sum'},
{text: trValidated, dataIndex: 'validated', flex: 1, summaryType: 'sum'},
{text: trInvalid, dataIndex: 'error', flex: 1, summaryType: 'sum'}
{
xtype: 'rownumberer'
}, {
text: trProject,
dataIndex: 'project',
flex: 2,
summaryRenderer: rTotal
}, {
text: trRecords,
dataIndex: 'records',
flex: 1,
summaryType: 'sum'
}, {
text: trStatusOK,
dataIndex: 'ok',
flex: 1,
summaryType: 'sum'
}, {
text: trValidated,
dataIndex: 'validated',
flex: 1,
summaryType: 'sum'
}, {
text: trInvalid,
dataIndex: 'error',
flex: 1,
summaryType: 'sum'
}
],
collapsible: true,
forceFit: true,
features: [{ftype:'summary'}],
padding: "0 40 20 30",
renderTo: 'grid-{{=divstat}}'
renderTo: '{{=divstat}}'
});
//
// instantiate the grid showing the log for each publication.
// the row are group per error and sorted by title.
// double click on a row display the form to modify the publication record.
//
gridLog = Ext.create('Ext.grid.Panel', {
store: Ext.create('Ext.data.ArrayStore', cfgLogsStore),
columns: [
{xtype: 'rownumberer'},
{text: trTitle, dataIndex: 'title', flex: 3},
{text: trError, dataIndex: 'txt', flex: 1, hidden: true},
{text: trError, dataIndex: 'txt', hidden: true},
{text: trId, dataIndex: 'id', flex: 0.2},
{text: trDuplicate, dataIndex: 'ids', flex: 0.4},
{text: trCategory, dataIndex: 'category', flex: 0.2},
......@@ -343,7 +372,7 @@
],
forceFit: true,
padding: "10 40 20 30",
renderTo: 'grid-{{=divlogs}}'
renderTo: '{{=divlogs}}'
});
</script>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment