Commit e57f7d2e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch 'master' into 'production'

Release 0.9.5.7

* Identical to 0.9.5.6 but running with ExtJS 6.0.1
* Require plugins `dbui.091` and `extjs.601`
* Build via the script `build-version6` in `w2pext/utilities`

See merge request !75
parents 87e27cdb a49cb1c5
......@@ -2,6 +2,11 @@
HEAD
0.9.5.7 (Aug 2016)
- Same as 0.9.5.6 but running with ExtJS 6.0.1
- Require plugin_dbui 0.9.1 and plugin_extjs 6.0.1
- Build via the script build-version6 in w2pext/utilities
0.9.5.6 (Jul 2016)
- Update to harvest true inspirehep collection like HAL Hidden.
......
0.9.5.6
\ No newline at end of file
0.9.5.7
\ No newline at end of file
......@@ -162,7 +162,11 @@ def edit_insert():
except CheckException:
pass
values['PublicationsFirst_author'] = record.first_author()
fauthor = record.first_author()
if isinstance(fauthor, list):
fauthor = u", ".join(fauthor)
values['PublicationsFirst_author'] = fauthor
values['PublicationsAuthors'] = record.authors()
values['PublicationsAuthors_institute'] = record.my_authors
......
......@@ -148,7 +148,12 @@ if session.role in (ADMIN, USER):
# HELP NODE
#
#-------------------------------------------------------------------------------
aboutLeaf = Panel(autoLoad=URL('plugin_dbui', 'about'), autoScroll=True)
loader = dict(autoLoad=True,
renderer='html',
scripts=False,
url=URL('plugin_dbui', 'about'))
aboutLeaf = Panel(loader=loader, autoScroll=True)
loader = dict(autoLoad=True,
renderer='html',
......
......@@ -107,12 +107,22 @@ class RecordPubli(Record):
break
# the first author is defined not the other one
elif first_author and isinstance(first_author, list):
authors.extend(first_author)
elif first_author:
authors.append(first_author)
authors.append(first_author)
# sometime the first author is missing
if first_author and len(authors) > 0 and first_author != authors[0]:
authors.insert(0, first_author)
if first_author and len(authors) > 0:
if isinstance(first_author, list):
for i in xrange(len(first_author)):
if first_author[i] != authors[i]:
authors.insert(i, first_author[i])
elif first_author != authors[0]:
authors.insert(0, first_author)
return authors
......
......@@ -51,7 +51,7 @@
</a>
</li>
<li class="my-li">
<a href="http://www.sencha.com/" target="_blank">
<a href="https://www.sencha.com/products/extjs" target="_blank">
Ext JS
</a>
</li>
......
......@@ -45,7 +45,8 @@ Ext.onReady(function(){
// Action trigger when the page is refreshed or when the tab is closed.
// NOTE: It should work when the browser is closed to.
// Not working with FireFox 17.0.8, web2py 2.4.5 and Ext JS 3.4.0.
Ext.EventManager.on(window, 'beforeunload', Dbui.closeUserSession);
// nor with Firefox 38, web2py 2.14.6, Ext JS 6.0.1
Ext.getWin().on('beforeunload', Dbui.closeUserSession);
// Instantiate the application
app = Ext.create('Dbui.container.Viewport', Dbui.config.viewport);
......
......@@ -310,6 +310,7 @@ Ext.define('Limbra.wizard.Harvester', {
selectFirst: true,
store: categories,
valueField: 'automaton',
width: '98%',
xtype: 'xcombobox'
}]
};
......@@ -333,6 +334,7 @@ Ext.define('Limbra.wizard.Harvester', {
allowBlank: false,
itemId: 'fieldCollection',
name: 'collection',
width: '98%',
xtype: 'textfield'
}, {
border: false,
......@@ -360,11 +362,13 @@ Ext.define('Limbra.wizard.Harvester', {
allowBlank: false,
itemId: 'fieldCollaboration',
name: 'collaboration',
width: '98%',
xtype: 'textfield'
}, {
border: false,
html: me.textCollaboration2.join(" ")
}]
}],
layout: 'column'
};
return cfg;
......@@ -410,11 +414,13 @@ Ext.define('Limbra.wizard.Harvester', {
itemId: 'fieldPeople',
minimumRows: 4,
name: 'people',
width: 300,
xtype: 'xlistfield'
}, {
border: false,
html: me.textPeople2.join(" ")
}]
}],
layout: 'column'
};
return cfg;
......@@ -446,6 +452,7 @@ Ext.define('Limbra.wizard.Harvester', {
name: 'producer'
}],
vertical: true,
width: '98%',
xtype: 'radiogroup'
}]
};
......@@ -474,6 +481,7 @@ Ext.define('Limbra.wizard.Harvester', {
name: 'project',
store: 'projectsStore',
valueField: 'ProjectsId',
width: '98%',
xtype: 'xcombobox'
}, {
border: false,
......@@ -492,15 +500,13 @@ Ext.define('Limbra.wizard.Harvester', {
cfg,
stores;
stores = {
stores = Ext.create('Ext.data.Store' , {
fields: ['store'],
data: [{
"store": "cds.cern.ch"
}, {
"store": "inspirehep.net"
}],
xtype: 'array'
};
data: [
{"store": "cds.cern.ch"},
{"store": "inspirehep.net"}
]
});
cfg = {
itemId: 'pageStore',
......@@ -516,6 +522,7 @@ Ext.define('Limbra.wizard.Harvester', {
name: 'store',
store: stores,
valueField: 'store',
width: '98%',
xtype: 'combobox'
}]
};
......
......@@ -8,20 +8,13 @@
#--------------------------------------------------------------------------
import json
#
# Export python variables to the javascript
#
jsvars = ["cfg = %s" % json.dumps(cfg),
"form",
"values = %s" % json.dumps(values),
"win"]
jsvars = " var %s;" % ',\n'.join(jsvars)
response.write(SCRIPT(jsvars), escape=False)
}}
<script type="text/javascript">
var cfg = {{=XML(json.dumps(cfg))}},
values = {{=XML(json.dumps(values))}},
form, win;
// create the form and load values
form = Ext.create('Dbui.form.Panel', cfg);
form.setAction('create');
......
......@@ -148,38 +148,6 @@
response.write(P(delta, _style="".join(style)))
#
# Export python variables to the javascript
#
jsvars = ["cfgStatStore = %s" % cfg_statStore,
"cfgLogsStore = %s" % cfg_logsStore,
"divstat = '%s'" % divstat,
"divlogs = '%s'" % divlogs,
"gridStat",
"gridLog",
"menu",
"trAction = '%s'" % T('Action'),
"trAdded = '%s'" % T('Added'),
"trCollection = '%s'" % T('Collection'),
"trEditAndInsert = '%s'" % T('Edit and insert'),
"trError = '%s'" % T('Error'),
"trExisting = '%s'" % T('Existing'),
"trFailure = '%s'" % T('Loading failed'),
"trFound = '%s'" % T('Found'),
"trHost = '%s'" % T('Host'),
"trLoading = '%s'" % T('Loading...'),
"trLost = '%s'" % T('Lost'),
"trModified = '%s'" % T('Modified'),
"trRejected = '%s'" % T('Rejected'),
"trSynonym = '%s'" % T('Synonym'),
"trTitle = '%s'" % T('Title'),
"trTxt ='%s'" % T('Message'),
"trStatistics = '%s'" % T('Statistics'),
"trYear = '%s'" % T('Year')]
jsvars = " var %s;" % ',\n'.join(jsvars)
response.write(SCRIPT(jsvars), escape=False)
}}
<script type="text/javascript">
......@@ -190,11 +158,10 @@
"use strict";
var harvester,
li,
mask,
record = this.gridLog.getSelectionModel().getSelection()[0],
record_id;
var me = this,
gridLog = me,
record = gridLog.getSelectionModel().getSelection()[0],
harvester, li, mask, record_id;
// mask the main ViewPort during the data transfer
//
......@@ -285,6 +252,28 @@
return 'Total';
}
var cfgStatStore = {{=XML(cfg_statStore)}},
cfgLogsStore = {{=XML(cfg_logsStore)}},
trAction = '{{=T("Action")}}',
trAdded = '{{=T("Added")}}',
trCollection = '{{=T("Collection")}}',
trEditAndInsert = '{{=T("Edit and insert")}}',
trError = '{{=T("Error")}}',
trExisting = '{{=T("Existing")}}',
trFailure = '{{=T("Loading failed")}}',
trFound = '{{=T("Found")}}',
trHost = '{{=T("Host")}}',
trLoading = '{{=T("Loading...")}}',
trLost = '{{=T("Lost")}}',
trModified = '{{=T("Modified")}}',
trRejected = '{{=T("Rejected")}}',
trSynonym = '{{=T("Synonym")}}',
trTitle = '{{=T("Title")}}',
trTxt ='{{=T("Message")}}',
trStatistics = '{{=T("Statistics")}}',
trYear = '{{=T("Year")}}',
gridStat, gridLog, menu;
//
// instantiate the grid for the STAT
//
......@@ -300,19 +289,54 @@
renderer: rTitle,
summaryRenderer: rTotal
},
{align: 'right', text: trFound, dataIndex: 'found', flex: 1, summaryType: 'sum'},
{align: 'right', text: trExisting, dataIndex: 'idle', flex: 1, summaryType: 'sum'},
{align: 'right', text: trAdded, dataIndex: 'add', flex: 1, summaryType: 'sum'},
{align: 'right', text: trModified, dataIndex: 'modify', flex: 1, summaryType: 'sum'},
{align: 'right', text: trRejected, dataIndex: 'reject', flex: 1, summaryType: 'sum'},
{align: 'right', text: trLost, dataIndex: 'lost', flex: 1, hidden: true, summaryType: 'sum'},
{align: 'right', text: trError, dataIndex: 'error', flex: 1, hidden: true}
{
align: 'right',
flex: 1,
text: trFound,
dataIndex: 'found',
summaryType: 'sum'
}, {
align: 'right',
flex: 1,
text: trExisting,
dataIndex: 'idle',
summaryType: 'sum'
}, {
align: 'right',
flex: 1,
text: trAdded,
dataIndex: 'add',
summaryType: 'sum'
}, {
align: 'right',
flex: 1,
text: trModified,
dataIndex: 'modify',
summaryType: 'sum'
}, {
align: 'right',
flex: 1,
text: trRejected,
dataIndex: 'reject',
summaryType: 'sum'
}, {
align: 'right',
text: trLost,
dataIndex: 'lost',
hidden: true,
summaryType: 'sum'
}, {
align: 'right',
text: trError,
dataIndex: 'error',
hidden: true
}
],
collapsible: true,
features: [{ftype:'summary'}],
forceFit: true,
padding: "0 40 20 30",
renderTo: divstat
renderTo: '{{=divstat}}'
});
//
......@@ -328,19 +352,19 @@
{text: trTitle, dataIndex: 'title', flex: 3, renderer: rTitle},
{text: trSynonym, dataIndex: 'synonym', flex: 1},
{text: trHost, dataIndex: 'host', flex: 1},
{text: trAction, dataIndex: 'action', flex: 1, hidden: true},
{text: trTxt, dataIndex: 'txt', flex: 1, hidden: true},
{text: trCollection, dataIndex: 'collection', flex: 1, hidden: true},
{text: trYear, dataIndex: 'year', flex: 1, hidden: true},
{text: 'harvester', dataIndex: 'harvester', flex: 1, hidden: true},
{text: 'record_id', dataIndex: 'record_id', flex: 1, hidden: true}
{text: trAction, dataIndex: 'action', hidden: true},
{text: trTxt, dataIndex: 'txt', hidden: true},
{text: trCollection, dataIndex: 'collection', hidden: true},
{text: trYear, dataIndex: 'year', hidden: true},
{text: 'harvester', dataIndex: 'harvester', hidden: true},
{text: 'record_id', dataIndex: 'record_id', hidden: true}
],
features: [
{ftype:'grouping', groupHeaderTpl: '{name}', startCollapsed: true}
],
forceFit: true,
padding: "10 40 20 30",
renderTo: divlogs
renderTo: '{{=divlogs}}'
});
//
......@@ -351,7 +375,7 @@
handler: onEditAndInsert,
iconCls: 'xaction-create',
itemId: 'editAndInsert',
scope: this,
scope: gridLog,
text: trEditAndInsert
}]
});
......@@ -359,15 +383,6 @@
gridLog.on('itemcontextmenu', function(view, record, item, index, event) {
event.stopEvent();
// FIX EXT JS 4.2.1
// In that version the selection of the row is wrong when the grouping
// feature is activated. It has been corrected in 4.2.2.
// The next lines fix this bug.
// (from www.sencha.com/forum/showthread.php?264961-Grid-Grouping-Bug)
index = item.getAttribute('data-recordid');
view.getSelectionModel().select(view.dataSource.data.get(index));
record = view.getSelectionModel().getSelection()[0];
// the editAndInsert action is only available when the record is
// not already in the database
if (record.get('action') === 'idle') {
......
from IPython.parallel.apps.launcher import check_output
{{include 'lists/index.html'}}
{{
import base64
......
......@@ -38,18 +38,13 @@
=BR()
pass
#
# Export python variables to the javascript
#
jsvars = ["cfgStore = %s" % cfg_store,
"columns = []",
"divgrid = '%s'" % divgrid,
"i"]
jsvars = " var %s;" % ',\n'.join(jsvars)
response.write(SCRIPT(jsvars), escape=False)
}}
<script>
<script type="text/javascript">
var cfgStore = {{=XML(cfg_store)}},
columns = [],
divgrid = '{{=divgrid}}',
i;
/**
* Renderer functions
......
......@@ -55,14 +55,15 @@
# modified the content of the row.id
#
for row in logs:
script = "javascript:onGridLogClick(%i)" % row.id
script = "javascript:Limbra.onGridLogClick(%i)" % row.id
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
#
......@@ -192,46 +201,16 @@
response.write(P(delta, _style="".join(style)))
#
# export python variables to the javascript
#
jsvars = ["cfgLogsStore = %s" % cfg_logsStore,
"cfgStatStore = %s" % cfg_statStore,
"fields = %s" % publications_fields,
"trCategory = '%s'" % T('Category'),
"trCollection = '%s'" % T('Collection'),
"trDuplicate = '%s'" % T('Duplicate'),
"trError = '%s'" % T('Error'),
"trId = '%s'" % T('Id'),
"trInvalid = '%s'" % T('Invalid'),
"trProject = '%s'" % T('Project'),
"trRecord = '%s'" % T('Record'),
"trRecords = '%s'" % T('Records'),
"trStatistics = '%s'" % T('Statistics'),
"trStatusOK = '%s'" % T('Status OK'),
"trTitle = '%s'" % T('Title'),
"trUpdate = '%s'" % T('Update'),
"trValidated = '%s'" % T('Validated'),
"trYear = '%s'" % T('Year'),
"urlRead = '%s'" % URL('publications', 'read'),
"urlUpdate = '%s'" % URL('publications', 'update')]
jsvars = " var %s;" % ',\n'.join(jsvars)
response.write(SCRIPT(jsvars), escape=False)
}}
<script type="text/javascript">
var gridLog,
gridStat;
/**
* handler to instantiate the form allowing to modify a publication record.
*
* @param {Number} publicationId
*
*/
function onGridLogClick(publicationId) {
Limbra.onGridLogClick = function (publicationId) {
var actionLoad,
actionSubmit,
......@@ -272,7 +251,7 @@
}],
items: fields,
url: urlUpdate,
width: 420
width: 450
});
formPanel.load(actionLoad);
......@@ -308,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")}}',