📄 main.cgi.svn-base
字号:
#!/usr/bin/haserl# Copyright (C) 2008 OpenRB.comcontent-type: text/html(function(){ var moduleId = 'netutils'; var elems = FlashSYS.getCache( moduleId ); if (!elems) { var window = FlashSYS.newWindow({ id: moduleId, title: $TR( moduleId ), padding: 0, width: 600, height: 350 }); var hasIperf = FlashSYS.isInstalled('iperf'); var netUtilsEnd = function(result, params) { var elem = params.elem; if (!elem) { return; } elem.removeClass('NetUtilsLoading').store('lock', false).set('html', result.nl2br()); }; var netUtilsStart = function(values, params) { var elem = params.elem; if (!elem || elem.retrieve('lock')) { return; } elem.empty().addClass('NetUtilsLoading').store('lock', true); FlashSYS.load({ module: moduleId, action: params.action, data: values, exec: false, elem: elem, success: netUtilsEnd }); }; var tabs = new FlashSYS.Tabs(window.contentEl, { tabs: ['ping', 'traceroute', 'iperf'], trPrefix: 'netutils_', footerEl: window.footerEl }); var pingResult = new Element('div', { 'class': 'NetUtilsResult' }).inject( tabs.getPanelByIndex(0) ); var pingForm = new FlashSYS.Form(tabs.getPanelByIndex(0), { module: moduleId, elements: [ { type: 'text', name: 'ip', validate: { required: true, regexp: /^[-0-9a-zA-Z\.]+$/ } } ], trPrefix: 'netutils_', skipAutoSize: true, submit: netUtilsStart, submitParam: { elem: pingResult, action: 'ping' }, submitEl: tabs.getFooterByIndex(0) }); var traceResult = new Element('div', { 'class': 'NetUtilsResult' }).inject( tabs.getPanelByIndex(1) ); var traceForm = new FlashSYS.Form(tabs.getPanelByIndex(1), { module: moduleId, elements: [ { type: 'text', name: 'ip', validate: { required: true, regexp: /^[-0-9a-zA-Z\.]+$/ } } ], trPrefix: 'netutils_', skipAutoSize: true, submit: netUtilsStart, submitParam: { elem: traceResult, action: 'trace' }, submitEl: tabs.getFooterByIndex(1) }); if (hasIperf) { var iperfResult = new Element('div', { 'class': 'NetUtilsResult' }).inject( tabs.getPanelByIndex(2) ); var iperfServStat = <? /lib/flashsys/modules/netutils/iperfserv.sh -s ?>; var iperfForm = new FlashSYS.Form(tabs.getPanelByIndex(2), { module: moduleId, elements: [ { type: 'checkbox', name: 'server', checked: iperfServStat, callback: function(checkBoxElem) { checkBoxElem.disabled = true; checkBoxElem.blur(); FlashSYS.load({ module: 'netutils', action: 'iperfserv', params: checkBoxElem, exec: false, noEncode: true, data: checkBoxElem, success: function(response, params) { var checkBoxElem = params.data; checkBoxElem.checked = !(response.toInt()); checkBoxElem.disabled = false; checkBoxElem.blur(); } }); }}, { type: 'text', name: 'ip', validate: { required: true, regexp: /^[-0-9a-zA-Z\.]+$/ } } ], trPrefix: 'netutils_', skipAutoSize: true, submit: netUtilsStart, submitParam: { elem: iperfResult, action: 'iperf' }, submitEl: tabs.getFooterByIndex(2) }); } else { var iperfForm = null; new Element('h4', { 'class': 'Notice', 'text': $TR('module_not_installed') + ' iperf' }).inject(tabs.getPanelByIndex(2)); } elems = FlashSYS.setCache( moduleId, { window: window, tabs: tabs, pingForm: pingForm, traceForm: traceForm, iperfForm: iperfForm }); }})();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -