Commit 681f09c6 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Basic elements and logic to run a wizard.

parent 2737167b
......@@ -233,6 +233,14 @@ if session.role in (ADMIN, USER):
baseUrl=URL('harvest', 'edit_insert'),
selectorTitle='Fill all fields')
harvesterLeaf = Window(closable=True,
height=300,
items=[dict(xtype='xwizardharvester')],
layout='fit',
modal=True,
title='Wizard to Create an harvester...',
width=400)
marc12Leaf = PanelWithUrlSelector(virtdb.marc12_selector,
selectorTitle='Fill all fields',
baseUrl=URL('harvest', 'insert_marcxml'))
......@@ -243,6 +251,7 @@ if session.role in (ADMIN, USER):
if session.role == ADMIN:
wizardNode.add_child(T('check and validate'), checkLeaf)
wizardNode.add_child('Create an harvester', harvesterLeaf)
else:
wizardNode.add_child(T('check'), checkLeaf)
......
/**
* Wizard to create an harvester looking for publication in the
* store inspirehpe.net
*
*/
Ext.define('App.panel.WizardHarvester', {
extend: 'Ext.panel.Panel',
alias: 'widget.xwizardharvester',
// predefine configuration options
bodyStyle: 'padding:15px',
buttons: [{
disabled: true,
itemId: 'buttonPrev',
text: 'previous'
}, {
itemId: 'buttonNext',
text: 'next'
}, {
disabled: true,
itemId: 'buttonFinish',
text: 'finish'
}],
defaults: {
border: false
},
layout: 'card',
// private properties for navigation
buttonFinish: null,
buttonNext: null,
burronPrev: null,
currentPage: 0,
lastPage: 0,
// private properties for internationalisation
// private method requires by the Ext JS component model
initComponent: function (config) {
var me = this,
toolbar;
me.items = [
me.configurePage0(),
me.configurePage1()];
//initialise the base class
me.callParent(arguments);
// short cuts
toolbar = me.getDockedItems()[0];
me.buttonFinish = toolbar.getComponent('buttonFinish');
me.buttonNext = toolbar.getComponent('buttonNext');
me.buttonPrev = toolbar.getComponent('buttonPrev');
me.lastPage = me.items.length - 1;
// handler for navigation
me.buttonNext.setHandler(function(){me.navigate(1);}, me);
me.buttonPrev.setHandler(function(){me.navigate(-1);}, me);
},
configurePage0: function() {
"use strict";
var cfg,
me = this;
cfg = {
html: 'Hello word',
title: 'Introduction'
};
return cfg;
},
configurePage1: function() {
"use strict";
var cfg,
me = this;
cfg = {
html: 'on the second page',
title: 'Category of publications'
};
return cfg;
},
finish: function() {
"use strict";
var me = this;
},
navigate: function(increment) {
"use strict";
var flag,
me = this;
// activate the next / previous page
me.currentPage += increment;
me.getLayout().setActiveItem(me.currentPage);
// inhibit buttons
me.buttonNext.setDisabled(me.currentPage === me.lastPage);
me.buttonPrev.setDisabled(me.currentPage === 0);
}
});
\ 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