Commit 8a36af2c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the wizard AffiliationFromPublication.js.

parent abc68ccb
......@@ -38,9 +38,10 @@ def affiliation_publication():
"""
# shortcuts
vars = request.vars
author_name = vars.author_name
family_name = vars.family_name
first_name = vars.first_name
publication_id = vars.publication_id
store = vars.store
publication_store = vars.publication_store
return
......
......@@ -13,11 +13,12 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
extend: 'Dbui.grid.plugin.ContextMenu',
alias: 'plugin.pGridAffiliationRulesContextMenu',
uses: ['Ext.window.Window',
'Limbra.wizard.AffiliationFromInstituteDb'],
'Limbra.wizard.AffiliationFromInstituteDb',
'Limbra.wizard.AffiliationFromPublication'],
//private
widthFromInstitute: 300,
widthFromPublication: 300,
widthFromInstitute: 350,
widthFromPublication: 350,
// private properties for internationalization
textAddFromInstitute: 'Add one rule from the institute database',
......@@ -107,7 +108,7 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
window = Ext.create('Ext.window.Window', {
closable: true,
items: [],
items: [{xtype: 'xwizardaffiliationfrompublication'}],
layout: 'fit',
modal: true,
title: me.textAddFromPublication + "...",
......
......@@ -18,7 +18,7 @@ Ext.define('Limbra.wizard.AffiliationFromInstituteDb', {
textWelcome: [
"<h4> 1/2 Institute database</h4>",
"<p>The <i>inspirehept</i> database contains one record for each",
"<p>The <i>inspirehep</i> database contains one record for each",
"institute. Records can be consult at",
"<a href='https://inspirehep.net/collection/Institutions'",
"target='_blank'>https://inspirehep.net/collection/Institutions</a>",
......@@ -34,7 +34,7 @@ Ext.define('Limbra.wizard.AffiliationFromInstituteDb', {
],
textIdentifier: [
"<h4> 1/2 Identifier of you Institute</h4>",
"<h4> 2/2 Identifier of you Institute</h4>",
"<p>Open the record of your institute an have look to its hyperlink.",
"The hyperlink contains the identifier of your institute, namely ",
"the number after the keyword <i>record</i>.</p>",
......@@ -81,6 +81,7 @@ Ext.define('Limbra.wizard.AffiliationFromInstituteDb', {
itemId: 'fieldInstId',
minValue: 1,
name: 'institute_id',
padding: '0 0 20 0',
width: '98%',
xtype: 'numberfield'
}]
......
/**
* Wizard to create an affiliation rule from a given publication.
*
* @since 0.9.6
*
*/
Ext.define('Limbra.wizard.AffiliationFromPublication', {
extend: 'Dbui.wizard.Wizard',
alias: 'widget.xwizardaffiliationfrompublication',
uses: [
'Ext.form.field.ComboBox',
'Ext.form.field.Number',
'Ext.form.field.Text'
],
url: 'wizards/affiliation_publication',
// private properties for internationalisation
textWelcome: [
"<h4> 1/3 Publication store</h4>",
"<p>In the stores <i>inspirehep.net</i> or <i>cds.cern.ch</i>",
"the affiliation is defined for each author and for each ",
"publication.</p>",
"The wizard will find the definition of the affiliation for your ",
"institute using a given publication and a given author.</p>",
"Keep in mind that rule(s) defining your affiliation might depend on",
"the store, the collection, <i>etc</i>.",
"<p>Click on the button <i>Next</i> or <i>Previous</i> to navigate",
"between the wizard pages.",
"At the end click on the button <i>Finish</i>.</p>",
"<p>The <i>Finish</i> button is enable ",
"when all fields are defined.</p>"
],
textPublication1: [
"<h4> 2/3 Select the publication</h4>",
"<p>A publication is referenced by a store and a local identifier.",
"All these information are defined in the hyperlink pointing to",
"the publication.</p>",
"<p>For the publication: ",
"<a href='http://cds.cern.ch/record/2157071'",
"target='_blank'>http://cds.cern.ch/record/2157071</a>",
"the store is <i>cds.cern.ch</i> and its identifier <i>2157071</i>.",
"</p>",
"<p>Please select a store:</p>"
],
textPublication2: [
"<p>Please select a publication identifier:</p>"
],
textAuthor: [
"<h4> 3/3 Select the author</h4>",
],
// jshint strict: false
// private method requires by the Ext JS component model
initComponent: function () {
var me = this;
//initialise the base class
me.callParent(arguments);
// add the pages
me.add([
me.pageWelcome(),
me.pagePublication(),
me.pageAuthor()
]);
},
// jshint strict: true
pageAuthor: function () {
"use strict";
var me = this,
cfg;
cfg = {
itemId: 'pageAuthor',
items: [{
border: false,
html: me.textAuthor.join(" ")
}, {
allowBlank: false,
fieldLabel: 'Family name:',
itemId: 'fieldFamilyName',
name: 'family_name',
padding: '0 0 20 0',
width: '98%',
xtype: 'textfield'
}, {
allowBlank: false,
fieldLabel: 'First name:',
itemId: 'fieldFirstName',
name: 'first_name',
padding: '0 0 20 0',
width: '98%',
xtype: 'textfield'
}]
};
return cfg;
},
pagePublication: function () {
"use strict";
var me = this,
cfg,
stores;
stores = Ext.create('Ext.data.Store' , {
fields: ['store'],
data: [
{"store": "cds.cern.ch"},
{"store": "inspirehep.net"}
]
});
cfg = {
itemId: 'pagePublication',
items: [{
border: false,
html: me.textPublication1.join(" ")
}, {
allowBlank: false,
displayField: 'store',
itemId: 'fieldStore',
editable: false,
queryMode: 'local',
name: 'publication_store',
store: stores,
valueField: 'store',
width: '98%',
xtype: 'combobox'
}, {
border: false,
html: me.textPublication2.join(" ")
}, {
allowBlank: false,
allowDecimal: false,
itemId: 'fieldPubId',
minValue: 1,
name: 'publication_id',
padding: 'O 0 20 0',
width: '98%',
xtype: 'numberfield'
}]
};
return cfg;
},
pageWelcome: function () {
"use strict";
var me = this,
cfg;
cfg = {
itemId: 'pageWelcome',
items: [{
border: false,
html: me.textWelcome.join(" ")
}]
};
return cfg;
}
});
\ 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