Commit 5d792430 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the page Collection.

parent 8daf3716
/**
* Wizard to create an harvester.
*
* The harvester is configures to look for publication in the
* store inspirehpe.net
*
* @since 0.9.3
*
*/
......@@ -25,13 +22,26 @@ Ext.define('Trp.wizard.Harvester', {
"<p>Select the <i>category of publication</i> you are looking for:</p>"
],
textCollection1: [
"<h4> 6/7 collection</h4>",
"<p>Enter the name of the collection:</p>"
],
textCollection2: [
"<p>Collections per experiment, know by <i>cds.cern.ch</i>,",
"can be found at",
"<a href='https://cds.cern.ch/collection/CERN Experiments'",
"target='_blank'>",
"https://cds.cern.ch/collection/CERN Experiments</a>.</p>"
],
textCollaboration1: [
"<h4> 5/7 collaboration</h4>",
"<p>Enter the name of the collaboration:</p>"
],
textCollaboration2: [
"<p>Collaborations, know by the store <i>inspirehep.net</i>,",
"<p>Collaborations, know by <i>inspirehep.net</i>,",
"can be found at",
"<a href='https://inspirehep.net/collection/Experiments'",
"target='_blank'>",
......@@ -106,6 +116,7 @@ Ext.define('Trp.wizard.Harvester', {
me.pageCategory(),
me.pageProducer(),
me.pageCollaborationOrPeople(),
me.pageCollection(),
me.pageProject()
]);
......@@ -115,19 +126,14 @@ Ext.define('Trp.wizard.Harvester', {
// set the default store and trigger the handler onStoreChange
me.down('#fieldStore').setValue('inspirehep.net');
// set the default producer value and trigger the handler onProducerChange
me.down('#fieldProducer').setValue({
producer: "collaboration"
});
},
// jshint strict: true
/**
* Handler call when the collaboration / People is selected
* The method hide the unwanted page and setup
* the allowBlank flag properly.
* Handler calls when the producer of publications is selected.
* It is required using the store inspirehep.net.
* It enables the page collaboration or people.
*
* @param {Ext.form.RadioGroup} radiofield
*
......@@ -164,60 +170,100 @@ Ext.define('Trp.wizard.Harvester', {
}
},
/**
* Handler calls when the store is selected.
* It loads the category store. It enables / disables the pages Producer,
* CollaborationOrPeople and Collections. Finally, it setups the
* allowBlank property.
*
* @param {Ext.field.ComboBox}
*
*/
onStoreChange: function (combo) {
"use strict";
var me = this,
fieldCategory = me.down("#fieldCategory"),
fieldCategory = me.down('#fieldCategory'),
fieldCollaboration = me.down('#fieldCollaboration'),
fieldCollection = me.down('#fieldCollection'),
fieldPeople = me.down('#fieldPeople'),
storeCategory = fieldCategory.getStore(),
selectedStore = combo.getValue();
// choice of category depends on the selected store
fieldCategory.clearValue();
if (selectedStore === "cds.cern.ch") {
storeCategory.loadData([{
"category": "article"
category: "article"
}, {
"category": "note"
category: "note"
}, {
"category": "preprint"
category: "preprint"
}, {
"category": "proceeding"
category: "proceeding"
}, {
"category": "report"
category: "report"
}, {
"category": "talk"
category: "talk"
}, {
"category": "thesis"
category: "thesis"
}]);
} else if (selectedStore === "inspirehep.net") {
storeCategory.loadData([{
"category": "article"
category: "article"
}, {
"category": "proceeding"
category: "proceeding"
}]);
} else {
storeCategory.loadData([]);
}
// wizard pages depends on the selected store
if (selectedStore === "cds.cern.ch") {
me.down('#pageProducer').setDisabled(true);
me.down('#pageCollection').setDisabled(false);
me.down('#pageCollaborationOrPeople').setDisabled(true);
me.down('#pageProducer').setDisabled(true);
} else if (selectedStore === "inspirehep.net") {
me.down('#pageProducer').setDisabled(false);
me.down('#pageCollaborationOrPeople').setDisabled(false);
me.down('#pageCollection').setDisabled(true);
me.down('#pageCollaborationOrPeople').setDisabled(false);
me.down('#pageProducer').setDisabled(false);
}
// Setup of the allowBlank configuration
if (selectedStore === "cds.cern.ch") {
fieldCollection.allowBlank = false;
fieldCollaboration.allowBlank = true;
fieldPeople.allowBlank = true;
} else if (selectedStore === "inspirehep.net") {
fieldCollection.allowBlank = true;
fieldCollaboration.allowBlank = false;
fieldPeople.allowBlank = false;
// set the default producer value and the propert pages / fields
// setting for Collaboration and people (via onProducerChange)
me.down('#fieldProducer').setValue({
producer: "collaboration"
});
}
// initialize the values
fieldCategory.selectFirstItem();
fieldCollaboration.setValue('');
fieldCollection.setValue('');
fieldPeople.setValue([]);
// put the finish button in the disable state
fieldCollaboration.validate();
fieldCollection.validate();
fieldPeople.validate();
},
pageCategory: function () {
......@@ -254,6 +300,32 @@ Ext.define('Trp.wizard.Harvester', {
return cfg;
},
pageCollection: function () {
"use strict";
var me = this,
cfg;
cfg = {
itemId: 'pageCollection',
items: [{
border: false,
html: me.textCollection1.join(" ")
}, {
allowBlank: false,
itemId: 'fieldCollection',
name: 'collection',
xtype: 'textfield'
}, {
border: false,
html: me.textCollection2.join(" ")
}]
};
return cfg;
},
pageCollaboration: function () {
"use strict";
......
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