📄 main.cgi
字号:
#!/usr/bin/haserl# Copyright (C) 2008 OpenRB.comcontent-type: text/html(function(){ var moduleId = 'firewall'; var elems = FlashSYS.getCache( moduleId ); if (!elems) { var window = FlashSYS.newWindow({ id: moduleId, title: $TR( moduleId ), width: 500, height: 225 }); var tabs = new FlashSYS.Tabs(window.contentEl, { tabs: ['zones', 'rules', 'fwd'], trPrefix: 'firewall_', footerEl: window.footerEl }); var zoneTable = new FlashSYS.Table(tabs.getPanelByIndex(0), { params: { 'module': moduleId, 'action': 'formzone' }, trPrefix: 'firewall_zone_', tableHead: { 'name': { width: 30 }, 'ifname': { width: 45 }, 'masq': { width: 20 }, 'delete': { width: 5, blank: true, confirm: 'del_confirm', params: { module: moduleId, action: 'delete', reload: moduleId } } } }); FlashSYS.Control.addButton(tabs.getFooterByIndex(0), { 'params': { 'module': moduleId, 'action': 'formzone', 'data': { 'new': true } }, 'cls': 'Add', 'title': $TR('add') }); FlashSYS.Control.addButton(tabs.getFooterByIndex(0), { 'params': { 'module': moduleId, 'action': 'formsettings' }, 'cls': 'Settings', 'title': $TR('firewall_formsettings') }); var ruleTable = new FlashSYS.Table(tabs.getPanelByIndex(1), { params: { 'module': moduleId, 'action': 'formrule' }, trPrefix: 'firewall_rule_', sortable: true, tableHead: { 'nr': { width: 10 }, 'target': { width: 25 }, 'src': { width: 25 }, 'dest': { width: 25 }, 'sortup': { width: 5, blank: true, params: { module: moduleId, action: 'sort', reload: moduleId } }, 'sortdown': { width: 5, blank: true, params: { module: moduleId, action: 'sort', reload: moduleId } }, 'delete': { width: 5, blank: true, confirm: 'del_confirm', params: { module: moduleId, action: 'delete', reload: moduleId } } } }); FlashSYS.Control.addButton(tabs.getFooterByIndex(1), { 'params': { 'module': moduleId, 'action': 'formrule', 'data': { 'new': true } }, 'cls': 'Add', 'title': $TR('add') }); FlashSYS.Control.addButton(tabs.getFooterByIndex(1), { 'params': { 'module': moduleId, 'action': 'formcustom' }, 'cls': 'Custom', 'title': $TR('firewall_formcustom') }); var fwdTable = new FlashSYS.Table(tabs.getPanelByIndex(2), { params: { 'module': moduleId, 'action': 'formfwd' }, trPrefix: 'firewall_fwd_', tableHead: { 'src': { width: 45 }, 'dest': { width: 50 }, 'delete': { width: 5, blank: true, confirm: 'del_confirm', params: { module: moduleId, action: 'delete', reload: moduleId } } } }); FlashSYS.Control.addButton(tabs.getFooterByIndex(2), { 'params': { 'module': moduleId, 'action': 'formfwd', 'data': { 'new': true } }, 'cls': 'Add', 'title': $TR('add') }); elems = FlashSYS.setCache( moduleId, { window: window, tabs: tabs, zoneTable: zoneTable, ruleTable: ruleTable, fwdTable: fwdTable }); } var tableData = <? /lib/flashsys/modules/firewall/main.lua ?>, zoneValues = {}, ruleValues = {}, fwdValues = {}, delIcon = { cls: 'Icon Delete', title: $TR('title_delete') }, upIcon = { cls: 'Icon SortUp', data: 'up', title: $TR('title_moveup') }, downIcon = { cls: 'Icon SortDown', data: 'down', title: $TR('title_movedown') }, ruleCount = 0; // parse config data for (var i = 0, j = tableData.length; i < j; i++) { var options = tableData[ i ]; var id = options['.name']; switch (options['.type']) { case 'zone': zoneValues[ id ] = [ options.name, (options.ifnames || ''), (options.masq ? $TR('yes') : $TR('no')), delIcon ]; break; case 'rule': case 'redirect': ruleValues[ id ] = [ (++ruleCount).toString(), (options.target || 'FORWARD'), options.src, options.dest, upIcon, downIcon, delIcon ]; break; case 'forwarding': fwdValues[ id ] = [ options.src, options.dest, delIcon ]; break; } } elems.zoneTable.loadValues(zoneValues); elems.ruleTable.loadValues(ruleValues); elems.fwdTable.loadValues(fwdValues);})();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -