1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] Admin: Scripts
</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'
>
16 <link rel='stylesheet' type='text/css' href='color.css'
>
17 <script type='text/javascript' src='tomato.js'
></script>
20 <style type='text/css'
>
26 border: 1px solid
#eee;
31 <script type='text/javascript' src='debug.js'
></script>
33 <script type='text/javascript'
>
35 // <% nvram("script_init,script_shut,script_fire,script_wanup"); %>
37 tabs
= [['as-init', 'Init'],['as-shut', 'Shutdown'],['as-fire','Firewall'],['as-wanup', 'WAN Up']];
39 function tabSelect(name
)
42 for (var i
= 0; i
< tabs
.length
; ++i
) {
43 var on
= (name
== tabs
[i
][0]);
44 elem
.display(tabs
[i
][0] + '-text', on
);
46 if (i
>= tabs
.length
) return;
47 E(name
+ '-text').focus();
48 cookie
.set('scripts_tab', name
)
53 for (var i
= 0; i
< tabs
.length
; ++i
) {
54 var e
= E(tabs
[i
][0] + '-text');
56 var c
= e
.cloneNode(false);
57 wrap
= E('as-wordwrap').checked
;
58 c
.setAttribute('wrap', wrap
? 'virtual' : 'off');
59 e
.parentNode
.replaceChild(c
, e
);
68 for (i
= 0; i
< tabs
.length
; ++i
) {
70 n
= E(t
[0] + '-text').value
.length
;
71 x
= (t
[0] == 'as-fire') ? 8192 : 4096;
74 alert(t
[1] + ' script is too long. Maximum allowed is ' + x
+ ' bytes.');
78 form
.submit('_fom', 1);
83 for (var i
= 0; i
< tabs
.length
; ++i
) {
85 E(t
+ '-text').value
= nvram
['script_' + t
.replace('as-', '')];
87 tabSelect(cookie
.get('scripts_tab') || 'as-init');
93 <form id='_fom' method='post' action='tomato.cgi'
>
94 <table id='container' cellspacing=
0>
95 <tr><td colspan=
2 id='header'
>
96 <div class='title'
>Tomato
</div>
97 <div class='version'
>Version <%
version(); %></div>
99 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
101 <div id='ident'
><%
ident(); %></div>
105 <input type='hidden' name='_nextpage' value='admin-scripts.asp'
>
107 <script type='text/javascript'
>
108 tabCreate
.apply(this, tabs
);
110 wrap
= cookie
.get('scripts_wrap') || 0;
111 y
= Math
.floor(docu
.getViewSize().height
* 0.65);
112 s
= 'height:' + ((y
> 300) ? y
: 300) + 'px;display:none';
113 for (i
= 0; i
< tabs
.length
; ++i
) {
115 W('<textarea class="as-script" name="script_' + t
.replace('as-', '') + '" id="' + t
+ '-text" wrap=' + (wrap
? 'virtual' : 'off') + ' style="' + s
+ '"></textarea>');
117 W('<br><input type="checkbox" id="as-wordwrap" onclick="wordWrap()" onchange="wordWrap()" ' +
118 (wrap
? 'checked' : '') + '> Word Wrap');
124 <tr><td id='footer' colspan=
2>
125 <span id='footer-msg'
></span>
126 <input type='button' value='Save' id='save-button' onclick='save()'
>
127 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
131 <script type='text/javascript'
>earlyInit();</script>