-
- this.dialog = new Roo.LayoutDialog(Roo.get(document.body).createChild({tag:'div'}),
- { // the real end set is here...
- autoCreated: true,
- title: "Login",
- modal: true,
- width: 350,
- height: 230,
- shadow:true,
- minWidth:200,
- minHeight:180,
- //proxyDrag: true,
- closable: false,
- draggable: false,
- collapsible: false,
- resizable: false,
- center: {
- autoScroll:false,
- titlebar: false,
- // tabPosition: 'top',
- hideTabs: true,
- closeOnTab: true,
- alwaysShowTabs: false
- }
-
- });
-
-
-
- this.dialog.addButton("Forgot Password", function()
- {
-
- var n = _this.form.findField('username').getValue();
- if (!n.length) {
- Roo.MessageBox.alert("Error", "Fill in your email address");
- return;
- }
- Roo.Ajax.request({
- url: baseURL + '/Login.js',
- params: {
- passwordRequest: n
- },
- method: 'POST',
- success: function(response, opts) { // check successfull...
-
- var res = Pman.processResponse(response);
- if (!res.success) { // error!
- Roo.MessageBox.alert("Error" , res.errorMsg ? res.errorMsg : "Problem Requesting Password Reset");
- return;
- }
- Roo.MessageBox.alert("Notice" , "Please check you email for the Password Reset message");
- },
- failure : function() {
- Roo.MessageBox.alert("Error" , "Problem Requesting Password Reset");
- }
-
- });
- });
-
- this.dialog.addButton("Login", function()
- {
- Pman.Login.dialog.el.mask("Logging in");
- Pman.Login.form.doAction('submit', {
- url: baseURL + '/Login',
- method: 'POST'
- });
- });
- this.layout = this.dialog.getLayout();
- this.layout.beginUpdate();
-
- //layout.add('center', new Roo.ContentPanel('center', {title: 'The First Tab'}));
- // generate some other tabs
- this.form = new Roo.form.Form({
- labelWidth: 100 ,
-
- listeners : {
- actionfailed : function(f, act) {
- // form can return { errors: .... }
-
- //act.result.errors // invalid form element list...
- //act.result.errorMsg// invalid form element list...
-
- Pman.Login.dialog.el.unmask();
- Roo.MessageBox.alert("Error", act.result.errorMsg ? act.result.errorMsg :
- "Login failed - communication error - try again.");
-
- },
- actioncomplete: function(re, act) {
-
- Roo.state.Manager.set('Pman.Login.username.'+appNameShort, Pman.Login.form.findField('username').getValue() );
- Roo.state.Manager.set('Pman.Login.lang.'+appNameShort, Pman.Login.form.findField('lang').getValue() );
- Pman.Login.fillAuth(act.result.data);
-
- Pman.Login.dialog.hide();
- if (Roo.get('loading-mask')) {
- //Roo.get('loading').show();
- Roo.get('loading-mask').show();
- }
-
- Pman.onload();
-
-
-
- }
- }
-
-
-
-
- });
-
-
-
- this.form.add(
-
- new Roo.form.TextField({
- fieldLabel: "Email Address",
- name: 'username',
- width:200,
- autoCreate : {tag: "input", type: "text", size: "20"}
- }),
-
- new Roo.form.TextField({
- fieldLabel: "Password",
- inputType: 'password',
- name: 'password',
- width:200,
- autoCreate : {tag: "input", type: "text", size: "20"},
- listeners : {
- specialkey : function(e,ev) {
- if (ev.keyCode == 13) {
- Pman.Login.dialog.el.mask("Logging in");
- Pman.Login.form.doAction('submit', {
- url: baseURL + '/Login.json',
- method: 'POST'
- });
- }
- }
- }
- }) ,
- new Roo.form.ComboBox({
- fieldLabel: "Language",
- name : 'langdisp',
- store: {
- xtype : 'SimpleStore',
- fields: ['lang', 'ldisp'],
- data : [
- [ 'en', 'English' ],
- [ 'zh_HK' , '\u7E41\u4E2D' ],
- [ 'zh_CN', '\u7C21\u4E2D' ]
- ]
- },
-
- valueField : 'lang',
- hiddenName: 'lang',
- width: 200,
- displayField:'ldisp',
- typeAhead: false,
- editable: false,
- mode: 'local',
- triggerAction: 'all',
- emptyText:'Select a Language...',
- selectOnFocus:true,
- listeners : {
- select : function(cb, rec, ix) {
-
-
- Pman.Login.switchLang(rec.data.lang);
-
- }
- }
-
- })
-
- );
-
-
- var ef = this.dialog.getLayout().getEl().createChild({tag: 'div'});
- ef.dom.style.margin = 10;
-
- this.form.render(ef.dom);
- // logoprefix comes from base config.
- Pman.Login.form.el.createChild({
- tag: 'img',
- src: rootURL + '/Pman/'+appNameShort + '/templates/images/logo.gif',
- style: 'margin-bottom: 10px;'
- },
- Pman.Login.form.el.dom.firstChild
- );
-
- var vp = this.dialog.getLayout().add('center', new Roo.ContentPanel(ef, {
- autoCreate : true,
- //title: 'Org Details',
- //toolbar: this.tb,
- width: 250,
- maxWidth: 250,
- fitToFrame:true
- }));
-
- this.layout.endUpdate();
-
- this.fireEvent('render', this);
-
-
-