r2161 - try using CodePress for RackCode editing
[racktables] / index.php
CommitLineData
b325120a 1<?php
e673ee24
DO
2
3require 'inc/init.php';
da958e52
DO
4// no ctx override is necessary
5fixContext();
6if (!permitted())
7{
8 renderAccessDenied();
9 die;
10}
b0348307
DO
11// Only store the tab name after clearance is got. Any failure is unhandleable.
12setcookie ('RTLT-' . $pageno, $tabno, time() + getConfigVar ('COOKIE_TTL'));
e673ee24
DO
13
14echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
15echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
16echo '<head><title>' . getTitle ($pageno, $tabno) . "</title>\n";
21fd978f 17echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
e673ee24
DO
18echo "<link rel=stylesheet type='text/css' href=pi.css />\n";
19echo "<link rel=icon href='" . getFaviconURL() . "' type='image/x-icon' />";
20echo "<style type='text/css'>\n";
21// Print style information
9c0b0016 22foreach (array ('F', 'A', 'U', 'T', 'Th', 'Tw', 'Thw') as $statecode)
e673ee24
DO
23{
24 echo "td.state_${statecode} {\n";
2a201216 25 echo "\ttext-align: center;\n";
9c0b0016 26 echo "\tbackground-color: #" . (getConfigVar ('color_' . $statecode)) . ";\n";
2a201216 27 echo "\tfont: bold 10px Verdana, sans-serif;\n";
e673ee24
DO
28 echo "}\n\n";
29}
30?>
2a201216
DY
31.validation-error {
32 border:1px solid red;
33}
34
35.validation-success {
36 border:1px solid green;
37}
e673ee24 38 </style>
a30489ac 39 <script language='javascript' type='text/javascript' src='js/live_validation.js'></script>
54592771 40 <script language='javascript' type='text/javascript' src='js/codepress/codepress.js'></script>
2a201216
DY
41 <script type="text/javascript">
42 function init() {
43 document.add_new_range.range.setAttribute('match', "^\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\/\\d\\d?$");
44
45 Validate.init();
46 }
47 window.onload=init;
48 </script>
e673ee24
DO
49 </head>
50<body>
51 <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
52 <tr class=mainheader>
c4d215e8 53 <td colspan=2>
e673ee24
DO
54 <table width='100%' cellspacing=0 cellpadding=2 border=0>
55 <tr>
1db97c25 56 <td valign=top><a href='http://racktables.org/'><?php printImageHREF ('logo'); ?></a></td>
b325120a 57 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
e673ee24
DO
58 </tr>
59 </table>
60 </td>
61 </tr>
62
63 <tr>
c4d215e8 64 <td class="menubar" colspan=2>
e673ee24
DO
65 <table border="0" width="100%" cellpadding="3" cellspacing="0">
66 <tr>
b325120a 67<?php showPathAndSearch ($pageno); ?>
e673ee24
DO
68 </tr>
69 </table>
70 </td>
71 </tr>
72
73 <tr>
b325120a 74<?php
e673ee24
DO
75 showTabs ($pageno, $tabno);
76?>
77 </tr>
78
79 <tr>
c4d215e8 80 <td colspan=2>
b325120a 81<?php
e45a78d7
DO
82if (isset ($tabhandler[$pageno][$tabno]))
83{
3bebaebd
DO
84 if (isset ($page[$pageno]['bypass']) && isset ($page[$pageno]['bypass_type']))
85 {
86 switch ($page[$pageno]['bypass_type'])
87 {
88 case 'uint':
2c6c7645 89 assertUIntArg ($page[$pageno]['bypass'], 'index');
3bebaebd 90 break;
105cea6e 91 case 'uint0':
2c6c7645 92 assertUIntArg ($page[$pageno]['bypass'], 'index', TRUE);
105cea6e 93 break;
1fbc9fd6
DO
94 case 'inet4':
95 assertIPv4Arg ($page[$pageno]['bypass'], 'index');
96 break;
3bebaebd 97 default:
b0348307 98 showError ('Dispatching error for bypass parameter', __FILE__);
3bebaebd
DO
99 break;
100 }
101 $tabhandler[$pageno][$tabno] ($_REQUEST[$page[$pageno]['bypass']]);
102 }
e45a78d7
DO
103 else
104 $tabhandler[$pageno][$tabno] ();
105}
106elseif (isset ($page[$pageno]['handler']))
e673ee24
DO
107 $page[$pageno]['handler'] ($tabno);
108else
b0348307 109 showError ("Failed to find handler for page '${pageno}', tab '${tabno}'", __FILE__);
e673ee24
DO
110?>
111 </td>
112 </tr>
113 </table>
114</body>
115</html>