Ext.namespace('Ext.backOfficeLanguages'); Ext.backOfficeLanguages.languages = [ ['it-IT', 'Italiano'] ,['en-EN', 'English'] ,['fr-FR', 'French'] ,['es-ES', 'Spanish'] ,['pl-PL', 'Polish'] ,['de-DE', 'Deutsch'] ,['ro-RO', 'Romanian'] ,['pt-PT', 'Portuguese'] ,['tr-TR', 'Turkish'] ,['ru-RU', 'Russian'] ,['fa-IR', 'Farsi'] ,['ky-KG', 'Kyrgyz'] ]; var storeLanguages = new Ext.data.SimpleStore({ fields: ['CODE', 'LANG'], data : Ext.backOfficeLanguages.languages }); Ext.example = function(){ var msgCt; function createBox(t, s){ return ['
', '
', '

', t, '

', s, '
', '
', '
'].join(''); } return { msg : function(title, format){ if(!msgCt){ msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true); } msgCt.alignTo(document, 'tr'); var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1)); var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true); m.slideIn('t').pause(8).ghost("t", {remove:true}); }, init : function(){ var t = Ext.get('exttheme'); if(!t){ // run locally? return; } var theme = Cookies.get('exttheme') || 'aero'; if(theme){ t.dom.value = theme; Ext.getBody().addClass('x-'+theme); } t.on('change', function(){ Cookies.set('exttheme', t.getValue()); setTimeout(function(){ window.location.reload(); }, 250); }); var lb = Ext.get('lib-bar'); if(lb){ lb.show(); } } }; }(); Ext.onReady(function(){ // turn on validation errors beside the field globally Ext.form.Field.prototype.msgTarget = 'side'; var fs = new Ext.FormPanel({ frame: true, id: 'login-form', //title: ((languageLogin=='it-IT')?("Accesso al sistema"):("System login")), title: "System login", labelAlign: 'right', labelWidth: 85, height:160, width: 350, defaults: {width: 230}, defaultType: 'textfield', //waitMsgTarget: true, keys: [{ key: [10,13], fn: function(){ sendLoginForm(); } }], items: [{ height:23, fieldLabel: 'Username', name: 'username' },{ height:23, fieldLabel: 'Password', name: 'password', inputType : 'password' }, new Ext.form.ComboBox({ id: 'combo-lingua', xtype : "combo", triggerAction: 'all', store : storeLanguages, valueField : 'CODE', displayField : 'LANG', hiddenName: 'combolanguagevalue', //fieldLabel : ((languageLogin=='it-IT')?("Lingua"):("Language")), fieldLabel : "Language", typeAhead : false, mode: 'local', loadingText : "Loading...", emptyText : "Select a language", name : "RESP", forceSelection : true, allowBlank : false, blankText : "Select a language", value: languageLogin }) ] }); // explicit add var submit = fs.addButton({ id: 'loginButton', text: "Submit", disabled:false, handler: function(){ sendLoginForm(); } }); function sendLoginForm(){ Ext.getCmp('loginButton').disable(); fs.form.submit({ url:'logger.php?'+SID, //waitMsg: ((languageLogin=='it-IT')?("Login in corso, attendere..."):("Login, please wait...")), waitMsg: "Login, please wait...", success : function(f,a){ document.location.replace(a.result.url); }, failure : function(f,a){ Ext.getCmp('loginButton').enable(); /*if (languageLogin=='it-IT') Ext.MessageBox.alert('Login', 'User o Password errata: riprovare.'); else */ //Ext.MessageBox.alert('Login', 'Wrong User or Password or User locked due to too many failed attempts.'); Ext.MessageBox.alert('Login', 'Wrong User or Password.'); } }); } fs.render('myLoginDiv'); //Ext.getCmp('combo-lingua').on('select', function(combo){ if (combo.getValue()!=languageLogin) document.location.replace("index.php?cLang="+combo.getValue()); }, true); if (false) Ext.MessageBox.alert('Logout', 'You have logged out successfully.'); //Ext.MessageBox.alert('Uscita', 'Uscita correttamente effettuata.'); else if (false) Ext.MessageBox.alert('Session terminated', 'Please insert User and Password.'); //Ext.MessageBox.alert('Sessione terminata', 'La sessione di lavoro è termitata. Effettuare un nuovo Login.'); });