Ext.define('smb.view.ipMacBinding',{ extend: 'smb.view.module', alias: 'widget.ipMacBinding', id: 'ipMacBinding', type: 'advancedSettings', // hidden: true, model: 'ipMacBindingForm', url: './data/ipMacBinding.json', title: smb.charset.module.ipMacBinding, collapsed: true, // buttons: false, grid: { 'ipMacBinding':'ipMacBindingGrid' }, items: [ { xtype:'checkbox', id:'ipMacEnable', name:'enable', labelWidth: 100, labelAlign: 'left', fieldLabel: smb.charset.label.ipmacBinding, boxLabel:smb.charset.label.enable, checked: false, listeners:{ change: function( item, newValue, oldValue) { if(newValue){ Ext.getCmp('ipMacBindingGrid').show(); } else{ Ext.getCmp('ipMacBindingGrid').hide(); } } } }, /* { xtype: 'button', text: smb.charset.button.submit, margin: '5 0 10 105', listeners:{ click:function( item, event ) { Ext.Ajax.request({ url: './data/ipMacBinding.json', params: { enable: Ext.getCmp('ipMacEnable').getValue() }, success: function(response) { var s = setTimeout(resetApplyChanges, 1000); var formData = Ext.JSON.decode(response.responseText); if( formData.success == true ) { Ext.getCmp('ipMacEnable').setValue(formData.data.enable); } else if( formData.success == false ) { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+formData.errCode]); } } }); } } }, */ { xtype: 'smbGrid', store: 'ipMacBinding', id: 'ipMacBindingGrid', hidden: true, selModel: false, columns: [ { text: smb.charset.column.enable, hideable: false, dataIndex: 'enable', width: 80, align: 'center', editor: { xtype: 'checkbox' }, defaultValue: true, renderer: function(value) { if(value == true) { return ''; } else if(value == false) { return ''; } } }, { text: smb.charset.column.ip, hideable: false, dataIndex:'ip', flex:1, editor: { xtype: 'textfield', allowBlank: false, vtype: 'ip' } }, { text: smb.charset.column.mac, hideable: false, dataIndex:'mac', flex:1, editor: { xtype: 'textfield', allowBlank: false, vtype: 'mac' } } /* { text: smb.charset.column.comment, hideable: false, dataIndex:'comment', flex:1, editor: { xtype: 'textfield', allowBlank: true, maxLength: 31 } }, { text: 'setting', xtype:'actioncolumn', align:'center', width:60, items: [{ icon: 'extjs/resources/shared/icons/fam/cog_edit.png', // Use a URL in the icon config tooltip: 'Edit', padding:10, handler: function(grid, rowIndex, colIndex) { //var rec = grid.getStore().getAt(rowIndex); //alert("Edit " + rec.get('firstname')); console.log("Edit"); } },{ icon: 'extjs/resources/shared/icons/fam/delete.gif', tooltip: 'Delete', handler: function(grid, rowIndex, colIndex) { //var rec = grid.getStore().getAt(rowIndex); //alert("Terminate " + rec.get('firstname')); console.log("Delete"); } }] }*/ ], 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' },{ text: smb.charset.tbar.impor, xtype: 'button', iconCls: 'grid-import', listeners:{ click:function(){ Ext.Ajax.request({ url: './data/ipMacBinding.json?option=import', method: 'POST', params: { }, success: function(response) { var data = Ext.JSON.decode(response.responseText); Ext.getStore('ipMacBinding').loadData(data.data.ipMacBindingGrid); } }); var s = setTimeout(resetApplyChanges, 1000); } } } ] } ] }); Ext.define('smb.view.bandWidthControl',{ extend: 'smb.view.module', alias: 'widget.bandWidthControl', id: 'bandWidthControl', type: 'advancedSettings', // hidden: true, model: 'bandWidthControlForm', collapsed: true, url: './data/bandWidthControl.json', title: smb.charset.module.bandwidthControl, // buttons: false, grid: { 'bandWidthControl': 'bandWidthControlGrid' }, items: [ { xtype: 'fieldcontainer', layout: 'column', items: [ { xtype: 'numberfield', fieldLabel: smb.charset.label.totalIngressBandwidth, id: 'totalIngressBandwidth', name: 'totalIngressBandwidth', labelAlign: 'left', decimalPrecision:0, minValue: 1, maxValue: 100000, labelWidth: 140, inputWidth: 80, width: 240 }, { xtype: 'label', text: smb.charset.label.kbps, margin: '3 60 0 0' }, { xtype: 'numberfield', fieldLabel: smb.charset.label.totalEgressBandwidth, id: 'totalEgressBandwidth', name: 'totalEgressBandwidth', labelAlign: 'left', decimalPrecision:0, minValue: 1, maxValue: 100000, labelWidth: 140, inputWidth: 80, width: 240 }, { xtype: 'label', text: smb.charset.label.kbps, margin: '3 50 0 0' } ] }, { xtype:'checkbox', id:'bwcStatus', name:'enable', labelWidth: 140, labelAlign: 'left', fieldLabel: smb.charset.label.bandWidthControl, boxLabel:smb.charset.label.enable, checked: false, listeners:{ change: function( item, newValue, oldValue) { if(newValue){ Ext.getCmp('bandwidthGrid').show(); } else{ Ext.getCmp('bandwidthGrid').hide(); } } } }, /* { xtype: 'button', // id: 'bwcSubmit', margin: '5 5 10 145', text: smb.charset.button.submit, listeners:{ click: function(btn,event) { if(btn.gridName) { var enable = enable+btn.gridName; }; if(!Ext.getCmp('totalIngressBandwidth').isValid() || !Ext.getCmp('totalEgressBandwidth').isValid()) { return false; } Ext.Ajax.request({ url: './data/bandWidthControl.json', params: { enable: Ext.getCmp('bwcStatus').getValue(), totalIngressBandwidth: Ext.getCmp('totalIngressBandwidth').getValue(), totalEgressBandwidth: Ext.getCmp('totalEgressBandwidth').getValue() }, success: function(response) { var data = Ext.JSON.decode(response.responseText); if(data.success == true) { smb.user.timeout.call(this, response, response); var s = setTimeout(resetApplyChanges, 1000); Ext.getCmp('bandWidthControl').loadRecord(data); } else { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+data.errCode]); } } }); } } }, */ { xtype: 'smbGrid', id: 'bandwidthGrid', store: 'bandWidthControl', hidden: true, selModel: false, columns: [ { text: smb.charset.column.enable, hideable: false, dataIndex: 'enable', width: 80, align: 'center', flex: 1, editor: { xtype: 'checkbox' }, defaultValue: true, renderer: function(value) { if(value == true) { return ''; } else if(value == false) { return ''; } } }, { text: smb.charset.column.ipRange, hideable: false, dataIndex:'ipRange', flex:3, editor: { xtype: 'textfield', allowBlank: false, validator: function(value) { var list = value.split('-'); if(list.length == 1) { var ipStart = list[0]; return smb.verify.ip(ipStart) } else if(list.length == 2) { var ipStart = list[0]; var ipEnd = list[1]; if( smb.verify.ip(ipStart)!=true ){ return smb.verify.ip(ipStart); } if( smb.verify.ip(ipEnd)!=true ){ return smb.verify.ip(ipEnd); } if( smb.format.ipToInt(ipStart)>=smb.format.ipToInt(ipEnd) ) { return smb.charset.validation.ipRange; } return true; } else { return smb.charset.validation.ipRangeNum; } } } }, { text: smb.charset.column.portRange, hideable: false, dataIndex:'portRange', flex:2, editor: { xtype: 'textfield', allowBlank: false, validator: function(value) { var list = value.split('-'); if(list.length == 1) { var portStart = list[0]; if(Number(portStart)<1) { return smb.charset.validation.portStartErr; } if(Number(portStart)>65535) { return smb.charset.validation.portEndErr; } return smb.verify.integer(portStart) } else if(list.length == 2) { var portStart = list[0]; var portEnd = list[1]; if( smb.verify.integer(portStart) && smb.verify.integer(portEnd) ) { if(Number(portStart)65535) { return smb.charset.validation.portEndErr; } return true; } else { return smb.charset.validation.portRangeErr; } } else { return smb.charset.validation.portRangeFormat; } } else { return smb.charset.validation.portRangeInvalid; } } }, defaultValue: '1-65535' }, { text: smb.charset.column.protocol, hideable: false, dataIndex:'protocol', flex:2, editor: { xtype: 'combobox', editable: false, store: 'natProtocol', displayField: 'display', valueField: 'name' }, renderer: function(value) { switch(value) { case 0: return smb.charset.comboBox.all; case 1: return smb.charset.comboBox.tcp; case 2: return smb.charset.comboBox.udp; } } }, { text: smb.charset.column.ingressMin, hideable: false, dataIndex:'ingressMin', flex:2, editor: { xtype: 'numberfield', decimalPrecision:0, allowBlank: false, id: 'ingressMin', minValue: 0 } }, { text: smb.charset.column.ingressMax, hideable: false, dataIndex:'ingressMax', flex:2, editor: { xtype: 'numberfield', allowBlank: false, decimalPrecision:0, minValue: 0, validator: function(value) { var formPanel = this.ownerCt; var minValue = formPanel.getComponent('ingressMin').getValue(); if(value'; } else if(value == false) { return ''; } } }, { text: smb.charset.column.targetNetworkIp, hideable: false, dataIndex:'targetNetworkIp', flex:1, editor: { xtype: 'textfield', id: 'targetNetworkIp', name: 'targetNetworkIp', allowBlank: false, vtype: 'ip' } }, { text: smb.charset.column.netmask, hideable: false, dataIndex:'netmask', flex:1, editor: { xtype: 'textfield', allowBlank: false, vtype: 'mask', validator: function(value) { var formPanel = this.ownerCt; var ipValue = formPanel.getComponent('targetNetworkIp').getValue(); return smb.verify.ipMask.call(this, value, ipValue); } }, defaultValue: '255.255.255.255' }, { text: smb.charset.column.gatewayIp, hideable: false, dataIndex:'gatewayIp', flex:1, editor: { xtype: 'textfield', allowBlank: false, vtype: 'ip' } } /* { text: smb.charset.column.comment, hideable: false, dataIndex:'comment', flex:1, editor: { xtype: 'textfield', allowBlank: true, maxLength: 31 } } */ ] } ] }); Ext.define('smb.view.accessControl',{ extend: 'smb.view.module', alias: 'widget.accessControl', id: 'accessControl', type: 'advancedSettings', // hidden: true, model: 'accessControlForm', url: './data/accessControl.json', title: smb.charset.module.accessControl, collapsed: true, // buttons: false, grid: { 'accessControlGrid': 'accessControlGrid' }, items: [ { xtype: 'fieldcontainer', layout: 'hbox', items: [ { xtype:'checkbox', id:'acStatus', name:'enable', labelWidth: 90, labelAlign: 'left', labelPad: 9, fieldLabel: smb.charset.label.accessControl, boxLabel:smb.charset.label.enable, checked: false, listeners:{ change: function( item, newValue, oldValue) { if(newValue){ Ext.getCmp('accessControlGrid').show(); } else{ Ext.getCmp('accessControlGrid').hide(); } } } }, { xtype: 'helpIcon', id: 'accessControlHelp', listeners:{ afterrender:function(button, event){ var tip = Ext.create('Ext.tip.ToolTip', { target: 'accessControlHelp', maxWidth: 500, dismissDelay: 0, html: smb.charset.help.accessControl }); } } } ] }, { xtype: 'radiogroup', id: 'acPolicy', fieldLabel: smb.charset.label.filteringPolicy, columns: 1, width: 800, labelWidth: 90, items: [ {boxLabel:smb.charset.label.allowPackets, id:'acAllowPolicy', name:'policy', inputValue:1}, {boxLabel:smb.charset.label.denyPackets, id:'acDenyPolicy', name:'policy', inputValue:0, width:700} ] }, /* { xtype: 'button', margin: '5 5 10 99', width: 60, text: smb.charset.button.submit, id: 'acSubmit', listeners:{ click: function(btn,event) { Ext.Ajax.request({ url: './data/accessControl.json', params: { enable: Ext.getCmp('acStatus').getValue().enable, policy: Ext.getCmp('acPolicy').getValue().policy }, success: function(response) { var data = Ext.JSON.decode(response.responseText); if(data.success == true) { smb.user.timeout.call(this, response, response); var s = setTimeout(resetApplyChanges, 1000); Ext.getCmp('accessControl').loadRecord(data); } else { Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+data.errCode]); } } }); } } }, */ { xtype: 'smbGrid', id: 'accessControlGrid', store: 'accessControlGrid', hidden: true, columns: [ { text: smb.charset.column.enable, hideable: false, dataIndex: 'enable', width: 80, align: 'center', flex: 0.5, editor: { xtype: 'checkbox' }, defaultValue: true, renderer: function(value) { if(value == true) { return ''; } else if(value == false) { return ''; } } }, /* { text: smb.charset.column.policy, hideable: false, dataIndex: 'policy', flex:1, editor: { xtype: 'combobox', store: 'policy', editable: false, valueField: 'name', displayField:'display', value: 1 }, defaultValue: 1, renderer: function(value) { if(value == 1) { return 'Allow'; } else if(value == 0) { return 'Deny'; } } }, */ { text: smb.charset.column.protocol, hideable: false, dataIndex:'protocol', flex:0.7, editor: { xtype: 'combobox', editable: false, store: 'protocol', displayField: 'display', valueField: 'name', defaultValue: 1, listeners: { change: function( scope, newValue, oldValue, eOpts) { if(newValue == 0 || newValue == 3) { Ext.getCmp('acTargetPort').disable(); } else { Ext.getCmp('acTargetPort').enable(); } } } }, defaultValue: 1, renderer: function(value) { switch(value) { case 0: return smb.charset.comboBox.ip; case 1: return smb.charset.comboBox.tcp; case 2: return smb.charset.comboBox.udp; case 3: return smb.charset.comboBox.icmp; } } }, { text: smb.charset.column.hostIp, hideable: false, dataIndex:'hostIp', flex:2, editor: { xtype: 'textfield', id: 'hostIpEdit', allowBlank: true, allowAllZero: true, validator: function(value) { if(value) { var list = value.split('-'); if(list.length == 1) { var ipStart = list[0]; return smb.verify.ip.call(Ext.getCmp('hostIpEdit'), ipStart); } else if(list.length == 2) { var ipStart = list[0]; var ipEnd = list[1]; if( smb.verify.ip.call(Ext.getCmp('hostIpEdit'), ipStart)!=true ){ return smb.verify.ip.call(Ext.getCmp('hostIpEdit'), ipStart); } if( smb.verify.ip.call(Ext.getCmp('hostIpEdit'), ipEnd)!=true ){ return smb.verify.ip.call(Ext.getCmp('hostIpEdit'), ipEnd); } if( smb.format.ipToInt(ipStart)>=smb.format.ipToInt(ipEnd) ) { return smb.charset.validation.ipRange; } return true; } else { return smb.charset.validation.ipRangeNum; } } else { return true; } } } }, { text: smb.charset.column.targetIp, hideable: false, dataIndex:'targetIp', flex:2, editor: { xtype: 'textfield', id: 'targetIpEdit', allowBlank: true, allowAllZero: true, validator: function(value) { if(value) { var list = value.split('-'); if(list.length == 1) { var ipStart = list[0]; return smb.verify.ip.call(Ext.getCmp('targetIpEdit'), ipStart); } else if(list.length == 2) { var ipStart = list[0]; var ipEnd = list[1]; if( smb.verify.ip.call(Ext.getCmp('targetIpEdit'), ipStart)!=true ){ return smb.verify.ip.call(Ext.getCmp('targetIpEdit'), ipStart); } if( smb.verify.ip.call(Ext.getCmp('targetIpEdit'), ipEnd)!=true ){ return smb.verify.ip.call(Ext.getCmp('targetIpEdit'), ipEnd); } if( smb.format.ipToInt(ipStart)>=smb.format.ipToInt(ipEnd) ) { return smb.charset.validation.ipRange; } return true; } else { return smb.charset.validation.ipRangeNum; } } else { return true; } } } }, { text: smb.charset.column.targetPort, hideable: false, dataIndex:'targetPort', flex:0.9, editor: { xtype: 'textfield', id: 'acTargetPort', allowBlank: true, validator: function(value) { if(value) { var list = value.split('-'); if(list.length == 1) { var portStart = list[0]; if(Number(portStart)<1) { return smb.charset.validation.portStartErr; } if(Number(portStart)>65535) { return smb.charset.validation.portEndErr; } return smb.verify.integer(portStart) } else if(list.length == 2) { var portStart = list[0]; var portEnd = list[1]; if( smb.verify.integer(portStart) && smb.verify.integer(portEnd) ) { if(Number(portStart)65535) { return smb.charset.validation.portEndErr; } return true; } else { return smb.charset.validation.portRangeErr; } } else { return smb.charset.validation.portRangeFormat; } } else { return smb.charset.validation.portRangeInvalid; } } else { return true; } } } }, { text: smb.charset.column.weekdays, hideable: false, dataIndex: 'scheduleDay', flex:2.1, renderer: function(value) { var str = ""; var delimiter = smb.charset.delimiter; if (-1 != value.indexOf("Sun")) {str += smb.charset.comboBox.sun + delimiter;} if (-1 != value.indexOf("Mon")) {str += smb.charset.comboBox.mon + delimiter;} if (-1 != value.indexOf("Tue")) {str += smb.charset.comboBox.tue + delimiter;} if (-1 != value.indexOf("Wed")) {str += smb.charset.comboBox.wed + delimiter;} if (-1 != value.indexOf("Thu")) {str += smb.charset.comboBox.thu + delimiter;} if (-1 != value.indexOf("Fri")) {str += smb.charset.comboBox.fri + delimiter;} if (-1 != value.indexOf("Sat")) {str += smb.charset.comboBox.sat + delimiter;} return str.slice(0, -1 * delimiter.length); // remove last delimiter }, editor: { xtype: 'combobox', store: 'weekdays', id: 'cmb_schedule_id', multiSelect: true, valueField: 'name', displayField:'display', editable: false, // forceSelection: true, value: 'Sun' }, defaultValue: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat' }, { text: smb.charset.column.time, hideable: false, dataIndex:'time', flex:0.8, editor: { xtype: 'textfield', allowBlank: false, value: "0:00-24:00", validator:function(value) { var list = value.split('-'); if(list!='' && list.length == 1) { return smb.charset.validation.timeEnd; } else if(list.length == 2) { var timeStart = list[0]; var timeEnd = list[1]; if( smb.verify.timeStart(timeStart)==true && smb.verify.timeEnd(timeEnd)==true ) { var timeStart = smb.format.timeToInt(list[0]); var timeEnd = smb.format.timeToInt(list[1]); if( timeStart < timeEnd) { return true; } else { return smb.charset.validation.timeRange; } } else if(smb.verify.timeStart(timeStart) != true) { return smb.charset.validation.timeStart; } else if(smb.verify.timeEnd(timeEnd) != true) { return smb.charset.validation.timeEnd; } } else { return smb.charset.validation.timeFormat; } } }, defaultValue: '00:00-24:00' } /* { text: smb.charset.column.comment, hideable: false, dataIndex:'comment', flex:1, editor: { xtype: 'textfield', allowBlank: true, maxLength: 31 } } */ ], plugins: [ { ptype: 'rowediting', clicksToMoveEditor: 1, errorSummary: false, saveBtnText: smb.charset.button.ok, cancelBtnText: smb.charset.button.cancel, autoCancel: false, listeners:{ beforeedit:function( editor, obj ) { if( obj.record.data.protocol==0 || obj.record.data.protocol==3 ) { Ext.getCmp('acTargetPort').disable(); } else { Ext.getCmp('acTargetPort').enable(); } } } } ], listeners:{ itemdblclick: function(){ var scheduleCmp = Ext.getCmp("cmb_schedule_id"); var scheduleData = scheduleCmp.getValue()[0]; scheduleData = scheduleData.split(","); scheduleCmp.setValue(scheduleData); } } } ] }); Ext.define('smb.view.networkSecurity',{ extend: 'smb.view.module', alias: 'widget.networkSecurity', id: 'networkSecurity', type: 'advancedSettings', // hidden: true, model: 'securityForm', url: './data/security.json', title: smb.charset.module.security, collapsed: true, items: [ { xtype: 'smbAdvancedSettings', title: smb.charset.label.basic, padding: '5 5 5 33', items: [ { xtype: 'fieldcontainer', layout: 'hbox', defaults:{ labelWidth: 110, labelAlign: 'right' }, items: [ { xtype: 'checkboxgroup', id: 'networkSecurity_firewall_id', columns: 1, width: 210, fieldLabel: smb.charset.label.firewall, items: [{name:'firewall', boxLabel: smb.charset.label.spiFirewall, inputValue:1}] }, { xtype: 'helpIcon', id: 'securityHelp', listeners:{ afterrender:function(button, event){ var tip = Ext.create('Ext.tip.ToolTip', { target: 'securityHelp', maxWidth: 500, dismissDelay: 0, html: smb.charset.help.security }); } } } ] }, { xtype: 'checkboxgroup', id: 'networkSecurity_ping_id', columns: 4, fieldLabel: smb.charset.label.ping, items: [ {name:'wanPingForbidden', boxLabel: smb.charset.label.wanPingForbid, inputValue:1, id: 'wanPingForbidden'}, {name:'lanPingForbidden', boxLabel: smb.charset.label.lanPingForBid, inputValue:2, id: 'lanPingForbidden'} ] }, { xtype: 'checkboxgroup', id: 'networkSecurity_vpn_id', columns: 4, fieldLabel: smb.charset.label.vpn, items: [ {name:'pptpPassthrough', boxLabel: smb.charset.label.pptpPassthrough, inputValue:1}, {name:'l2tpPassthrough', boxLabel: smb.charset.label.l2tpPassthrough, inputValue:2}, {name:'ipsecPassthrough', boxLabel: smb.charset.label.ipsecPassthrough, inputValue:3} ] } ] }, { xtype: 'smbAdvancedSettings', title: smb.charset.label.advancedSecurity, padding: '5 5 5 33', items: [ { xtype: 'checkbox', id: 'dosProtection', name: 'dosProtection', fieldLabel: smb.charset.label.dosProtection, boxLabel: smb.charset.label.enable, cls: 'inlineBlock', margin: '0 0 5 27', checked: true }, { xtype: 'fieldcontainer', layout: 'column', items: [ { xtype: 'combobox', editable: false, id: 'packetsInterval', name: 'packetsInterval', fieldLabel: smb.charset.label.packetsInterval, store: 'packetsInterval', displayField: 'display', valueField: 'name', labelWidth: 195, inputWidth: 80, width: 290, labelAlign: 'left', margin: '0 0 5 143' }, { xtype: 'label', text: smb.charset.label.seconds, id: 'packetsIntervalLabel', width: 70, margin: '3 0 0 5' } ] }, { xtype: 'fieldcontainer', id: 'icmpCnt', layout:'column', items: [ { xtype: 'checkbox', width: 200, margin: '0 0 0 143', boxLabel: smb.charset.label.icmpFlood, fieldLabel: smb.charset.label.icmpFlood, hideLabel: true, id: 'icmpFlood', name: 'icmpFlood', checked: true }, { xtype: 'numberfield', width: 95, inputWidth: 80, hideLabel: true, id: 'icmpFloodValue', name: 'icmpFloodValue', decimalPrecision:0, minValue: 5, maxValue: 3600 }, { xtype: 'label', text: smb.charset.label.packetPerSec, id : 'icmpFloodLabel', width: 60, margin: '3 0 0 0' } ] }, { xtype: 'fieldcontainer', layout:'column', id: 'udpFloodCnt', items: [ { xtype: 'checkbox', width: 200, margin: '0 0 0 143', boxLabel: smb.charset.label.udpFlood, fieldLabel: smb.charset.label.udpFlood, hideLabel: true, id: 'udpFlood', checked: true, name: 'udpFlood' }, { xtype: 'numberfield', width: 95, inputWidth: 80, hideLabel: true, id: 'udpFloodValue', name: 'udpFloodValue', decimalPrecision:0, minValue: 5, maxValue: 3600 }, { xtype: 'label', text: smb.charset.label.packetPerSec, id : 'udpFloodLabel', width: 60, margin: '3 0 0 0' } ] }, { xtype: 'fieldcontainer', layout:'column', id: 'tcpSynCnt', items: [ { xtype: 'checkbox', width: 200, margin: '0 0 0 143', boxLabel: smb.charset.label.tcpSynFlood, fieldLabel: smb.charset.label.tcpSynFlood, hideLabel: true, id: 'tcpSynFlood', name: 'tcpSynFlood', checked: true }, { xtype: 'numberfield', width: 95, inputWidth: 80, hideLabel: true, id: 'tcpSynFloodValue', name: 'tcpSynFloodValue', decimalPrecision:0, minValue: 5, maxValue: 3600 }, { xtype: 'label', text: smb.charset.label.packetPerSec, id : 'tcpSynFloodLabel', width: 60, margin: '3 0 0 0' } ] }, { xtype: 'button', id: 'dosListBtn', margin: '0 0 0 143', text: smb.charset.button.blockedDosList, listeners:{ click:function(button, event){ smb.user.bodyMask.show(); smb.user.bodyMask2.show(); Ext.getCmp('dosList').show(); var position = button.getPosition(); var h = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight; var temp = 0; temp = (h-300)/2+Ext.getBody().dom.scrollTop-150; Ext.getCmp('dosList').setPosition((960-600)/2, temp); Ext.Ajax.request({ url: './data/dosList.json', method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success){ Ext.getStore('dosHostList').loadData(data.data.dosList); } else{ Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+data.errCode]); } }, failure: function(){ Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } }) } } } ] } ] }); Ext.define('smb.view.dosList',{ extend: 'smb.view.popBox', alias: 'widget.dosList', id: 'dosList', name: 'dosList', title: smb.charset.module.blockedDosHostList, width: 600, height: 300, bodyStyle: { // background: '#fff', padding: 0 }, hidden: true, closeAction: 'hide', items: [ { xtype: 'grid', id: 'dosListGrid', store: 'dosHostList', multiSelect: true, columns: [ { text: smb.charset.column.hostIp, dataIndex: 'hostIp', align: 'center', hideable: false, flex: 1 }, { text: smb.charset.column.hostMac, dataIndex: 'hostMac', align: 'center', hideable: false, flex: 1 } ], tbar: [ { text: smb.charset.tbar.refresh, xtype: 'button', iconCls: 'grid-refresh', listeners:{ click:function(button, event){ Ext.Ajax.request({ url: './data/dosList.json', method: 'GET', success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success){ Ext.getStore('dosHostList').loadData(data.data.dosList); } else{ Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+data.errCode]); } }, failure: function(){ Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } }) } } }, { text: smb.charset.tbar.clear, xtype: 'button', iconCls: 'grid-clear', listeners:{ click:function(button, event){ //console.log('clear') Ext.Ajax.request({ url: './data/dosList.json?option=clear', method: 'POST', params:{ others: 'clear' }, success: function(response) { smb.user.timeout.call(this, response, response); var data = Ext.JSON.decode(response.responseText); if(data.success){ Ext.getStore('dosHostList').loadData(data.data.dosList); } else{ Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode['e'+data.errCode]); } }, failure: function(){ Ext.Msg.alert(smb.charset.label.failure, smb.charset.errCode.eDefault); } }) } } }, { text: smb.charset.tbar.unlock, xtype: 'button', id: 'dosListUnlock', iconCls: 'grid-unlock', disabled:true, // type: 'btnDelete' listeners:{ click:function(button, event){ var grid = Ext.getCmp('dosListGrid'); var store = Ext.getStore('dosHostList'); var records = grid.getSelectionModel().getSelection(); store.remove(records); store.sync({ success: function(optional,a,b,c){ store.reload(); // var s = setTimeout(resetApplyChanges, 1000); }, failure: function(optional){ var data = optional.proxy.reader.rawData; store.rejectChanges(); var ret = smb.user.timeout.call(this, data, data, 1); } }); } } } ], listeners:{ selectionchange:function( sltMode, selected, eOpts) { var view = sltMode.view; var grid = view.ownerCt; var length = selected.length; if(length == 0) { Ext.getCmp('dosListUnlock').disable(); } else { Ext.getCmp('dosListUnlock').enable(); } } } } ], listeners:{ close:function(){ smb.user.bodyMask.hide(); smb.user.bodyMask2.hide(); } } }) Ext.define('smb.model.dosHostList', { extend: 'Ext.data.Model', fields: [ {name:'hostIp', type:'string'}, {name:'hostMac', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.dosHostList', { extend: 'Ext.data.Store', model: 'smb.model.dosHostList', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.dosList' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/dosList.json?option=add&table=vs&mode=' + smb.mode.status, read : './data/dosList.json?option=get&table=vs&mode=' + smb.mode.status, update: './data/dosList.json?option=edit&table=vs&mode=' + smb.mode.status, destroy: './data/dosList.json?option=delete&table=vs&mode=' + smb.mode.status } } }); Ext.define('smb.model.upnp', { extend: 'Ext.data.Model', fields: [ {name:'appDescription', type:'string'}, {name:'externalPort', type:'int'}, {name:'internalPort', type:'int'}, {name:'protocol', type:'int'}, {name:'ipAddress', type:'string'}, {name:'status', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.upnp', { extend: 'Ext.data.Store', model: 'smb.model.upnp', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.upnp' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/nat.json?option=add&mode=' + smb.mode.status, read : './data/nat.json?option=get&mode=' + smb.mode.status, update: './data/nat.json?option=edit&mode=' + smb.mode.status, destroy: './data/nat.json?option=delete&mode=' + smb.mode.status } } }); Ext.define('smb.model.virtualServer', { extend: 'Ext.data.Model', fields: [ {name:'enable', type:'boolean'}, {name:'ip', type:'string'}, {name:'inrport', type:'string'}, {name:'svrport', type:'string'}, {name:'protocol', type:'int'} // {name:'comment', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.virtualServer', { extend: 'Ext.data.Store', model: 'smb.model.virtualServer', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.virtualServerGrid' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/nat.json?option=add&table=vs&mode=' + smb.mode.status, read : './data/nat.json?option=get&table=vs&mode=' + smb.mode.status, update: './data/nat.json?option=edit&table=vs&mode=' + smb.mode.status, destroy: './data/nat.json?option=delete&table=vs&mode=' + smb.mode.status } } }); Ext.define('smb.model.portTrigger', { extend: 'Ext.data.Model', fields: [ {name:'enable', type:'boolean'}, {name:'incomingPort', type:'string'}, {name:'triggerPort', type:'string'}, {name:'protocol', type:'int'} // {name:'comment', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.portTrigger', { extend: 'Ext.data.Store', model: 'smb.model.portTrigger', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.portTriggerGrid' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/nat.json?option=add&table=pt&mode=' + smb.mode.status, read : './data/nat.json?option=get&table=pt&mode=' + smb.mode.status, update: './data/nat.json?option=edit&table=pt&mode=' + smb.mode.status, destroy: './data/nat.json?option=delete&table=pt&mode=' + smb.mode.status } } }); Ext.define('smb.model.accessControlGrid', { extend: 'Ext.data.Model', fields: [ {name:'enable', type:'boolean'}, // {name:'policy', type:'int'}, {name:'protocol', type:'int'}, {name:'hostIp', type:'string'}, {name:'targetIp', type:'string'}, {name:'targetPort', type:'string'}, {name:'scheduleDay', type:'string'}, {name:'time', type:'string'} // {name:'comment', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.accessControlGrid', { extend: 'Ext.data.Store', model: 'smb.model.accessControlGrid', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.accessControlGrid' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/accessControl.json?option=add&mode=' + smb.mode.status, read : './data/accessControl.json?option=get&mode=' + smb.mode.status, update: './data/accessControl.json?option=edit&mode=' + smb.mode.status, destroy: './data/accessControl.json?option=delete&mode=' + smb.mode.status } } }); Ext.define('smb.model.staticRouting', { extend: 'Ext.data.Model', fields: [ {name:'enable', type:'boolean'}, {name:'targetNetworkIp', type:'string'}, {name:'netmask', type:'string'}, {name:'gatewayIp', type:'string'} // {name:'comment', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.staticRouting', { extend: 'Ext.data.Store', model: 'smb.model.staticRouting', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.staticRoutingGrid' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/staticRouting.json?option=add&mode=' + smb.mode.status, read : './data/staticRouting.json?option=get&mode=' + smb.mode.status, update: './data/staticRouting.json?option=edit&mode=' + smb.mode.status, destroy: './data/staticRouting.json?option=delete&mode=' + smb.mode.status } } }); Ext.define('smb.model.bandWidthControl', { extend: 'Ext.data.Model', fields: [ {name:'enable', type:'boolean'}, {name:'ipRange', type:'string'}, {name:'portRange', type:'string'}, {name:'protocol', type:'int'}, {name:'ingressMin', type:'string'}, {name:'ingressMax', type:'string'}, {name:'egressMin', type:'string'}, {name:'egressMax', type:'string'} // {name:'comment', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.bandWidthControl', { extend: 'Ext.data.Store', model: 'smb.model.bandWidthControl', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.bandWidthControlGrid' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/bandWidthControl.json?option=add&mode=' + smb.mode.status, read : './data/bandWidthControl.json?option=get&mode=' + smb.mode.status, update: './data/bandWidthControl.json?option=edit&mode=' + smb.mode.status, destroy: './data/bandWidthControl.json?option=delete&mode=' + smb.mode.status } } }); Ext.define('smb.model.addressReservationGrid', { extend: 'Ext.data.Model', fields: [ {name:'enable', type:'boolean'}, {name:'mac', type:'string'}, {name:'ip', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.addressReservationGrid', { extend: 'Ext.data.Store', model: 'smb.model.addressReservationGrid', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.addressReservationGrid' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/addressReservationGrid.json?option=add&mode=' + smb.mode.status, read : './data/addressReservationGrid.json?option=get&mode=' + smb.mode.status, update: './data/addressReservationGrid.json?option=edit&mode=' + smb.mode.status, destroy: './data/addressReservationGrid.json?option=delete&mode=' + smb.mode.status } } }); Ext.define('smb.model.ipMacBinding', { extend: 'Ext.data.Model', fields: [ {name:'enable', type:'boolean'}, {name:'ip', type:'string'}, {name:'mac', type:'string'} // {name:'comment', type:'string'} ], idProperty: 'key' }); Ext.define('smb.store.ipMacBinding', { extend: 'Ext.data.Store', model: 'smb.model.ipMacBinding', proxy: { type: 'ajax', reader: { type: 'json', root: 'data.ipMacBindingGrid' }, writer: { type: 'json', writeAllFields: false }, api: { create: './data/ipMacBinding.json?option=add&mode=' + smb.mode.status, read : './data/ipMacBinding.json?option=get&mode=' + smb.mode.status, update: './data/ipMacBinding.json?option=edit&mode=' + smb.mode.status, destroy: './data/ipMacBinding.json?option=delete&mode=' + smb.mode.status } }, listeners: { refresh:function(store,event) { } } }); // 定义combobox中只有true和false的store Ext.define('smb.store.trueFalse',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'string'}, {name:'display', type:'string'} ], data: [ {name:'1', display:smb.charset.comboBox["true"]}, {name:'0', display:smb.charset.comboBox["false"]} ] }) Ext.define('smb.store.policy',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'int'}, {name:'display', type:'string'} ], data: [ {name:0, display:smb.charset.comboBox.deny}, {name:1, display:smb.charset.comboBox.allow} ] }) Ext.define('smb.store.natProtocol',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'int'}, {name:'display', type:'string'} ], data: [ {name:0, display:smb.charset.comboBox.all}, {name:1, display:smb.charset.comboBox.tcp}, {name:2, display:smb.charset.comboBox.udp} ] }) Ext.define('smb.store.protocol',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'int'}, {name:'display', type:'string'} ], data: [ {name:0, display:smb.charset.comboBox.ip}, {name:1, display:smb.charset.comboBox.tcp}, {name:2, display:smb.charset.comboBox.udp}, {name:3, display:smb.charset.comboBox.icmp} ] }) Ext.define('smb.store.packetsInterval',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'int'}, {name:'display', type:'int'} ], data: [ {name:5, display:5}, {name:10, display:10}, {name:15, display:15}, {name:20, display:20}, {name:25, display:25}, {name:30, display:30}, {name:35, display:35}, {name:40, display:40}, {name:45, display:45}, {name:50, display:50}, {name:55, display:55}, {name:60, display:60} ] }) Ext.define('smb.store.weekdays',{ extend: 'Ext.data.Store', fields: [ {name:'name', type:'string'}, {name:'display', type:'string'} ], data: [ // {name:0, display:smb.charset.comboBox.sun}, // {name:1, display:smb.charset.comboBox.mon}, {name:'Sun', display:smb.charset.comboBox.sun}, {name:'Mon', display:smb.charset.comboBox.mon}, {name:'Tue', display:smb.charset.comboBox.tue}, {name:'Wed', display:smb.charset.comboBox.wed}, {name:'Thu', display:smb.charset.comboBox.thu}, {name:'Fri', display:smb.charset.comboBox.fri}, {name:'Sat', display:smb.charset.comboBox.sat} ] }) Ext.define('smb.view.nat',{ extend: 'smb.view.module', alias: 'widget.nat', id: 'nat', type: 'advancedSettings', // hidden: true, model: 'nat', url: './data/nat.json', title: smb.charset.module.forwarding, collapsed: true, grid: { 'upnp': 'upnp', 'virtualServer': 'virtualServerGrid', 'portTrigger': 'portTriggerGrid' }, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'fieldcontainer', layout: 'hbox', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'checkboxgroup', id: 'nat_dmz_id', width: 345, columns: 1, fieldLabel: smb.charset.label.dmz, items: [ {name:'enableDmz', id:'enableDmz', inputWidth:13, boxLabel: smb.charset.label.enable, checked: false} ] }, { xtype: 'helpIcon', id: 'dmzHelp', listeners:{ afterrender:function(button, event){ var tip = Ext.create('Ext.tip.ToolTip', { target: 'dmzHelp', maxWidth: 500, dismissDelay: 0, html: smb.charset.help.dmz }); } } } ] }, { xtype: 'textfield', fieldLabel: smb.charset.label.dmzIp, labelPad: 9, id: 'dmzIp', name: 'dmzIp', hidden: true, disabled: true, vtype: 'ip' }, { xtype: 'fieldcontainer', layout: 'hbox', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'checkboxgroup', columns: 4, width: 660, fieldLabel: smb.charset.label.alg, items: [ {name:'ftpAlg', boxLabel: smb.charset.label.ftpAlg, inputValue:1}, {name:'tftpAlg', boxLabel: smb.charset.label.tftpAlg, inputValue:2}, {name:'h323Alg', boxLabel: smb.charset.label.h323Alg, inputValue:3}, {name:'rtspAlg', boxLabel: smb.charset.label.rtspAlg, inputValue:4} ] }, { xtype: 'helpIcon', id: 'algHelp', listeners:{ afterrender:function(button, event){ var tip = Ext.create('Ext.tip.ToolTip', { target: 'algHelp', maxWidth: 500, dismissDelay: 0, html: smb.charset.help.alg }); } } } ] }, { xtype: 'fieldcontainer', layout: 'hbox', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'checkbox', name:'enableVirtualServer', id: 'nat_vs_id', inputWidth: 13, labelPad: 9, width: 345, fieldLabel: smb.charset.label.virtualSvr, boxLabel: smb.charset.label.enable, checked: false, listeners:{ change:function(item, newValue, oldValue) { if( newValue ) { Ext.getCmp('virtualGrid').show(); } else { Ext.getCmp('virtualGrid').hide(); } } } }, { xtype: 'helpIcon', id: 'virtualServerHelp', listeners:{ afterrender:function(button, event){ var tip = Ext.create('Ext.tip.ToolTip', { target: 'virtualServerHelp', maxWidth: 500, dismissDelay: 0, html: smb.charset.help.virtualServer }); } } } ] }, { xtype: 'smbGrid', id: 'virtualGrid', store: 'virtualServer', hidden: true, columns: [ { text: smb.charset.column.enable, hideable: false, dataIndex: 'enable', width: 80, align: 'center', editor: { xtype: 'checkbox' }, defaultValue: true, renderer: function(value) { if(value == true) { return ''; } else if(value == false) { return ''; } } }, { text: smb.charset.column.ip, hideable: false, dataIndex: 'ip', flex: 1, editor: { xtype: 'textfield', allowblank: false, vtype: 'ip' } }, { text: smb.charset.column.internalPort, hideable: false, dataIndex: 'inrport', flex: 1, renderer: function(value, metaData, record) { if (value=="") { return record.data.svrport; } else { return value; } }, editor: { xtype: 'numberfield', allowBlank: true, decimalPrecision:0, minValue: 1, maxValue: 65535 } }, { text: smb.charset.column.servicePort, hideable: false, dataIndex: 'svrport', flex: 1, editor: { xtype: 'textfield', allowblank: false, validator: function(value) { if(value) { var list = value.split('-'); if(list.length == 1) { var portStart = list[0]; if(Number(portStart)<1) { return smb.charset.validation.portStartErr; } if(Number(portStart)>65535) { return smb.charset.validation.portEndErr; } return smb.verify.integer(portStart) } else if(list.length == 2) { var portStart = list[0]; var portEnd = list[1]; if( smb.verify.integer(portStart) && smb.verify.integer(portEnd) ) { if(Number(portStart)65535) { return smb.charset.validation.portEndErr; } return true; } else { return smb.charset.validation.portRangeErr; } } else { return smb.charset.validation.portRangeFormat; } } else { return smb.charset.validation.portRangeInvalid; } } else { return true; } } } }, { text: smb.charset.column.protocol, hideable: false, dataIndex: 'protocol', flex: 1, editor: { xtype: 'combobox', editable: false, store: 'natProtocol', displayField: 'display', valueField: 'name' }, defaultValue: 0, renderer: function(value) { switch(value) { case 0: return smb.charset.comboBox.all; case 1: return smb.charset.comboBox.tcp; case 2: return smb.charset.comboBox.udp; } } } /* { text: smb.charset.column.comment, hideable: false, dataIndex: 'comment', flex: 1, editor: { xtype: 'textfield', allowBlank: true, maxLength: 31 } } */ ] }, { xtype: 'checkbox', name:'enablePortTrigger', id: 'nat_pt_id', inputWidth: 13, labelPad: 9, width: 345, fieldLabel: smb.charset.label.portTrigger, boxLabel: smb.charset.label.enable, checked: false, listeners:{ change:function(item, newValue, oldValue) { if( newValue ) { Ext.getCmp('portGrid').show(); } else { Ext.getCmp('portGrid').hide(); } } } }, { xtype: 'smbGrid', id: 'portGrid', store: 'portTrigger', hidden: true, columns: [ { text: smb.charset.column.enable, hideable: false, dataIndex: 'enable', width: 80, align: 'center', editor: { xtype: 'checkbox' }, defaultValue: true, renderer: function(value) { if(value == true) { return ''; } else if(value == false) { return ''; } } }, { text: smb.charset.column.incomingPort, hideable: false, dataIndex: 'incomingPort', flex: 1, editor: { xtype: 'textfield', allowblank: false, validator: function(value) { var list = value.split(','); for(var i=0; i5) { return smb.charset.validation.portNum; } for(var m=0; m 2 ) { return smb.charset.validation.portRangeFormat; } for ( var i = 0 ; i < len ; i++ ) { if( !pattern_port.test(sub_array[i]) ){ return smb.charset.validation.invalidPortRange; } if(sub_array[i].length == 0 || ( parseInt(sub_array[i]) < 1 || parseInt(sub_array[i]) > 65535 )) { return smb.charset.validation.portRangeOut; } } } return true; } } }, { text: smb.charset.column.triggerPort, hideable: false, dataIndex: 'triggerPort', flex: 1, editor: { xtype: 'numberfield', allowblank: false, decimalPrecision:0, minValue: 1, maxValue: 65535 } }, { text: smb.charset.column.protocol, hideable: false, dataIndex: 'protocol', flex: 1, editor: { xtype: 'combobox', editable: false, store: 'natProtocol', displayField: 'display', valueField: 'name' }, defaultValue: 0, renderer: function(value) { switch(value) { case 0: return smb.charset.comboBox.all; case 1: return smb.charset.comboBox.tcp; case 2: return smb.charset.comboBox.udp; } } } /* { text: smb.charset.column.comment, hideable: false, dataIndex: 'comment', editor: { xtype: 'textfield', allowBlank: true, maxLength: 31 } } */ ] }, { xtype: 'fieldcontainer', layout: 'hbox', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'checkbox', id: 'nat_upnp_id', name:'enableUpnp', inputWidth: 13, labelPad: 9, width: 345, fieldLabel: smb.charset.label.upnp, boxLabel: smb.charset.label.enable, checked: false, listeners:{ change:function(item, newValue, oldValue) { if( newValue ) { Ext.getCmp('upnpGrid').show(); } else { Ext.getCmp('upnpGrid').hide(); } } } }, { xtype: 'helpIcon', id: 'upnpHelp', listeners:{ afterrender:function(button, event){ var tip = Ext.create('Ext.tip.ToolTip', { target: 'upnpHelp', maxWidth: 500, dismissDelay: 0, html: smb.charset.help.upnp }); } } } ] }, { xtype: 'grid', id: 'upnpGrid', store: 'upnp', hidden: true, columns: [ { text: smb.charset.column.appDescription, hideable: false, dataIndex: 'appDescription', flex: 1 }, { text: smb.charset.column.externalPort, hideable: false, dataIndex: 'externalPort', flex: 1 }, { text: smb.charset.column.internalPort, hideable: false, dataIndex: 'internalPort', flex: 1 }, { text: smb.charset.column.protocol, hideable: false, dataIndex: 'protocol', flex: 1, renderer: function(value) { switch(value) { case 0: return smb.charset.comboBox.all; case 1: return smb.charset.comboBox.tcp; case 2: return smb.charset.comboBox.udp; } } }, { text: smb.charset.column.ipAddr, hideable: false, dataIndex: 'ipAddress', flex: 1 }, { text: smb.charset.column.status, hideable: false, dataIndex: 'status', flex: 1, renderer: function(value) { if (-1 != value.indexOf("Enabled")) {return smb.charset.label.enabled;} else if (-1 != value.indexOf("Disabled")) {return smb.charset.label.disabled;} else {return value;} } } ], tbar: [ { xtype: 'button', text: smb.charset.tbar.refresh, iconCls: 'grid-refresh', // type: 'btnAdd', listeners:{ click:function(item, event) { Ext.Ajax.request({ url: './data/nat.json?table=upnp&refresh=true', params: { refresh: true }, success: function(response) { smb.user.timeout.call(this, response, response); var respObj = Ext.JSON.decode(response.responseText); var store = Ext.getStore('upnp'); if(respObj.success) { store.loadData(respObj.data.upnp); } } }); } } } ], listeners:{ show: function(item, eOpts) { Ext.Ajax.request({ url: './data/nat.json?table=upnp&refresh=true', params: { refresh: true }, success: function(response) { smb.user.timeout.call(this, response, response); var respObj = Ext.JSON.decode(response.responseText); var store = Ext.getStore('upnp'); if(respObj.success) { store.loadData(respObj.data.upnp); } } }); }, hide: function(item, eOpts) { Ext.getStore('upnp').loadData([]); } } } ], initComponent: function(){ this.callParent(arguments); } }); Ext.define('smb.view.lan',{ extend: 'smb.view.module', model: 'lan', id: 'lan', alias: 'widget.lan', url: './data/lan.json', title: smb.charset.module.lan, grid: { 'addressReservationGrid':'addressReservationGrid' }, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, //icon:'../extjs/resources/themes/images/default/icons/accept.gif', /*tools:[{ type:'refresh', tooltip: 'Refresh', handler: function(event, toolEl, panel){ this.ownerCt.ownerCt.getForm().load(); } }, { type:'help', tooltip: smb.charset.tip.help, handler: function(event, toolEl, panel){ Ext.create('Ext.window.Window', { title: 'Help', height: 200, width: 400, layout: 'fit', html: "

just for test

" }).show(); } }], url: './data/lan.json', method: 'get', reader: { type: 'json', root: 'data' }, */ items: [ { xtype: 'combobox', changeEnable:true, fieldLabel: smb.charset.label.connType, id: 'lanChkConnectionType', editable: false, queryMode: 'local', name: 'connType', store: Ext.create('Ext.data.Store',{ fields: ['name', 'value'], data: [ {value: 'static', name: smb.charset.comboBox.staticConn}, {value: 'dynamic', name: smb.charset.comboBox.dynamic} ] }), value: 'dynamic', displayField: 'name', valueField: 'value' }, { xtype: 'detailSettings', id: 'staticLanDetailSetting', hidden: true, disabled: true, type: 'lanConnectionType', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'textfield', id:'lanStaticIp', value: '0.0.0.0', fieldLabel:smb.charset.label.ipAddress, name: 'ipAddress', vtype: 'ip' }, { xtype: 'textfield', id:'lanStaticMask', value: '0.0.0.0', fieldLabel:smb.charset.label.netmask, vtype:'mask', name:'netMask' }, { xtype: 'textfield', id:'lanStaticGateway', vtype: 'ip', value: '0.0.0.0', changeEnable: true, fieldLabel: smb.charset.label.gateway, allowAllZero:true, allowBlank: true, name: 'gateway' } ] }, { xtype: 'detailSettings', id: 'dynamicLanDetailSetting', type: 'lanConnectionType', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'checkbox', fieldLabel: smb.charset.label.fallbackIp, boxLabel: smb.charset.label.enable, inputWidth: 13, id: 'isUseFallback', name: 'isUseFallback', checked: true }, { xtype: 'textfield', fieldLabel: smb.charset.label.dhcpFallBackIp, id: 'fallbackIp', name: 'fallbackIp', vtype: 'ip' }, { xtype: 'textfield', fieldLabel: smb.charset.label.dhcpFallBackMask, id: 'fallbackMask', name: 'fallbackMask', vtype: 'mask' } ] }, { xtype: 'checkbox', id:'igmpProxy', labelAlign: 'right', inputWidth: 13, fieldLabel: smb.charset.label.igmpProxy, boxLabel: smb.charset.label.enable, name:'igmpProxy' }, { xtype: 'checkbox', id:'lanDhcpServer', labelAlign: 'right', disabled: true, hidden: true, inputWidth: 13, fieldLabel: smb.charset.label.dhcpServer, boxLabel: smb.charset.label.enable, name:'dhcpServer', checked: false }, { xtype: 'smbAdvancedSettings', id: 'dhcpAdvSetting', disabled: true, hidden: true, title: smb.charset.label.dhcpServer, // expandItem: 'advancedSettings', collapsible: true, width: 'auto', items: [ { xtype: 'fieldcontainer', layout: { type: 'hbox' }, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ {xtype: 'textfield', changeEnable:true, vtype: 'ip', id: 'lanStartIpAddress', fieldLabel: smb.charset.label.startIpAddress, name:'startIpAddress'}, {xtype: 'textfield', changeEnable:true, vtype: 'ip', id: 'lanEndIpAddress', endFlag: true, fieldLabel: smb.charset.label.endIpAddress, name: 'endIpAddress', labelWidth: 120} ] }, { xtype: 'fieldcontainer', layout: { type: 'hbox' }, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ {xtype: 'textfield', changeEnable:true, vtype: 'ip', allowBlank: true, allowAllZero:true, id:'lanDefaultGateway', fieldLabel: smb.charset.label.defaultGateway, name: 'defaultGateway'}, {xtype: 'textfield', changeEnable:true, vtype:'domain', allowBlank: true, id:'lanDefaultDomain', fieldLabel: smb.charset.label.defaultDomain, name: 'defaultDomain', labelWidth: 120, maxLength: 30, enforceMaxLength: true} ] }, { xtype: 'fieldcontainer', layout: { type: 'hbox' }, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ {xtype: 'textfield', changeEnable:true, vtype: 'ip', allowAllZero:true, allowBlank: true, id:'lanPrimaryDns', fieldLabel: smb.charset.label.primaryDns, name: 'primaryDns'}, {xtype: 'textfield', changeEnable:true, vtype: 'ip', allowAllZero:true, allowBlank: true, id:'lanSecondaryDns', fieldLabel: smb.charset.label.secondaryDns, name: 'secondaryDns', labelWidth: 120} ] }, { xtype: 'fieldcontainer', layout: { type: 'hbox' }, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ {xtype: 'numberfield', changeEnable:true, fieldLabel:smb.charset.label.dhcpLeaseTime, id:'lanDhcpLeaseTime', decimalPrecision:0, minValue:1, maxValue:2880, name: 'dhcpLeaseTime', labelAlign: 'right'}, {xtype:'displayfield', hideLabel:true, id:'dhcpMinutes', value:smb.charset.label.minutes, disabledCls:'disabledLabel', margin:'3 0 0 5'} ] }, { xtype: 'fieldset', title: smb.charset.label.addrReservation, border: '1 0 0 0', padding: 5, items:[ { xtype: 'smbGrid', store: 'addressReservationGrid', id: 'addressReservationGrid', selModel: false, columns: [ { text: smb.charset.column.enable, hideable: false, dataIndex: 'enable', width: 80, align: 'center', editor: { xtype: 'checkbox' }, defaultValue: true, renderer: function(value) { if(value == true) { return ''; } else if(value == false) { return ''; } } }, { text: smb.charset.column.macAddr, hideable: false, dataIndex:'mac', flex:1, editor: { xtype: 'textfield', allowBlank: false, vtype: 'mac' } }, { text: smb.charset.column.reservedIpAddr, hideable: false, dataIndex:'ip', flex:1, editor: { xtype: 'textfield', allowBlank: false, vtype: 'ip' } } ] } ] } ] } ], buttons: [ { xtype: 'button', id: 'lanSubmit', hidden:false, elemType:'saveBtn', text: smb.charset.button.submit } ], initComponent: function(){ this.callParent(arguments); if( smb.mode.status == 'apRouter' || smb.mode.status == 'apClientRouter' ) { Ext.getCmp('lanChkConnectionType').setReadOnly(true); Ext.getCmp('lanStaticGateway').hide(); //Ext.getCmp('igmpProxy').show(); } } }); Ext.define('smb.model.lan',{ extend: 'Ext.data.Model', fields: [ {mapping: 'connType', name:'connType', type: 'string'}, {mapping: 'isUseFallback', name:'isUseFallback', type: 'boolean'}, {mapping: 'fallbackIp', name:'fallbackIp', type: 'string'}, {mapping: 'fallbackMask', name:'fallbackMask', type: 'string'}, {mapping: 'ipAddress', name:'ipAddress', type: 'string'}, {mapping: 'netMask', name: 'netMask', type: 'string'}, {mapping: 'gateway', name: 'gateway', type: 'string'}, {mapping: 'igmpProxy', name: 'igmpProxy', type: 'boolean'}, {mapping: 'dhcpServer', name: 'dhcpServer', type: 'boolean'}, {mapping: 'startIpAddress', name: 'startIpAddress', type: 'string'}, {mapping: 'endIpAddress', name: 'endIpAddress', type: 'string'}, // {mapping: 'subnetMask', name: 'subnetMask', type: 'auto'}, {mapping: 'defaultGateway', name: 'defaultGateway', type: 'auto'}, {mapping: 'defaultDomain', name: 'defaultDomain', type: 'auto'}, {mapping: 'primaryDns', name: 'primaryDns', type: 'auto'}, {mapping: 'secondaryDns', name: 'secondaryDns', type: 'auto'}, {mapping: 'dhcpLeaseTime', name: 'dhcpLeaseTime', type: 'string'} ], proxy: { type: 'ajax', url: './data/lan.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.model.wan',{ extend: 'Ext.data.Model', fields: [ {mapping: 'pcMac', name: 'pcMac', type: 'string'}, {mapping: 'factoryMac', name: 'factoryMac', type: 'string'}, {mapping: 'connType', name: 'connType', type: 'string'}, {mapping: 'staticIp', name: 'staticIp', type: 'string'}, {mapping: 'staticMask', name: 'staticMask', type: 'string'}, {mapping: 'staticGateway', name: 'staticGateway', type: 'string'}, {mapping: 'staticDns1', name: 'staticDns1', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'staticDns2', name: 'staticDns2', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'l2tpServerIp', name: 'l2tpServerIp', type: 'string'}, {mapping: 'l2tpUserName', name: 'l2tpUsername', type: 'string'}, {mapping: 'l2tpPassword', name: 'l2tpPassword', type: 'string'}, {mapping: 'l2tpConnMode', name: 'l2tpConnMode', type: 'string'}, {mapping: 'l2tpIdleTime', name: 'l2tpIdleTime', type: 'int'}, {mapping: 'pptpServerIp', name: 'pptpServerIp', type: 'string'}, {mapping: 'pptpUserName', name: 'pptpUsername', type: 'string'}, {mapping: 'pptpPassword', name: 'pptpPassword', type: 'string'}, {mapping: 'pptpConnMode', name: 'pptpConnMode', type: 'string'}, {mapping: 'pptpIdleTime', name: 'pptpIdleTime', type: 'int'}, {mapping: 'pppoeUserName', name: 'pppoeUsername', type: 'string'}, {mapping: 'pppoePassword', name: 'pppoePassword', type: 'string'}, {mapping: 'pppoeConnMode', name: 'pppoeConnMode', type: 'string'}, {mapping: 'pppoeFromHhMm', name: 'pppoeFromHhMm', type: 'string'}, {mapping: 'pppoeToHhMm', name: 'pppoeToHhMm', type: 'string'}, {mapping: 'pppoeIdleTime', name: 'pppoeIdleTime', type: 'int'}, {mapping: 'l2tpConnectionType', name: 'l2tpConnectionType', type: 'string'}, {mapping: 'l2tpConnStaticIp', name: 'l2tpConnStaticIp', type: 'string'}, {mapping: 'l2tpConnStaticMask', name: 'l2tpConnStaticMask', type: 'string'}, {mapping: 'l2tpConnStaticGateway', name: 'l2tpConnStaticGateway', type: 'string'}, {mapping: 'l2tpConnStaticDns1', name: 'l2tpConnStaticDns1', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'pptpConnectionType', name: 'pptpConnectionType', type: 'string'}, {mapping: 'pptpConnStaticIp', name: 'pptpConnStaticIp', type: 'string'}, {mapping: 'pptpConnStaticMask', name: 'pptpConnStaticMask', type: 'string'}, {mapping: 'pptpConnStaticGateway', name: 'pptpConnStaticGateway', type: 'string'}, {mapping: 'pptpConnStaticDns1', name: 'pptpConnStaticDns1', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'dynamicUserDnsServer', name: 'dynamicUserDnsServer', type: 'auto'}, {mapping: 'dynamicDns1', name: 'dynamicDns1', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'dynamicDns2', name: 'dynamicDns2', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'staticMtuSize', name: 'staticMtuSize', type: 'auto', defaultValue:1500}, {mapping: 'dynamicMtuSize', name: 'dynamicMtuSize', type: 'auto', defaultValue:1480}, {mapping: 'l2tpMtuSize', name: 'l2tpMtuSize', type: 'auto', defaultValue:1460}, {mapping: 'pptpMtuSize', name: 'pptpMtuSize', type: 'auto', defaultValue:1420}, {mapping: 'pppoeMtuSize', name: 'pppoeMtuSize', type: 'auto', defaultValue:1480}, {mapping: 'pppoeServiceName', name: 'pppoeServiceName', type: 'string'}, {mapping: 'pppoeAcName', name: 'pppoeAcName', type: 'string'}, {mapping: 'pppoeDetectInterval', name: 'pppoeDetectInterval', type: 'auto'}, {mapping: 'pppoeUserIspIp', name: 'pppoeUserIspIp', type: 'auto'}, {mapping: 'pppoeIspIp', name: 'pppoeIspIp', type: 'string'}, {mapping: 'pppoeUserDnsServer', name: 'pppoeUserDnsServer', type: 'auto'}, {mapping: 'pppoeDns1', name: 'pppoeDns1', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'pppoeDns2', name: 'pppoeDns2', type: 'string', defaultValue:'0.0.0.0'}, {mapping: 'pppoeConnectionType', name: 'pppoeConnectionType', type: 'string'}, {mapping: 'pppoeConnStaticIp', name: 'pppoeConnStaticIp', type: 'string'}, {mapping: 'pppoeConnStaticMask', name: 'pppoeConnStaticMask', type: 'string'}, {mapping: 'mac', name: 'macCloneValue', type: 'string'} ], proxy: { type: 'ajax', url: './data/wan.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.view.wan', { extend: 'smb.view.module', model: 'wan', id: 'wan', alias: 'widget.wan', title: smb.charset.module.wan, model: 'wan', // queryMode: 'local', // autoLoad: true, url: './data/wan.json', items: [ { xtype: 'container', layout: 'hbox', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'combobox', fieldLabel: smb.charset.label.wanConnectionType, id: 'chkConnectionType', margin: '0 0 5 0', editable: false, labelAlign: 'right', queryMode: 'local', name: 'connType', store: Ext.create('Ext.data.Store', { fields: ['name', 'value'], data: [{ value: 'static', name: smb.charset.comboBox.staticConn }, { value: 'dynamic', name: smb.charset.comboBox.dynamic }, { value: 'pppoe', name: smb.charset.comboBox.pppoe }, { value: 'l2tp', name: smb.charset.comboBox.l2tp }, { value: 'pptp', name: smb.charset.comboBox.pptp }] }), displayField: 'name', valueField: 'value', value: '' }, { xtype: 'smbButton', id: 'wanConn', text: smb.charset.button.connect, hidden: true, margin: '0 5 0 5' }, { xtype: 'smbButton', id: 'wanDisconn', hidden: true, text: smb.charset.button.disconnect }] }, { xtype: 'detailSettings', id: 'staticDetailSetting', type: 'wanConnectionType', hidden: true, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [{ xtype: 'textfield', vtype: 'ip', fieldLabel: smb.charset.label.ipAddress, changeEnable: true, name: 'staticIp' }, { xtype: 'textfield', vtype: 'mask', fieldLabel: smb.charset.label.netmask, changeEnable: true, name: 'staticMask' }, { xtype: 'textfield', vtype: 'ip', changeEnable: true, fieldLabel: smb.charset.label.gateway, name: 'staticGateway' }, { xtype: 'textfield', vtype: 'ip', value: '0.0.0.0', changeEnable: true, fieldLabel: smb.charset.label.priDns, // allowBlank: true, // allowAllZero: true, name: 'staticDns1' }, { xtype: 'textfield', vtype: 'ip', value: '0.0.0.0', changeEnable: true, fieldLabel: smb.charset.label.secDns, allowBlank: true, allowAllZero: true, name: 'staticDns2' }] }, { xtype: 'detailSettings', id: 'l2tpDetailSetting', type: 'wanConnectionType', hidden: true, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'textfield', changeEnable: true, fieldLabel: smb.charset.label.serverIpName, maxLength: 63, enforceMaxLength: true, name: 'l2tpServerIp', validator: function(value) { if ( smb.verify.ip(value)!=true && smb.verify.domain(value)!=true ) { return smb.charset.validation.invalidIpOrDomain; } else { return true; } } }, { xtype: 'textfield', vtype: 'username', changeEnable: true, fieldLabel: smb.charset.label.username, maxLength: 119, enforceMaxLength: true, allowBlank: true, name: 'l2tpUsername' }, { xtype: 'fieldcontainer', layout: 'column', defaults:{ labelWidth: 275, inputWidth: 160 }, items:[ { xtype: 'textfield', fieldLabel: smb.charset.label.password, id: 'l2tpPwd', name: 'l2tpPassword', changeEnable: true, inputType: 'password', maxLength: 119, enforceMaxLength: true, allowBlank: true, vtype: 'wanPwd', changeFlag: true, listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('l2tpPwdText').changeFlag = false; if(item.changeFlag) { Ext.getCmp('l2tpPwdText').setValue(newValue); } Ext.getCmp('l2tpPwdText').changeFlag = true; } } }, { xtype: 'textfield', id: 'l2tpPwdText', submitValue: false, hidden: true, fieldLabel: smb.charset.label.password, vtype: 'wanPwd', maxLength: 119, enforceMaxLength: true, allowBlank: true, changeFlag: true, listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('l2tpPwd').changeFlag = false; if(item.changeFlag) { Ext.getCmp('l2tpPwd').setValue(newValue); } Ext.getCmp('l2tpPwd').changeFlag = true; } } }, { xtype: 'checkbox', id: 'showL2tpPwd', margin: '2 0 0 5', inputWidth: 13, boxLabel: smb.charset.label.show, hideLabel: true } ] }, { xtype: 'combobox', fieldLabel: smb.charset.label.connectionMode, name: 'l2tpConnMode', editable: false, queryMode: 'local', value: 'automatic', store: Ext.create('Ext.data.Store',{ fields: ['value', 'display'], data: [ {value:'onDemand', display:smb.charset.label.onDemand}, {value:'automatic', display:smb.charset.label.automatic}, {value:'manual', display:smb.charset.label.manual} ] }), displayField: 'display', valueField: 'value', listeners:{ change:function( item, newValue, oldValue){ Ext.getCmp('l2tpManualIdleTime').clearInvalid(); Ext.getCmp('l2tpManualIdleTime').disable(); Ext.getCmp('l2tpManualIdle').hide(); Ext.getCmp('l2tpDemandIdleTime').clearInvalid(); Ext.getCmp('l2tpDemandIdleTime').clearInvalid(); Ext.getCmp('l2tpDemandIdleTime').disable(); Ext.getCmp('l2tpDemandIdle').hide(); if( newValue=='manual') { Ext.getCmp('l2tpManualIdleTime').enable(); Ext.getCmp('l2tpManualIdle').show(); } else if( newValue=='onDemand') { Ext.getCmp('l2tpDemandIdleTime').enable(); Ext.getCmp('l2tpDemandIdle').show(); } } } }, /* { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.connectionMode, name: 'connMode', defaultType: 'radiofield', layout: { type: 'hbox' }, width: 700, items:[ { xtype: 'radiofield', changeEnable: true, inputValue: 'onDemand', width: 100, boxLabel: smb.charset.label.onDemand, name: 'l2tpConnMode', id: 'l2tpDemand' }, { xtype: 'radiofield', changeEnable: true, inputValue: 'automatic', width: 100, boxLabel: smb.charset.label.automatic, name: 'l2tpConnMode', checked: true }, { xtype: 'radiofield', changeEnable: true, inputValue: 'manual', width: 100, boxLabel: smb.charset.label.manual, name: 'l2tpConnMode', id: 'l2tpManual' } ] }, */ { xtype: 'fieldcontainer', id: 'l2tpDemandIdle', hidden: true, layout: 'hbox', width: 700, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items:[ { xtype: 'numberfield', minValue: 0, maxValue: 99, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.maxIdleTime, name: 'l2tpIdleTime', id: 'l2tpDemandIdleTime', disabled: true }, { xtype: 'displayfield', hideLabel: true, id: 'l2tpDemandMinutes', value: smb.charset.label.minutes, disabledCls: 'disabledLabel', margin: '0 0 0 5' } ] }, { xtype: 'fieldcontainer', id: 'l2tpManualIdle', hidden: true, layout: 'hbox', width: 700, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items:[ { xtype: 'numberfield', minValue: 0, maxValue: 99, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.maxIdleTime, name: 'l2tpIdleTime', id: 'l2tpManualIdleTime', disabled: true }, { xtype: 'displayfield', hideLabel: true, id: 'l2tpManualMinutes', value: smb.charset.label.minutes, disabledCls: 'disabledLabel', margin: '0 0 0 5' } ] }, { xtype: 'combobox', fieldLabel: smb.charset.label.secondConn, id: 'l2tpConnectionType', name: 'l2tpConnectionType', editable: false, queryMode: 'local', value: 'dynamic', store: Ext.create('Ext.data.Store',{ fields: ['value', 'display'], data: [ {value:'static', display:smb.charset.label.staticIp}, {value:'dynamic', display:smb.charset.label.dynamicIp} ] }), displayField: 'display', valueField: 'value', listeners:{ change:function( item, newValue, oldValue){ if(newValue=='static') { Ext.getCmp('l2tpConnStaticIpDetails').show(); Ext.getCmp('l2tpConnStaticIpDetails').enable(); var tempArr = Ext.getCmp('l2tpConnStaticIpDetails').query('[changeEnable=true]'); Ext.each(tempArr, function(item) { if(item) { if(item.isDisabled()) { item.enable(); } } }); } else { Ext.getCmp('l2tpConnStaticIpDetails').hide(); Ext.getCmp('l2tpConnStaticIpDetails').disable(); } } } }, /* { xtype: 'radiogroup', fieldLabel: smb.charset.label.secondConn, columns: 3, vertical: false, width: 580, height: 24, items: [ { inputValue: 'static', changeEnable: true, id: 'l2tpConnectionTypeStatic', boxLabel: smb.charset.label.staticIp, name: 'l2tpConnectionType', checked: true }, { inputValue: 'dynamic', changeEnable: true, id: 'l2tpConnectionTypedynamic', boxLabel: smb.charset.label.dynamicIp, name: 'l2tpConnectionType' } ] }, */ { xtype: 'container', id: 'l2tpConnStaticIpDetails', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [{ xtype: 'textfield', vtype: 'ip', fieldLabel: smb.charset.label.ipAddress, changeEnable: true, name: 'l2tpConnStaticIp', id: 'forTest' }, { xtype: 'textfield', vtype: 'mask', fieldLabel: smb.charset.label.netmask, changeEnable: true, name: 'l2tpConnStaticMask' }, { xtype: 'textfield', vtype: 'ip', allowBlank: true, allowAllZero: true, changeEnable: true, fieldLabel: smb.charset.label.gateway, name: 'l2tpConnStaticGateway' }, { xtype: 'textfield', vtype: 'ip', allowBlank: true, allowAllZero: true, changeEnable: true, fieldLabel: smb.charset.label.priDns, name: 'l2tpConnStaticDns1' } ] } ] }, { xtype: 'detailSettings', id: 'pptpDetailSetting', type: 'wanConnectionType', hidden: true, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [{ xtype: 'textfield', changeEnable: true, fieldLabel: smb.charset.label.serverIpName, name: 'pptpServerIp', maxLength: 63, enforceMaxLength: 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', vtype: 'username', changeEnable: true, fieldLabel: smb.charset.label.username, maxLength: 119, enforceMaxLength: true, allowBlank: true, name: 'pptpUsername' }, { xtype: 'fieldcontainer', layout: 'column', defaults:{ labelWidth: 275, inputWidth: 160 }, items:[ { xtype: 'textfield', fieldLabel: smb.charset.label.password, id: 'pptpPwd', name: 'pptpPassword', changeEnable: true, inputType: 'password', maxLength: 119, enforceMaxLength: true, allowBlank: true, vtype: 'wanPwd', changeFlag: true, listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('pptpPwdText').changeFlag = false; if(item.changeFlag) { Ext.getCmp('pptpPwdText').setValue(newValue); } Ext.getCmp('pptpPwdText').changeFlag = true; } } }, { xtype: 'textfield', id: 'pptpPwdText', submitValue: false, hidden: true, fieldLabel: smb.charset.label.password, vtype: 'wanPwd', maxLength: 119, enforceMaxLength: true, allowBlank: true, changeFlag: true, listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('pptpPwd').changeFlag = false; if(item.changeFlag) { Ext.getCmp('pptpPwd').setValue(newValue); } Ext.getCmp('pptpPwd').changeFlag = true; } } }, { xtype: 'checkbox', id: 'showPptpPwd', margin: '2 0 0 5', inputWidth: 13, boxLabel: smb.charset.label.show, hideLabel: true } ] }, { xtype: 'combobox', fieldLabel: smb.charset.label.connectionMode, name: 'pptpConnMode', editable: false, queryMode: 'local', value: 'automatic', store: Ext.create('Ext.data.Store',{ fields: ['value', 'display'], data: [ {value:'onDemand', display:smb.charset.label.onDemand}, {value:'automatic', display:smb.charset.label.automatic}, {value:'manual', display:smb.charset.label.manual} ] }), displayField: 'display', valueField: 'value', listeners:{ change:function( item, newValue, oldValue){ Ext.getCmp('pptpManualIdleTime').clearInvalid(); Ext.getCmp('pptpManualIdleTime').disable(); Ext.getCmp('pptpManualIdle').hide(); Ext.getCmp('pptpDemandIdleTime').clearInvalid(); Ext.getCmp('pptpDemandIdleTime').clearInvalid(); Ext.getCmp('pptpDemandIdleTime').disable(); Ext.getCmp('pptpDemandIdle').hide(); if( newValue=='manual') { Ext.getCmp('pptpManualIdleTime').enable(); Ext.getCmp('pptpManualIdle').show(); } else if( newValue=='onDemand') { Ext.getCmp('pptpDemandIdleTime').enable(); Ext.getCmp('pptpDemandIdle').show(); } } } }, /* { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.connectionMode, name: 'connMode', defaultType: 'radiofield', layout: { type: 'hbox' }, width: 700, items:[ { xtype: 'radiofield', changeEnable: true, inputValue: 'onDemand', width: 100, boxLabel: smb.charset.label.onDemand, name: 'pptpConnMode', id: 'pptpDemand' }, { xtype: 'radiofield', changeEnable: true, inputValue: 'automatic', width: 100, boxLabel: smb.charset.label.automatic, name: 'pptpConnMode', checked: true }, { xtype: 'radiofield', changeEnable: true, inputValue: 'manual', width: 100, boxLabel: smb.charset.label.manual, name: 'pptpConnMode', id: 'pptpManual' } ] }, */ { xtype: 'fieldcontainer', id: 'pptpDemandIdle', hidden: true, layout: 'hbox', width: 700, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items:[ { xtype: 'numberfield', minValue: 0, maxValue: 99, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.maxIdleTime, name: 'pptpIdleTime', id: 'pptpDemandIdleTime', disabled: true }, { xtype: 'displayfield', id: 'pptpDemandMinutes', value: smb.charset.label.minutes, hideLabel: true, disabledCls: 'disabledLabel', margin: '0 0 0 5' } ] }, { xtype: 'fieldcontainer', id: 'pptpManualIdle', hidden: true, layout: 'hbox', width: 700, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items:[ { xtype: 'numberfield', fieldLabel: smb.charset.label.maxIdleTime, id: 'pptpManualIdleTime', name: 'pptpIdleTime', changeEnable: true, minValue: 0, maxValue: 99, decimalPrecision:0, disabled: true }, { xtype: 'displayfield', hideLabel: true, id: 'pptpManualMinutes', value: smb.charset.label.minutes, disabledCls: 'disabledLabel', margin: '0 0 0 5' } ] }, { xtype: 'combobox', fieldLabel: smb.charset.label.secondConn, id: 'pptpConnectionType', name: 'pptpConnectionType', editable: false, queryMode: 'local', value: 'dynamic', store: Ext.create('Ext.data.Store',{ fields: ['value', 'display'], data: [ {value:'static', display:smb.charset.label.staticIp}, {value:'dynamic', display:smb.charset.label.dynamicIp} ] }), displayField: 'display', valueField: 'value', listeners:{ change:function( item, newValue, oldValue){ if(newValue=='static') { Ext.getCmp('pptpConnStaticIpDetails').show(); Ext.getCmp('pptpConnStaticIpDetails').enable(); var tempArr = Ext.getCmp('pptpConnStaticIpDetails').query('[changeEnable=true]'); Ext.each(tempArr, function(item) { if(item) { if(item.isDisabled()) { item.enable(); } } }); } else { Ext.getCmp('pptpConnStaticIpDetails').hide(); Ext.getCmp('pptpConnStaticIpDetails').disable(); } } } }, /* { xtype: 'radiogroup', fieldLabel: smb.charset.label.secondConn, columns: 3, vertical: false, width: 580, height: 24, defaultType: 'radiofield', items: [{ inputValue: 'static', changeEnable: true, id: 'pptpConnectionTypeStatic', boxLabel: smb.charset.label.staticIp, name: 'pptpConnectionType', checked: true }, { inputValue: 'dynamic', changeEnable: true, id: 'pptpConnectionTypedynamic', boxLabel: smb.charset.label.dynamicIp, name: 'pptpConnectionType' } ] }, */ { xtype: 'container', id: 'pptpConnStaticIpDetails', defaults: { //width: 300, labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [{ xtype: 'textfield', vtype: 'ip', fieldLabel: smb.charset.label.ipAddress, changeEnable: true, name: 'pptpConnStaticIp' }, { xtype: 'textfield', vtype: 'mask', fieldLabel: smb.charset.label.netmask, changeEnable: true, name: 'pptpConnStaticMask' }, { xtype: 'textfield', vtype: 'ip', allowBlank: true, allowAllZero: true, changeEnable: true, fieldLabel: smb.charset.label.gateway, name: 'pptpConnStaticGateway' }, { xtype: 'textfield', vtype: 'ip', allowBlank: true, allowAllZero: true, changeEnable: true, fieldLabel: smb.charset.label.priDns, name: 'pptpConnStaticDns1' }] }] }, { xtype: 'detailSettings', id: 'pppoeDetailSetting', type: 'wanConnectionType', hidden: true, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [{ xtype: 'textfield', vtype: 'username', changeEnable: true, name: 'pppoeUsername', maxLength: 119, enforceMaxLength: true, allowBlank: true, fieldLabel: smb.charset.label.username }, { xtype: 'fieldcontainer', layout: 'column', defaults:{ labelWidth: 275, inputWidth: 160 }, items:[ { xtype: 'textfield', fieldLabel: smb.charset.label.password, id: 'pppoePwd', name: 'pppoePassword', changeEnable: true, inputType: 'password', maxLength: 119, enforceMaxLength: true, allowBlank: true, changeFlag: true, vtype: 'wanPwd', listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('pppoePwdText').changeFlag = false; if(item.changeFlag) { Ext.getCmp('pppoePwdText').setValue(newValue); } Ext.getCmp('pppoePwdText').changeFlag = true; } } }, { xtype: 'textfield', id: 'pppoePwdText', submitValue: false, hidden: true, fieldLabel: smb.charset.label.password, vtype: 'wanPwd', maxLength: 119, enforceMaxLength: true, allowBlank: true, changeFlag: true, listeners:{ change: function( item, newValue, oldValue, scope) { Ext.getCmp('pppoePwd').changeFlag = false; if(item.changeFlag) { Ext.getCmp('pppoePwd').setValue(newValue); } Ext.getCmp('pppoePwd').changeFlag = true; } } }, { xtype: 'checkbox', id: 'showPppoePwd', margin: '2 0 0 5', inputWidth: 13, boxLabel: smb.charset.label.show, hideLabel: true } ] }, { xtype: 'combobox', fieldLabel: smb.charset.label.connectionMode, name: 'pppoeConnMode', editable: false, queryMode: 'local', value: 'automatic', store: Ext.create('Ext.data.Store',{ fields: ['value', 'display'], data: [ {value:'onDemand', display:smb.charset.label.onDemand}, {value:'automatic', display:smb.charset.label.automatic}, {value:'timeBased', display:smb.charset.label.timeBased}, {value:'manual', display:smb.charset.label.manual} ] }), displayField: 'display', valueField: 'value', listeners:{ change:function( item, newValue, oldValue){ Ext.getCmp('pppoeManualIdleTime').clearInvalid(); Ext.getCmp('pppoeManualIdleTime').disable(); Ext.getCmp('pppoeManualIdle').hide(); Ext.getCmp('pppoeDemandIdleTime').clearInvalid(); Ext.getCmp('pppoeDemandIdleTime').clearInvalid(); Ext.getCmp('pppoeDemandIdleTime').disable(); Ext.getCmp('pppoeDemandIdle').hide(); Ext.getCmp('pppoeManualIdleTime').clearInvalid(); Ext.getCmp('pppoeFromHhMm').clearInvalid(); Ext.getCmp('pppoeToHhMm').clearInvalid(); Ext.getCmp('pppoeFromHhMm').disable(); Ext.getCmp('pppoeToHhMm').disable(); Ext.getCmp('pppoeTimeCnt').hide(); if( newValue=='manual') { Ext.getCmp('pppoeManualIdleTime').enable(); Ext.getCmp('pppoeManualIdle').show(); } else if( newValue=='onDemand') { Ext.getCmp('pppoeDemandIdleTime').enable(); Ext.getCmp('pppoeDemandIdle').show(); } else if( newValue=='timeBased') { Ext.getCmp('pppoeFromHhMm').enable(); Ext.getCmp('pppoeToHhMm').enable(); Ext.getCmp('pppoeTimeCnt').show(); } } } }, /* { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.connectionMode, layout: { type: 'hbox' }, defaultType: 'radiofield', defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, width: 900, items: [ { xtype: 'radiofield', inputValue: 'onDemand', inputWidth: 13, width: 100, boxLabel: smb.charset.label.onDemand, name: 'pppoeConnMode', id: 'pppoeDemand', changeEnable: true }, { xtype: 'radiofield', inputValue: 'automatic', inputWidth: 13, width: 100, boxLabel: smb.charset.label.automatic, name: 'pppoeConnMode', checked: true }, { xtype: 'radiofield', inputValue: 'timeBased', inputWidth: 13, width: 100, boxLabel: smb.charset.label.timeBased, id: 'pppoeTimeBased', name: 'pppoeConnMode' }, { xtype: 'radiofield', inputValue: 'manual', inputWidth: 13, width: 100, boxLabel: smb.charset.label.manual, name: 'pppoeConnMode', id: 'pppoeManual' } ] }, */ { xtype: 'fieldcontainer', id: 'pppoeDemandIdle', hidden: true, layout: 'hbox', width: 800, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'numberfield', minValue: 0, maxValue: 99, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.maxIdleTime, name: 'pppoeIdleTime', id: 'pppoeDemandIdleTime', disabled: true }, { xtype: 'displayfield', hideLabel: true, id: 'pppoeDemandMinutes', value: smb.charset.label.minutes, disabledCls: 'disabledLabel', margin: '0 0 0 5' } ] }, { xtype: 'fieldcontainer', id: 'pppoeTimeCnt', hidden: true, changeEnable: true, width: 800, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'textfield', changeEnable: true, fieldLabel: smb.charset.label.fromHhMm, name: 'pppoeFromHhMm', id: 'pppoeFromHhMm', vtype: 'timeStart', disabled: true }, { xtype: 'textfield', changeEnable: true, fieldLabel: smb.charset.label.toHhMm, name: 'pppoeToHhMm', id: 'pppoeToHhMm', vtype: 'timeStart', disabled: true, validator: function(value) { if (smb.verify.timeEnd(value) == true) { var timeStart = smb.format.timeToInt(Ext.getCmp('pppoeFromHhMm').getValue()); var timeEnd = smb.format.timeToInt(value); if (timeStart < timeEnd) { return true; } else { return smb.charset.validation.timeRange; } } else { return smb.charset.validation.timeEnd; } } } ] }, { xtype: 'fieldcontainer', id: 'pppoeManualIdle', hidden: true, layout: 'hbox', width: 800, defaults:{ labelWidth: 275, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'numberfield', minValue: 0, maxValue: 99, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.maxIdleTime, name: 'pppoeIdleTime', id: 'pppoeManualIdleTime', disabled: true }, { xtype: 'displayfield', hideLabel: true, id: 'pppoeManualMinutes', value: smb.charset.label.minutes, disabledCls: 'disabledLabel', margin: '0 0 0 5' } ] }, { xtype: 'combobox', fieldLabel: smb.charset.label.secondConn, name: 'pppoeConnectionType', id: 'pppoeConnectionType', editable: false, queryMode: 'local', value: 'dynamic', store: Ext.create('Ext.data.Store',{ fields: ['value', 'display'], data: [ {value:'dynamic', display:smb.charset.label.dynamicIp}, {value:'static', display:smb.charset.label.staticIp}, {value:'disabled', display:smb.charset.label.disable} ] }), displayField: 'display', valueField: 'value', listeners:{ change:function( item, newValue, oldValue){ if( newValue=='static') { Ext.getCmp('scStaticIp').show(); Ext.getCmp('scStaticIp').enable(); Ext.getCmp('scStaticMask').show(); Ext.getCmp('scStaticMask').enable(); } else { Ext.getCmp('scStaticIp').hide(); Ext.getCmp('scStaticIp').disable(); Ext.getCmp('scStaticMask').hide(); Ext.getCmp('scStaticMask').disable(); } } } }, /* { xtype: 'fieldcontainer', fieldLabel: smb.charset.label.secondConn, defaultType: 'radiofield', width: 580, margin: '0 0 10 0', defaults:{ flex: 3 }, layout: 'hbox', items:[ { boxLabel: smb.charset.label.dynamicIp, name: 'pppoeConnectionType', inputValue: 'dynamic', width: 100, id: 'scDynamic' }, { boxLabel: smb.charset.label.staticIp, name: 'pppoeConnectionType', inputValue: 'static', width: 100, id: 'scStatic' }, { boxLabel: smb.charset.label.disable, name: 'pppoeConnectionType', inputValue: 'disabled', checked: true, width: 80, id: 'scDisable' } ] }, */ { xtype: 'textfield', fieldLabel: smb.charset.label.ipAddress, hidden: true, disabled: true, id: 'scStaticIp', name: 'pppoeConnStaticIp', vtype: 'ip' }, { xtype: 'textfield', fieldLabel: smb.charset.label.netmask, hidden: true, disabled: true, id: 'scStaticMask', name: 'pppoeConnStaticMask', vtype: 'mask' } ] }, { xtype: 'smbAdvancedSettings', title: smb.charset.label.advancedSettings, expandItem: 'advancedSettings', collapsible: true, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'fieldcontainer', id: 'staticAdv', type: 'wanConnectionType', hidden: true, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'numberfield', defaultValue: 1500, minValue: 576, maxValue: 1500, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.mtuSize, name: 'staticMtuSize' }] }, { xtype: 'fieldcontainer', title: smb.charset.label.advancedSettingsDynamic, type: 'wanConnectionType', id: 'dynamicAdv', defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [{ xtype: 'numberfield', value: 1500, minValue: 576, maxValue: 1500, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.mtuSize, name: 'dynamicMtuSize' }, { xtype: 'checkboxfield', id: 'dynamicChkDnsServer', inputWidth: 13, fieldLabel: smb.charset.label.userDnsServer, boxLabel: smb.charset.label.enable, name: 'dynamicUserDnsServer', checked: false }, { xtype: 'textfield', vtype: 'ip', changeEnable: true, fieldLabel: smb.charset.label.priDns, hidden: true, disabled: true, name: 'dynamicDns1', id: 'dynamicDns1' }, { xtype: 'textfield', vtype: 'ip', changeEnable: true, fieldLabel: smb.charset.label.secDns, allowAllZero: true, allowBlank: true, hidden: true, disabled: true, name: 'dynamicDns2', id: 'dynamicDns2' }] }, { xtype: 'fieldcontainer', title: smb.charset.label.advancedSettingsPppoe, type: 'wanConnectionType', id: 'pppoeAdv', hidden: true, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'numberfield', value: 1480, minValue: 576, maxValue: 1492, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.mtuSize, name: 'pppoeMtuSize' }, { xtype: 'textfield', vtype: 'serviceName', changeEnable: true, allowBlank: true, fieldLabel: smb.charset.label.serviceName, maxLength: 31, enforceMaxLength: true, name: 'pppoeServiceName' }, { xtype: 'textfield', vtype: 'acName', changeEnable: true, allowBlank: true, fieldLabel: smb.charset.label.acName, maxLength: 31, enforceMaxLength: true, name: 'pppoeAcName' }, { xtype: 'fieldcontainer', layout: 'column', width: 700, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'numberfield', changeEnable: true, fieldLabel: smb.charset.label.detectInterval, minValue: 0, maxValue: 120, decimalPrecision:0, name: 'pppoeDetectInterval' // width: 445 }, { xtype: 'label', text: smb.charset.label.seconds, width: 70, margin: '3 0 0 5' } ] }, { xtype: 'checkboxfield', fieldLabel: smb.charset.label.userIspIp, boxLabel: smb.charset.label.enable, // margin: '0 0 5 268', inputWidth: 13, id: 'pppoeUserIspIp', name: 'pppoeUserIspIp', checked: true }, { xtype: 'textfield', fieldLabel: smb.charset.label.ispSpecifiedIp, changeEnable: true, id: 'pppoeIspIp', name: 'pppoeIspIp', vtype: 'ip' }, { xtype: 'checkboxfield', id: 'chkDnsServer', inputWidth: 13, // margin: '0 0 5 268', fieldLabel: smb.charset.label.userDnsServer, boxLabel: smb.charset.label.enable, name: 'pppoeUserDnsServer', checked: true }, { xtype: 'textfield', vtype: 'ip', changeEnable: true, fieldLabel: smb.charset.label.priDns, id: 'pppoeDns1', name: 'pppoeDns1' }, { xtype: 'textfield', vtype: 'ip', allowBlank: true, allowAllZero: true, changeEnable: true, fieldLabel: smb.charset.label.secDns, id: 'pppoeDns2', name: 'pppoeDns2' } ] }, { xtype: 'fieldcontainer', type: 'wanConnectionType', id: 'l2tpAdv', hidden: true, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [{ xtype: 'numberfield', value: 1460, minValue: 576, maxValue: 1460, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.mtuSize, name: 'l2tpMtuSize' }] }, { xtype: 'fieldcontainer', type: 'wanConnectionType', id: 'pptpAdv', hidden: true, defaults:{ labelWidth: 263, inputWidth: 160, labelAlign: 'right' }, items: [ { xtype: 'numberfield', value: 1420, minValue: 576, maxValue: 1420, decimalPrecision:0, changeEnable: true, fieldLabel: smb.charset.label.mtuSize, name: 'pptpMtuSize' }] }, { xtype: 'fieldcontainer', id: 'advWanMacFactoryCnt', layout: { type: 'hbox' }, items: [ { xtype: 'textfield', vtype: 'mac', fieldLabel: smb.charset.label.wanMacAddr, labelWidth: 263, inputWidth: 160, id: 'wanMacAddr', name: 'macCloneValue' }, { xtype: 'hiddenfield', id: 'factoryMacRaw', name: 'factoryMac', allowBlank: true, submitValue: false }, { xtype: 'smbButton', id: 'factoryMac', width: 150, margin: '0 0 0 5', text: smb.charset.button.factoryMac, listeners: { click:function(button, event) { Ext.getCmp('wanMacAddr').setValue(Ext.getCmp('factoryMacRaw').getValue()); } } } ] }, { xtype: 'fieldcontainer', id: 'advWanMacCloneCnt', layout: { type: 'hbox' }, // margin: '0 0 0 268', items: [ { xtype: 'textfield', vtype: 'mac', fieldLabel: smb.charset.label.yourPcMac, submitValue: false, disabled: true, labelWidth: 263, inputWidth: 160, id: 'macCloneValue', name: 'pcMac' }, { xtype: 'smbButton', width: 150, margin: '0 0 0 5', id: 'cloneFromPcsMacAddress', text: smb.charset.button.cloneFromPcsMacAddress, listeners: { click:function(button, event) { Ext.getCmp('wanMacAddr').setValue(Ext.getCmp('macCloneValue').getValue()); } } } ] } ] }], initComponent: function() { this.callParent(arguments); if(smb.user.isRemoteLogin) { Ext.getCmp('cloneFromPcsMacAddress').hide(); } } }); Ext.define('smb.model.nat',{ extend: 'Ext.data.Model', fields: [ {mapping: 'enableDmz', name: 'enableDmz', type: 'boolean'}, {mapping: 'dmzIp', name: 'dmzIp', type: 'string'}, {mapping: 'enableUpnp', name: 'enableUpnp', type: 'boolean'}, {mapping: 'enableVirtualServer', name: 'enableVirtualServer', type: 'boolean'}, {mapping: 'enablePortTrigger', name: 'enablePortTrigger', type: 'boolean'}, {mapping: 'ftpAlg', name: 'ftpAlg', type: 'boolean'}, {mapping: 'tftpAlg', name: 'tftpAlg', type: 'boolean'}, {mapping: 'h323Alg', name: 'h323Alg', type: 'boolean'}, {mapping: 'rtspAlg', name: 'rtspAlg', type: 'boolean'} ], proxy: { type: 'ajax', url: './data/nat.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.model.securityForm',{ extend: 'Ext.data.Model', fields: [ {mapping: 'firewall', name: 'firewall', type: 'boolean'}, {mapping: 'wanPingForbidden', name: 'wanPingForbidden', type: 'boolean'}, {mapping: 'lanPingForbidden', name: 'lanPingForbidden', type: 'boolean'}, {mapping: 'pptpPassthrough', name: 'pptpPassthrough', type: 'boolean'}, {mapping: 'l2tpPassthrough', name: 'l2tpPassthrough', type: 'boolean'}, {mapping: 'ipsecPassthrough', name: 'ipsecPassthrough', type: 'boolean'}, {mapping: 'packetsInterval', name: 'packetsInterval', type: 'string'}, {mapping: 'icmpFlood', name: 'icmpFlood', type: 'boolean'}, {mapping: 'icmpFloodValue', name: 'icmpFloodValue', type: 'int'}, {mapping: 'udpFlood', name: 'udpFlood', type: 'boolean'}, {mapping: 'udpFloodValue', name: 'udpFloodValue', type: 'int'}, {mapping: 'tcpSynFlood', name: 'tcpSynFlood', type: 'boolean'}, {mapping: 'tcpSynFloodValue', name: 'tcpSynFloodValue', type: 'int'}, {mapping: 'dosProtection', name: 'dosProtection', type: 'boolean'} ], proxy: { type: 'ajax', url: './data/security.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.model.accessControlForm',{ extend: 'Ext.data.Model', fields: [ {mapping: 'enable', name: 'enable', type: 'boolean'}, {mapping: 'policy', name: 'policy', type: 'int'} ], proxy: { type: 'ajax', url: './data/accessControl.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.model.staticRoutingForm',{ extend: 'Ext.data.Model', fields: [ {mapping: 'enable', name: 'enable', type: 'boolean'} ], proxy: { type: 'ajax', url: './data/staticRouting.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.model.bandWidthControlForm',{ extend: 'Ext.data.Model', fields: [ {mapping: 'enable', name: 'enable', type: 'boolean'}, {mapping: 'totalIngressBandwidth', name: 'totalIngressBandwidth', type: 'int'}, {mapping: 'totalEgressBandwidth', name: 'totalEgressBandwidth', type: 'int'} ], id: 'bandWidthControlForm', proxy: { type: 'ajax', url: './data/bandWidthControl.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.model.ipMacBindingForm',{ extend: 'Ext.data.Model', fields: [ {mapping: 'enable', name: 'enable', type: 'boolean'} ], proxy: { type: 'ajax', url: './data/ipMacBinding.json', reader: { type: 'json', root: 'data' } } }); Ext.define('smb.view.tpNetwork',{ extend: 'Ext.container.Container', alias: 'widget.tpNetwork', id: 'tpNetwork', url: './data/lan.json', method: 'get', initComponent: function(){ this.callParent(arguments); /*this.add({ xtype: 'checkbox', checked: true, name: 'advancedSettingsNetwork', id: 'advancedSettingsNetwork', fieldLabel: smb.charset.label.advancedSettings, boxLabel: smb.charset.label.advancedSettings, hideLabel: true, margin: '10 0 10 20' });*/ /* this.insert(0,{ xtype: 'checkbox', checked: false, name: 'advancedSettingsNetwork', id: 'advancedSettingsNetwork', fieldLabel: smb.charset.label.advancedSettings, boxLabel: smb.charset.label.advancedSettings, hideLabel: true, margin: '10 0 10 20' }); */ /* var networkItem = smb.mode.subItems["tpNetwork"][smb.mode.status]; this.insert(1,networkItem); var len = networkItem.length; for(var i = 0; i < len; i++) { smb.modules["tpNetwork"][networkItem[i]["xtype"]].status = "on"; } */ var mode = smb.mode.status; for (var name in smb.mode[mode].tpNetwork){ if(name) { var index = smb.mode[mode].tpNetwork[name]; this.insert(index, { xtype: name }); smb.modules["tpNetwork"][name].status = "on"; } } } }); Ext.define('smb.controller.tpNetwork', { extend: 'Ext.app.Controller', init: function(){ this.control({ '#tpNetwork checkbox[id=advancedSettingsNetwork]': { change: function(checkbox, newValue, oldValue, Opts){ // smb.pages.advancedSettingCheck.call(this, 'tpNetwork', newValue); } }, /* '#wan [id=l2tpConnectionTypeStatic]': { change: function( scope, newValue, oldValue, eOpts){ if(newValue) { Ext.getCmp('l2tpConnStaticIpDetails').show(); Ext.getCmp('l2tpConnStaticIpDetails').enable(); var tempArr = Ext.getCmp('l2tpConnStaticIpDetails').query('[changeEnable=true]'); Ext.each(tempArr, function(item) { if(item) { if(item.isDisabled()) { item.enable(); } } }); } else { Ext.getCmp('l2tpConnStaticIpDetails').hide(); Ext.getCmp('l2tpConnStaticIpDetails').disable(); } } }, */ /* '#wan [id=pptpConnectionTypeStatic]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('pptpConnStaticIpDetails').show(); Ext.getCmp('pptpConnStaticIpDetails').enable(); var tempArr = Ext.getCmp('pptpConnStaticIpDetails').query('[changeEnable=true]'); Ext.each(tempArr, function(item) { if(item) { if(item.isDisabled()) { item.enable(); } } }); } else { Ext.getCmp('pptpConnStaticIpDetails').hide(); Ext.getCmp('pptpConnStaticIpDetails').disable(); } } }, */ '#wan [id=pppoeManual]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('pppoeManualIdleTime').enable(); Ext.getCmp('pppoeManualIdle').show(); Ext.getCmp('pppoeDemandIdleTime').disable(); Ext.getCmp('pppoeDemandIdle').hide(); Ext.getCmp('pppoeFromHhMm').disable(); Ext.getCmp('pppoeToHhMm').disable(); Ext.getCmp('pppoeTimeCnt').hide(); } else { Ext.getCmp('pppoeManualIdleTime').clearInvalid(); Ext.getCmp('pppoeManualIdleTime').disable(); Ext.getCmp('pppoeManualIdle').hide(); Ext.getCmp('pppoeDemandIdleTime').clearInvalid(); } } }, '#wan [id=pppoeDemand]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('pppoeDemandIdleTime').enable(); Ext.getCmp('pppoeDemandIdle').show(); Ext.getCmp('pppoeManualIdleTime').disable(); Ext.getCmp('pppoeManualIdle').hide(); Ext.getCmp('pppoeFromHhMm').disable(); Ext.getCmp('pppoeToHhMm').disable(); Ext.getCmp('pppoeTimeCnt').hide(); } else { Ext.getCmp('pppoeDemandIdleTime').clearInvalid(); Ext.getCmp('pppoeDemandIdleTime').disable(); Ext.getCmp('pppoeDemandIdle').hide(); Ext.getCmp('pppoeManualIdleTime').clearInvalid(); } } }, '#wan [id=pppoeTimeBased]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('pppoeFromHhMm').enable(); Ext.getCmp('pppoeToHhMm').enable(); Ext.getCmp('pppoeTimeCnt').show(); Ext.getCmp('pppoeManualIdleTime').disable(); Ext.getCmp('pppoeManualIdle').hide(); Ext.getCmp('pppoeDemandIdleTime').disable(); Ext.getCmp('pppoeDemandIdle').hide(); } else { Ext.getCmp('pppoeFromHhMm').clearInvalid(); Ext.getCmp('pppoeToHhMm').clearInvalid(); Ext.getCmp('pppoeFromHhMm').disable(); Ext.getCmp('pppoeToHhMm').disable(); Ext.getCmp('pppoeTimeCnt').hide(); } } }, '#wan [id=l2tpManual]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('l2tpManualIdleTime').enable(); Ext.getCmp('l2tpManualIdle').show(); Ext.getCmp('l2tpDemandIdleTime').disable(); Ext.getCmp('l2tpDemandIdle').hide(); } else { Ext.getCmp('l2tpManualIdleTime').clearInvalid(); Ext.getCmp('l2tpManualIdleTime').disable(); Ext.getCmp('l2tpManualIdle').hide(); Ext.getCmp('l2tpDemandIdleTime').clearInvalid(); } } }, '#wan [id=l2tpDemand]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('l2tpDemandIdleTime').enable(); Ext.getCmp('l2tpDemandIdle').show(); Ext.getCmp('l2tpManualIdleTime').disable(); Ext.getCmp('l2tpManualIdle').hide(); } else { Ext.getCmp('l2tpDemandIdleTime').clearInvalid(); Ext.getCmp('l2tpDemandIdleTime').disable(); Ext.getCmp('l2tpDemandIdle').hide(); Ext.getCmp('l2tpManualIdleTime').clearInvalid(); } } }, '#wan [id=pptpManual]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('pptpManualIdleTime').enable(); Ext.getCmp('pptpManualIdle').show(); Ext.getCmp('pptpDemandIdleTime').disable(); Ext.getCmp('pptpDemandIdle').hide(); } else { Ext.getCmp('pptpManualIdleTime').clearInvalid(); Ext.getCmp('pptpManualIdleTime').disable(); Ext.getCmp('pptpManualIdle').hide(); Ext.getCmp('pptpDemandIdleTime').clearInvalid(); } } }, '#wan [id=pptpDemand]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { Ext.getCmp('pptpDemandIdleTime').enable(); Ext.getCmp('pptpDemandIdle').show(); Ext.getCmp('pptpManualIdleTime').disable(); Ext.getCmp('pptpManualIdle').hide(); } else { Ext.getCmp('pptpDemandIdleTime').clearInvalid(); Ext.getCmp('pptpDemandIdleTime').disable(); Ext.getCmp('pptpDemandIdle').hide(); Ext.getCmp('pptpManualIdleTime').clearInvalid(); } } }, '#wan [id=chkConnectionType]': { change: function(checkbox, newValue, oldValue, Opts){ var page = Ext.getCmp('wan'); var panelQuery = page.query('[type=wanConnectionType]'); Ext.each(panelQuery, function(panel) { /* var tempArr = panel.query('[changeEnable=true]'); Ext.each(tempArr, function(item) { if(item) { if(!item.disabled) { item.disable(); } } }); */ panel.disable(); panel.hide(); }); if(newValue=='static' || newValue=='dynamic') { Ext.getCmp('wanConn').hide(); Ext.getCmp('wanDisconn').hide(); } else { Ext.getCmp('wanConn').show(); Ext.getCmp('wanDisconn').show(); } /***显示当前的拨号方式基本配置*****/ var id = newValue + 'DetailSetting'; var detailSetting = Ext.getCmp(id); if (detailSetting) { detailSetting.enable(); detailSetting.show(); } /***显示当前的拨号方式高级配置*****/ var idd = newValue + 'Adv'; var advSetting = Ext.getCmp(idd); if (advSetting) { advSetting.enable(); advSetting.show(); } // 配置l2tp和pptp下面的static和dynamic选项 if(newValue=='l2tp') { if(Ext.getCmp('l2tpConnectionType').getValue() =='static') { Ext.getCmp('l2tpConnStaticIpDetails').show(); Ext.getCmp('l2tpConnStaticIpDetails').enable(); } else { Ext.getCmp('l2tpConnStaticIpDetails').hide(); Ext.getCmp('l2tpConnStaticIpDetails').disable(); } } if(newValue=='pptp') { if(Ext.getCmp('pptpConnectionType').getValue()=='static') { Ext.getCmp('pptpConnStaticIpDetails').show(); Ext.getCmp('pptpConnStaticIpDetails').enable(); } else { Ext.getCmp('pptpConnStaticIpDetails').hide(); Ext.getCmp('pptpConnStaticIpDetails').disable(); } } } }, '#lan checkbox[id=isUseFallback]':{ change:function(obj, newValue, oldValue, event) { if(newValue) { Ext.getCmp('fallbackIp').enable(); Ext.getCmp('fallbackMask').enable(); } else { Ext.getCmp('fallbackIp').disable(); Ext.getCmp('fallbackMask').disable(); } } }, '#lan [id=lanChkConnectionType]': { change: function(checkbox, newValue, oldValue, Opts) { if(newValue == 'static') { Ext.getCmp('staticLanDetailSetting').show(); Ext.getCmp('staticLanDetailSetting').enable(); Ext.getCmp('dynamicLanDetailSetting').hide(); Ext.getCmp('dynamicLanDetailSetting').disable(); Ext.getCmp('lanDhcpServer').enable(); Ext.getCmp('lanDhcpServer').show(); if( Ext.getCmp('lanDhcpServer').getValue() ){ Ext.getCmp('dhcpAdvSetting').enable(); Ext.getCmp('dhcpAdvSetting').show(); } } else if(newValue == 'dynamic') { Ext.getCmp('staticLanDetailSetting').hide(); Ext.getCmp('staticLanDetailSetting').disable(); Ext.getCmp('dynamicLanDetailSetting').show(); Ext.getCmp('dynamicLanDetailSetting').enable(); Ext.getCmp('lanDhcpServer').disable(); Ext.getCmp('lanDhcpServer').hide(); Ext.getCmp('dhcpAdvSetting').disable(); Ext.getCmp('dhcpAdvSetting').hide(); } } }, '#lan [id=lanStaticIp]':{ change:function(field, newValue, oldValue, option) { Ext.getCmp('lanDefaultGateway').setValue(newValue); } }, '#lan [id=lanDhcpServer]': { change: function( scope, newValue, oldValue, eOpts){ if(scope.getValue()) { /* Ext.getCmp('lanStartIpAddress').enable(); Ext.getCmp('lanEndIpAddress').enable(); Ext.getCmp('lanDefaultGateway').enable(); Ext.getCmp('lanDefaultDomain').enable(); Ext.getCmp('lanPrimaryDns').enable(); Ext.getCmp('lanSecondaryDns').enable(); Ext.getCmp('lanDhcpLeaseTime').enable(); Ext.getCmp('dhcpMinutes').enable(); */ Ext.getCmp('dhcpAdvSetting').enable(); Ext.getCmp('dhcpAdvSetting').show(); } else { /* Ext.getCmp('lanStartIpAddress').disable(); Ext.getCmp('lanEndIpAddress').disable(); Ext.getCmp('lanDefaultGateway').disable(); Ext.getCmp('lanDefaultDomain').disable(); Ext.getCmp('lanPrimaryDns').disable(); Ext.getCmp('lanSecondaryDns').disable(); Ext.getCmp('lanDhcpLeaseTime').disable(); Ext.getCmp('dhcpMinutes').disable(); */ Ext.getCmp('dhcpAdvSetting').disable(); Ext.getCmp('dhcpAdvSetting').hide(); } } }, '#lan button[id=lanSubmit]': { click: function(btn, event) { var form = btn.findParentByType('smbModule'); var formBasic = form.getForm(); if (! formBasic.isValid() ) {return;} function goToNewUrl() { var oriUrl = top.location.href; var stIindex = oriUrl.indexOf('//'); var endIndex = oriUrl.slice(stIindex+2).indexOf(':'); top.location.href = oriUrl.slice(0, stIindex+2) + Ext.getCmp('lanStaticIp').getValue() + oriUrl.slice(stIindex+2).slice(endIndex); } var t; if( Ext.getCmp('lanChkConnectionType').getValue() == 'static' ) { t = setTimeout( goToNewUrl, 4000); } formBasic.submit({ // waitTitle: 'Submitting your data', // waitMsg: 'Submitting your data msg', timeout: 15, clientValidation:true, success: function(thisForm, action) { clearTimeout(t); var formData = Ext.JSON.decode(action.response.responseText); smb.user.timeout.call(this, thisForm, action, 0); thisForm.loadRecord(formData); 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: { clearTimeout(t); 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; } } } }); } }, '#nat checkbox[id=enableDmz]':{ change: function(el,newValue,oldValue,scope) { if(newValue) { Ext.getCmp('dmzIp').enable(); Ext.getCmp('dmzIp').show(); } else { Ext.getCmp('dmzIp').disable(); Ext.getCmp('dmzIp').hide(); } } }, '#wan [id=pppoeDemandIdleTime]':{ change:function(field, newValue, oldValue, option) { Ext.getCmp('pppoeManualIdleTime').setValue(newValue); } }, '#wan [id=pppoeManualIdleTime]':{ change:function(field, newValue, oldValue, option) { Ext.getCmp('pppoeDemandIdleTime').setValue(newValue); } }, '#wan [id=l2tpDemandIdleTime]':{ change:function(field, newValue, oldValue, option) { Ext.getCmp('l2tpManualIdleTime').setValue(newValue); } }, '#wan [id=l2tpManualIdleTime]':{ change:function(field, newValue, oldValue, option) { Ext.getCmp('l2tpDemandIdleTime').setValue(newValue); } }, '#wan [id=pptpDemandIdleTime]':{ change:function(field, newValue, oldValue, option) { Ext.getCmp('pptpManualIdleTime').setValue(newValue); } }, '#wan [id=pptpManualIdleTime]':{ change:function(field, newValue, oldValue, option) { Ext.getCmp('pptpDemandIdleTime').setValue(newValue); } }, '#wan button[id=wanConn]':{ click:function(button,event,obj) { var form = Ext.getCmp('wan'); var formBasic = form.getForm(); if( formBasic.isValid() ) { button.disable(); formBasic.submit({ // waitTitle: '', // waitMsg: 'Connecting...', timeout: 10, clientValidation:true, url: './data/wan.json?connect=true', success: function(thisForm, action) { smb.user.timeout.call(this, action, action, 0); var formData = Ext.JSON.decode(action.response.responseText); thisForm.loadRecord(formData); button.enable(); 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; } } button.enable(); } }); } else { //如果有高级选项,则展开高级选项 var advPanel = form.query('[expandItem=advancedSettings]'); Ext.each(advPanel, function(panel){ panel.expand(); }); //btn.disabled = true; } } }, '#wan button[id=wanDisconn]':{ click:function(button,event,obj) { var form = Ext.getCmp('wan'); var formBasic = form.getForm(); if( formBasic.isValid() ) { button.disable(); formBasic.submit({ // waitTitle: '', // waitMsg: 'Disconnecting...', timeout: 10, clientValidation:true, url: './data/wan.json?disconnect=true', success: function(thisForm, action) { smb.user.timeout.call(this, action, action, 0); var formData = Ext.JSON.decode(action.response.responseText); thisForm.loadRecord(formData); button.enable(); 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; } } button.enable(); } }); } else { //如果有高级选项,则展开高级选项 var advPanel = form.query('[expandItem=advancedSettings]'); Ext.each(advPanel, function(panel){ panel.expand(); }); //btn.disabled = true; } } }, '#wan [id=dynamicChkDnsServer]': { change: function( scope, newValue, oldValue, eOpts) { if(scope.getValue()) { Ext.getCmp('dynamicDns1').enable(); Ext.getCmp('dynamicDns2').enable(); Ext.getCmp('dynamicDns1').show(); Ext.getCmp('dynamicDns2').show(); } else { Ext.getCmp('dynamicDns1').disable(); Ext.getCmp('dynamicDns2').disable(); Ext.getCmp('dynamicDns1').hide(); Ext.getCmp('dynamicDns2').hide(); } } }, '#wan [id=pppoeUserIspIp]': { change: function( scope, newValue, oldValue, eOpts) { if(scope.getValue()) { Ext.getCmp('pppoeIspIp').enable(); Ext.getCmp('pppoeIspIp').show(); } else { Ext.getCmp('pppoeIspIp').disable(); Ext.getCmp('pppoeIspIp').hide(); } } }, '#wan [id=chkDnsServer]': { change: function( scope, newValue, oldValue, eOpts) { if(scope.getValue()) { Ext.getCmp('pppoeDns1').enable(); Ext.getCmp('pppoeDns2').enable(); Ext.getCmp('pppoeDns1').show(); Ext.getCmp('pppoeDns2').show(); } else { Ext.getCmp('pppoeDns1').disable(); Ext.getCmp('pppoeDns2').disable(); Ext.getCmp('pppoeDns1').hide(); Ext.getCmp('pppoeDns2').hide(); } } }, '#wan [id=scStatic]': { change: function( scope, newValue, oldValue, eOpts) { if(newValue) { Ext.getCmp('scStaticIp').show(); Ext.getCmp('scStaticIp').enable(); Ext.getCmp('scStaticMask').show(); Ext.getCmp('scStaticMask').enable(); } else { Ext.getCmp('scStaticIp').hide(); Ext.getCmp('scStaticIp').disable(); Ext.getCmp('scStaticMask').hide(); Ext.getCmp('scStaticMask').disable(); } } }, '#wan checkbox[id = showL2tpPwd]': { change: function( scope, newValue, oldValue, eOpts) { if( newValue ) { Ext.getCmp('l2tpPwdText').show(); Ext.getCmp('l2tpPwd').hide(); } else { Ext.getCmp('l2tpPwdText').hide(); Ext.getCmp('l2tpPwd').show(); } } }, '#wan checkbox[id = showPptpPwd]': { change: function( scope, newValue, oldValue, eOpts) { if( newValue ) { Ext.getCmp('pptpPwdText').show(); Ext.getCmp('pptpPwd').hide(); } else { Ext.getCmp('pptpPwdText').hide(); Ext.getCmp('pptpPwd').show(); } } }, '#wan checkbox[id = showPppoePwd]': { change: function( scope, newValue, oldValue, eOpts) { if( newValue ) { Ext.getCmp('pppoePwdText').show(); Ext.getCmp('pppoePwd').hide(); } else { Ext.getCmp('pppoePwdText').hide(); Ext.getCmp('pppoePwd').show(); } } }, '#networkSecurity checkbox[id=icmpFlood]':{ change:function(obj,newValue,oldValue) { if(newValue==true) { Ext.getCmp('icmpFloodValue').enable(); } else { Ext.getCmp('icmpFloodValue').disable(); } } }, '#networkSecurity checkbox[id=udpFlood]':{ change:function(obj,newValue,oldValue) { if(newValue==true) { Ext.getCmp('udpFloodValue').enable(); } else { Ext.getCmp('udpFloodValue').disable(); } } }, '#networkSecurity checkbox[id=tcpSynFlood]':{ change:function(obj,newValue,oldValue) { if(newValue==true) { Ext.getCmp('tcpSynFloodValue').enable(); } else { Ext.getCmp('tcpSynFloodValue').disable(); } } }, '#networkSecurity checkbox[id=dosProtection]':{ change:function(obj, newValue, oldValue, event) { if(newValue) { Ext.getCmp('packetsInterval').enable(); Ext.getCmp('icmpCnt').enable(); Ext.getCmp('udpFloodCnt').enable(); Ext.getCmp('tcpSynCnt').enable(); Ext.getCmp('dosListBtn').enable(); } else { Ext.getCmp('packetsInterval').disable(); Ext.getCmp('icmpCnt').disable(); Ext.getCmp('udpFloodCnt').disable(); Ext.getCmp('tcpSynCnt').disable(); Ext.getCmp('dosListBtn').disable(); } } } }); } });