// JavaScript Document Ext.define('smb.view.system',{ extend: 'Ext.container.Container', alias: 'widget.system', id: 'system', items:[ { xtype: 'fieldcontainer', // width: 950, layout:{ type: 'table', tdAttrs:{ valign:'top' }, columns:2 }, items:[ {xtype:'deviceName'}, {xtype:'location'}, {xtype:'userAccount'}, {xtype:'time'} ] }, {xtype:'firmware'}, {xtype:'configuration'}, {xtype:'rebootBar'} ], initComponent: function(){ this.callParent(arguments); } }); Ext.define('smb.model.deviceName',{ extend: 'Ext.data.Model', fields: [ {mapping: 'deviceName', name: 'deviceName', type: 'string'}, {mapping: 'language', name: 'language', type: 'int'} ], proxy: { type: 'ajax', url: './data/deviceInfo.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.view.deviceName',{ extend: 'smb.view.module', id: 'deviceName', alias: 'widget.deviceName', title: smb.charset.module.device, width: 450, height: 130, collapsible: false, model: 'deviceName', buttons: [ { xtype: 'button', id: 'deviceNameSubmit', hidden:false, elemType:'saveBtn', text: smb.charset.button.submit } ], url: './data/deviceInfo.json', //flex: 1, items: [ { xtype: 'textfield', labelWidth: 160, id: 'deviceNameLabel', name: 'deviceName', // vtype: 'username', maxLength: 31, enforceMaxLength: true, fieldLabel: smb.charset.label.deviceName, validator:function(value) { var pattern_password = /^[A-Za-z0-9\-\_]+$/; if(value && !pattern_password.test(value)){ return smb.charset.validation.deviceNameInvalid; }; return true; } }, { xtype: 'combobox', id: 'language', name: 'language', editable: false, fieldLabel: smb.charset.label.language, labelWidth: 160, queryMode: 'local', displayField: 'display', valueField: 'value', store: Ext.create('Ext.data.Store',{ fields:['value', 'display'], data: [ {value:0, display: smb.charset.comboBox.english}, {value:1, display: smb.charset.comboBox.chinese}, {value:2, display: smb.charset.comboBox.russia}, {value:3, display: smb.charset.comboBox.spanish} ] }) } ], initComponent: function(){ this.callParent(arguments); if(smb.user.isCnProduct == true) { Ext.getCmp('language').setReadOnly(true); } } }); Ext.define('smb.model.location',{ extend: 'Ext.data.Model', fields: [ {mapping: 'longitude', name: 'longitude', type: 'string'}, {mapping: 'latitude', name: 'latitude', type: 'string'} ], proxy: { type: 'ajax', url: './data/location.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.view.location',{ extend: 'smb.view.module', id: 'location', alias: 'widget.location', title: smb.charset.module.location, width: 450, height: 130, collapsible: false, model: 'location', url: './data/location.json', //flex: 1, items: [ { xtype: 'numberfield', labelWidth: 160, name: 'longitude', fieldLabel: smb.charset.label.longitude, minValue: -180, maxValue: 180, decimalPrecision: 13 /* validator:function(value) { console.log(value) console.log( Math.round(value) ) console.log( 180.000000000000001 >= 180 ) if(Ext.isNumeric(value)) { if(Number(value)>180 || Number(value)<-180) { return smb.charset.validation.numberRange180; } var part = value.toString().split('.')[1]; if(part && part.length>15) { return smb.charset.validation.decimalOverflow; } return true; } else{ return smb.charset.validation.invalidNumber; } } */ }, { xtype: 'numberfield', labelWidth: 160, name: 'latitude', fieldLabel: smb.charset.label.latitude, minValue: -90, maxValue: 90, decimalPrecision: 13 /* validator:function(value) { if(Ext.isNumeric(value)) { if(Number(value)>90 || Number(value)<-90) { return smb.charset.validation.numberRange90; } var part = value.toString().split('.')[1]; if(part && part.length>15) { return smb.charset.validation.decimalOverflow; } return true; } else{ return smb.charset.validation.invalidNumber; } } */ } ] }); Ext.define('smb.model.userAccount',{ extend: 'Ext.data.Model', fields: [ {mapping: 'curUserName', name: 'curUserName', type: 'string'} ], proxy: { type: 'ajax', url: './data/userAccount.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.view.userAccount',{ extend: 'smb.view.module', id: 'userAccount', alias: 'widget.userAccount', title: smb.charset.module.userAccount, width: 450, height: 280, collapsible: false, url: './data/userAccount.json', model: 'userAccount', //flex: 1, items: [ { xtype: 'textfield', changeEnable: true, name: 'curUserName', id : 'curUserName', readOnly: true, //disabled: true, labelWidth: 160, vtype: 'adminName', fieldLabel: smb.charset.label.curUserName }, { xtype: 'hidden', submitValue: true, name: 'curPassword', id: 'submitCurPwd' }, { xtype: 'fieldcontainer', layout: 'column', defaults:{ labelWidth: 160, inputWidth: 150 }, items:[ { xtype: 'textfield', fieldLabel: smb.charset.label.curPassword, id: 'curPassword', labelWidth: 160, changeEnable: true, inputType: 'password', submitValue: false, maxLength: 15, enforceMaxLength: true, changeFlag: true, vtype: 'userPwd', listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('curPwdText').changeFlag = false; if(item.changeFlag) { Ext.getCmp('curPwdText').setValue(newValue); Ext.getCmp('submitCurPwd').setValue( Ext.util.Format.uppercase(md5(newValue)) ); } Ext.getCmp('curPwdText').changeFlag = true; } } }, { xtype: 'textfield', id: 'curPwdText', submitValue: false, hidden: true, fieldLabel: smb.charset.label.curPassword, vtype: 'userPwd', maxLength: 15, enforceMaxLength: true, changeFlag: true, listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('curPassword').changeFlag = false; if(item.changeFlag) { Ext.getCmp('curPassword').setValue(newValue); Ext.getCmp('submitCurPwd').setValue( Ext.util.Format.uppercase(md5(newValue)) ); } Ext.getCmp('curPassword').changeFlag = true; } } }, { xtype: 'checkbox', id: 'showCurPwd', margin: '0 0 0 5', inputWidth: 13, boxLabel: smb.charset.label.show, hideLabel: true } ] }, { xtype: 'textfield', changeEnable: true, vtype: 'adminName', allowBlank: false, maxLength: 31, enforceMaxLength: true, labelWidth: 160, id : 'newUserName', name : 'newUserName', fieldLabel: smb.charset.label.newUserName }, { xtype: 'hidden', submitValue: true, name: 'newPwd', id: 'submitNewPwd' }, { xtype: 'fieldcontainer', layout: 'column', defaults:{ labelWidth: 160, inputWidth: 150 }, items:[ { xtype: 'textfield', changeEnable: true, allowBlank: false, maxLength: 15, enforceMaxLength: true, inputType: 'password', labelWidth: 160, id: 'newPwd', submitValue: false, changeFlag: true, fieldLabel: smb.charset.label.newPwd, validator: function(value) { if( value && value.toUpperCase()=='ADMIN') { return smb.charset.validation.adminPwd; } return smb.verify.userPwd(value); }, listeners:{ change: function( item, newValue, oldValue, scope) { // Ext.getCmp('submitCurPwd').setValue( Ext.util.Format.uppercase(md5(newValue)) ); Ext.getCmp('newPwdText').changeFlag = false; if(item.changeFlag) { Ext.getCmp('newPwdText').setValue(newValue); } Ext.getCmp('newPwdText').changeFlag = true; } } }, { xtype: 'textfield', id: 'newPwdText', submitValue: false, hidden: true, maxLength: 15, enforceMaxLength: true, fieldLabel: smb.charset.label.newPwd, changeFlag: true, validator: function(value) { if( value && value.toUpperCase()=='ADMIN') { return smb.charset.validation.adminPwd; } return smb.verify.userPwd(value); }, listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('newPwd').changeFlag = false; if(item.changeFlag) { Ext.getCmp('newPwd').setValue(newValue); } Ext.getCmp('newPwd').changeFlag = true; } } }, { xtype: 'checkbox', id: 'showNewPwd', margin: '0 0 0 5', inputWidth: 13, boxLabel: smb.charset.label.show, hideLabel: true } ] }, { xtype: 'textfield', allowBlank: false, // maxLength: 31, inputType: 'password', labelWidth: 160, maxLength: 15, enforceMaxLength: true, id: 'confirmNewPwd', name: 'confirmNewPwd', changeEnable: true, submitValue: false, fieldLabel: smb.charset.label.confirmNewPwd, validator: function(value) { var newPwd = Ext.getCmp('newPwd').getValue(); if(value == newPwd) { Ext.getCmp('submitNewPwd').setValue( Ext.util.Format.uppercase(md5(value)) ); return true; } else { return smb.charset.validation.pwdNotEqual; } } }], buttons:[ { text: smb.charset.button.submit, formBind:false, hidden:false, elemType:'saveBtn', id:'userAccSubmit' } ] }); Ext.define('smb.model.time',{ extend: 'Ext.data.Model', fields: [ {mapping: 'timezone', name: 'timezone', type: 'int'}, {mapping: 'date', name: 'date', type: 'date'}, {mapping: 'time', name: 'time', type: 'string'}, {mapping: 'ntp1', name: 'ntp1', type: 'string'}, {mapping: 'ntp2', name: 'ntp2', type: 'string'} ], proxy: { type: 'ajax', url: './data/time.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.view.time',{ extend: 'smb.view.module', id: 'time', alias: 'widget.time', title: smb.charset.module.time, width: 450, height: 280, model: 'time', url: './data/time.json', //flex: 1, collapsible: false, items: [ { xtype: 'combobox', fieldLabel: smb.charset.label.timeZone, id: 'timezone', editable: false, queryMode: 'local', name: 'timezone', emptyText: smb.charset.comboBox.slt, store: 'timeZone', displayField: 'display', valueField: 'name', labelWidth: 160, inputWidth: 240, enforceMaxLength: true }, { xtype: 'datefield', //anchor: '100%', fieldLabel: smb.charset.label.date, labelWidth: 160, inputWidth: 240, id: 'timeDate', name: 'date', format: 'Y/m/d', changeFlag: 0 //maxValue: new Date() // limited to the current date or prior }, { xtype: 'timefield', id: 'timeTime', name: 'time', labelWidth: 160, inputWidth: 240, fieldLabel: smb.charset.label.time, format: 'H:i:s', changeFlag: 0 }, { xtype: 'textfield', labelWidth: 160, inputWidth: 240, // vtype:'ip', id: 'timeNtp1', name: 'ntp1', fieldLabel: smb.charset.label.ntpServer1, value: '0.0.0.0', maxLength: 31, allowBlank: true, validator: function(value) { if ( smb.verify.ip(value)!=true && smb.verify.domain(value)!=true ) { return smb.charset.validation.invalidIpOrDomain; } else { return true; } } }, { xtype: 'textfield', labelWidth: 160, inputWidth: 240, id: 'timeNtp2', name: 'ntp2', // vtype:'ip', fieldLabel: smb.charset.label.ntpServer2, value: '0.0.0.0', maxLength: 31, allowBlank: true, validator: function(value) { if ( smb.verify.ip(value)!=true && smb.verify.domain(value)!=true ) { return smb.charset.validation.invalidIpOrDomain; } else { return true; } } }, { xtype: 'hidden', id: 'isTimeChanged', name: 'isTimeChanged', value: '0' }, { xtype: 'fieldcontainer', items:[ { xtype: 'button', id: 'getGmt', //disabled: true, text: smb.charset.button.getGmt, margin: '0 0 0 165', width: 70 }, { xtype: 'button', id : 'synchronizeClock', text: smb.charset.button.synchronizeClock, margin: '0 0 0 10', width: 160, listeners:{ click:function( item, event ) { function setLength(value) { if(value.toString().length==1) { value = '0'+value; } return value; } var date = new Date(); Ext.getCmp('timeDate').setValue(date); Ext.getCmp('timeTime').setValue( setLength(date.getHours()) +':'+ setLength(date.getMinutes()) +':'+ setLength(date.getSeconds()) ); } } } ] }, { xtype: 'fieldcontainer', id:'dstContainer', items: [ { xtype: 'label', text: smb.charset.label.daylightSavingTime+':', cls: 'inlineBlock', style: 'text-align:right', width: 160 }, { xtype: 'button', text: smb.charset.button.setting, // name:'logOpen', id:'daylightShow', margin: '0 0 0 5', width: 70 } ] } ], initComponent: function(){ this.callParent(arguments); /* if( smb.mode.status=='apRouter' || smb.mode.status=='apClientRouter' ) { Ext.getCmp('getGmt').enable(); } else { Ext.getCmp('getGmt').disable(); } */ } }); Ext.define('smb.view.configuration',{ extend: 'smb.view.module', id: 'configuration', alias: 'widget.configuration', title: smb.charset.module.configuration, //url: './data/lan.json', method: 'post', collapsible: false, buttons: false, items: [ { xtype: 'container', layout: 'hbox', height: 36, items: [ { xtype: 'displayfield', name: 'file1', id : 'backupLabel', labelAlign: 'right', labelWidth: 140, fieldLabel: smb.charset.label.backupConfig }, { xtype: 'button', margin: '0 12 0 4', id: 'backupBtn', width: 70, text: smb.charset.button.backup } ] }, { xtype: 'container', layout: 'hbox', height: 36, items: [ { xtype: 'filefield', labelAlign: 'right', id : 'updateConfigLabel', labelWidth: 140, width: 450, labelPad: 9, name: 'file1', fieldLabel: smb.charset.label.updateConfig, buttonText: smb.charset.button.browse, /* listeners:{ change:function( item, value, scope) { if( value.length!=0 ) { // console.log(value) // console.log('value length' + value.length) // Ext.getCmp('').show(); } }, dirtyChange: function() { console.log('dirty') } }, */ validator:function(value) { var filename=/\.bin$/g; if(!filename.test(value)) { return smb.charset.validation.fileUnmatch; } var name = value.split('\\')[value.split('\\').length-1].split('.')[0]; if( name.length>64 ) { return smb.charset.validation.fileNameOver; } return true; } }, { xtype: 'button', margin: '0 12 0 4', id: 'restoreBtn', width: 70, text: smb.charset.button.upload } ] }, { xtype: 'container', layout: 'hbox', height: 36, items: [ { xtype: 'displayfield', name: 'file1', id : 'resetBtnLabel', labelAlign: 'right', labelWidth: 140, fieldLabel: smb.charset.label.resetConfig }, { xtype: 'button', margin: '0 12 0 4', id: 'resetBtn', width: 70, text: smb.charset.button.reset } ] }, { xtype: 'container', layout: 'hbox', height: 36, items: [ { xtype: 'displayfield', name: 'file1', id : 'rebootBtnLabel', labelAlign: 'right', labelWidth: 140, fieldLabel: smb.charset.label.rebootDevice }, { xtype: 'button', margin: '0 12 0 4', id: 'rebootBtn', width: 70, text: smb.charset.button.reboot } ] } ], initComponent: function(){ this.callParent(arguments); } }); Ext.define('smb.view.firmware',{ extend: 'smb.view.module', id: 'firmware', alias: 'widget.firmware', title: smb.charset.module.firmware, url: './data/firmware.json', method: 'post', buttons: [], collapsible: false, items: [ { xtype: 'displayfield', fieldLabel: 'Home', name: 'version', id: 'version', fieldLabel: smb.charset.label.firmwareVersion, labelAlign: 'right', labelWidth: 140, margin: '5 0 10 0', submitValue: false }, { xtype: 'container', layout: 'hbox', items: [ { xtype: 'filefield', id: 'versionWare', labelAlign: 'right', labelWidth: 140, width: 450, name: 'file1', fieldLabel: smb.charset.label.firmwareUpgrade, buttonText: smb.charset.button.browse, validator:function(value) { var filename=/\.bin$/g; if(!filename.test(value)) { return smb.charset.validation.fileUnmatch; } var name = value.split('\\')[value.split('\\').length-1].split('.')[0]; if( name.length>64 ) { return smb.charset.validation.fileNameOver; } return true; } }, { xtype: 'button', id: 'updateWare', margin: '0 12 0 4', name: 'speedTest', width: 70, text: smb.charset.button.upload } ] } ], initComponent: function(){ this.callParent(arguments); } }); Ext.define('smb.testingBar', { extend: 'Ext.ProgressBar', alias: 'widget.testingBar', width: 200 }) Ext.define('smb.view.rebootBar', { extend: 'Ext.window.Window', alias: 'widget.rebootBar', id: 'rebootBar', name: 'rebootBar', // title: smb.charset.module.speedTest, width: 600, height: 200, hidden: true, closable: false, resizable: false, y: 100, items: [ { xtype: 'fieldcontainer', height: 30, width: 500, margin: '30 0 20 50', items: [ { xtype: 'fieldcontainer', id: 'proBarText', width: 500, hidden: true, layout: 'hbox', items: [ { xtype: 'displayfield', hideLabel: true, value: smb.charset.tip.takeTimeGrade }, { xtype: 'label', margin: '3 5', cls: 'doNotPowerOff', text: smb.charset.tip.doNotPowerOff }, { xtype: 'displayfield', hideLabel: true, value: smb.charset.tip.theDevice } ] }, { xtype: 'displayfield', id: 'upgradeProNum', hidden: true, hideLabel: true, margin: '5 0 5 220' }, { xtype: 'displayfield', id: 'proBarRebootText', hidden: true, hideLabel: true, margin: '0 0 0 180', value: smb.charset.label.rebooting }, { xtype: 'displayfield', id: 'proBarResetText', hidden: true, hideLabel: true, margin: '0 0 0 180', value: smb.charset.label.resetting }, { xtype: 'displayfield', id: 'proBarRestoreText', hidden: true, hideLabel: true, margin: '0 0 0 180', value: smb.charset.label.restoring } ] }, { xtype: 'testingBar', id: 'rebootProBar', width: 500, border: 0, margin: '10 45' } ] }) Ext.define('smb.model.speedTest',{ extend: 'Ext.data.Model', fields: [ {mapping: 'rx', name: 'rx', type: 'int'}, {mapping: 'tx', name: 'tx', type: 'int'}, {mapping: 'total', name: 'total', type: 'int'} ], proxy: { type: 'ajax', url: './data/speedTest.json', reader: { type: 'json', root: 'speedTest' } } }); Ext.define('smb.store.traceRoute', { extend: 'Ext.data.Store', storeId:'traceRoute', fields:['host', 'ip', 'response'], data:{'items':[ { 'host': '8080', "ip":"1.2.3.4", "response":"123456789" }, { 'host': '8080', "ip":"1.2.3.4", "response":"123456789" }, { 'host': '8080', "ip":"1.2.3.4", "response":"123456789" } ]}, proxy: { type: 'memory', reader: { type: 'json', root: 'items' } } }); Ext.define('smb.store.spectrumChart', { extend: 'Ext.data.Store', storeId: 'spectrumChart', fields: [ {name:'frequency', type:'int'}, {name:'peak', type:'int'}, {name:'current', type:'int'}, {name:'average', type:'int'} ] // data: [ // { frequency: 2412, peak: -10, current: -20, average: -100}, // { frequency: 2522, peak: -20, current: -50, average: -80}, // { frequency: 2552, peak: -50, current: -10, average: -60}, // { frequency: 2572, peak: -70, current: -90, average: -40}, // { frequency: 2592, peak: -100, current: -120, average: -30} // ] }); Ext.define('smb.store.frequencyRange',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'string'}, {name:'display', type:'string'} ], data: [ {name:'4920-5300', display:smb.charset.comboBox.uLowerBand}, {name:'5300-5700', display:smb.charset.comboBox.uMiddleBand}, {name:'5700-6080', display:smb.charset.comboBox.uUpperBand} ] }); Ext.define('smb.store.frequencyRangeUS',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'string'}, {name:'display', type:'string'} ], data: [ {name:'5180-5240', display:smb.charset.comboBox.uLowerBandUS}, {name:'5745-5825', display:smb.charset.comboBox.uUpperBandUS} ] }); Ext.define('smb.store.frequencyRangeEU',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'string'}, {name:'display', type:'string'} ], data: [ {name:'5500-5700', display:smb.charset.comboBox.uLowerBandEU} ] }); Ext.define('smb.store.pingResults',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'string'} ] }); Ext.define('smb.store.traceResult',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'string'} ] }); Ext.define('smb.store.count',{ extend: 'Ext.data.Store', fields: [ {name:'value', type:'int'}, {name:'display', type:'string'} ], data: [ {value:1, display:smb.charset.comboBox.first}, {value:2, display:smb.charset.comboBox.second}, {value:3, display:smb.charset.comboBox.third}, {value:4, display:smb.charset.comboBox.fourth}, {value:5, display:smb.charset.comboBox.last} ] }) Ext.define('smb.store.weekday',{ extend: 'Ext.data.Store', fields: [ {name:'value', type:'int'}, {name:'display', type:'string'} ], data: [ {value:0, display:smb.charset.comboBox.sunday}, {value:1, display:smb.charset.comboBox.monday}, {value:2, display:smb.charset.comboBox.tuesday}, {value:3, display:smb.charset.comboBox.wednesday}, {value:4, display:smb.charset.comboBox.thursday}, {value:5, display:smb.charset.comboBox.friday}, {value:6, display:smb.charset.comboBox.saturday} ] }) Ext.define('smb.store.hour',{ extend: 'Ext.data.Store', fields: [ {name:'value', type:'int'}, {name:'display', type:'string'} ], data: [ {value:0, display:'00'}, {value:1, display:'01'}, {value:2, display:'02'}, {value:3, display:'03'}, {value:4, display:'04'}, {value:5, display:'05'}, {value:6, display:'06'}, {value:7, display:'07'}, {value:8, display:'08'}, {value:9, display:'09'}, {value:10, display:'10'}, {value:11, display:'11'}, {value:12, display:'12'}, {value:13, display:'13'}, {value:14, display:'14'}, {value:15, display:'15'}, {value:16, display:'16'}, {value:17, display:'17'}, {value:18, display:'18'}, {value:19, display:'19'}, {value:20, display:'20'}, {value:21, display:'21'}, {value:22, display:'22'}, {value:23, display:'23'} ] }) Ext.define('smb.store.minutes',{ extend: 'Ext.data.Store', fields: [ {name:'value', type:'int'}, {name:'display', type:'string'} ], data: [ {value:0, display:'00'}, {value:1, display:'01'}, {value:2, display:'02'}, {value:3, display:'03'}, {value:4, display:'04'}, {value:5, display:'05'}, {value:6, display:'06'}, {value:7, display:'07'}, {value:8, display:'08'}, {value:9, display:'09'}, {value:10, display:'10'}, {value:11, display:'11'}, {value:12, display:'12'}, {value:13, display:'13'}, {value:14, display:'14'}, {value:15, display:'15'}, {value:16, display:'16'}, {value:17, display:'17'}, {value:18, display:'18'}, {value:19, display:'19'}, {value:20, display:'20'}, {value:21, display:'21'}, {value:22, display:'22'}, {value:23, display:'23'}, {value:24, display:'24'}, {value:25, display:'25'}, {value:26, display:'26'}, {value:27, display:'27'}, {value:28, display:'28'}, {value:29, display:'29'}, {value:30, display:'30'}, {value:31, display:'31'}, {value:32, display:'32'}, {value:33, display:'33'}, {value:34, display:'34'}, {value:35, display:'35'}, {value:36, display:'36'}, {value:37, display:'37'}, {value:38, display:'38'}, {value:39, display:'39'}, {value:40, display:'40'}, {value:41, display:'41'}, {value:42, display:'42'}, {value:43, display:'43'}, {value:44, display:'44'}, {value:45, display:'45'}, {value:46, display:'46'}, {value:47, display:'47'}, {value:48, display:'48'}, {value:49, display:'49'}, {value:50, display:'50'}, {value:51, display:'51'}, {value:52, display:'52'}, {value:53, display:'53'}, {value:54, display:'54'}, {value:55, display:'55'}, {value:56, display:'56'}, {value:57, display:'57'}, {value:58, display:'58'}, {value:59, display:'59'} ] }) Ext.define('smb.store.year',{ extend: 'Ext.data.Store', fields: [ {name:'value', type:'int'}, {name:'display', type:'string'} ], data: [ {value:2000, display:'2000'}, {value:2001, display:'2001'}, {value:2002, display:'2002'}, {value:2003, display:'2003'}, {value:2004, display:'2004'}, {value:2005, display:'2005'}, {value:2006, display:'2006'}, {value:2007, display:'2007'}, {value:2008, display:'2008'}, {value:2009, display:'2009'}, {value:2010, display:'2010'}, {value:2011, display:'2011'}, {value:2012, display:'2012'}, {value:2013, display:'2013'}, {value:2014, display:'2014'}, {value:2015, display:'2015'}, {value:2016, display:'2016'}, {value:2017, display:'2017'}, {value:2018, display:'2018'}, {value:2019, display:'2019'}, {value:2020, display:'2020'}, {value:2021, display:'2021'}, {value:2022, display:'2022'}, {value:2023, display:'2023'}, {value:2024, display:'2024'}, {value:2025, display:'2025'}, {value:2026, display:'2026'}, {value:2027, display:'2027'}, {value:2028, display:'2028'}, {value:2029, display:'2029'}, {value:2030, display:'2030'}, {value:2031, display:'2031'}, {value:2032, display:'2032'}, {value:2033, display:'2033'}, {value:2034, display:'2034'}, {value:2035, display:'2035'}, {value:2036, display:'2036'}, {value:2037, display:'2037'} ] }) Ext.define('smb.store.month',{ extend: 'Ext.data.Store', fields: [ {name:'value', type:'int'}, {name:'display', type:'string'} ], data: [ {value:1, display:smb.charset.comboBox.january}, {value:2, display:smb.charset.comboBox.february}, {value:3, display:smb.charset.comboBox.march}, {value:4, display:smb.charset.comboBox.april}, {value:5, display:smb.charset.comboBox.may}, {value:6, display:smb.charset.comboBox.june}, {value:7, display:smb.charset.comboBox.july}, {value:8, display:smb.charset.comboBox.august}, {value:9, display:smb.charset.comboBox.september}, {value:10, display:smb.charset.comboBox.october}, {value:11, display:smb.charset.comboBox.november}, {value:12, display:smb.charset.comboBox.december} ] }) Ext.define('smb.store.monthDay',{ extend: 'Ext.data.Store', fields: [ {name:'value', type:'int'}, {name:'display', type:'string'} ], data: [ {value:1, display:'1'}, {value:2, display:'2'}, {value:3, display:'3'}, {value:4, display:'4'}, {value:5, display:'5'}, {value:6, display:'6'}, {value:7, display:'7'}, {value:8, display:'8'}, {value:9, display:'9'}, {value:10, display:'10'}, {value:11, display:'11'}, {value:12, display:'12'}, {value:13, display:'13'}, {value:14, display:'14'}, {value:15, display:'15'}, {value:16, display:'16'}, {value:17, display:'17'}, {value:18, display:'18'}, {value:19, display:'19'}, {value:20, display:'20'}, {value:21, display:'21'}, {value:22, display:'22'}, {value:23, display:'23'}, {value:24, display:'24'}, {value:25, display:'25'}, {value:26, display:'26'}, {value:27, display:'27'}, {value:28, display:'28'}, {value:29, display:'29'}, {value:30, display:'30'}, {value:31, display:'31'} ] }) Ext.define('smb.model.daylightTime',{ extend: 'Ext.data.Model', fields: [ {mapping: 'dstStatus', name: 'dstStatus', type: 'boolean'}, {mapping: 'dstMode', name: 'dstMode', type: 'int'}, {mapping: 'modeCountry', name: 'modeCountry', type: 'int'}, {mapping: 'recurringTimeOffset', name: 'recurringTimeOffset', type: 'int'}, {mapping: 'startCount', name: 'startCount', type: 'int'}, {mapping: 'startWeekday', name: 'startWeekday', type: 'int'}, {mapping: 'startMonth', name: 'startMonth', type: 'int'}, {mapping: 'startHour', name: 'startHour', type: 'int'}, {mapping: 'startMin', name: 'startMin', type: 'int'}, {mapping: 'endCount', name: 'endCount', type: 'int'}, {mapping: 'endWeekday', name: 'endWeekday', type: 'int'}, {mapping: 'endMonth', name: 'endMonth', type: 'int'}, {mapping: 'endHour', name: 'endHour', type: 'int'}, {mapping: 'endMin', name: 'endMin', type: 'int'}, {mapping: 'dateTimeOffset', name: 'dateTimeOffset', type: 'int'}, {mapping: 'startDateDay', name: 'startDateDay', type: 'int'}, {mapping: 'startDateMonth', name: 'startDateMonth', type: 'int'}, {mapping: 'startDateHour', name: 'startDateHour', type: 'int'}, {mapping: 'startDateMin', name: 'startDateMin', type: 'int'}, {mapping: 'endDateDay', name: 'endDateDay', type: 'int'}, {mapping: 'endDateMonth', name: 'endDateMonth', type: 'int'}, {mapping: 'endDateHour', name: 'endDateHour', type: 'int'}, {mapping: 'endDateMin', name: 'endDateMin', type: 'int'} ], proxy: { type: 'ajax', url: './data/daylightTime.json', reader: { type: 'json', root: 'data' } } }); /* Ext.define('smb.model.',{ extend: 'Ext.data.Model', fields: [ {mapping: 'tcpSynFloodValue', name: 'tcpSynFloodValue', type: 'int'}, ], proxy: { type: 'ajax', url: './data/.json', reader: { type: 'json', root: '', } } }); */ Ext.define('smb.controller.system', { extend: 'Ext.app.Controller', init: function(){ this.control({ '#deviceName button[id=deviceNameSubmit]' : { click : function(btn, event){ var formBasic = Ext.getCmp('deviceName').getForm(); formBasic.submit({ timeout: 15, clientValidation:true, success: function(thisForm, action) { var formData = Ext.JSON.decode(action.response.responseText); thisForm.loadRecord(formData); var oldLanguageValue = productInfo[1]; switch (formData.data.language) { case 1: newLanguageValue = "zh_CN"; break; case 2: newLanguageValue = "ru"; break; case 3: newLanguageValue = "es"; break; case 0: default: newLanguageValue = "en"; break; } if (oldLanguageValue != newLanguageValue) { // reload page location.href = "./"; } var s = setTimeout(resetApplyChanges, 1000); } }) } }, '#firmware': { afterrender: function(scope, eOpts){ Ext.Ajax.request({ url: './data/firmware.json', success: function(response) { smb.user.timeout.call(this, response, response); var obj = Ext.decode(response.responseText); Ext.getCmp('version').setValue(obj.version); }, callback: function(response){ //return '2'; }, failure: function(response){ } }); } }, '#firmware button[id=updateWare]': { click: function(button,event) { Ext.Ajax.request({ url: './data/upgradeStartRequest.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success != true) { return false; } }, failure: function(response) { var formData = Ext.JSON.decode(response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }) function sendData() { if(smb.user.loginFlag) { Ext.Ajax.request({ url: './data/upgradeProcess.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var getData = Ext.JSON.decode(response.responseText); if(getData.success == true && getData.wholeTime != getData.currentTime) { Ext.getCmp('proBarText').show(); Ext.getCmp('upgradeProNum').show(); Ext.getCmp('upgradeProNum').setValue(Math.round(100*(getData.currentTime/getData.wholeTime))+'%'); Ext.getCmp('rebootProBar').updateProgress(getData.currentTime/getData.wholeTime); //100*(getData.currentTime/getData.wholeTime)+'%'); var o = setTimeout(sendData, 500); } else if(getData.success == true && getData.wholeTime == getData.currentTime) { Ext.getCmp('rebootProBar').updateProgress(1); Ext.getCmp('proBarText').hide(); Ext.getCmp('upgradeProNum').hide(); Ext.getCmp('proBarRebootText').show(); Ext.Ajax.request({ url: './data/rebootProcess.json', success: function(reboot) { smb.user.timeout.call(this, response, response); // Ext.getCmp('rebootBar').setTitle(smb.charset.module.reboot); var rebootInfo = Ext.JSON.decode(reboot.responseText); Ext.getCmp('rebootProBar').reset(); Ext.getCmp('rebootProBar').wait({ interval: 1000, duration: rebootInfo.wholeTime*1000, increment: rebootInfo.wholeTime+1, animate: true, // text: smb.charset.label.rebooting, scope: this, fn: function() { Ext.getCmp('rebootProBar').updateProgress( 1 ); } }); /////////////按照返回时间+0.5s var s = setTimeout('location=location', rebootInfo.wholeTime*1000+500); }, failure: function(response) { var formData = Ext.JSON.decode(response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }) } }, failure: function(response) { var formData = Ext.JSON.decode(response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }); } } function sendAjax(result) { var resetFlag = (result=='yes'?false:true); if(result == 'yes' || result=='no') { Ext.Ajax.request({ url: './data/upgradeContinue.json', params: { bReset: resetFlag }, success: function(continueResp) { smb.user.timeout.call(this, continueResp, continueResp); var continueData = Ext.JSON.decode(continueResp.responseText); if(continueData.success == true) { Ext.getCmp('rebootBar').show(); Ext.getCmp('rebootBar').setTitle(smb.charset.module.firmware); smb.user.bodyMask.show(); smb.user.bodyMask2.show(); var e = setTimeout(sendData, 500); } else if(continueData.success == false) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e' + continueData.errCode]); } }, failure: function(response) { var formData = Ext.JSON.decode(response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }); } else if( result == 'cancel') { Ext.Ajax.request({ url: './data/upgradeCancel.json', success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success == false) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e' + data.errCode]); } }, failure: function(response) { var formData = Ext.JSON.decode(response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }) } } if(Ext.getCmp('firmware').getForm().isValid()) { Ext.getCmp('firmware').getForm().submit({ waitTitle: smb.charset.module.firmware, waitMsg: smb.charset.label.uploadingFile, timeout: 10, clientValidation:true, url: './data/firmwareUpdata.json', success: function(thisForm, action) { var formData = Ext.JSON.decode(action.response.responseText); if(formData.errCode == 0) { Ext.MessageBox.show({ title: smb.charset.module.firmware, msg: smb.charset.tip.theVersionIs+ formData.version +smb.charset.tip.areYouSureToUpgrade, buttons: Ext.MessageBox.YESNOCANCEL, buttonText:{ yes: smb.charset.button.keep, no: smb.charset.button.restore, cancel: smb.charset.button.cancel }, fn: sendAjax }); // Ext.Msg.confirm(smb.charset.module.firmware, smb.charset.tip.theVersionIs+ formData.version +smb.charset.tip.areYouSureToUpgrade, sendAjax) } }, failure: function(form, action) { var formData = Ext.JSON.decode(action.response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); // switch (action.failureType) { // case Ext.form.action.Action.CLIENT_INVALID: { // Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values'); // break; // };case Ext.form.action.Action.CONNECT_FAILURE: { // Ext.Msg.alert('Failure', 'Ajax communication failed'); // break; // };case Ext.form.action.Action.SERVER_INVALID: { // alert(action); // Ext.Msg.alert('Failure', action.result.msg); // } // } } }); } } }, '#configuration button[id=backupBtn]': { click: function(button, event) { if(Ext.isIE){ var referLink = document.createElement('a'); referLink.href = 'data/configBackup.json'; document.body.appendChild(referLink); referLink.click(); } else{ window.location.href = 'data/configBackup.json'; } } }, '#configuration button[id=resetBtn]': { click: function(button, event) { function sendAjax(result) { if(result == 'yes') { smb.user.bodyMask.show(); smb.user.bodyMask2.show(); Ext.Ajax.request({ url: './data/configReset.json', success: function(response) { smb.user.timeout.call(this, response, response); Ext.getCmp('proBarResetText').show(); Ext.getCmp('rebootBar').show(); Ext.getCmp('rebootBar').setTitle(smb.charset.module.configuration); var resetInfo = Ext.JSON.decode(response.responseText); ///////////// reset Ext.getCmp('rebootProBar').reset(); Ext.getCmp('rebootProBar').wait({ interval: 1000, duration: resetInfo.resetTime*1000, increment: resetInfo.resetTime+1, animate: true, // text: smb.charset.label.resetting, scope: this, fn: function() { Ext.getCmp('rebootProBar').updateProgress( 1 ); } }); var b = setTimeout(reboot, resetInfo.resetTime*1000+500); /////////// reboot function reboot(rebootTime) { Ext.getCmp('proBarResetText').hide(); Ext.getCmp('proBarRebootText').show(); Ext.getCmp('rebootProBar').reset(); Ext.getCmp('rebootProBar').wait({ interval: 1000, duration: resetInfo.rebootTime*1000, increment: resetInfo.rebootTime+1, animate: true, // text: smb.charset.label.rebooting, scope: this, fn: function() { Ext.getCmp('rebootProBar').updateProgress( 1 ); } }); function goToIp() { top.location.href = 'http://'+ resetInfo.defaultIP; // window.top.location.host = resetInfo.defaultIP; // top.location.host = resetInfo.defaultIP; // window.location.href = resetInfo.defaultIP; } var s = setTimeout(goToIp, resetInfo.rebootTime*1000+500); } } }); } } Ext.Msg.confirm(smb.charset.module.configuration, smb.charset.tip.confirmReset, sendAjax) } }, '#configuration button[id=rebootBtn]': { click: function(button, event) { function sendAjax(result) { if(result == 'yes') { Ext.Ajax.request({ url: './data/configReboot.json', success: function(response) { smb.user.timeout.call(this, response, response); smb.user.bodyMask.show(); smb.user.bodyMask2.show(); Ext.getCmp('proBarRebootText').show(); Ext.getCmp('rebootBar').show(); Ext.getCmp('rebootBar').setTitle(smb.charset.module.configuration); var resetInfo = Ext.JSON.decode(response.responseText); ///////////// reset Ext.getCmp('rebootProBar').reset(); Ext.getCmp('rebootProBar').wait({ interval: 1000, duration: resetInfo.wholeTime*1000, increment: resetInfo.wholeTime+1, animate: true, // text: smb.charset.label.rebooting, scope: this, fn: function() { Ext.getCmp('rebootProBar').updateProgress( 1 ); } }); var s = setTimeout('location=location', resetInfo.wholeTime*1000+500); } }); } } Ext.Msg.confirm(smb.charset.module.configuration, smb.charset.tip.confirmReboot, sendAjax) } }, '#configuration button[id=restoreBtn]': { click: function(button, event) { function sendAjax(result) { if(result == 'yes') { Ext.getCmp('configuration').getForm().submit({ waitTitle: smb.charset.module.configuration, waitMsg: smb.charset.label.uploadingFile, timeout: 10, clientValidation: true, url: './data/configRestore.json', success: function(thisForm, action) { var formData = Ext.JSON.decode(action.response.responseText); if(formData.success) { smb.user.bodyMask.show(); smb.user.bodyMask2.show(); Ext.getCmp('proBarRestoreText').show(); Ext.getCmp('rebootBar').show(); Ext.getCmp('rebootBar').setTitle(smb.charset.module.configuration); ///////////// reset Ext.getCmp('rebootProBar').reset(); Ext.getCmp('rebootProBar').wait({ interval: 1000, duration: formData.restoreTime*1000, increment: formData.restoreTime+1, animate: true, // text: smb.charset.label.restoring, scope: this, fn: function() { Ext.getCmp('rebootProBar').updateProgress( 1); } }); /////////// reboot function reboot(rebootTime) { Ext.getCmp('proBarRestoreText').hide(); Ext.getCmp('proBarRebootText').show(); Ext.getCmp('rebootProBar').reset(); Ext.getCmp('rebootProBar').wait({ interval: 1000, duration: formData.rebootTime*1000, increment: formData.rebootTime+1, animate: true, // text: smb.charset.label.rebooting, scope: this, fn: function() { Ext.getCmp('rebootProBar').updateProgress( 1 ); } }); var s = setTimeout('location=location', formData.rebootTime*1000+500); } var b = setTimeout(reboot, formData.restoreTime*1000+500); } }, failure: function(form, action) { var formData = Ext.JSON.decode(action.response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); // switch (action.failureType) { // case Ext.form.action.Action.CLIENT_INVALID: { // Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values'); // break; // };case Ext.form.action.Action.CONNECT_FAILURE: { // Ext.Msg.alert('Failure', 'Ajax communication failed'); // break; // };case Ext.form.action.Action.SERVER_INVALID: { // alert(action); // Ext.Msg.alert('Failure', action.result.msg); // } // } } }); } } if(Ext.getCmp('configuration').getForm().isValid()) { Ext.Msg.confirm(smb.charset.module.configuration, smb.charset.tip.confirmRestore, sendAjax) } } }, '#time button[id=daylightShow]':{ click: function(button, event) { smb.user.bodyMask.show(); smb.user.bodyMask2.show(); if(Ext.getCmp('daylightTime')) { Ext.getCmp('daylightTime').show(); } else { Ext.create('smb.view.popBox',{ id: 'daylightTime', name: 'daylightTime', title: smb.charset.module.daylightSavingTime, width: 800, height: 420, resizable: false, items:[ { xtype: 'smbModule', header: false, id: 'daylightTimeForm', model: 'daylightTime', url: './data/daylightTime.json', items:[ { xtype: 'hidden', submitValue: true, name: 'hidden', value: 'hidden' }, { xtype: 'checkbox', id: 'dstStatus', name: 'dstStatus', fieldLabel: smb.charset.label.dstStatus, boxLabel: smb.charset.label.enable, checked: true, listeners:{ change:function(item, newValue, oldValue) { if(newValue){ Ext.getCmp('daylightSetCnt').enable(); } else{ Ext.getCmp('daylightSetCnt').disable(); } } } }, { xtype: 'fieldcontainer', id: 'daylightSetCnt', items:[ { xtype: 'radio', name: 'dstMode', boxLabel: smb.charset.label.predefinedMode, margin: '10 0 5 0', inputValue: 0, listeners:{ change:function( item, newValue, oldValue ) { if( newValue) { Ext.getCmp('predefinedCnt').enable(); Ext.getCmp('recurringCnt').disable(); Ext.getCmp('dateCnt').disable(); } } } }, { xtype: 'fieldcontainer', id: 'predefinedCnt', defaultType: 'radio', layout: 'hbox', width: 780, items: [ { xtype: 'radio', boxLabel: smb.charset.label.usa, name: 'modeCountry', margin: '0 20 0 80', inputValue: 0 }, { boxLabel: smb.charset.label.european, name: 'modeCountry', inputValue: 1 }, { boxLabel: smb.charset.label.australia, name: 'modeCountry', margin: '0 20', inputValue: 2 }, { boxLabel: smb.charset.label.newZealand, name: 'modeCountry', inputValue: 3 } ] }, { xtype: 'radio', name: 'dstMode', boxLabel: smb.charset.label.recurringMode, margin: '10 0 5 0', inputValue: 1, listeners:{ change:function( item, newValue, oldValue ) { if( newValue) { Ext.getCmp('recurringCnt').enable(); Ext.getCmp('predefinedCnt').disable(); Ext.getCmp('dateCnt').disable(); } } } }, { xtype: 'fieldcontainer', id: 'recurringCnt', width: 780, items:[ { xtype: 'fieldcontainer', layout: 'hbox', width: 700, items:[ { xtype: 'numberfield', fieldLabel: smb.charset.label.timeOffset, name: 'recurringTimeOffset', decimalPrecision: 0, labelWidth: 120, labelAlign: 'right', minValue: 0, maxValue: 180 }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 0 0 20', value: smb.charset.label.minutes } ] }, { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.startTime, labelWidth: 120, labelAlign: 'right', layout: 'hbox', width: 780, items:[ { xtype: 'combobox', id: 'startCount', name: 'startCount', store: 'count', displayField: 'display', valueField: 'value', editable: false, width: 90, value: 1, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); if( startMonth == endMonth ){ if( startCount > endCount ){ return smb.charset.validation.endTimeWrong; } } return true; } }, { xtype: 'combobox', id: 'startWeekday', name: 'startWeekday', store: 'weekday', displayField: 'display', valueField: 'value', editable: false, width: 110, margin: '0 10 0 10', value: 0, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); var startWeek = parseInt( Ext.getCmp('startWeekday').getValue() ); var endWeek = parseInt( Ext.getCmp('endWeekday').getValue() ); if( Ext.getCmp('startCount').validate() && Ext.getCmp('endCount').validate() ){ if( startMonth==endMonth && startCount==endCount ){ if( startWeek>endWeek){ return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, value: smb.charset.label.inWord }, { xtype: 'combobox', id: 'startMonth', name: 'startMonth', store: 'month', displayField: 'display', valueField: 'value', editable: false, width: 110, margin: '0 10 0 10', value: 1 }, { xtype: 'displayfield', submitValue: false, hideLabel: true, value: smb.charset.label.at }, { xtype: 'combobox', id: 'startHour', name: 'startHour', store: 'hour', displayField: 'display', valueField: 'value', editable: false, width: 60, margin: '0 10 0 10', value: 0, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); var startWeek = parseInt( Ext.getCmp('startWeekday').getValue() ); var endWeek = parseInt( Ext.getCmp('endWeekday').getValue() ); var startHour = parseInt( Ext.getCmp('startHour').getValue() ); var endHour = parseInt( Ext.getCmp('endHour').getValue() ); if( Ext.getCmp('startCount').validate() && Ext.getCmp('endCount').validate() && Ext.getCmp('startWeekday').validate() && Ext.getCmp('endWeekday').validate() ){ if( startMonth==endMonth && startCount==endCount && startWeek==endWeek ){ if( startHour>endHour){ return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, value: ':' }, { xtype: 'combobox', id: 'startMin', name: 'startMin', store: 'minutes', displayField: 'display', valueField: 'value', editable: false, width: 60, margin: '0 0 0 10', value: 0, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); var startWeek = parseInt( Ext.getCmp('startWeekday').getValue() ); var endWeek = parseInt( Ext.getCmp('endWeekday').getValue() ); var startHour = parseInt( Ext.getCmp('startHour').getValue() ); var endHour = parseInt( Ext.getCmp('endHour').getValue() ); var startMin = parseInt( Ext.getCmp('startMin').getValue() ); var endMin = parseInt( Ext.getCmp('endMin').getValue() ); if( Ext.getCmp('startCount').validate() && Ext.getCmp('endCount').validate() && Ext.getCmp('startWeekday').validate() && Ext.getCmp('endWeekday').validate() && Ext.getCmp('startHour').validate() && Ext.getCmp('endHour').validate() ){ if( startMonth==endMonth && startCount==endCount && startWeek==endWeek && startHour==endHour ){ if( startMin>=endMin){ return smb.charset.validation.endTimeWrong; } } } return true; } } ] }, { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.endTime, labelWidth: 120, labelAlign: 'right', layout: 'hbox', width: 780, items:[ { xtype: 'combobox', id: 'endCount', name: 'endCount', store: 'count', displayField: 'display', valueField: 'value', editable: false, width: 90, value: 1, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); if( startMonth == endMonth ){ if( startCount > endCount ){ return smb.charset.validation.endTimeWrong; } } return true; } }, { xtype: 'combobox', id: 'endWeekday', name: 'endWeekday', store: 'weekday', displayField: 'display', valueField: 'value', editable: false, width: 110, margin: '0 10 0 10', value: 0, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); var startWeek = parseInt( Ext.getCmp('startWeekday').getValue() ); var endWeek = parseInt( Ext.getCmp('endWeekday').getValue() ); if( Ext.getCmp('startCount').validate() && Ext.getCmp('endCount').validate() ){ if( startMonth==endMonth && startCount==endCount ){ if( startWeek>endWeek){ return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, value: smb.charset.label.inWord }, { xtype: 'combobox', id: 'endMonth', name: 'endMonth', store: 'month', displayField: 'display', valueField: 'value', editable: false, width: 110, margin: '0 10 0 10', value: 1 }, { xtype: 'displayfield', submitValue: false, hideLabel: true, value: smb.charset.label.at }, { xtype: 'combobox', id: 'endHour', name: 'endHour', store: 'hour', displayField: 'display', valueField: 'value', editable: false, width: 60, margin: '0 10 0 10', value: 0, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); var startWeek = parseInt( Ext.getCmp('startWeekday').getValue() ); var endWeek = parseInt( Ext.getCmp('endWeekday').getValue() ); var startHour = parseInt( Ext.getCmp('startHour').getValue() ); var endHour = parseInt( Ext.getCmp('endHour').getValue() ); if( Ext.getCmp('startCount').validate() && Ext.getCmp('endCount').validate() && Ext.getCmp('startWeekday').validate() && Ext.getCmp('endWeekday').validate() ){ if( startMonth==endMonth && startCount==endCount && startWeek==endWeek ){ if( startHour>endHour){ return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, value: ':' }, { xtype: 'combobox', id: 'endMin', name: 'endMin', store: 'minutes', displayField: 'display', valueField: 'value', editable: false, width: 60, margin: '0 0 0 10', value: 0, validator:function(value) { var startMonth = parseInt( Ext.getCmp('startMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endMonth').getValue() ); var startCount = parseInt( Ext.getCmp('startCount').getValue() ); var endCount = parseInt( Ext.getCmp('endCount').getValue() ); var startWeek = parseInt( Ext.getCmp('startWeekday').getValue() ); var endWeek = parseInt( Ext.getCmp('endWeekday').getValue() ); var startHour = parseInt( Ext.getCmp('startHour').getValue() ); var endHour = parseInt( Ext.getCmp('endHour').getValue() ); var startMin = parseInt( Ext.getCmp('startMin').getValue() ); var endMin = parseInt( Ext.getCmp('endMin').getValue() ); if( Ext.getCmp('startCount').validate() && Ext.getCmp('endCount').validate() && Ext.getCmp('startWeekday').validate() && Ext.getCmp('endWeekday').validate() && Ext.getCmp('startHour').validate() && Ext.getCmp('endHour').validate() ){ if( startMonth==endMonth && startCount==endCount && startWeek==endWeek && startHour==endHour ){ if( startMin>=endMin){ return smb.charset.validation.endTimeWrong; } } } return true; } } ] } ] }, { xtype: 'radio', name: 'dstMode', boxLabel: smb.charset.label.dateMode, margin: '10 0 5 0', inputValue: 2, listeners:{ change:function( item, newValue, oldValue ) { if( newValue) { Ext.getCmp('dateCnt').enable(); Ext.getCmp('recurringCnt').disable(); Ext.getCmp('predefinedCnt').disable(); } } } }, { xtype: 'fieldcontainer', id: 'dateCnt', width: 780, items:[ { xtype: 'fieldcontainer', layout: 'hbox', width: 700, items:[ { xtype: 'numberfield', fieldLabel: smb.charset.label.timeOffset, id: 'dateTimeOffset', name: 'dateTimeOffset', labelWidth: 120, labelAlign: 'right', decimalPrecision: 0, minValue: 0, maxValue: 180 }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 0 0 20', value: smb.charset.label.minutes } ] }, { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.startTime, labelWidth: 120, labelAlign: 'right', layout: 'hbox', width: 780, items:[ { xtype: 'combobox', id: 'startDateYear', name: 'startDateYear', store: 'year', displayField: 'display', valueField: 'value', editable: false, width: 80, value: 2000, validator:function(value) { var endYear = parseInt(Ext.getCmp('endDateYear').getValue()); value = parseInt(value); if( value > endYear ) { return smb.charset.validation.startYearWrong; } else if( endYear-value>1 ) { return smb.charset.validation.startEndYearRangeWrong; } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 10 0 10', value: '-' }, { xtype: 'combobox', id: 'startDateMonth', name: 'startDateMonth', store: 'month', displayField: 'display', valueField: 'value', editable: false, width: 110, value: 1, validator:function(value) { var startYear = parseInt( Ext.getCmp('startDateYear').getValue() ); var endYear = parseInt( Ext.getCmp('endDateYear').getValue() ); var startMonth = parseInt( Ext.getCmp('startDateMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endDateMonth').getValue() ); if( Ext.getCmp('startDateYear').validate() && Ext.getCmp('endDateYear').validate() ){ if( startYear == endYear ){ if( startMonth>endMonth){ return smb.charset.validation.endTimeWrong; } } } return true; }, listeners:{ change:function(item, newValue, oldValue) { var curDate = new Date(); var date = new Date(curDate.getFullYear(), newValue-1, 15); var monthStore = Ext.getCmp('startDateDay').getStore(); monthStore.removeAll(); for(var i=1; i<=Ext.Date.getDaysInMonth(date); i++) { monthStore.add({value:i, display:i}) } } } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 10 0 10', value: '-' }, { xtype: 'combobox', id: 'startDateDay', name: 'startDateDay', displayField: 'display', valueField: 'value', editable: false, width: 80, value: 1, queryMode: 'local', store: Ext.create('Ext.data.Store',{ fields: ['value','display'] }), validator:function(value) { var startYear = parseInt( Ext.getCmp('startDateYear').getValue() ); var endYear = parseInt( Ext.getCmp('endDateYear').getValue() ); var startMonth = parseInt( Ext.getCmp('startDateMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endDateMonth').getValue() ); var startDay = parseInt( Ext.getCmp('startDateDay').getValue() ); var endDay = parseInt( Ext.getCmp('endDateDay').getValue() ); if( Ext.getCmp('startDateYear').validate() && Ext.getCmp('endDateYear').validate() && Ext.getCmp('startDateMonth').validate() && Ext.getCmp('endDateMonth').validate() ){ if( startYear == endYear && startMonth==endMonth ){ if( startDay > endDay ) { return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 10 0 10', value: smb.charset.label.at }, { xtype: 'combobox', id: 'startDateHour', name: 'startDateHour', store: 'hour', displayField: 'display', valueField: 'value', editable: false, width: 80, value: 0, validator:function(value) { var startYear = parseInt( Ext.getCmp('startDateYear').getValue() ); var endYear = parseInt( Ext.getCmp('endDateYear').getValue() ); var startMonth = parseInt( Ext.getCmp('startDateMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endDateMonth').getValue() ); var startDay = parseInt( Ext.getCmp('startDateDay').getValue() ); var endDay = parseInt( Ext.getCmp('endDateDay').getValue() ); var startHour = parseInt( Ext.getCmp('startDateHour').getValue() ); var endHour = parseInt( Ext.getCmp('endDateHour').getValue() ); if( Ext.getCmp('startDateYear').validate() && Ext.getCmp('endDateYear').validate() && Ext.getCmp('startDateMonth').validate() && Ext.getCmp('endDateMonth').validate() && Ext.getCmp('startDateDay').validate() && Ext.getCmp('endDateDay').validate() ){ if( startYear == endYear && startMonth==endMonth && startDay == endDay ){ if( startHour>endHour ){ return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 10 0 10', value: ':' }, { xtype: 'combobox', id: 'startDateMin', name: 'startDateMin', store: 'minutes', displayField: 'display', valueField: 'value', editable: false, width: 80, value: 0, validator:function(value) { var startYear = parseInt( Ext.getCmp('startDateYear').getValue() ); var endYear = parseInt( Ext.getCmp('endDateYear').getValue() ); var startMonth = parseInt( Ext.getCmp('startDateMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endDateMonth').getValue() ); var startDay = parseInt( Ext.getCmp('startDateDay').getValue() ); var endDay = parseInt( Ext.getCmp('endDateDay').getValue() ); var startHour = parseInt( Ext.getCmp('startDateHour').getValue() ); var endHour = parseInt( Ext.getCmp('endDateHour').getValue() ); var startMin = parseInt( Ext.getCmp('startDateMin').getValue() ); var endMin = parseInt( Ext.getCmp('endDateMin').getValue() ); if( Ext.getCmp('startDateYear').validate() && Ext.getCmp('endDateYear').validate() && Ext.getCmp('startDateMonth').validate() && Ext.getCmp('endDateMonth').validate() && Ext.getCmp('startDateDay').validate() && Ext.getCmp('endDateDay').validate() && Ext.getCmp('startDateHour').validate() && Ext.getCmp('endDateHour').validate() ){ if( startYear == endYear && startMonth==endMonth && startDay == endDay && startHour==endHour ){ if( startMin>=endMin ){ return smb.charset.validation.endTimeWrong; } } } return true; } } ] }, { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.endTime, labelWidth: 120, labelAlign: 'right', layout: 'hbox', width: 780, items:[ { xtype: 'combobox', id: 'endDateYear', name: 'endDateYear', store: 'year', displayField: 'display', valueField: 'value', editable: false, width: 80, value: 2000, validator:function(value) { var startYear = parseInt(Ext.getCmp('startDateYear').getValue()); value = parseInt(value); if( value < startYear ) { return smb.charset.validation.startYearWrong; } else if( value - startYear>1 ) { return smb.charset.validation.startEndYearRangeWrong; } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 10 0 10', value: '-' }, { xtype: 'combobox', id: 'endDateMonth', name: 'endDateMonth', store: 'month', displayField: 'display', valueField: 'value', editable: false, width: 110, value: 1, validator:function(value) { var startYear = parseInt( Ext.getCmp('startDateYear').getValue() ); var endYear = parseInt( Ext.getCmp('endDateYear').getValue() ); var startMonth = parseInt( Ext.getCmp('startDateMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endDateMonth').getValue() ); if( Ext.getCmp('startDateYear').validate() && Ext.getCmp('endDateYear').validate() ){ if( startYear == endYear ){ if( endMonth endDay ) { return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 10 0 10', value: smb.charset.label.at }, { xtype: 'combobox', id: 'endDateHour', name: 'endDateHour', store: 'hour', displayField: 'display', valueField: 'value', editable: false, width: 80, value: 0, validator:function(value) { var startYear = parseInt( Ext.getCmp('startDateYear').getValue() ); var endYear = parseInt( Ext.getCmp('endDateYear').getValue() ); var startMonth = parseInt( Ext.getCmp('startDateMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endDateMonth').getValue() ); var startDay = parseInt( Ext.getCmp('startDateDay').getValue() ); var endDay = parseInt( Ext.getCmp('endDateDay').getValue() ); var startHour = parseInt( Ext.getCmp('startDateHour').getValue() ); var endHour = parseInt( Ext.getCmp('endDateHour').getValue() ); if( Ext.getCmp('startDateYear').validate() && Ext.getCmp('endDateYear').validate() && Ext.getCmp('startDateMonth').validate() && Ext.getCmp('endDateMonth').validate() && Ext.getCmp('startDateDay').validate() && Ext.getCmp('endDateDay').validate() ){ if( startYear == endYear && startMonth==endMonth && startDay == endDay ){ if( startHour>endHour ){ return smb.charset.validation.endTimeWrong; } } } return true; } }, { xtype: 'displayfield', submitValue: false, hideLabel: true, margin: '0 10 0 10', value: ':' }, { xtype: 'combobox', id: 'endDateMin', name: 'endDateMin', store: 'minutes', displayField: 'display', valueField: 'value', editable: false, width: 80, value: 0, validator:function(value) { var startYear = parseInt( Ext.getCmp('startDateYear').getValue() ); var endYear = parseInt( Ext.getCmp('endDateYear').getValue() ); var startMonth = parseInt( Ext.getCmp('startDateMonth').getValue() ); var endMonth = parseInt( Ext.getCmp('endDateMonth').getValue() ); var startDay = parseInt( Ext.getCmp('startDateDay').getValue() ); var endDay = parseInt( Ext.getCmp('endDateDay').getValue() ); var startHour = parseInt( Ext.getCmp('startDateHour').getValue() ); var endHour = parseInt( Ext.getCmp('endDateHour').getValue() ); var startMin = parseInt( Ext.getCmp('startDateMin').getValue() ); var endMin = parseInt( Ext.getCmp('endDateMin').getValue() ); if( Ext.getCmp('startDateYear').validate() && Ext.getCmp('endDateYear').validate() && Ext.getCmp('startDateMonth').validate() && Ext.getCmp('endDateMonth').validate() && Ext.getCmp('startDateDay').validate() && Ext.getCmp('endDateDay').validate() && Ext.getCmp('startDateHour').validate() && Ext.getCmp('endDateHour').validate() ){ if( startYear == endYear && startMonth==endMonth && startDay == endDay && startHour==endHour ){ if( startMin>=endMin ){ return smb.charset.validation.endTimeWrong; } } } return true; } } ] } ] } ] } ], buttons:[ { text: smb.charset.button.submit, listeners:{ click:function(button, event) { var formBasic = Ext.getCmp('daylightTimeForm').getForm(); if( formBasic.isValid() ) { formBasic.submit({ timeout: 15, clientValidation:true, success: function(thisForm, action) { var formData = Ext.JSON.decode(action.response.responseText); smb.user.timeout.call(this, thisForm, action, 0); thisForm.loadRecord(formData); var s = setTimeout(resetApplyChanges, 1000); Ext.getCmp('daylightTime').hide(); smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); }, failure: function(form, action) { var formData = Ext.JSON.decode(action.response.responseText); switch (action.failureType) { case Ext.form.action.Action.CLIENT_INVALID: { Ext.Msg.alert(smb.charset.module.failure, smb.charset.tip.formInvalid); break; }; case Ext.form.action.Action.CONNECT_FAILURE: { Ext.Msg.alert(smb.charset.module.failure, smb.charset.tip.dataFailure); break; }; case Ext.form.action.Action.SERVER_INVALID: { if(formData.errCode) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } else { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } break; } } } }); } } } } ] } ], listeners:{ close:function( item, event ) { smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); } } }); Ext.getCmp('daylightTime').show(); } Ext.Ajax.request({ url: './data/daylightTime.json', success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success) { Ext.getCmp('daylightTimeForm').getForm().setValues(data.data); } } }); } }, '#userAccount checkbox[id = showCurPwd]': { change: function( scope, newValue, oldValue, eOpts) { if( newValue ) { Ext.getCmp('curPwdText').show(); Ext.getCmp('curPassword').hide(); } else { Ext.getCmp('curPwdText').hide(); Ext.getCmp('curPassword').show(); } } }, '#userAccount checkbox[id = showNewPwd]': { change: function( scope, newValue, oldValue, eOpts) { if( newValue ) { Ext.getCmp('newPwdText').show(); Ext.getCmp('newPwd').hide(); } else { Ext.getCmp('newPwdText').hide(); Ext.getCmp('newPwd').show(); } } }, '#userAccount button[id=userAccSubmit]':{ click: function(btn,event) { var formBasic = Ext.getCmp('userAccount').getForm(); if( formBasic.isValid() ) { formBasic.submit({ // waitTitle: 'Submitting your data', // waitMsg: 'Submitting your data msg', timeout: 15, clientValidation:true, success: function(thisForm, action) { smb.user.timeout.call(this, action, action, 0); var formData = Ext.JSON.decode(action.response.responseText); thisForm.loadRecord(formData); Ext.getCmp('curPassword').setValue(''); Ext.getCmp('curPassword').clearInvalid(); Ext.getCmp('curPwdText').setValue(''); Ext.getCmp('curPwdText').clearInvalid(); Ext.getCmp('newUserName').setValue(''); Ext.getCmp('newUserName').clearInvalid(); Ext.getCmp('newPwd').setValue(''); Ext.getCmp('newPwd').clearInvalid(); Ext.getCmp('newPwdText').setValue(''); Ext.getCmp('newPwdText').clearInvalid(); Ext.getCmp('confirmNewPwd').setValue(''); Ext.getCmp('confirmNewPwd').clearInvalid(); var s = setTimeout(resetApplyChanges, 1000); }, failure: function(form, action) { var formData = Ext.JSON.decode(action.response.responseText); switch (action.failureType) { case Ext.form.action.Action.CLIENT_INVALID: { Ext.Msg.alert(smb.charset.module.failure, smb.charset.tip.formInvalid); break; }; case Ext.form.action.Action.CONNECT_FAILURE: { Ext.Msg.alert(smb.charset.module.failure, smb.charset.tip.dataFailure); break; }; case Ext.form.action.Action.SERVER_INVALID: { if(formData.errCode) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } else { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } break; } } } }); } } }, '#time button[id=getGmt]': { click: function(button, event) { Ext.Ajax.request({ url: './data/GetGMT.json', params: { }, success: function(response) { var formData = Ext.JSON.decode(response.responseText); smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success == true) { Ext.getCmp('time').getForm().loadRecord(formData.data); Ext.getCmp('timeDate').setValue(formData.data.date); Ext.getCmp('timeTime').setValue(formData.data.time); Ext.getCmp('timeZone').setValue(formData.data.timezone); Ext.getCmp('timeNtp1').setValue(formData.data.ntp1); Ext.getCmp('timeNtp2').setValue(formData.data.ntp2); } else if(data.success == false) { Ext.Msg.alert(smb.charset.module.failure, smb.charset.tip.failGetGmt); } }, failure: function() { Ext.Msg.alert(smb.charset.module.failure, smb.charset.tip.failGetGmt); } }); } }, '#time datefield[name=date]': { change: function(obj, newValue, oldValue, Opts) { if(obj.changeFlag == 0) { obj.changeFlag = 1; obj.oriValue = newValue; } if(newValue && (newValue.toString() != obj.oriValue.toString())) { Ext.getCmp('isTimeChanged').setValue('1'); } else { Ext.getCmp('isTimeChanged').setValue('0'); } } }, '#time timefield[name=time]': { change: function(obj, newValue, oldValue, Opts) { if(obj.validate()) { if(obj.changeFlag == 0) { obj.changeFlag = 1; obj.oriValue = newValue; } if(newValue.toString() != obj.oriValue.toString()) { Ext.getCmp('isTimeChanged').setValue('1'); } else { Ext.getCmp('isTimeChanged').setValue('0'); } } } } }); } });