Ext.SSL_SECURE_URL="javascript/extjs2/resources/images/default/s.gif"; Ext.BLANK_IMAGE_URL="javascript/extjs2/resources/images/default/s.gif"; var coo = new Ext.state.CookieProvider(); var clogin=coo.get('login',''); if (clogin==='func') { top.location='loginf.php'; } else { coo.set('login', 'norm'); genPass=function(){ var head= document.getElementsByTagName('head')[0]; var script= document.createElement('script'); script.type= 'text/javascript'; script.src= "js-recupera.php"; head.appendChild(script); } Login = function(){ var win, form, submitUrl = 'session/access_virtual.php'; this.process=0; return{ Init:function(){ Ext.QuickTips.init(); var logoPanel = new Ext.Panel({ baseCls: 'x-plain', id: 'login-logo', height: 120, region: 'north' }); var entrar = function(){ if (this.process==1) return; this.process=1; win.body.mask('Autenticando, espere un momento por favor.. ', 'x-mask-loading'); var options = { url : 'session/access_virtual.php' ,method : 'post' ,scope : Login ,params : {} ,timeout : 300000 ,callback : function(options, success, response){ var ucsc_action = response.getResponseHeader('ucsc-action') ? response.getResponseHeader('ucsc-action') : response.getResponseHeader('UCSC-Action'); var ucsc_user = response.getResponseHeader('ucsc-user') ? response.getResponseHeader('ucsc-user') : response.getResponseHeader('UCSC-User'); if (ucsc_action && ucsc_action.trim() == 'FormLoad' && parseInt(ucsc_user) == parseInt(options.params.user)){ $("body").html(response.responseText); } else { Ext.Ajax.timeout=30000; this.process=0; this.win.body.unmask(); var i, o; if(true === success) { try { o = Ext.decode(response.responseText); } catch(ex) { //Ext.Msg.alert("Error", response.responseText); Ext.Msg.alert("Error", 'Lo sentimos pero el sistema intranet no se encuentra disponible (Errjs dec01)'); return; } if(true === o.success) { if (o.url) { win.hide(); document.location=o.url; } } else { if (o.msgError) Ext.Msg.alert("Error", o.msgError); else Ext.Msg.alert("Error", 'Lo sentimos pero el sistema intranet no se encuentra disponible
Respuesta del servidor: ' + (response.responseText || 'Sin respuesta')); } } else { Ext.Msg.alert("Error", 'Lo sentimos pero el sistema intranet no se encuentra disponible
Respuesta del servidor: ' + (response.responseText || 'Sin respuesta')); } } } }; Ext.apply(options.params,formPanel.getForm().getValues()); Ext.apply(options.params,{items: item}); //alert(Ext.util.JSON.encode(formPanel.getForm().getValues())); //alert(Ext.util.JSON.encode(options.params)); Ext.Ajax.request(options); } var formPanel = new Ext.form.FormPanel({ baseCls: 'x-plain', title:" ", baseParams: { module: 'login' }, defaults: { width: 200 }, defaultType: 'textfield', frame: false, height: 100, id: 'login-form', items: [ { fieldLabel: 'Rut' ,id:'cmp-user' ,name: 'user' ,width: 120 ,maxLength:8 ,maxLengthText:'El tamaño máximo es 8' ,maskRe:/^[0-9]{0,7}$/ ,selectOnFocus:true ,scope:this ,listeners:{ specialkey: function(t,e){ if(e.getKey()==13) { e.stopEvent(); var form=formPanel.getForm() var cm=form.getValues(); if (!cm.clave) { form.items.itemAt(1).focus(true); } else { entrar.createDelegate(Login)(); /* form.submit({ waitTitle:'Espera un momento', reset:true, success:Login.Success, failure:Login.Failure, scope:Login }); */ } } } } } ,{ id:'login-gen-box-1', xtype:'box', autoEl: { tag:'div', html:'
Ingrese su rut sin dígito verificador
' } } ,{ fieldLabel: 'Contraseña' ,id:'cmp-pass' ,inputType: 'password' ,name: 'clave' ,maxLength:15 ,maxLengthText:'El tamaño máximo es 15' ,selectOnFocus:true ,width: 120 ,listeners:{ specialkey: function(t,e) { if(e.getKey()==13) { e.stopEvent(); var form=formPanel.getForm() var cm=form.getValues(); if (!cm.user) { form.items.itemAt(0).focus(true); } else { entrar.createDelegate(Login)(); /* form.submit({ waitTitle:'Espera un momento..', reset:true, success:Login.Success, failure:Login.Failure, scope:Login }); */ } } } } } ,{ id:'login-gen-box-2', xtype:'box', autoEl: { tag:'div', html:'
Ingrese su contraseña, en caso de olvido haga clic AQUÍ
' } } ], labelWidth:90, region: 'center', url: submitUrl, buttons: [{ handler: function(){ entrar.createDelegate(this)(); /* form.submit({ waitTitle:'Espera un momento', reset:true, success:Login.Success, failure:Login.Failure, scope:Login }); */ }, scope: Login, text: 'Ingresar' }] }); //south Login.formPanel=formPanel; var piePanel = new Ext.Panel({ id: 'login-pie' ,height: 40 ,region: 'south' ,frame:true ,html:'
Intranet Corporativa Universidad Católica de la Santísima Concepción
Optimizada para resolución 1024 x 768 Mozilla Firefox 3 (o superior) e Internet Explorer 7 (o superior)
' }); win = new Ext.Window({ buttonAlign: 'right' ,closable: false ,draggable: false ,height: 340 ,id: 'login-win' ,layout: 'border' ,minHeight: 290 ,minWidth: 530 ,plain: false ,resizable: false ,frame:true ,items: [ logoPanel ,formPanel ,piePanel ] ,title: 'Acceso Intranet Corporativa UCSC' ,width: 530 }); Login.win=win; form = formPanel.getForm(); var ifocus=function(){ var form=formPanel.getForm() form.items.itemAt(0).focus(true,500); } win.on({ 'activate':ifocus ,'show':function(){ var u=Ext.get('cmp-user'); var p=Ext.get('cmp-pass'); u.dom.maxLength=8; p.dom.maxLength=15; } }); win.show(); }, Success: function(f,a){ var response=a.response; try { o = Ext.decode(response.responseText); } catch(e) { alert('Lo sentimos pero el sistema intranet no se encuentra disponible'); Login.process=0; Login.win.body.unmask(); return; } if (o.url) { document.location=o.url; } }, Failure: function(f,a){ Login.process=0; Login.win.body.unmask(); switch (a.failureType) { case Ext.form.Action.CLIENT_INVALID: Ext.Msg.alert("Error", "Datos Incorrectos"); return; break; case Ext.form.Action.CONNECT_FAILURE: //Ext.Msg.alert("Error", "Ajax Error: No fue posible conectarse con el servidor"); return; break; case Ext.form.Action.SERVER_INVALID: Ext.Msg.alert("Error", a.result.msgError); return; return; } var response=a.response; //alert(response.responseText); Login.process=0; Login.win.body.unmask(); // process ajax success var response=a.response; try { o = Ext.decode(response.responseText); } catch(e) { alert('Lo sentimos pero el sistema intranet no se encuentra disponible'); return; } if (o){ if (o.msgError){ alert(o.msgError); } } else { alert("Lo sentimos pero el sistema intranet no se encuentra disponible, el servidor no responde"); /* new Ext.Window({ width : 400 ,height : 400 ,autoScroll : true ,html : response.responseText }).show(); */ } } }; }(); Ext.BasicForm.prototype.afterAction=function(action, success){ this.activeAction = null; var o = action.options; if(o.waitMsg){ Ext.MessageBox.updateProgress(1); Ext.MessageBox.hide(); } if(success){ if(o.reset){ this.reset(); } Ext.callback(o.success, o.scope, [this, action]); this.fireEvent('actioncompleted', this, action); }else{ Ext.callback(o.failure, o.scope, [this, action]); this.fireEvent('actionfailed', this, action); } } Ext.onReady(Login.Init, Login, true); }