SetupWizard.js (3411B)
1 Ext.define('PartKeeprSetup.SetupWizard', { 2 extend: 'Ext.ux.BreadCrumbWizard', 3 4 /** 5 * The wizard's window shouldn't have a close button 6 */ 7 closable: false, 8 9 /** 10 * Some style settings for the individual cards 11 */ 12 cardPanelConfig: { 13 defaults: { 14 baseCls: 'x-small-editor', 15 bodyStyle: 'padding:10px 15px 5px 10px;background-color:#F6F6F6;', 16 border: false 17 }, 18 layout: 'card' 19 }, 20 21 /** 22 * Configure the header 23 */ 24 includeHeaderPanel: true, 25 headConfig: { 26 headerPosition: 'bottom', 27 position: 'top', 28 cls: "x-setup-header", 29 height: 120, 30 stepText: '' 31 }, 32 33 /** 34 * The width and height of the window, in pixels 35 */ 36 width: 900, 37 height: 500, 38 39 /** 40 * Initializes the component 41 */ 42 initComponent: function () 43 { 44 this.items = this.setupCards(); 45 this.on("submit", function () { 46 var target = window.location.href.replace(/setup\/index.html$/, ""); 47 target = target.replace(/setup\/$/, ""); 48 target = target.replace(/setup$/, ""); 49 window.location.href = target; 50 51 }); 52 this.callParent(); 53 }, 54 /** 55 * Sets up all cards 56 * @returns {Array} 57 */ 58 setupCards: function () 59 { 60 var cards = new Array(); 61 62 cards.push(Ext.create('Ext.form.Panel', { 63 breadCrumbTitle: 'Welcome', 64 padding: 20, 65 border: false, 66 bodyStyle: 'background: none;', 67 html: 'This wizard guides you through the setup of <b>PartKeepr</b>.<br/><br/>Note that you can ' + 68 're-start setup any time, even if you already have an existing database. No existing data will ' + 69 'be overwritten.<br/><br/><strong>If you are upgrading, make sure you created a backup of your ' + 70 'database and filesystem!</strong>' 71 })); 72 73 var cardNames = [ 74 "PartKeeprSetup.PrerequisitesTestCard", 75 "PartKeeprSetup.AuthKeyCard", 76 "PartKeeprSetup.ExistingConfigParserCard", 77 "PartKeeprSetup.DatabaseParametersCard", 78 "PartKeeprSetup.DatabaseSetupCard", 79 "PartKeeprSetup.AdminUserCard", 80 "PartKeeprSetup.UserSetupCard", 81 ]; 82 83 for (var card = 0; card < cardNames.length; card++) { 84 cards.push(Ext.create(cardNames[card], { 85 setupConfig: this.setupConfig 86 })); 87 } 88 89 cards.push(Ext.create('Ext.form.Panel', { 90 breadCrumbTitle: 'Setup Complete', 91 padding: 20, 92 border: false, 93 bodyStyle: 'background: none;', 94 html: "<b>PartKeepr is now set-up.</b><br/><br/>" + 95 "Please remember to setup a cronjob:<br/>"+ 96 '<code style="background-color: white; border: 1px solid black;">' + 97 "0 0,6,12,18 * * * /usr/bin/php <path-to-partkeepr>/app/console partkeepr:cron:run" + 98 "</code><br/>The cronjob should run at least every 12 hours. Remove any legacy PartKeepr cronjobs.<br/><br/>" + 99 "If possible, set your web server's document root to the <b>web/</b> directory.<br/><br/>" + 100 "PartKeepr will be opened when you click the submit button.<br/><br/>" 101 })); 102 103 return cards; 104 } 105 });