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

Add the wizard AffiliationFromInstituteDb.js.

parent 0e134da4
......@@ -22,6 +22,29 @@ MSG_NO_AUTHORS = "<br><br>Removing affiliation failed.<br>"\
"Use INSPIRES instead with the tool 'insert MARCXML'"
def affiliation_institute():
"""Build affiliation rule form the institute database.
"""
# shortcuts
institute_id = request.vars.institute_id
return
def affiliation_publication():
"""Build affiliation rule form a given publication.
"""
# shortcuts
vars = request.vars
author_name = vars.author_name
publication_id = vars.publication_id
store = vars.store
return
def check_validate():
"""Check and validate publication records.
......
/**
* The plugin instantiating the context menu for the Affiliation_rules grid.
*
* Display the context menu when the user right click on a row.
* The content of the menu allows to run the wizard "add from publication"
* and "add from institute database" as well as to delete an entry.
* The menu allows to run the wizard "add rule from publication"
* and "add rule institute database" as well as to delete any rules.
*
* @uses Dbui.grid.plugin.RowEditorBase
* @since 0.9.6
......@@ -13,12 +12,20 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
extend: 'Dbui.grid.plugin.ContextMenu',
alias: 'plugin.pGridAffiliationRulesContextMenu',
uses: ['Ext.window.Window',
'Limbra.wizard.AffiliationFromInstituteDb'],
//private
widthFromInstitute: 300,
widthFromPublication: 300,
// private properties for internationalization
textAddFromInstitute: 'Add rule(s) from the institute database',
textAddFromPublication: 'Add a rule from a publication',
textAddFromInstitute: 'Add one rule from the institute database',
textAddFromPublication: 'Add one rule from a given publication',
textDestroy: 'Delete a rule',
// jshint strict: false
/**
* Initialize the plugin.
*
......@@ -26,8 +33,6 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
*/
init: function (grid) {
"use strict";
var me = this,
rowEditor = grid.getPlugin('rowEditor');
......@@ -59,6 +64,8 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
me.callParent(arguments);
},
// jshint strict: true
/**
* Add rule(s) from the institute database
*
......@@ -66,8 +73,26 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
onAddFromInstitute: function () {
"use strict";
var me = this,
window;
window = Ext.create('Ext.window.Window', {
closable: true,
items: [{xtype: 'xwizardaffiliationfrominstitute'}],
layout: 'fit',
modal: true,
title: me.textAddFromInstitute + "...",
width: me.widthFromInstitute
});
// the window is close when the wizard transaction is succesful or
// when the user quit. The close event is used to update the grid
// content with the new value
window.on('close', me.onWindowClose, me, {
single: true
});
Ext.Msg.alert("Warning", "not yet implemented !!!");
window.show();
},
/**
......@@ -77,7 +102,39 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
onAddFromPublication: function () {
"use strict";
var me = this,
window;
window = Ext.create('Ext.window.Window', {
closable: true,
items: [],
layout: 'fit',
modal: true,
title: me.textAddFromPublication + "...",
width: me.widthFromPublication
});
// the window is close when the wizard transaction is succesful or
// when the user quit. The close event is used to update the grid
// content with the new value
window.on('close', me.onWindowClose, me, {
single: true
});
window.show();
},
/**
* Handler to update the grid content with the new value
* once the transaction is complete.
*
*/
onWindowClose: function () {
"use strict";
var me = this,
store = me.getCmp().getStore();
Ext.Msg.alert("Warning", "not yet implemented");
store.reload();
}
});
\ No newline at end of file
/**
* Wizard to create an affiliation rule from the institute database.
*
* @since 0.9.6
*
*/
Ext.define('Limbra.wizard.AffiliationFromInstituteDb', {
extend: 'Dbui.wizard.Wizard',
alias: 'widget.xwizardaffiliationfrominstitute',
uses: [
'Ext.form.field.Number'
],
url: 'wizards/affiliation_institute',
// private properties for internationalisation
textWelcome: [
"<h4> 1/2 Institute database</h4>",
"<p>The <i>inspirehept</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>",
"<p>Each record has the definition for the affiliation uses by",
"the stores <i>inspirehep.net</i> and <i>cds.cern.ch</i>.",
"The wizard will find the definition for you institute and it ",
"will load it as an affiliation rule.",
"<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>"
],
textIdentifier: [
"<h4> 1/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>",
"<p>For example, the hyperlink for the CPPM record is ",
"<a href='https://inspirehep.net/record/902989'",
"target='_blank'>https://inspirehep.net/record/902989</a> and",
"its identifier is <i>902989</i>.</p>",
"Please enter the identifier of your institute:"
],
// 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.pageIdentifier()
]);
},
// jshint strict: true
pageIdentifier: function () {
"use strict";
var me = this,
cfg;
cfg = {
itemId: 'pageIdentifer',
items: [{
border: false,
html: me.textIdentifier.join(" ")
}, {
allowBlank: false,
allowDecimal: false,
itemId: 'fieldInstId',
minValue: 1,
name: 'institute_id',
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