r1131 + welcome the first revision of main help page
[racktables] / inc / pagetitles.php
CommitLineData
e673ee24
DO
1<?
2/*
3*
4* This file is a library of title generation functions for RackTables.
5*
6*/
7
8function dynamic_title_ipaddress ()
9{
10 return array ('name' => $_REQUEST['ip'], 'params' => array ('ip' => $_REQUEST['ip']));
11}
12
13function dynamic_title_iprange ()
14{
15 global $pageno;
16 switch ($pageno)
17 {
18 case 'iprange':
19 $range = getIPRange($_REQUEST['id']);
20 return array ('name' => $range['ip'].'/'.$range['mask'], 'params' => array('id'=>$_GET['id']));
21 break;
22 case 'ipaddress':
23 $range = getRangeByIp($_REQUEST['ip']);
24 return array ('name' => $range['ip'].'/'.$range['mask'], 'params' => array('id'=>$range['id']));
25 break;
26 default:
27 return NULL;
28 }
29}
30
31function dynamic_title_row ()
32{
33 global $pageno;
34 $ret = array();
35 switch ($pageno)
36 {
37 case 'rack':
38 assertUIntArg ('rack_id');
39 $rack = getRackData ($_REQUEST['rack_id']);
40 if ($rack == NULL)
41 {
42 showError ('getRackData() failed in dynamic_title_row()');
43 return NULL;
44 }
45 $ret['name'] = $rack['row_name'];
46 $ret['params']['row_id'] = $rack['row_id'];
47 break;
48 case 'row':
49 assertUIntArg ('row_id');
50 $rowInfo = getRackRowInfo ($_REQUEST['row_id']);
51 if ($rowInfo == NULL)
52 {
53 showError ('getRackRowInfo() failed in dynamic_title_row()');
54 return NULL;
55 }
56 $ret['name'] = $rowInfo['dict_value'];
57 $ret['params']['row_id'] = $_REQUEST['row_id'];
58 break;
59 default:
60 return NULL;
61 }
62 return $ret;
63}
64
65function dynamic_title_rack ()
66{
67 $rack = getRackData ($_GET['rack_id']);
68 return array ('name' => $rack['name'], 'params' => array ('rack_id' => $_GET['rack_id']));
69}
70
71function dynamic_title_object ()
72{
73 global $pageno;
74 $ret = array();
75 switch ($pageno)
76 {
77 case 'object':
78 assertUIntArg ('object_id');
79 $object = getObjectInfo ($_REQUEST['object_id']);
80 if ($object == NULL)
81 {
82 showError ('getObjectInfo() failed in dynamic_title_object()');
83 return NULL;
84 }
85 $ret['name'] = $object['dname'];
86 $ret['params']['object_id'] = $_REQUEST['object_id'];
87 break;
88 default:
89 return NULL;
90 }
91 return $ret;
92}
93
94function dynamic_title_search ()
95{
96 if (isset ($_REQUEST['q']))
97 {
98 $ret['name'] = "search results for '${_REQUEST['q']}'";
99 $ret['params']['q'] = $_REQUEST['q'];
100 }
101 else
102 {
103 $ret['name'] = "search results";
104 $ret['params'] = array();
105 }
106 return $ret;
107}
108
109function dynamic_title_objgroup ()
110{
111 global $pageno;
112 $ret = array();
113 switch ($pageno)
114 {
115 case 'objgroup':
116 assertUIntArg ('group_id');
117 $groupInfo = getObjectGroupInfo ($_REQUEST['group_id']);
118 if ($groupInfo == NULL)
119 {
120 showError ('getObjectGroupInfo() failed in dynamic_title_objgroup()');
121 return NULL;
122 }
123 $ret['name'] = $groupInfo['name'];
124 $ret['params']['group_id'] = $groupInfo['id'];
125 break;
126 case 'object':
127 assertUIntArg ('object_id');
128 $objectInfo = getObjectInfo ($_REQUEST['object_id']);
129 if ($objectInfo == NULL)
130 {
131 showError ('getObjectInfo() failed in dynamic_title_objgroup()');
132 return NULL;
133 }
134 $ret['name'] = $objectInfo['objtype_name'];
135 $ret['params']['group_id'] = $objectInfo['objtype_id'];
136 break;
137 default:
138 return NULL;
139 }
140 return $ret;
141}
142
143function static_title ($pageno)
144{
145 $ret['params'] = array();
146 switch ($pageno)
147 {
148 case 'index':
149 $ret['name'] = 'Main page';
150 break;
151 case 'ipv4space':
152 $ret['name'] = 'IPv4 space';
153 break;
154 case 'rackspace':
155 $ret['name'] = 'Rackspace';
156 break;
157 case 'objects':
158 $ret['name'] = 'Objects';
159 break;
160 case 'perms':
161 $ret['name'] = 'Permissions';
162 break;
163 case 'config':
164 $ret['name'] = 'Configuration';
165 break;
166 case 'accounts':
167 $ret['name'] = 'Accounts';
168 break;
169 case 'portmap':
170 $ret['name'] = 'Port compatibility map';
171 break;
172 case 'attrs':
173 $ret['name'] = 'Attributes';
174 break;
175 case 'dict':
176 $ret['name'] = 'Dictionary';
177 break;
178 case 'ui':
179 $ret['name'] = '[ User interface ]';
180 break;
181 case 'ro':
182 $ret['name'] = 'config.php';
183 break;
184 case 'reports':
185 $ret['name'] = 'Reports';
186 break;
ae545907
DO
187 case 'help':
188 $ret['name'] = 'Help';
189 break;
e673ee24
DO
190 default:
191 $ret['name'] = 'UNKNOWN';
192 break;
193 }
194 return $ret;
195}
196
197?>