// -*- coding: utf-8 -*- // :Progetto: AirPIM/Services -- Login panel // :Creato: mar 24 ago 2011 11:16:39 CEST // :Autore: Xavi Torné // :Licenza: Copyright (C) 2009 Azeta Soluzioni S.r.l. Tutti i diritti riservati. // Copyright (C) 2010 Airpim S.r.l. Tutti i diritti riservati. // /*jsl:declare Ext*/ /*jsl:declare alert*/ /*jsl:declare window*/ /*jsl:declare confirm*/ /*jsl:declare document*/ /*jsl:declare AirPIM*/ /*jsl:declare _*/ Ext.ns('AirPIM'); Ext.application({ name: 'Login', launch: function() { Ext.Ajax.timeout = 120000; Ext.override(Ext.form.field.Base,{ invalidText: _('The value in this field is invalid') }); Ext.override(Ext.form.field.Text,{ blankText: _('This field is required'), maxLengthText: _('The maximum length for this field is {0}'), minLengthText: _('The minimum length for this field is {0}') }); Ext.override(Ext.form.field.Number,{ minText: _('The minimum value for this field is {0}'), maxText: _('The maximum value for this field is {0}') }); var companies = Ext.create('Ext.data.ArrayStore', { fields: ['guid', 'title'] }); var submitLogin = function(form){ if (form.isValid()) { form.submit({ success: function(selfform, action) { if(action.result.completed) { win.destroy(true); //redirect the window window.location = window.location.pathname; } else { companies.loadData(action.result.companies); var field = form.findField('company'); field.setVisible(true); field.focus(); field.expand(); } }, failure: function(selfform, action) { form.reset(); companies.removeAll(); Ext.Msg.alert(_('Login failed'), _('Username or password is incorrect.')); } }); } else { Ext.Msg.alert(_('Login failed'), _('Username or password is incorrect.')); } }; /* This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com Cookie script - Scott Andrew Popup script, Copyright 2005, Sandeep Gangadharan */ function newCookie(name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); expires = ";expires=" + date.toGMTString(); } document.cookie = name+"=" + value + expires + "; path=/"; } function readCookie(name) { var nameSG = name + "="; var nuller = ''; if (document.cookie.indexOf(nameSG) == -1) return nuller; var ca = document.cookie.split(';'); for(var i=0; i