// JavaScript Document Ext.define('smb.view.tabs',{ id: 'tabs', extend: 'Ext.tab.Panel', alias: 'widget.tabs', /*tools: [ {xtype: 'button', id:'applyChange', width:100, height:26, text: smb.charset.button.saveToFlash}, {xtype: 'displayfield', id:'saveTip', width:500, margin:'0 0 0 10'}, {xtype: 'modeCombo', margin:'0 10 0 10'}, {xtype: 'button', id: 'btnLogout', height:26, width:80, text: smb.charset.button.logout} ],*/ frame: true, border: false, initComponent: function(){ this.callParent(arguments); for (var tab in smb.pages){ var tabInfo = smb.pages[tab]; if (tabInfo.type == 'page'){ var name = tabInfo.name; this.add({ title: smb.charset.tab[name], id: name, xtype: 'container' }); } }; this.setActiveTab(0); } }); Ext.define('smb.view.savetool',{ id: 'savetool', extend: 'Ext.panel.Panel', alias: 'widget.savetool', width:960, frame:true, layout:'hbox', items: [ {xtype: 'button', id:'applyChange', width:100, height:26, text: smb.charset.button.saveToFlash}, {xtype: 'displayfield', id:'saveTip', width:400, margin:'0 0 0 10'}, {xtype: 'modeCombo', width:300, margin:'0 10 0 10'}, {xtype: 'button', id:'btnLogout', width:100, height:26, width:80, text: smb.charset.button.logout} ], border: false }); Ext.define('smb.view.loadingBar',{ extend: 'Ext.window.Window', id: 'loadingBar', name: 'loadingBar', alias: 'widget.loadingBar', width: 600, height: 200, hidden:false, closable: false, items:[ { xtype: 'progressbar', id: 'loadingprogressbar', width: 500, border: 0, margin: '10 45' } ] }); Ext.define('smb.view.modeCombo',{ id: 'modeCombo', extend: 'Ext.form.field.ComboBox', alias: 'widget.modeCombo', fieldLabel: smb.charset.label.operationMode, editable: false, queryMode: 'local', defautValue: 'accessPoint', store: Ext.create('Ext.data.Store',{ fields: ['name', 'value'], data: [ {value: 'accessPoint', name: smb.charset.mode.accessPoint}, {value: 'client', name: smb.charset.mode.client}, {value: 'wdsRepeater', name: smb.charset.mode.wdsRepeater}, {value: 'bridgeWithAP', name: smb.charset.mode.bridgeWithAP}, {value: 'apRouter', name: smb.charset.mode.apRouter}, {value: 'apClientRouter', name: smb.charset.mode.apClientRouter} ] }), displayField: 'name', valueField: 'value' }); Ext.define('smb.controller.main', { extend: 'Ext.app.Controller', init: function(){ this.control({ '#btnLogout': { click: function(btn){ if(Ext.getCmp('loginUsername') && Ext.getCmp('loginPassword') ) { Ext.getCmp('loginUsername').setValue(''); Ext.getCmp('loginPassword').setValue(''); Ext.getCmp('loginUsername').clearInvalid(); Ext.getCmp('loginPassword').clearInvalid(); } smb.user.doLogoutRequest.call(this); } }, '#applyChange': { click: function(btn,event) { Ext.getCmp('saveTip').setValue(''); Ext.Ajax.request({ url: './data/saveChanges.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success == true) { document.getElementById('savetoolCnt').style.display = 'none'; } else { Ext.Msg.alert(smb.charset.module.failure, smb.charset.tip.failToSaveChange); } } }); } }, '#modeCombo': { change: function(combo, newValue, oldValue, eOps){ if( (typeof(oldValue) != "undefined") && (combo.hasFocus) && ((typeof combo.confirmFlag=="undefined") || (combo.confirmFlag))) { this.newValue = newValue; this.oldValue = oldValue; Ext.MessageBox.confirm( smb.charset.label.modeChangeConfirmTitle, smb.charset.label.modeChangeConfirmStr+' '+combo.getRawValue(), this.modeChangeCallback, this); } else { if(typeof combo.confirmFlag!="undefined") { delete combo.confirmFlag; } if(typeof(oldValue) == "undefined")//如果初始化值为空,则是第一次系统加载,页面本身已经根据正确的模式加载,不需要再根据模式去切换 { return -1; } if(smb.mode.refreshFlag ) { //模式发生了改变,初始化时不需要提示 smb.mode.changeMode.call(this, newValue, oldValue);//改变各个module的状态 //smb.pages.refreshCurrent.call(this); } } } }, '#toolCombo': { change: function( item, newValue, oldValue, eOps) { if( newValue != smb.charset.comboBox.tools && (newValue != 'spectrumTool' || smb.user.isWirelessAccess != true) ) { smb.user.bodyMask.show(); smb.user.bodyMask2.show(); } // var position = button.getPosition(); var w = (window.innerWidth) ? window.innerWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth; var h = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight; var temp = 0; temp = (h-380)/2+Ext.getBody().dom.scrollTop; var localProductInfo = "UN"; if ("undefined" != typeof(productInfo)) { localProductInfo = productInfo[0]; } switch(newValue) { case 'pingTool': if( Ext.getCmp('pingBox') ) { Ext.getCmp('pingBox').show(); } else { var pingPopBox = Ext.create('smb.view.popBox', { id: 'pingBox', title: smb.charset.module.pingTool, width: 860, height: 380, resizable: false, items:[ { xtype: 'fieldcontainer', layout: { type: 'column' }, width: 860, items: [ { xtype: 'textfield', id: 'pingDestinationIp', fieldLabel: smb.charset.label.destinationIpDomain, labelWidth: 130, inputWidth: 180, width: 340, maxLength: 63, validator: function(value) { if (smb.verify.ip(value) != true) { return smb.verify.domain(value); } else { return true; } } }, { xtype: 'fieldcontainer', width: 260, margin: '0 0 0 140', layout: 'hbox', items: [ { xtype: 'numberfield', id: 'pingPacketCount', decimalPrecision: 0, fieldLabel: smb.charset.label.packetCount, // padding: '0 100 0 0', minValue: 1, maxValue: 50, inputWidth: 80, width: 205, value: 4 }, { xtype: 'displayfield', hideLabel: true, width: 140, value: '(1-50)', margin: '0 0 0 5' } ] } ] }, { xtype: 'fieldcontainer', layout: { type: 'column' }, width: 860, items: [ { xtype: 'fieldcontainer', width: 440, layout: 'hbox', items: [ { xtype: 'numberfield', id: 'pingTimeout', decimalPrecision: 0, fieldLabel: smb.charset.label.pingTimeout, // padding: '0 100 0 0', minValue: 100, maxValue: 2000, labelWidth: 130, inputWidth: 80, width: 236, value: 800 }, { xtype: 'displayfield', width: 140, hideLabel: true, value: smb.charset.label.pingTimeoutTip } ] }, { xtype: 'fieldcontainer', width: 300, margin: '0 0 0 40', layout: 'hbox', items: [ { xtype: 'numberfield', id: 'pingPacketSize', decimalPrecision: 0, fieldLabel: smb.charset.label.packetSize, minValue: 4, maxValue: 1472, inputWidth: 80, width: 205, value: 64 }, { xtype: 'displayfield', hideLabel: true, width: 140, value: smb.charset.label.packetSizeTip, margin: '0 0 0 5' } ] } ] }, { xtype: 'fieldset', title: smb.charset.label.pingResults, padding: 5, height: 230, items: [ { xtype: 'grid', store: 'pingResults', id: 'pingResults', hidden: true, height: 200, sortableColumns: false, columns: [ { dataIndex: 'name', hideable: false, flex: 1 } ] } ] } /* { xtype: 'button', id: 'startPing', width: 100, margin: '0 12 0 0', text: smb.charset.button.start, state: 'start' } */ ], buttonAlign: 'right', buttons:[ { id: 'startPing', width: 100, margin: '0 12 0 0', text: smb.charset.button.start, state: 'start' } ], listeners:{ close:function(item, event) { smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); var pingResults = Ext.getCmp('pingResults'); var pingStore = pingResults.getStore(); clearInterval(pingResults.intr) pingStore.removeAll(); pingResults.hide(); pingResults.flag = false; Ext.getCmp('pingDestinationIp').enable(true); Ext.getCmp('pingTimeout').enable(true); Ext.getCmp('pingPacketCount').enable(true); Ext.getCmp('pingPacketSize').enable(true); Ext.getCmp('startPing').state = 'start'; Ext.getCmp('startPing').setText(smb.charset.button.start); Ext.getCmp('startPing').enable(true); Ext.getCmp('toolCombo').setValue(smb.charset.comboBox.tools); } } }) pingPopBox.show(); pingPopBox.setPosition((w-860)/2, temp); } break; case 'tracerouteTool': if( Ext.getCmp('tracerouteBox') ) { Ext.getCmp('tracerouteBox').show(); } else { var tracerouteBox = Ext.create('smb.view.popBox', { id: 'tracerouteBox', title: smb.charset.module.traceroute, width: 860, height: 380, resizable: false, items:[ { xtype: 'fieldcontainer', width: 840, layout: { type: 'column' }, items: [ { xtype: 'textfield', id: 'traceDstIp', fieldLabel: smb.charset.label.destinationHost, width: 380, labelWidth: 150, inputWidth: 200, maxLength: 63, // vtype: 'ip', validator: function(value) { if (smb.verify.ip(value) != true) { return smb.verify.domain(value); } else { return true; } } }, { xtype: 'numberfield', id: 'traceTtl', decimalPrecision: 0, fieldLabel: smb.charset.label.tracerouteMaxTtl, labelWidth: 220, inputWidth: 120, minValue: 1, maxValue: 30, value: 5 }, { xtype: 'label', text: '(1-30)', // columnWidth: 0.1, margin: 4 } ] }, { xtype: 'fieldset', title: smb.charset.label.tracerouteResults, padding: 5, height: 230, items: [ { xtype: 'grid', store: 'traceResult', id: 'traceResult', hidden: true, height: 200, sortableColumns: false, columns: [ { dataIndex: 'name', hideable: false, flex: 1 } ] } ] } /* { xtype: 'button', id: 'startTrace', width: 100, margin: '0 12 0 0', text: smb.charset.button.start, state: 'start' } */ ], buttonAlign: 'right', buttons:[ { id: 'startTrace', width: 100, margin: '0 12 0 0', text: smb.charset.button.start, state: 'start' } ], listeners:{ close:function(item, event) { smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); var traceResult = Ext.getCmp('traceResult'); var tracerouteStore = traceResult.getStore(); clearInterval(traceResult.intr) tracerouteStore.removeAll(); traceResult.hide(); traceResult.flag = false; Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); Ext.getCmp('startTrace').state = 'start'; Ext.getCmp('startTrace').setText(smb.charset.button.start); Ext.getCmp('startTrace').enable(true); Ext.getCmp('toolCombo').setValue(smb.charset.comboBox.tools); } } }) tracerouteBox.show(); tracerouteBox.setPosition((w-860)/2, temp); } break; case 'speedTestTool': if( Ext.getCmp('speedTestBox') ) { Ext.getCmp('speedTestBox').show(); } else { var speedTestBox = Ext.create('smb.view.popBox', { id: 'speedTestBox', title: smb.charset.module.speedTest, width: 860, height: 400, resizable: false, items:[ { xtype: 'fieldset', margin: '0 40 20 200', padding: '10 10 20 10', width: 440, defaults: { labelWidth: 50, labelAlign: 'right' }, title: smb.charset.label.testResult, layout: 'column', items: [ { xtype: 'displayfield', id: 'spRx', name: 'rx', fieldLabel: smb.charset.label.rx, columnWidth: 0.3 }, { xtype: 'displayfield', id: 'spTx', name: 'tx', fieldLabel: smb.charset.label.tx, columnWidth: 0.3 }, { xtype: 'displayfield', id: 'spTotal', name: 'total', fieldLabel: smb.charset.label.total, columnWidth: 0.3 } ] }, { xtype: 'fieldcontainer', defaultType: 'radiofield', width: 234, margin: '10 0 15 305', defaults: { flex: 1 }, layout: 'hbox', items: [ {name:'svrMode', id:'svrClient', boxLabel:smb.charset.label.speedTestClient, inputValue:0, checked:true }, {name:'svrMode', id:'svrServer', boxLabel:smb.charset.label.server, inputValue:1} ] }, { xtype: 'fieldcontainer', id: 'svrIpCnt', width: 500, margin: '10 0 10 200', defaults: { inputWidth: 200 }, items: [ { xtype: 'textfield', fieldLabel: smb.charset.label.serverIp, id: 'spServerIp', vtype: 'ip', margin: '0 0 10 0' }, { xtype: 'numberfield', fieldLabel: smb.charset.label.parallel, id: 'spParallel', decimalPrecision: 0, maxValue: 20, minValue: 1, inputWidth: 150, cls: 'inlineBlock', margin: '0 0 10 0', value: 10 }, { xtype: 'label', text: smb.charset.label.oneToTwenty, cls: 'inlineBlock', margin: '3 0 0 10' }, { xtype: 'combobox', fieldLabel: smb.charset.label.direction, id: 'spDirection', editable: false, store: Ext.create('Ext.data.Store', { fields: ['display', 'value'], data: [ {'value':'1', 'display': smb.charset.label.unidirectional}, {'value':'2', 'display':smb.charset.label.bidirectional} ] }), queryMode: 'local', displayField: 'display', valueField: 'value', autoSelect: true, margin: '0 0 10 0', value: '1' } ] }, { xtype: 'label', id: 'testingLabel', text: smb.charset.label.testing, labelAlign: 'right', width: 100, padding: '0 0 5 0', margin: '0 0 0 200', cls: 'inlineBlock', forId: 'testBar', disabledCls: 'disabledLabel', style: { textAlign: 'right', verticalAlign: 'top' } }, { xtype: 'testingBar', id: 'testBar', flag: false, cls: 'inlineBlock', margin: '3 0 0 7', width: 335 } ], listeners:{ close: function() { smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); Ext.getCmp('toolCombo').setValue(smb.charset.comboBox.tools); } }, buttons: [ { // xtype: 'button', text: smb.charset.button.start, margin: '10 0 0 100', id: 'svrStart', hidden: true }, { // xtype: 'button', text: smb.charset.button.start, margin: '10 0 0 100', id: 'stStart' } ] }); speedTestBox.show(); speedTestBox.setPosition((w-860)/2, temp); } break; case 'survey': if( Ext.getCmp('surveyBox') ) { Ext.getStore('searchGrid').removeAll(); Ext.getCmp('surveyBoxApCount').setValue(0); Ext.getCmp('surveyBoxGrid').hide(); Ext.getCmp('surveyBoxLoading').show(); Ext.getCmp('surveyBox').show(); } else { var surveyBox = Ext.create('smb.view.popBox', { id: 'surveyBox', title: smb.charset.module.survey, width: 920, height: 560, resizable: false, bodyStyle:{ //background: '#fff' }, items:[ { xtype:'loadingCnt', id: 'surveyBoxLoading', margin: '0 0', //width: 890, height: 497, hidden: true }, { xtype: 'gridpanel', id: 'surveyBoxGrid', store: 'searchGrid', //selType:'checkboxmodel', // padding: 0, margin: 0, //width: 890, maxHeight: 497, columns: [ {xtype: 'rownumberer',text: smb.charset.column.index,hideable: false,align: 'center',flex: 1.1}, {text: smb.charset.column.bssid, hideable: false, dataIndex:'bssid', flex:3.5}, {text: smb.charset.column.ssid, hideable: false, dataIndex:'ssid', flex:4.5}, {text: smb.charset.column.tdma, hideable: false, dataIndex:'tdma', flex:1.7, renderer : function(value, metaData, record, colIndex, store, view) { if (value === 'Yes'){ return smb.charset.status.yes; } else if (value === 'No'){ return smb.charset.status.no; } else { return value; } } }, {text: smb.charset.column.deviceName, hideable: false, dataIndex:'deviceName', flex:3}, {text: smb.charset.column.snr, hideable: false, dataIndex:'snr', flex:1.5}, {text: smb.charset.column.signalNoise, hideable: false, dataIndex:'signal', flex:3, renderer:function(value, metaData, record, colIndex, store, view) { return value + '/' + record.data.noise; } }, {text: smb.charset.column.frequencyChannel, hideable: false, dataIndex:'channel', flex:2}, {text: smb.charset.column.security, hideable: false, dataIndex:'security', flex:3.5} ] /*listeners: { viewready:function() { // console.log(this) var me = this; me.getEl().mask(); me.getStore().load(function(records, operation, success){ me.getEl().unmask(); }); } }*/ } ], buttonAlign: 'right', buttons:[ { xtype: 'displayfield', fieldLabel: smb.charset.label.apCount, id: 'surveyBoxApCount', name: 'apCount', labelWidth: 60, width: 120, margin: '0 674 0 0' }, { width: 100, id: 'surveyBoxRefresh', margin: '0 12 0 0', text: smb.charset.button.refresh, listeners:{ click: function(button) { Ext.getStore('searchGrid').removeAll(); Ext.getCmp('surveyBoxApCount').setValue(0); Ext.getCmp('surveyBoxGrid').hide(); Ext.getCmp('surveyBoxLoading').show(); button.setText(smb.charset.button.scanning); button.disable(); var survey = Ext.getCmp('survey'); var searchGrid = Ext.getCmp('surveyBoxGrid'); Ext.Ajax.request({ url: './data/search.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var respObj = Ext.JSON.decode(response.responseText); if(respObj.success) { searchGrid.intr = setInterval(function() { if(smb.user.loginFlag) { Ext.Ajax.request({ url: './data/getSearch.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var responseData = Ext.JSON.decode(response.responseText); if(responseData.success == false) { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); Ext.getCmp('surveyBoxApCount').setValue(0); clearInterval(Ext.getCmp('surveyBoxGrid').intr); button.setText(smb.charset.button.refresh); button.enable(); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); return; } else if( responseData.success ) { if (responseData.data.searchDone == '2') { clearInterval(Ext.getCmp('surveyBoxGrid').intr); button.setText(smb.charset.button.refresh); button.enable(); return; } Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); var gridStore = responseData.data.searchGrid; Ext.getStore('searchGrid').loadData(gridStore); Ext.getCmp('surveyBoxApCount').setValue(responseData.data.apCount); if (responseData.data.searchDone == '1') { Ext.Ajax.request({ url: './data/stopSearch.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var rspData = Ext.JSON.decode(response.responseText); if(rspData.success == false) { clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); button.setText(smb.charset.button.refresh); button.enable(); return; } else if( rspData.success ) { clearInterval(Ext.getCmp('surveyBoxGrid').intr); button.setText(smb.charset.button.refresh); button.enable(); return; } }, failure: function() { clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); button.setText(smb.charset.button.refresh); button.enable(); return; } }); } } }, failure: function() { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); Ext.getCmp('surveyBoxApCount').setValue(0); clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); button.setText(smb.charset.button.refresh); button.enable(); return; } }); } }, 4000); } else { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); Ext.getCmp('surveyBoxApCount').setValue(0); button.setText(smb.charset.button.refresh); button.enable(); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); } }, failure: function(response) { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); return; } }); } } } ], listeners:{ close:function(item, event) { if(Ext.getCmp('surveyBoxRefresh').isDisabled() == true) { clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.Ajax.request({ url: './data/stopSearch.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var rspData = Ext.JSON.decode(response.responseText); if(rspData.success == false) { Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); return; } }, failure: function() { Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); return; } }); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); } smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); Ext.getCmp('toolCombo').setValue(smb.charset.comboBox.tools); } } }) surveyBox.show(); } Ext.getCmp('surveyBox').setPosition((w-910)/2, temp); Ext.getCmp('surveyBoxApCount').setValue(0); Ext.getCmp('surveyBoxGrid').hide(); Ext.getCmp('surveyBoxLoading').show(); var searchGrid = Ext.getCmp('surveyBoxGrid'); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.scanning); Ext.getCmp('surveyBoxRefresh').disable(); Ext.Ajax.request({ url: './data/search.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var respObj = Ext.JSON.decode(response.responseText); if(respObj.success) { searchGrid.intr = setInterval(function() { if(smb.user.loginFlag) { Ext.Ajax.request({ url: './data/getSearch.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var responseData = Ext.JSON.decode(response.responseText); if(responseData.success == false) { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); Ext.getCmp('surveyBoxApCount').setValue(0); clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); return; } else if( responseData.success ) { if (responseData.data.searchDone == '2') { Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); clearInterval(Ext.getCmp('surveyBoxGrid').intr); return; } Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); var gridStore = responseData.data.searchGrid; Ext.getStore('searchGrid').loadData(gridStore); Ext.getCmp('surveyBoxApCount').setValue(responseData.data.apCount); if (responseData.data.searchDone == '1') { Ext.Ajax.request({ url: './data/stopSearch.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var rspData = Ext.JSON.decode(response.responseText); if(rspData.success == false) { clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); return; } else if( rspData.success ) { Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); clearInterval(Ext.getCmp('surveyBoxGrid').intr); return; } }, failure: function() { clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); return; } }); } } }, failure: function() { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); Ext.getCmp('surveyBoxApCount').setValue(0); clearInterval(Ext.getCmp('surveyBoxGrid').intr); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); return; } }); } }, 4000); } else { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxGrid').show(); Ext.getCmp('surveyBoxApCount').setValue(0); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); Ext.Msg.alert(smb.charset.module.failure, 'fail to get data'); } }, failure: function(response) { Ext.getCmp('surveyBoxLoading').hide(); Ext.getCmp('surveyBoxRefresh').setText(smb.charset.button.refresh); Ext.getCmp('surveyBoxRefresh').enable(); return; } }); break; case 'spectrumTool': function showSpectrumBox(result) { Ext.getStore('spectrumChart').removeAll(); if( result == 'cancel' || result == 'no' ) { smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); Ext.getCmp('toolCombo').setValue(smb.charset.comboBox.tools); } else if( result == 'yes' ) { if( smb.pages.currentCmpId == 'sysStatus' ){ clearInterval(smb.user.loop.info); clearInterval(smb.user.loop.progress); smb.user.loop.progress = false; smb.user.loop.progressCount = 0; smb.user.loop.info = false; clearInterval(smb.user.loop.station); clearInterval(smb.user.loop.interfaces); clearInterval(smb.user.loop.arpTable); clearInterval(smb.user.loop.routes); clearInterval(smb.user.loop.dhcpClients); clearInterval(smb.user.loop.dynamicWan); } if( Ext.getCmp('spectrumAnalysisBox') ) { Ext.getCmp('spectrumAnalysisBox').show(); } else { if (spectrumRegion == 840 || (Ext.getCmp('apRegion') != undefined && Ext.getCmp('apRegion').getValue() == 840)) { var spectrumAnalysisBox = Ext.create('smb.view.popBox', { id: 'spectrumAnalysisBox', // name: 'spectrumAnalysisBox', title: smb.charset.module.spectrumAnalysis, width: 960, height: 560, resizable: false, closeAction: 'destroy', bodyStyle: { background: '#fff', padding: '10px' }, items: [ { xtype: 'smbForm', header: false, buttonAlign: 'right', items: [ { xtype: 'combobox', id: 'frequencyRangeSltBox', align: 'right', store: 'frequencyRangeUS', fieldLabel: smb.charset.label.frequencyRange, inputWidth: 150, editable: false, displayField: 'display', valueField: 'name', value: '5180-5240', listeners:{ change: function(item, newValue, oldValue, scope) { switch(newValue) { case '5180-5240': Ext.getCmp('spectrumChartBox').axes.items[1].minimum = 5180; Ext.getCmp('spectrumChartBox').axes.items[1].maximum = 5240; Ext.getCmp('spectrumChartBox').axes.items[1].majorTickSteps = 2; Ext.getStore('spectrumChart').loadData([ {frequency:5180, peak:-10, current:-20, average:0}, {frequency:5200, peak:-10, current:-20, average:0}, {frequency:5220, peak:-10, current:-20, average:0}, {frequency:5240, peak:-10, current:-20, average:0}]); Ext.getStore('spectrumChart').removeAll(true); break; case '5745-5825': Ext.getCmp('spectrumChartBox').axes.items[1].minimum = 5745; Ext.getCmp('spectrumChartBox').axes.items[1].maximum = 5825; Ext.getCmp('spectrumChartBox').axes.items[1].majorTickSteps = 3; Ext.getStore('spectrumChart').loadData([ {frequency:5745, peak:-10, current:-20, average:0}, {frequency:5765, peak:-10, current:-20, average:0}, {frequency:5785, peak:-10, current:-20, average:0}, {frequency:5805, peak:-10, current:-20, average:0}, {frequency:5825, peak:-10, current:-20, average:0}]); Ext.getStore('spectrumChart').removeAll(true); break; } } } }, { xtype: 'hiddenfield', submitValue: true, id: 'frequencyRangeHiddenBox', value: '2412-2462' }, { id: 'spectrumChartBox', xtype: 'chart', store: 'spectrumChart', width: 850, height: 430, theme: 'Fancy', shadow: false, background: { fill: '#fff' }, legend: { boxStrokeWidth: 0, boxFill: '#fff', position: 'top', labelColor: '#000' }, axes: [ { title: smb.charset.label.powerTitle, type: 'Numeric', position: 'left', fields: ['peak','current','average'], minorTickSteps: 1, majorTickSteps: 9, minimum: -110, maximum: -10, grid: { odd: { opacity: 1, // fill: '#4c4c4e', stroke: '#c8c8c8', 'stroke-width': 0.5 }, even: { opacity: 1, // fill: '#4c4c4e', stroke: '#c8c8c8', 'stroke-width': 0.5 } } }, { title: smb.charset.label.frequencyTitle, type: 'Numeric', minorTickSteps: 1, majorTickSteps: 2, position: 'bottom', fields: 'frequency', grid: true, minimum: 5180, maximum: 5240 } ], series: [ { type: 'line', title: smb.charset.label.peak, xField: 'frequency', yField: 'peak', highlight: { size: 3, radius: 3 }, style: { // stroke: '#00ff00', 'stroke-width': 2, // fill: '#80A080', opacity: 1 }, showMarkers: false, tips: { trackMouse: true, width: 50, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('peak')); } } }, { type: 'line', title: smb.charset.label.current, xField: 'frequency', yField: 'current', highlight: { size: 3, radius: 3 }, showMarkers: false, style: { // stroke: '#00ff00', 'stroke-width': 2, // fill: '#80A080', opacity: 1 }, tips: { trackMouse: true, width: 50, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('peak')); } } }, { type: 'line', title: smb.charset.label.average, xField: 'frequency', yField: 'average', fill: true, highlight: { size: 3, radius: 3 }, markerConfig: { type: 'circle', size: 1, radius: 1, 'stroke-width': 0 }, showMarkers: false, tips: { trackMouse: true, width: 50, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('average')); } } } ] }, { id: 'spectrumChartDefaultBox', xtype: 'chart', store: 'spectrumChartDefault', width: 850, height: 430, theme: 'Fancy', shadow: false, margin: '10 0 10 20', background: { fill: '#fff' }, legend: { boxStrokeWidth: 0, boxFill: '#fff', position: 'top', labelColor: '#000' }, axes: [ { title: smb.charset.label.powerTitle, type: 'Numeric', position: 'left', fields: ['peak','current','average'], minorTickSteps: 1, majorTickSteps: 7, minimum: -130, maximum: -10, grid: { odd: { opacity: 1, // fill: '#4c4c4e', stroke: '#c8c8c8', 'stroke-width': 0.5 }, even: { opacity: 1, // fill: '#4c4c4e', stroke: '#c8c8c8', 'stroke-width': 0.5 } } }, { title: smb.charset.label.frequencyTitle, type: 'Numeric', minorTickSteps: 1, majorTickSteps: 9, position: 'bottom', fields: 'frequency', grid: true, minimum: 2412, maximum: 2462 } ], series: [ { type: 'line', title: smb.charset.label.peak, xField: 'frequency', yField: 'peak', highlight: { size: 3, radius: 3 }, style: { 'stroke-width': 2, opacity: 1 }, showMarkers: false, tips: { trackMouse: true, width: 50, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('peak')); } } }, { type: 'line', title: smb.charset.label.current, xField: 'frequency', yField: 'current', highlight: { size: 3, radius: 3 }, showMarkers: false, style: { 'stroke-width': 2, opacity: 1 }, tips: { trackMouse: true, width: 50, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('peak')); } } }, { type: 'line', title: smb.charset.label.average, xField: 'frequency', yField: 'average', fill: true, highlight: { size: 3, radius: 3 }, markerConfig: { type: 'circle', size: 1, radius: 1, 'stroke-width': 0 }, showMarkers: false, tips: { trackMouse: true, width: 50, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('average')); } } } ] } ], buttons: [ { id: 'startSpectrumBox', text: smb.charset.button.start, status: 'start', width: 50, listeners:{ click: function( button, event, obj) { if(button.status == 'start') { button.disable(); Ext.getCmp('frequencyRangeSltBox').setDisabled(true); var spectrumStore = Ext.getStore('spectrumChart'); var spectrumChart = Ext.getCmp('spectrumChartBox'); var dataused = 4; var spectrumStoreDefault = Ext.getStore('spectrumChartDefault'); var spectrumChartDefault = Ext.getCmp('spectrumChartDefaultBox'); var range = ''; if(smb.user.is2G == true) { range = Ext.getCmp('frequencyRangeHiddenBox').getValue(); } else { range = Ext.getCmp('frequencyRangeSltBox').getValue(); } Ext.Ajax.request({ url: './data/spectrumAnalysisStart.json', params: { range: range }, success: function(startResponse) { button.enable(); smb.user.timeout.call(this, startResponse, startResponse); var startData = Ext.JSON.decode(startResponse.responseText); var data = new Array(); if(startData.success == true) { button.status = 'stop'; button.setText(smb.charset.button.stop); spectrumChart.intr = setInterval(function() { if(smb.user.loginFlag) { Ext.Ajax.request({ url: './data/spectrumAnalysisGet.json', params: { range: range }, success: function(response) { smb.user.timeout.call(this, response, response); var responseData = Ext.JSON.decode(response.responseText); var spectrum = responseData.data; data.length = 0; if(responseData.success == false) { button.status = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('frequencyRangeSltBox').enable(true); clearInterval(Ext.getCmp('spectrumChartBox').intr); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+responseData.errCode]); } else if( responseData.success ) { if(smb.user.is2G == true) { for(var i=0; i<160/dataused; i++) { var obj = { frequency: 2412+i*0.3206*dataused, current: spectrum.current[i], average: spectrum.average[i], peak: spectrum.peak[i] } data.push(obj); } spectrumStoreDefault.removeAll(true); spectrumStoreDefault.loadData(data); } else { switch(Ext.getCmp('frequencyRangeSltBox').getValue()) { case '5180-5240': for(var i=0; i<192/dataused; i++) { var obj = { frequency: 5180+i*0.32*dataused, current: spectrum.current[i], average: spectrum.average[i], peak: spectrum.peak[i] } data.push(obj); Ext.getCmp('spectrumChartBox').axes.items[1].minimum = 5180; Ext.getCmp('spectrumChartBox').axes.items[1].maximum = 5240; Ext.getCmp('spectrumChartBox').axes.items[1].majorTickSteps = 2; } spectrumStore.removeAll(true); spectrumStore.loadData(data); break; case '5745-5825': for(var i=0; i<256/dataused; i++) { var obj = { frequency: 5745+i*0.32*dataused, current: spectrum.current[i], average: spectrum.average[i], peak: spectrum.peak[i] } data.push(obj); Ext.getCmp('spectrumChartBox').axes.items[1].minimum = 5745; Ext.getCmp('spectrumChartBox').axes.items[1].maximum = 5825; Ext.getCmp('spectrumChartBox').axes.items[1].majorTickSteps = 3; } spectrumStore.removeAll(true); spectrumStore.loadData(data); break; } } } }, failure: function() { button.status = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('frequencyRangeSltBox').enable(true); clearInterval(Ext.getCmp('spectrumChartBox').intr); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.e404); return; } }); } }, 1000); } else if(startData.success == false) { Ext.getCmp('frequencyRangeSltBox').enable(true); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+startData.errCode]); } }, failure: function() { button.enable(); Ext.getCmp('frequencyRangeSltBox').enable(true); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.e404); return; } }); } else if(button.status == 'stop') { button.disable(); clearInterval(Ext.getCmp('spectrumChartBox').intr); Ext.Ajax.request({ url: './data/spectrumAnalysisStop.json', params: { range: Ext.getCmp('frequencyRangeSltBox').getValue() }, success: function(response) { button.enable(); smb.user.timeout.call(this, response, response); button.status = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('frequencyRangeSltBox').enable(true); var stopData = Ext.JSON.decode(response.responseText); if( stopData.success==false) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+stopData.errCode]); } }, failure: function() { button.enable(); button.status = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('frequencyRangeSltBox').enable(true); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.e404); return false; } }); } } } } ] } ], listeners:{ close:function() { if(Ext.getCmp('startSpectrumBox').status=='stop' || Ext.getCmp('startSpectrumBox').isDisabled() == true) { clearInterval(Ext.getCmp('spectrumChartBox').intr); Ext.Ajax.request({ url: './data/spectrumAnalysisStop.json', params: { range: Ext.getCmp('frequencyRangeSltBox').getValue() }, method: 'POST', success: function(response) { smb.user.timeout.call(this, response, response); var stopData = Ext.JSON.decode(response.responseText); if( stopData.success==false) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+stopData.errCode]); } }, failure: function() { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.e404); return false; } }); } smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); Ext.getCmp('startSpectrumBox').setText(smb.charset.button.start); Ext.getCmp('startSpectrumBox').status = 'start'; Ext.getCmp('frequencyRangeSltBox').enable(true); //clearInterval(Ext.getCmp('spectrumChartBox').intr); Ext.getCmp('toolCombo').setValue(smb.charset.comboBox.tools); // restart the refresh part in status page if( smb.pages.currentCmpId == 'sysStatus' ){ if( smb.user.loop.progress == false ) { smb.user.loop.progress = setInterval(getProgressBar,2000); smb.user.loop.progressCount = 0; } if( smb.user.loop.info == false ) { smb.user.loop.info = setInterval(refreshInfo,5000); } showMonitor(smb.user.monitor); if( Ext.getCmp('monitor').stationFlag == true && Ext.getCmp('autoRefreshStation').getValue() ) { smb.user.loop.station = setInterval(getStation, 2000); } if( Ext.getCmp('monitor').interfaceFlag == true && Ext.getCmp('autoRefreshInterface').getValue() ) { smb.user.loop.interfaces = setInterval(getInterface, 2000); } if( Ext.getCmp('monitor').arpTableFlag == true && Ext.getCmp('autoRefreshArptable').getValue()) { smb.user.loop.arpTable = setInterval(getArpTable, 2000); } if( Ext.getCmp('monitor').routesFlag == true && Ext.getCmp('autoRefreshRoutes').getValue()) { smb.user.loop.routes = setInterval(getRoutes, 2000); } if( Ext.getCmp('monitor').dhcpClientFlag == true && Ext.getCmp('autoRefreshDhcpClients').getValue()) { smb.user.loop.dhcpClients = setInterval(getDhcpClients, 2000); } if( Ext.getCmp('monitor').dynamicWanFlag == true && Ext.getCmp('autoRefreshDynamicWan').getValue() ) { smb.user.loop.dynamicWan = setInterval(getDynamicWanFn, 2000); } Ext.Ajax.request({ url: './data/getThroughputIfList.json', timeout: 10000, params: { }, success: function(response) { if(!smb.user.timeout.call(this, response, response)) { var data = Ext.JSON.decode(response.responseText); var ifList = new Array; for( var i=0; i pingResults.timeMax) { pingResults.timeMax = str.time; } else if(str.time < pingResults.timeMin) { pingResults.timeMin = str.time; } if(str.icmpCode == 0) { //计数 pingResults.timeCount += str.time; pingResults.icmp0++; var str = 'Reply from ' + str.ipaddr + ': ' + 'bytes=' + str.bytes + ' time=' + str.time + ' TTL=' + str.ttl + ' seq=' + str.seq; pingStore.add({name: str}); } else if(str.icmpCode == 255) { //计数 pingResults.icmp255++; pingStore.add({name: "Request time out"}); } }); // 计算相应的值 var numArray = [ {name: '
Ping statistics for '+ Ext.getCmp('pingDestinationIp').getValue()}, {name: '     Packets: Sent = ' + pingResults.lineNum + ' Received = ' + pingResults.icmp0 + ' Lost = '+(pingResults.lineNum-pingResults.icmp0)} ]; var timeArray = [ {name: 'Approximate round trip times in milliseconds:'}, {name: '     Minimum = '+ pingResults.timeMin +' Maximum = '+ pingResults.timeMax +' Average = '+pingResults.timeCount/pingResults.lineNum} ]; pingStore.add(numArray); pingResults.getSelectionModel().select(pingResults.lineNum + 1,true,false); if (pingResults.icmp0 > 0) { pingStore.add(timeArray); pingResults.getSelectionModel().select(pingResults.lineNum + 3,true,false); } pingResults.flag = false; button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('pingDestinationIp').enable(true); Ext.getCmp('pingTimeout').enable(true); Ext.getCmp('pingPacketCount').enable(true); Ext.getCmp('pingPacketSize').enable(true); Ext.getCmp('startPing').enable(true); } else { pingResults.lineNum = getData.lineCount; //对返回的数据进行输出在panel的显示操作 Ext.Array.each(getData.result,function(str, index, array) { //计数 if(str.time > pingResults.timeMax) { pingResults.timeMax = str.time; } else if(str.time < pingResults.timeMin) { pingResults.timeMin = str.time; } if(str.icmpCode == 0) { //计数 pingResults.timeCount += str.time; pingResults.icmp0++; var str = 'Reply from ' + str.ipaddr + ': ' + 'bytes=' + str.bytes + ' time=' + str.time + ' TTL=' + str.ttl + ' seq=' + str.seq; pingStore.add({name: str}); } else if(str.icmpCode == 255) { //计数 pingResults.icmp255++; pingStore.add({name: "Request time out"}); } }); } pingResults.getSelectionModel().select(pingResults.lineNum-1,true,false); var o = setTimeout(sendGetData, 400); } }) } } function stopPing() { var numArray = [ {name: '
Ping statistics for '+ Ext.getCmp('pingDestinationIp').getValue()}, {name: '     Packets: Sent = ' + pingResults.lineNum + ' Received = ' + pingResults.icmp0 + ' Lost = '+(pingResults.lineNum-pingResults.icmp0)} ]; var timeArray = [ {name: 'Approximate round trip times in milliseconds:'}, {name: '     Minimum = '+ pingResults.timeMin +' Maximum = '+ pingResults.timeMax +' Average = '+pingResults.timeCount/pingResults.lineNum} ]; pingStore.add(numArray); pingResults.getSelectionModel().select(pingResults.lineNum + 1,true,false); if (pingResults.icmp0 > 0) { pingStore.add(timeArray); pingResults.getSelectionModel().select(pingResults.lineNum + 3,true,false); } /* var array = [ {name: '
Ping statistics for '+ Ext.getCmp('pingDestinationIp').getValue()}, {name: '     Packets: Sent = ' + pingResults.lineNum + ' Received = ' + pingResults.icmp0 + ' Lost = '+(pingResults.lineNum-pingResults.icmp0)}, {name: 'Approximate round trip times in milliseconds:'}, {name: '     Minimum = '+ pingResults.timeMin +' Maximum = '+ pingResults.timeMax +' Average = '+pingResults.timeCount/pingResults.lineNum} ]; pingStore.add(array); */ button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('pingDestinationIp').enable(true); Ext.getCmp('pingTimeout').enable(true); Ext.getCmp('pingPacketCount').enable(true); Ext.getCmp('pingPacketSize').enable(true); Ext.getCmp('startPing').enable(true); } if(button.state == 'start') { Ext.getCmp('startPing').disable(true); Ext.getCmp('pingDestinationIp').disable(true); Ext.getCmp('pingTimeout').disable(true); Ext.getCmp('pingPacketCount').disable(true); Ext.getCmp('pingPacketSize').disable(true); pingStore.removeAll(); pingResults.flag = true; pingResults.lineNum = 0; pingResults.icmp0 = 0; pingResults.icmp255 = 0; pingResults.timeMax = 0; pingResults.timeMin = 2001; pingResults.timeCount = 0; Ext.Ajax.request({ url: './data/startPing.json', params: { opType: 'start', destinationIp: Ext.getCmp('pingDestinationIp').getValue(), pingTimeout: Ext.getCmp('pingTimeout').getValue(), packetCount: Ext.getCmp('pingPacketCount').getValue(), packetSize: Ext.getCmp('pingPacketSize').getValue() }, success: function(response) { pingStore.removeAll(); pingResults.flag = true; pingResults.lineNum = 0; pingResults.icmp0 = 0; pingResults.icmp255 = 0; pingResults.timeMax = 0; pingResults.timeMin = 2001; pingResults.timeCount = 0; smb.user.timeout.call(this, response, response); var startData = Ext.JSON.decode(response.responseText); switch(startData.reCode) { case 0: pingResults.columns[0].setText('Ping '+Ext.getCmp('pingDestinationIp').getValue()+' with '+Ext.getCmp('pingPacketSize').getValue()+' bytes of data:'); if(pingResults.lineNum!=startData.lineCount) { pingResults.lineNum = startData.lineCount; //对返回的数据进行输出在panel的显示操作 Ext.Array.each(startData.result,function(str, index, array) { //计数 if(str.time > pingResults.timeMax) { pingResults.timeMax = str.time; } else if(str.time < pingResults.timeMin) { pingResults.timeMin = str.time; } if(str.icmpCode == 0) { //计数 pingResults.timeCount += str.time; pingResults.icmp0++; var str = 'Reply from ' + str.ipaddr + ': ' + 'bytes=' + str.bytes + ' time=' + str.time + ' TTL=' + str.ttl + ' seq=' + str.seq; pingStore.add({name: str}); } else if(str.icmpCode == 255) { //计数 pingResults.icmp255++; pingStore.add({name: "Request time out"}); } }) }; button.state = 'stop'; button.setText(smb.charset.button.stop); Ext.getCmp('startPing').enable(true); sendGetData(); break; case 8: pingResults.columns[0].setText('Error IP address.'); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('pingDestinationIp').enable(true); Ext.getCmp('pingTimeout').enable(true); Ext.getCmp('pingPacketCount').enable(true); Ext.getCmp('pingPacketSize').enable(true); Ext.getCmp('startPing').enable(true); break; case 9: pingResults.columns[0].setText('Some other task is running.Please wait for a moment and try again.'); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('pingDestinationIp').enable(true); Ext.getCmp('pingTimeout').enable(true); Ext.getCmp('pingPacketCount').enable(true); Ext.getCmp('pingPacketSize').enable(true); Ext.getCmp('startPing').enable(true); break; case 53: pingResults.columns[0].setText('Ping request could not find host.Please check the name and try again.'); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('pingDestinationIp').enable(true); Ext.getCmp('pingTimeout').enable(true); Ext.getCmp('pingPacketCount').enable(true); Ext.getCmp('pingPacketSize').enable(true); Ext.getCmp('startPing').enable(true); break; } } }); } else if(button.state == 'stop') { Ext.getCmp('startPing').disable(true); pingResults.flag = false; // clearInterval(pingResults.intr); pingResults.getSelectionModel().select(pingResults.lineNum-1,true,false); Ext.Ajax.request({ url: './data/stopPing.json', params: { opType: 'stop', destinationIp: Ext.getCmp('pingDestinationIp').getValue() }, success: function(response) { smb.user.timeout.call(this, response, response); /* var array = [ {name: '
Ping statistics for '+ Ext.getCmp('pingDestinationIp').getValue()}, {name: '     Packets: Sent = ' + pingResults.lineNum + ' Received = ' + pingResults.icmp0 + ' Lost = '+(pingResults.lineNum-pingResults.icmp0)}, {name: 'Approximate round trip times in milliseconds:'}, {name: '     Minimum = '+ pingResults.timeMin +' Maximum = '+ pingResults.timeMax +' Average = '+pingResults.timeCount/pingResults.lineNum} ]; pingStore.add(array); */ } }); /* button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('pingDestinationIp').enable(true); Ext.getCmp('pingTimeout').enable(true); Ext.getCmp('pingPacketCount').enable(true); Ext.getCmp('pingPacketSize').enable(true); Ext.getCmp('startPing').enable(true); */ var o = setTimeout(stopPing, 1000); } } }, 'button[id=startTrace]': { click: function(button) { if(!Ext.getCmp('traceDstIp').isValid() || !Ext.getCmp('traceTtl').isValid() ) { return false; } var traceResult = Ext.getCmp('traceResult'); traceResult.flag = false; var traceStore = traceResult.getStore(); traceResult.show(); function sendGetData() { if(smb.user.loginFlag && traceResult.flag == true) { Ext.Ajax.request({ url: './data/getTrace.json', params: { opType: 'get', destinationIp: Ext.getCmp('traceDstIp').getValue(), lineNum: traceResult.lineNum }, success: function(getResponse) { smb.user.timeout.call(this, getResponse, getResponse); var getData = Ext.JSON.decode(getResponse.responseText); if(getData.isOver==1 && traceResult.flag == true) { // console.log('start' + traceResult.flag) traceResult.lineNum = getData.lineCount; //对返回的数据进行输出在panel的显示操作 Ext.Array.each(getData.result,function(str, index, array) { var outStr = str.seq +'     '; if (str.time1 == 255) { outStr = outStr + '*  '; } else { outStr = outStr + str.time1 +'ms   '; } if (str.time2 == 255) { outStr = outStr + '*  '; } else { outStr = outStr + str.time2 +'ms   '; } if (str.time3 == 255) { outStr = outStr + '*  ' + 'Request time out.'; } else { outStr = outStr + str.time3 +'ms   ' + str.ipaddr; } traceStore.add({name: outStr}); // console.log('end' + traceResult.flag) }) traceResult.flag = false; button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); // clearInterval(traceResult.intr); traceStore.add({name: '
Trace complete'}); traceResult.getSelectionModel().select(traceResult.lineNum,true,false); } else if(traceResult.flag == true) { if(traceResult.lineNum != getData.lineCount) { traceResult.lineNum = getData.lineCount; //对返回的数据进行输出在panel的显示操作 Ext.Array.each(getData.result,function(str, index, array) { var outStr = str.seq +'     '; if (str.time1 == 255){ outStr = outStr + '*  '; } else{ outStr = outStr + str.time1 +'ms   '; } if (str.time2 == 255){ outStr = outStr + '*  '; } else{ outStr = outStr + str.time2 +'ms   '; } if (str.time3 == 255){ outStr = outStr + '*  ' + 'Request time out.'; } else{ outStr = outStr + str.time3 +'ms   ' + str.ipaddr; } traceStore.add({name: outStr}); }) traceResult.getSelectionModel().select(traceResult.lineNum-1,true,false); } var o = setTimeout(sendGetData, 600); } } }) } } function stopComplete() { traceStore.add({name: '
Trace complete'}); traceResult.getSelectionModel().select(traceResult.lineNum,true,false); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); Ext.getCmp('startTrace').enable(true); } if(button.state == 'start') { Ext.getCmp('traceDstIp').disable(true); Ext.getCmp('traceTtl').disable(true); Ext.getCmp('startTrace').disable(true); traceResult.flag = true; traceStore.removeAll(); traceResult.lineNum = 0 Ext.Ajax.request({ url: './data/startTrace.json', params: { opType: 'start', destinationIp: Ext.getCmp('traceDstIp').getValue(), pingTimeout: Ext.getCmp('traceTtl').getValue() }, success: function(response) { smb.user.timeout.call(this, response, response); var startData = Ext.JSON.decode(response.responseText); traceStore.removeAll(); switch(startData.reCode) { case 0: traceResult.columns[0].setText('Tracing route to '+Ext.getCmp('traceDstIp').getValue()+' over a maximum of '+Ext.getCmp('traceTtl').getValue()+' hops:'); if(traceResult.lineNum != startData.lineCount) { traceResult.lineNum = startData.lineCount; //对返回的数据进行输出在panel的显示操作 Ext.Array.each(startData.result,function(str, index, array) { var outStr = str.seq +'     '; if (str.time1 == 255) { outStr = outStr + '*  '; } else { outStr = outStr + str.time1 +'ms   '; } if (str.time2 == 255) { outStr = outStr + '*  '; } else { outStr = outStr + str.time2 +'ms   '; } if (str.time3 == 255) { outStr = outStr + '*  ' + 'Request time out.'; } else { outStr = outStr + str.time3 +'ms   ' + str.ipaddr; } traceStore.add({name: outStr}); }) } if(startData.isOver==1) { traceResult.flag = false; button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); // clearInterval(traceResult.intr); traceStore.add({name: '
Trace complete'}); traceResult.getSelectionModel().select(traceResult.lineNum,true,false); } else { button.state = 'stop'; button.setText(smb.charset.button.stop); sendGetData(); } break; case 8: traceResult.columns[0].setText('Error IP address'); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); break; case 9: traceResult.columns[0].setText('Some other task is running.Please wait for a moment and try again.'); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); break; case 53: traceResult.columns[0].setText('Tracert could not find host.Please check the name and try again.'); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); break; default: traceResult.columns[0].setText('Something wrong happened.'); button.state = 'start'; button.setText(smb.charset.button.start); Ext.getCmp('traceDstIp').enable(true); Ext.getCmp('traceTtl').enable(true); break; } } }); Ext.getCmp('startTrace').enable(true); } else if(button.state == 'stop') { Ext.getCmp('startTrace').disable(true); traceResult.flag = false; // clearInterval(traceResult.intr); Ext.Ajax.request({ url: './data/stopTrace.json', params: { opType: 'stop', destinationIp: Ext.getCmp('traceDstIp').getValue() }, success: function(response) { smb.user.timeout.call(this, response, response); //traceStore.add({name: '
Trace complete'}); } }); //button.state = 'start'; //button.setText(smb.charset.button.start); //Ext.getCmp('startTrace').enable(true); var o = setTimeout(stopComplete, 1000); } } }, 'button[id=stStart]': { click: function(button) { Ext.getCmp('spRx').setValue(''); Ext.getCmp('spTx').setValue(''); Ext.getCmp('spTotal').setValue(''); var speedTest = Ext.getCmp('speedTestBox'); // var formBasic = button.findParentByType('smbModule').getForm(); var proBar = Ext.getCmp('testBar'); if( (button.status == undefined || button.status == 'start') && (Ext.getCmp('spServerIp').isValid() && Ext.getCmp('spParallel').isValid() && Ext.getCmp('spDirection').isValid()) ) { // proBar.flag = true; button.setText(smb.charset.button.stop); proBar.wait({ interval: 1000, duration: 16000, increment: 17, animate: true, // text: smb.charset.label.testing, scope: this, fn: function() { proBar.updateText(''); } }); //发送请求 Ext.Ajax.request({ url: './data/clientStart.json', params: { serverIp: Ext.getCmp('spServerIp').getValue(), parallel: Ext.getCmp('spParallel').getValue(), direction: Ext.getCmp('spDirection').getValue() }, success: function(startResponse) { smb.user.timeout.call(this, startResponse, startResponse); // 返回数据后才可以发送stop请求 button.status = 'stop'; var startData = Ext.JSON.decode(startResponse.responseText); if(startData.success == true ) { ////////////////////////每隔一段时间发送请求 var timeCount = 0; smb.user.loop.speedTest = setInterval(function(){ if(smb.user.loginFlag ) { timeCount++; Ext.Ajax.request({ url: './data/clientGet.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var getData = Ext.JSON.decode(response.responseText); if(getData.success == false ) { clearInterval(smb.user.loop.speedTest); // proBar.flag = false; if( getData.errCode==51203 ) { button.status = 'start'; button.setText(smb.charset.button.start); Ext.Ajax.request({ url: './data/clientEnd.json', params: { }, success: function(endResponse) { smb.user.timeout.call(this, endResponse, endResponse); var endData = Ext.JSON.decode(endResponse.responseText); if(endData.success == true) { button.enable(); proBar.reset(); proBar.animate = true; proBar.updateProgress(1); Ext.getCmp('spRx').setValue(endData.data.rx + endData.data.rxUnit); Ext.getCmp('spTx').setValue(endData.data.tx + endData.data.txUnit); Ext.getCmp('spTotal').setValue(endData.data.total + endData.data.totalUnit); } else { proBar.reset(); proBar.updateText(''); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+endData.errCode]); } }, failure: function(response) { } }) return true; } else { proBar.reset(); proBar.updateText(''); // clearInterval(speedTest.intr); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+getData.errCode]); } } }, failure: function(response) { proBar.reset(); proBar.updateText(''); clearInterval(smb.user.loop.speedTest); } }); if(timeCount >= 16 ) { clearInterval(smb.user.loop.speedTest); // proBar.flag = false; button.status = 'start'; button.setText(smb.charset.button.start); Ext.Ajax.request({ url: './data/clientEnd.json', params: { }, success: function(endResponse) { smb.user.timeout.call(this, endResponse, endResponse); var endData = Ext.JSON.decode(endResponse.responseText); if(endData.success == true) { button.enable(); Ext.getCmp('spRx').setValue(endData.data.rx + endData.data.rxUnit); Ext.getCmp('spTx').setValue(endData.data.tx + endData.data.txUnit); Ext.getCmp('spTotal').setValue(endData.data.total + endData.data.totalUnit); } else { proBar.reset(); proBar.updateText(''); clearInterval(smb.user.loop.speedTest); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+endData.errCode]); } }, failure: function(response) { } }) } } }, 1000); } else { proBar.reset(); proBar.updateText(''); clearInterval(smb.user.loop.speedTest); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+startData.errCode]); } }, failure: function(response) { } }); } else if(button.status == 'stop' ) { if( smb.user.loop.speedTest!=false ) { clearInterval(smb.user.loop.speedTest); } // proBar.flag = false; button.setText(smb.charset.button.start); proBar.reset(); proBar.updateText(''); Ext.Ajax.request({ url: './data/clientStop.json', params: { }, success: function(startResponse) { smb.user.timeout.call(this, startResponse, startResponse); // 返回数据后才可以发送start请求 button.status = 'start'; /* var formData = Ext.JSON.decode(response.responseText); if(formData.success == false) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } */ }, failure: function(response) { } }); } } }, 'button[id=svrStart]': { click: function(button) { if(button.status == undefined || button.status == 'start') { button.setText(smb.charset.button.stop); button.status = 'stop'; Ext.Ajax.request({ url: './data/serverStart.json', params: { }, success: function(startResponse) { smb.user.timeout.call(this, startResponse, startResponse); }, failure: function(response) { Ext.Msg.alert(smb.charset.module.failure, 'fail load!'); } }); } else if(button.status == 'stop') { button.setText(smb.charset.button.start); button.status = 'start'; Ext.Ajax.request({ url: './data/serverStop.json', params: { }, success: function(startResponse) { smb.user.timeout.call(this, startResponse, startResponse); }, failure: function(response) { Ext.Msg.alert(smb.charset.module.failure, 'fail load!'); } }); } } }, 'radiofield[id=svrClient]': { change: function(radio, newValue, oldValue, event){ if(newValue) { Ext.getCmp('svrIpCnt').enable(); Ext.getCmp('testingLabel').enable(); Ext.getCmp('testBar').enable(); Ext.getCmp('stStart').show(); Ext.getCmp('svrStart').hide(); } else { Ext.getCmp('svrIpCnt').disable(); Ext.getCmp('testingLabel').disable(); Ext.getCmp('testBar').disable(); Ext.getCmp('stStart').hide(); Ext.getCmp('svrStart').show(); Ext.Ajax.request({ url: './data/serverGet.json', params: { }, success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText).data; if(data.serverState==true) { Ext.getCmp('svrStart').status = 'stop'; Ext.getCmp('svrStart').setText(smb.charset.button.stop); } else{ Ext.getCmp('svrStart').status = 'start'; Ext.getCmp('svrStart').setText(smb.charset.button.start); } }, failure: function(response) { Ext.Msg.alert(smb.charset.module.failure, 'fail load!'); } }); } } }, '#agreeTerm': { change: function(chk, newValue, oldValue, eOps){ if(newValue) { Ext.getCmp('loginSubmit').enable(); } else { Ext.getCmp('loginSubmit').disable(); } } }, 'button[id=loginSubmit]': { click: function(btn, event){ smb.user.doLogin.call(this); } }, 'button[id=loginClear]': { click: function(btn, event){ Ext.getCmp('loginRegion').clearValue(); Ext.getCmp('loginUsername').setValue(''); Ext.getCmp('loginPassword').setValue(''); Ext.getCmp('loginUsername').clearInvalid(); Ext.getCmp('loginPassword').clearInvalid(); Ext.getCmp('loginRegion').clearInvalid(); } }, 'button[id=loginContinue]': { click: function(btn, event) { Ext.Ajax.request({ url: './data/loginConfirm.json', params: { }, success: function(response) { var data = Ext.JSON.decode(response.responseText); smb.user.loginCallBack.call(this, data); // if(data.retCode == 0) // { // smb.mode.status = data.mode; // smb.user.showMain.call(this); // } // else if(data.retCode == 1) // { // smb.user.showLogin.call(this, data); // } } }) } }, 'button[id=loginCancel]': { click: function(btn, event) { Ext.Ajax.request({ url: './data/version.json', params: { option: 'cancel' }, success: function(response) { var data = Ext.JSON.decode(response.responseText); smb.user.showLogin.call(this, data); document.title = data.devInfo; } }); } } }); }, modeChangeCallback: function(itemId, value, cfg) { var oldValue = Ext.getCmp('modeCombo').getValue(); if(itemId == "yes") { //模式发生了改变 var curThis = this; var s = setTimeout(resetApplyChanges, 1000); Ext.get('maskBody').show(); smb.user.bodyMask.show(); smb.user.bodyMask2.show(); Ext.fly('waiting').show(); Ext.Ajax.request({ url: './data/sysmod.json', params: { oldValue: this.oldValue, newValue: this.newValue }, success: function(response) { var data = Ext.JSON.decode(response.responseText); smb.user.timeout.call(this, data, data, 1); location = location; // smb.mode.changeMode.call(curThis, curThis.newValue, curThis.oldValue); // smb.pages.refreshCurrent.call(curThis); } }); } else { //需要将mode值改回原来的值 smb.mode.refreshFlag = false; //Ext.getCmp('modeCombo').confirmFlag = true; Ext.getCmp('modeCombo').confirmFlag = false; Ext.getCmp('modeCombo').setValue(this.oldValue); } } }); /*名字字段,可用于1-31个字符的输入,也可用于comment等其他类的输入*/ Ext.define('smb.view.textfieldName', { extend: 'Ext.form.field.Text', alias: 'widget.textfieldName', allowBlank: false, msgTarget: 'side', minLength: 1, minLengthText: smb.charset.validation.minLen, maxLength: 31, maxLengthText: smb.charset.validation.maxLen //validator:smb.verify.mask }); Ext.define('smb.view.textfieldTime', { extend: 'Ext.form.field.Text', alias: 'widget.textfieldTime', allowBlank: false, msgTarget: 'side', margin : '0 0 0 16', //fieldLabel: smb.charset.label.ipAddress, minLength: 3, minLengthText: smb.charset.validation.minLen, maxLength: 5, width:200, //pollInterval:1000, maxLengthText: smb.charset.validation.maxLen, //maxLengthText: smb.charset.validation.maxLen, validator:smb.verify.timeStart //regex: /^\s*[0-9]{1,3}\.{1}[0-9]{1,3}\.{1}[0-9]{1,3}\.{1}[0-9]{1,3}\s*$/, //regexText: 'regex' }); /*mac format:xx-xx-xx-xx-xx-xx *注意:如果要允许广播的mac地址,请设置allowBroadcast为true,如果要设置多播的mac地址,请设置allowMulticast为true, */ Ext.define('smb.view.textfieldMac', { extend: 'Ext.form.field.Text', alias: 'widget.textfieldMac', allowBlank: false, msgTarget: 'side', //margin : '0 0 0 16', allowBroadcast: false, allowMulticast: false, //fieldLabel: smb.charset.label.mac, minLength: 17, minLengthText: smb.charset.validation.minLen, maxLength: 17, maxLengthText: smb.charset.validation.maxLen, validator:smb.verify.mac }); /*mtu 为一个最小为576,最大为1500的数字 *注意:如果最大值不一样,请赋值覆盖最大值即可 */ Ext.define('smb.view.numberfieldMtu', { extend: 'Ext.form.field.Number', alias: 'widget.numberfieldMtu', allowBlank: false, msgTarget: 'side', //margin : '0 0 0 16', width: 150, hideTrigger: true, fieldLabel: smb.charset.label.mtuSize, minValue: 576, minText: smb.charset.validation.minValue, maxValue: 1500, maxText: smb.charset.validation.maxValue //validator:smb.verify.mtuVerify }); /* *LeaseTime: 范围是1-2880 */ Ext.define('smb.view.numberfieldLeaseTime', { extend: 'Ext.form.field.Number', alias: 'widget.numberfieldLeaseTime', allowBlank: false, msgTarget: 'side', labelAlign: 'right', labelWidth: 250, //margin : '0 0 0 16', hideTrigger: true, fieldLabel: smb.charset.label.dhcpLeaseTime, minValue: 1, minText: smb.charset.validation.minValue, maxValue: 2880, maxText: smb.charset.validation.maxValue //validator:smb.verify.mtuVerify }); /* *max idle time:范围还需底层提供并修改 */ Ext.define('smb.view.numberfieldIdleTime', { extend: 'Ext.form.field.Number', alias: 'widget.numberfieldIdleTime', allowBlank: false, msgTarget: 'side', //margin : '0 0 0 16', width:200, hideTrigger: true, fieldLabel: smb.charset.label.maxIdleTime, minValue: 0, emptyText : 0, minText: smb.charset.validation.minValue, maxValue: 99, maxText: smb.charset.validation.maxValue //validator:smb.verify.mtuVerify }); Ext.define('smb.view.numberfieldInteger', { extend: 'Ext.form.field.Number', alias: 'widget.numberfieldInteger', allowBlank: false, msgTarget: 'side', //margin : '0 0 0 16', width:200, hideTrigger: true, fieldLabel: smb.charset.label.maxIdleTime, //minValue: 0, //emptyText : 0, minText: smb.charset.validation.minValue, //maxValue: 99, maxText: smb.charset.validation.maxValue }); /* *username:范围还需底层提供并修改 */ Ext.define('smb.view.textfieldUsername', { extend: 'Ext.form.field.Text', alias: 'widget.textfieldUsername', allowBlank: false, msgTarget: 'side', //margin : '0 0 0 16', //fieldLabel: smb.charset.label.mac, minLength: 1, minLengthText: smb.charset.validation.minLen, maxLength: 16, maxLengthText: smb.charset.validation.maxLen, validator:smb.verify.username }); /* *password:范围还需底层提供并修改 */ Ext.define('smb.view.textfieldPassword', { extend: 'Ext.form.field.Text', alias: 'widget.textfieldPassword', allowBlank: false, msgTarget: 'side', inputType: 'password', //margin : '0 0 0 16', //fieldLabel: smb.charset.label.mac, minLength: 1, minLengthText: smb.charset.validation.minLen, maxLength: 16, maxLengthText: smb.charset.validation.maxLen, validator:smb.verify.password }); /* *domain:范围: -.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 */ Ext.define('smb.view.textfieldDomain', { extend: 'Ext.form.field.Text', alias: 'widget.textfieldDomain', allowBlank: true, msgTarget: 'side', // minLength: 0, // minLengthText: smb.charset.validation.minLen, maxLength: 30, maxLengthText: smb.charset.validation.maxLen, validator:smb.verify.domain }); /* *password:范围还需底层提供并修改 */ Ext.define('smb.view.button', { extend: 'Ext.button.Button', alias: 'widget.smbButton', margin: '0 6 0 0', minWidth: 100 }); Ext.define('smb.view.textfieldPortRange', { extend: 'Ext.form.field.Text', alias: 'widget.textfieldPortRange', allowBlank: false, msgTarget: 'side', margin : '0 0 0 16', fieldLabel: smb.charset.label.portRange, minLength: 3, minLengthText: smb.charset.validation.minLen, maxLength: 11, maxLengthText: smb.charset.validation.maxLen, validator:smb.verify.portRange }); Ext.define('Ext.grid.column.Ip', { extend: 'Ext.grid.column.Column', alias: 'widget.ipcolumn', requires: 'Ext.util.Format', // format : '0.0.0.0', // initComponent: function(){ // console.log(this) // this.callParent(arguments); // }, // editRenderer: function(value) // { // console.log(value) // }, defaultRenderer: function(value) { // if(value == 1) // { // alert(12334455) // } return Ext.util.Format.number(value, this.format); } }); Ext.define('smb.view.grid', { extend: 'Ext.grid.Panel', alias: 'widget.smbGrid', frame: false, minHeight: 132, maxHeight: 198, scrollPositionPre:0, // selType:'checkboxmodel', multiSelect: true, selModel: { mode: 'MULTI', pruneRemoved: false }, autoCancel: false, plugins: [ { ptype: 'rowediting', clicksToMoveEditor: 1, errorSummary: false, saveBtnText: smb.charset.button.ok, cancelBtnText: smb.charset.button.cancel, autoCancel: false } ], tbar: [ { text: smb.charset.tbar.add, xtype: 'button', iconCls: 'grid-add', type: 'btnAdd' }, { text: smb.charset.tbar.edit, xtype: 'button', iconCls: 'grid-edit', disabled:true, type: 'btnEdit' },{ text: smb.charset.tbar.delet, xtype: 'button', iconCls: 'grid-remove', disabled:true, type: 'btnDelete' } ] }); Ext.define('smb.view.form',{ extend: 'Ext.form.Panel', alias: 'widget.smbForm', border: false //layout: 'vbox' }); Ext.define('smb.view.module',{ extend: 'Ext.form.Panel', alias: 'widget.smbModule', frame: true, margin: 3, padding: 10, maskDisabled:true, //collapseMode: 'mini', //collapseFirst: true, //animCollapse: false, collapsedCls:"x-plain", collapsible: true, //trackResetOnLoad:true, header: { padding: '5 0 2 15' }, //layout: 'form', //width: 320, // defaultType: 'textfield', buttonAlign: 'right', buttons:[ { text: smb.charset.button.submit, elemType:'saveBtn', formBind:false, hidden:false, type:'btnSubmit' } ], /*constructor: function(config) { config = config || {}; this.callParent([config]); this.getForm().on('dirtychange', function(form, isDirty, eOpts) { //console.dir(arguments); //console.dir(form.owner); //console.dir(form.getFieldValues(true)); var buttons = form.owner.query('button[elemType=saveBtn]'); //console.log(isDirty); if( isDirty ) { // Unsaved changes exist //console.log("has change"); for(var i=0; i 1024) { tmpUnit = smb.charset.units.Mbps; for(i = 0; i < tpArray.length; i++) { tpArray[i].deviceRx = (tpArray[i].deviceRx / 1024.0).toFixed(1); tpArray[i].deviceTx = (tpArray[i].deviceTx / 1024.0).toFixed(1); } } return tmpUnit; } var wdData = new Array(); var wlData = new Array(); function successCallback(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success == true) { if(Ext.getCmp('monitor').changeFlag==false) { if(wdData.length==20) { wdData.shift(); } if(wlData.length==20) { wlData.shift(); } for(var i=0; i 1800*2) { smb.user.loop.progressCount = 0; location = location; } Ext.Ajax.request({ url: './data/progressBar.json', params: { autorefresh: 'true' }, method: 'GET', success: successCallback, callback:function() {}, failure: function() {} }); } } /* function getProgressBar() { if(smb.user.loginFlag) { Ext.Ajax.request({ url: './data/info.json', params: { }, success: function(response) { var data = Ext.JSON.decode(response.responseText); Ext.getCmp('info').getForm().loadRecord(data); // smb.modules.loadData(Ext.getCmp('info')); // smb.modules.loadData.call(this, Ext.getCmp('info')); }, failure: function() {} }); } } */ function getDdnsStatus() { if(smb.user.loginFlag) { Ext.Ajax.request({ url: './data/ddnsLogin.json', params: { autorefresh: 'true' }, method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success == true) { switch(data.data.dStatus) { case 0: Ext.getCmp('dStatus').setValue(smb.charset.tip.ddns0); break; case 1: Ext.getCmp('dStatus').setValue(smb.charset.tip.ddns1); break; case 2: Ext.getCmp('dStatus').setValue(smb.charset.tip.ddns2); break; case 3: Ext.getCmp('dStatus').setValue(smb.charset.tip.ddns3); break; case 4: Ext.getCmp('dStatus').setValue(smb.charset.tip.ddns4); break; default: Ext.getCmp('dStatus').setValue(smb.charset.tip.ddns5); } switch(data.data.nStatus) { case 0: Ext.getCmp('nStatus').setValue(smb.charset.tip.ddns0); break; case 1: Ext.getCmp('nStatus').setValue(smb.charset.tip.ddns1); break; case 2: Ext.getCmp('nStatus').setValue(smb.charset.tip.ddns2); break; case 3: Ext.getCmp('nStatus').setValue(smb.charset.tip.ddns3); break; case 4: Ext.getCmp('nStatus').setValue(smb.charset.tip.ddns4); break; default: Ext.getCmp('nStatus').setValue(smb.charset.tip.ddns5); } switch(data.data.cStatus) { case 0: Ext.getCmp('cStatus').setValue(smb.charset.tip.ddns0); break; case 1: Ext.getCmp('cStatus').setValue(smb.charset.tip.ddns1); break; case 2: Ext.getCmp('cStatus').setValue(smb.charset.tip.ddns2); break; case 3: Ext.getCmp('cStatus').setValue(smb.charset.tip.ddns3); break; case 4: Ext.getCmp('cStatus').setValue(smb.charset.tip.ddns4); break; default: Ext.getCmp('cStatus').setValue(smb.charset.tip.ddns5); } } }, failure: function(){} }); } } function getStation(auto) { var refresh = Ext.getCmp('autoRefreshStation').getValue(); if('false' == auto){ refresh = auto; } Ext.getCmp('stationGrid').scrollPositionPre = Ext.getCmp('stationGrid').getEl().down('.x-grid-view').getScroll().top; Ext.Ajax.request({ url: './data/station.json', params: { autorefresh: refresh }, method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var formData = Ext.JSON.decode(response.responseText); if( formData.success && formData.data.length!=0 ) { Ext.getCmp('stationGrid').show(); Ext.getCmp('noStationsText').hide(); Ext.getCmp('stationGrid').getStore().loadData(formData.data); Ext.getCmp('stationGrid').getEl().down('.x-grid-view').scrollTo('top', Ext.getCmp('stationGrid').scrollPositionPre, false); } else if( formData.success && formData.data.length==0 ) { Ext.getCmp('stationGrid').hide(); Ext.getCmp('noStationsText').show(); } }, failure: function(response) { var formData = Ext.JSON.decode(response.responseText); Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }) } function getInterface(auto) { var refresh = Ext.getCmp('autoRefreshInterface').getValue(); if('false' == auto){ refresh = auto; } Ext.getCmp('interfaceGrid').scrollPositionPre = Ext.getCmp('interfaceGrid').getEl().down('.x-grid-view').getScroll().top; Ext.Ajax.request({ url: './data/interfaces.json', params: { autorefresh: refresh }, method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var formData = Ext.JSON.decode(response.responseText); if( formData.success ) { Ext.getCmp('interfaceGrid').getStore().loadData(formData.data); Ext.getCmp('interfaceGrid').getEl().down('.x-grid-view').scrollTo('top', Ext.getCmp('interfaceGrid').scrollPositionPre, false); } else { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }, failure: function(response) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } }) } function getArpTable(auto) { var refresh = Ext.getCmp('autoRefreshArptable').getValue(); if('false' == auto){ refresh = auto; } Ext.getCmp('arpTableGrid').scrollPositionPre = Ext.getCmp('arpTableGrid').getEl().down('.x-grid-view').getScroll().top; Ext.Ajax.request({ url: './data/arpTable.json', params: { autorefresh: refresh }, method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var formData = Ext.JSON.decode(response.responseText); if( formData.success ) { Ext.getCmp('arpTableGrid').getStore().loadData(formData.data); Ext.getCmp('arpTableGrid').getEl().down('.x-grid-view').scrollTo('top', Ext.getCmp('arpTableGrid').scrollPositionPre, false); } else { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }, failure: function(response) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } }) } function getRoutes(auto) { var refresh = Ext.getCmp('autoRefreshRoutes').getValue(); if('false' == auto){ refresh = auto; } Ext.getCmp('routesGrid').scrollPositionPre = Ext.getCmp('routesGrid').getEl().down('.x-grid-view').getScroll().top; Ext.Ajax.request({ url: './data/route.json', params: { autorefresh: refresh }, method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var formData = Ext.JSON.decode(response.responseText); if( formData.success ) { Ext.getCmp('routesGrid').getStore().loadData(formData.data); Ext.getCmp('routesGrid').getEl().down('.x-grid-view').scrollTo('top', Ext.getCmp('routesGrid').scrollPositionPre, false); } else { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }, failure: function(response) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } }) } function getDhcpClients(auto) { var refresh = Ext.getCmp('autoRefreshDhcpClients').getValue(); if('false' == auto){ refresh = auto; } Ext.getCmp('dhcpClientsGrid').scrollPositionPre = Ext.getCmp('dhcpClientsGrid').getEl().down('.x-grid-view').getScroll().top; Ext.Ajax.request({ url: './data/dhcpClients.json', params: { autorefresh: refresh }, method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var formData = Ext.JSON.decode(response.responseText); if( formData.success && formData.data.length!=0 ) { Ext.getCmp('dhcpClientsGrid').show(); Ext.getCmp('noDhcpText').hide(); Ext.getCmp('dhcpClientsGrid').getStore().loadData(formData.data); Ext.getCmp('dhcpClientsGrid').getEl().down('.x-grid-view').scrollTo('top', Ext.getCmp('dhcpClientsGrid').scrollPositionPre, false); } else if( formData.success && formData.data.length==0 ) { Ext.getCmp('dhcpClientsGrid').hide(); Ext.getCmp('noDhcpText').show(); } else if( !formData.success ) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } }, failure: function(response) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } }) } function showMonitor(index) { if(!Ext.getCmp('throughput')) { return ; } var idArr = ["throughput", "stations", "interfaces", "arpTable", "routes", "dhcpClientsList", "dynamicWan"]; var tabArr = ['throughputTab', 'stationsTab', 'interfacesTab', 'arpTab', 'routesTab', "dhcpClientsListTab", "dynamicWanTab"]; smb.user.monitor = index; var cmpId = ""; var tabId = ""; for(var i = 0; i < idArr.length; i++) { cmpId = idArr[i]; Ext.getCmp(cmpId).hide(); tabId = tabArr[i]; Ext.fly(tabId).removeCls('currentTab'); } cmpId = idArr[index]; tabId = tabArr[index]; var curCmp = Ext.getCmp(cmpId); curCmp.show(); Ext.fly(tabId).addCls('currentTab'); if( index == 0 && Ext.getCmp('monitor').changeFlag==true ) { Ext.getCmp('monitor').changeFlag = false; Ext.getCmp('monitor').stationFlag = false; Ext.getCmp('monitor').interfaceFlag = false; Ext.getCmp('monitor').arpTableFlag = false; Ext.getCmp('monitor').routesFlag = false; Ext.getCmp('monitor').dhcpClientFlag = false; Ext.getCmp('monitor').dynamicWanFlag = false; // smb.user.loop.monitor = setInterval(getThroughputChart,4000); clearInterval(smb.user.loop.station); clearInterval(smb.user.loop.interfaces); clearInterval(smb.user.loop.arpTable); clearInterval(smb.user.loop.routes); clearInterval(smb.user.loop.dhcpClients); clearInterval(smb.user.loop.dynamicWan); Ext.Ajax.request({ url: './data/getThroughputIfList.json', timeout: 10000, params: { }, success: function(response) { if(!smb.user.timeout.call(this, response, response)) { var data = Ext.JSON.decode(response.responseText); var ifList = new Array; for( var i=0; i=0) { a = a%0x80000000; a >>= b; a += 0x40000000 >> (b-1); } else a >>= b; return a; } function shl1(a) { a = a%0x80000000; if (a&0x40000000==0x40000000) { a-=0x40000000; a*=2; a+=0x80000000; } else a*=2; return a; } function shl(a,b) { a = integer(a); b = integer(b); for (var i=0; i=0) if (t2>=0) return ((t1&t2)+0x80000000); else return (t1&b); else if (t2>=0) return (a&t2); else return (a&b); } function or(a,b) { a = integer(a); b = integer(b); var t1 = (a-0x80000000); var t2 = (b-0x80000000); if (t1>=0) if (t2>=0) return ((t1|t2)+0x80000000); else return ((t1|b)+0x80000000); else if (t2>=0) return ((a|t2)+0x80000000); else return (a|b); } function xor(a,b) { a = integer(a); b = integer(b); var t1 = (a-0x80000000); var t2 = (b-0x80000000); if (t1>=0) if (t2>=0) return (t1^t2); else return ((t1^b)+0x80000000); else if (t2>=0) return ((a^t2)+0x80000000); else return (a^b); } function not(a) { a = integer(a); return (0xffffffff-a); } var state = new array(4); var count = new array(2); count[0] = 0; count[1] = 0; var buffer = new array(64); var transformBuffer = new array(16); var digestBits = new array(16); var S11 = 7; var S12 = 12; var S13 = 17; var S14 = 22; var S21 = 5; var S22 = 9; var S23 = 14; var S24 = 20; var S31 = 4; var S32 = 11; var S33 = 16; var S34 = 23; var S41 = 6; var S42 = 10; var S43 = 15; var S44 = 21; function F(x,y,z) { return or(and(x,y),and(not(x),z)); } function G(x,y,z) { return or(and(x,z),and(y,not(z))); } function H(x,y,z) { return xor(xor(x,y),z); } function I(x,y,z) { return xor(y,or(x,not(z))); } function rotateLeft(a,n) { return or(shl(a,n),(shr(a,(32-n)))); } function FF(a,b,c,d,x,s,ac) { a = a+F(b, c, d) + x + ac; a = rotateLeft(a, s); a = a+b; return a; } function GG(a,b,c,d,x,s,ac) { a = a+G(b,c,d)+x+ac; a = rotateLeft(a,s); a = a+b; return a; } function HH(a,b,c,d,x,s,ac) { a = a+H(b, c, d) + x + ac; a = rotateLeft(a, s); a = a+b; return a; } function II(a,b,c,d,x,s,ac) { a = a+I(b, c, d) + x + ac; a = rotateLeft(a, s); a = a+b; return a; } function transform(buf,offset) { var a=0, b=0, c=0, d=0; var x = transformBuffer; a = state[0]; b = state[1]; c = state[2]; d = state[3]; for (i = 0; i < 16; i++) { x[i] = and(buf[i*4+offset],0xff); for (j = 1; j < 4; j++) { x[i]+=shl(and(buf[i*4+j+offset] ,0xff), j * 8); } } /* Round 1 */ a = FF ( a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ d = FF ( d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ c = FF ( c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ b = FF ( b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ a = FF ( a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ d = FF ( d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ c = FF ( c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ b = FF ( b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ a = FF ( a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ d = FF ( d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ c = FF ( c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ b = FF ( b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ a = FF ( a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ d = FF ( d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ c = FF ( c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ b = FF ( b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ /* Round 2 */ a = GG ( a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ d = GG ( d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ c = GG ( c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ b = GG ( b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ a = GG ( a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ d = GG ( d, a, b, c, x[10], S22, 0x2441453); /* 22 */ c = GG ( c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ b = GG ( b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ a = GG ( a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ d = GG ( d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ c = GG ( c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ b = GG ( b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ a = GG ( a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ d = GG ( d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ c = GG ( c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ b = GG ( b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ /* Round 3 */ a = HH ( a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ d = HH ( d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ c = HH ( c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ b = HH ( b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ a = HH ( a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ d = HH ( d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ c = HH ( c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ b = HH ( b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ a = HH ( a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ d = HH ( d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ c = HH ( c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ b = HH ( b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ a = HH ( a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ d = HH ( d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ c = HH ( c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ b = HH ( b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ /* Round 4 */ a = II ( a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ d = II ( d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ c = II ( c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ b = II ( b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ a = II ( a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ d = II ( d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ c = II ( c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ b = II ( b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ a = II ( a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ d = II ( d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ c = II ( c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ b = II ( b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ a = II ( a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ d = II ( d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ c = II ( c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ b = II ( b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ state[0] +=a; state[1] +=b; state[2] +=c; state[3] +=d; } function init() { count[0]=count[1] = 0; state[0] = 0x67452301; state[1] = 0xefcdab89; state[2] = 0x98badcfe; state[3] = 0x10325476; for (i = 0; i < digestBits.length; i++) digestBits[i] = 0; } function update(b) { var index,i; index = and(shr(count[0],3) , 0x3f); if (count[0]<0xffffffff-7) count[0] += 8; else { count[1]++; count[0]-=0xffffffff+1; count[0]+=8; } buffer[index] = and(b,0xff); if (index >= 63) { transform(buffer, 0); } } function finish() { var bits = new array(8); var padding; var i=0, index=0, padLen=0; for (i = 0; i < 4; i++) { bits[i] = and(shr(count[0],(i * 8)), 0xff); } for (i = 0; i < 4; i++) { bits[i+4]=and(shr(count[1],(i * 8)), 0xff); } index = and(shr(count[0], 3) ,0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); padding = new array(64); padding[0] = 0x80; for (i=0;i?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"+ "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; function md5(entree) //加密 { var l,s,k,ka,kb,kc,kd; init(); for (k=0;k0;j--) { if(document.all) { charStr = str.slice(j,j+1); if(charStr != ' ')break; } else { if(str[j] != ' ')break; } } if(j 0) { sliceStr = tmpstring.indexOf(";"); if(sliceStr == -1) { srcStr = tmpstring; if(checkCookie(srcStr) == true) { sliceStr = srcStr.indexOf("="); if(sliceStr == -1)return null; var submitStr = strmodify(srcStr.slice(sliceStr+1)); return submitStr; } } else { srcStr = tmpstring.slice(0,sliceStr); if(checkCookie(srcStr) == true) { sliceStr = srcStr.indexOf("="); if(sliceStr == -1)return null; var submitStr = strmodify(srcStr.slice(sliceStr+1)); return submitStr; } } tmpstring = tmpstring.slice(sliceStr+1); } return null; } function addInfoItem() { Ext.getCmp("infoCnt").add(signal); Ext.getCmp("infoCnt").add(radio); Ext.getCmp("infoCnt").add(lan); Ext.getCmp("infoCnt").add(wan); var controller = smb.app.getController("main"); smb.modules.loadData.call(controller, Ext.getCmp("info")); smb.user.infoFlag = true; } function addInfoItemNew(obj) { //console.log(obj); Ext.getCmp("infoCnt").add(obj); } function _show(id, index) { return function() { //var cmpId = id+"Panel"; var cmpId = id; var xtypeId = id+"Content"; if(index < 6) { var width = parseInt((index+1)/7*smb.user.progressWidth,10) + "px"; Ext.fly("progress_bg").setStyle("width", width); } Ext.getCmp(cmpId).removeAll(true); Ext.getCmp(cmpId).add({xtype:xtypeId}); var modelName = smb.app.getModel("info"); smb.user.infoFlag = true; if(!smb.user.infoLoad) { var controller = smb.app.getController("main"); smb.modules.loadData.call(controller, Ext.getCmp("info")); } else { var reader = smb.app.getController("main").application.getModel('info').getProxy().getReader(); var resultSet = reader.readRecords(reader.rawData); //console.dir(smb.app.getController("main").application.getModel('info').getProxy().getReader().readRecords(smb.app.getController("main").application.getModel('info').getProxy().getReader().rawData)); //console.dir(smb.app.getController("main").application.getModel('info').getProxy().getReader().getResponseData(smb.app.getController("main").application.getModel('info').getProxy().getReader().rawData)); //console.dir(smb.app.getController("main").application.getModel('info').getProxy().getReader().getResponseData(smb.app.getController("main").application.getModel('info').getProxy().getReader().rawData)); //console.dir(reader.rawData); //console.dir(resultSet.records[0].data); Ext.getCmp('info').getForm().setValues(resultSet.records[0].data); //Ext.getCmp('info').loadRecord(resultSet.records[0].data); } //console.log(index); if(index == 6) { var width = parseInt((index+1)/7*smb.user.progressWidth-2,10) + "px"; Ext.fly("progress_bg").setStyle("width", width); setTimeout(function(){Ext.fly('waiting').hide();Ext.get('maskBody').hide();}, 300); } //smb.modules.loadData.call(controller, Ext.getCmp("info")); //smb.user.infoFlag = true; } } function replaceWireless(cntId) { return function() { var cmpId = cntId; //console.log(cntId); var xtypeId = cntId+"Content"; //console.log(xtypeId); Ext.getCmp(cmpId).removeAll(true); Ext.getCmp(cmpId).add({xtype:xtypeId}); smb.user.wirelessFlag = true; var modelName = smb.app.getModel("wireless"); smb.user.infoFlag = true; var controller = smb.app.getController("wireless"); smb.modules.loadData.call(controller, Ext.getCmp(cntId)); } } /*****************************************************************************/ function ipToInt(str_ip) { var patternIp = /^\s*[0-9]{1,3}\.{1}[0-9]{1,3}\.{1}[0-9]{1,3}\.{1}[0-9]{1,3}\s*$/; var ip_array = str_ip.split("."); if(ip_array.length != 4) { return -1; } if(!patternIp.test(str_ip)) { return -1; } return (Number(ip_array[0])*(1<<24)+(Number(ip_array[1])<<16 |Number(ip_array[2])<<8 |Number(ip_array[3]))); } function intToIp(int_ip) { var str_ip = ((int_ip>>24)&0xff) + "." + ((int_ip>>16)&0xff) +"." + ((int_ip>>8)&0xff)+ "." + ((int_ip)&0xff); return str_ip; } function getNetIp(str_ip,str_mask) /*通过str_ip地址和掩码,获得ip地址,地址以整数形式存在*/ { if(!str_ip) { return 0x00000000; } var int_ip = ipToInt(str_ip); var int_mask = ipToInt(str_mask); return (int_ip&int_mask); } function getBroadcastIpMask(str_ip,mask) { var int_ip = ipToInt(str_ip); var int_mask = ipToInt(mask); if (int_mask == 0) { int_mask = ipToInt('255.255.255.255'); return logic.or(int_ip,int_mask); } return logic.or(int_ip,~int_mask); } var logic = new Object; logic.or = function(int_a,int_b) { var binary_a = parseInt(int_a,10).toString(2); var binary_b = parseInt(int_b,10).toString(2); var len = (binary_a.length > binary_b.length) ? binary_a.length : binary_b.length; if (len != 32) { return int_a|int_b; } var cut = Math.abs(binary_a.length - binary_b.length); var temp = ''; for (var i = 0 ; i < cut; i++) { temp = temp + '0'; } if (binary_a.length > binary_b.length) { binary_b = temp + binary_b; } else { binary_a = temp + binary_a; } var res = 0; for (var i=len-1; i >= 0; i--) { if (binary_a.charAt(i)|binary_b.charAt(i) == 1) { if((len-1-i) > 24) { res = Number(res) + 256*Number((1<<(len-9-i))); } else { res = Number(res) + Number((1<<(len-1-i))); } } } return res; } function getIpRange_Mask(ip,mask) { var ip_range = new Object(); ip_range.start = ipToInt(intToIp(getNetIp(ip,mask))); ip_range.end = ipToInt(intToIp(getBroadcastIpMask(ip,mask))); return ip_range; } function checkIpRangeConflict( int_ip_start_net, int_ip_end_net, int_ip_start_sample, int_ip_end_sample ) { if (!int_ip_end_sample && int_ip_end_sample != 0) { if (int_ip_start_net <= int_ip_start_sample && int_ip_start_sample <= int_ip_end_net) { return true; } } else { if ((int_ip_start_net <= int_ip_start_sample && int_ip_start_sample <= int_ip_end_net) || (int_ip_start_net <= int_ip_end_sample && int_ip_end_sample <= int_ip_end_net)) { return true; } } return false; } function refreshChannel() { if(smb.pages.currentCmpId != "wireless") { return 1; } if(smb.mode.status == "accessPoint") { Ext.getCmp('apChannel').enable(); } else if(smb.mode.status == "client") { Ext.getCmp('apChannel').disable(); } else if(smb.mode.status == "wdsRepeater") { Ext.getCmp('apChannel').disable(); } else if(smb.mode.status == "bridgeWithAP") { Ext.getCmp('apChannel').disable(); } else if(smb.mode.status == "apRouter") { Ext.getCmp('apChannel').enable(); } else /***apClientRouter***/ { Ext.getCmp('apChannel').disable(); } } function getRecordOrModelData(cmpId, modelId) {//首先获取record的值,该值获取不到再获取model的值 if(Ext.getCmp(cmpId).getRecord()) { return Ext.getCmp(cmpId).getRecord().data; } else { if(modelId) { return smb.model[modelId].getProxy().getReader().rawData.data } else { return smb.model[cmpId].getProxy().getReader().rawData.data } } } function changeSubmitWaitStatus(show) { var obj = Ext.getBody().getViewRegion(); Ext.getDom('waiting-submit').style.top = (obj.bottom+obj.top)/2 + "px"; //Ext.fly('waiting-submit').css('top', (obj.bottom+obj.top)/2); if(show) { Ext.fly('waiting-submit').show(); smb.user.bodyMask.show(); smb.user.bodyMask2.show(); } else { Ext.fly('waiting-submit').hide(); smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); } }