/* * Ext JS Library 2.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ Ext.apply(Ext.form.VTypes, { password: function(val, field){ if (field.initialPassField) { var pwd = Ext.getCmp(field.initialPassField); return (val == pwd.getValue()); } return true; }, passwordText: 'Passwords do not match' }); Ext.onReady(function(){ Ext.BLANK_IMAGE_URL = 'images/s.gif'; Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = 'side'; var register_form = new Ext.FormPanel({ labelWidth: 110, // label settings here cascade unless overridden url: 'php/register.php', frame: true, bodyStyle: 'padding:5px 5px 0', defaults: { width: 230 }, defaultType: 'textfield', items: [{ fieldLabel: 'First Name', name: 'firstname', allowBlank: false }, { fieldLabel: 'Last Name', name: 'lastname', allowBlank: false }, { fieldLabel: 'Email', name: 'email', vtype: 'email', allowBlank: false }, { fieldLabel: 'Phone', name: 'phone', allowBlank: true }, { fieldLabel: 'Mobile', name: 'mobile', allowBlank: true }, { fieldLabel: 'Address', name: 'address', allowBlank: true, anchor: '100%' }, { fieldLabel: 'Birth Date', name: 'birth_date', allowBlank: true, xtype: 'datefield' }, { fieldLabel: 'Password', name: 'password', allowBlank: false, inputType: 'password', id: 'pass' }, { fieldLabel: 'Confirm Password', name: 'password2', allowBlank: false, inputType: 'password', vtype: 'password', initialPassField: 'pass' }] }); var register_window = new Ext.Window({ title: 'Registration Form', width: 500, height: 330, minWidth: 300, minHeight: 200, layout: 'fit', closable: false, resizable: false, draggable: false, plain: true, bodyStyle: 'padding:5px;', buttonAlign: 'center', items: register_form, buttons: [{ text: 'Register', id: 'reg-butt', handler: function(){ if (register_form.getForm().isValid()) { register_form.getForm().submit({ method: 'POST', waitTitle: 'Connecting', waitMsg: 'ارتباط با سرور...', success: function(f, a){ if (a.result.success == true) { window.location = 'desktop.html'; } else { Ext.Msg.alert('Warning', 'Please try again later'); } }, failure: function(f, a){ Ext.Msg.alert('Warning', a.result.errormsg); } }); } else { Ext.Msg.alert('Warning', "لطفا خطاها را تصحیح نمایید."); } } }, { text: 'راهنما', handler: function(){ Ext.WindowMgr.hideAll(); help_window.show(); } }, { text: 'Cancel', handler: function(){ register_form.getForm().reset(); } }] }); var help_window = new Ext.Window({ id: 'hlp-win', title: 'راهنمای سایت', iconCls: 'help', width: 600, height: 350, border: false, closable: false, layout: 'border', shim: false, animCollapse: false, constrainHeader: true, items: new Ext.Panel({ title: '   راهنماي ورود به سايت قرعه كشي my.ofoghnet.com', region: 'center', autoScroll: true, split: true, width: 550, collapsible: false, headerCfg: { tag: 'p', cls: 'titlefa' }, margins: '3 0 3 3', cmargins: '13 13 13 13', autoLoad: 'static/help-index.html' }), buttons: [{ text: 'Login', handler: function(){ Ext.WindowMgr.hideAll(); login_window.show(); } }, { text: 'Not a Member?', handler: function(){ Ext.WindowMgr.hideAll(); register_window.show(); } }], buttonAlign: 'center' }) var login_form = new Ext.FormPanel({ labelWidth: 75, // label settings here cascade unless overridden frame: true, url: 'php/login.php', bodyStyle: 'padding:5px 5px 0', defaults: { width: 230 }, defaultType: 'textfield', items: [{ fieldLabel: 'E-Mail', name: 'email', vtype: 'email', allowBlank: false, anchor: "95%" }, { fieldLabel: 'Password', name: 'password', anchor: "95%", allowBlank: false, inputType: 'password' }], buttons: [{ text: 'Login', id:'log-butt', handler: function(){ if (login_form.getForm().isValid()) { login_form.getForm().submit({ method: 'POST', waitTitle: 'در حال اتصال', waitMsg: 'ارتباط با سرور...', failure: function(f, a){ Ext.Msg.alert('Warning', a.result.errormsg); }, success: function(f, a){ if (a.result.success == true) { window.location = 'desktop.html'; } else { Ext.Msg.alert('Warning', 'لطفا بعدا تلاش نمایید'); } } }); } else { Ext.Msg.alert('Warning', "لطفا خطاها را تصحیح نمایید."); } } }, { text: 'Not a Member?', handler: function(){ Ext.WindowMgr.hideAll(); register_window.show(); } }, { text: 'راهنما', handler: function(){ Ext.WindowMgr.hideAll(); help_window.show(); } }, { text: 'Cancel', handler: function(){ login_form.getForm().reset(); } }] }); var login_window = new Ext.Window({ title: 'Login to members area', width: 500, height: 150, minWidth: 300, minHeight: 200, layout: 'fit', closable: false, resizable: false, draggable: false, plain: true, bodyStyle: 'padding:5px;', buttonAlign: 'center', items: login_form }); login_window.show(); });