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