r1492 + learn to list RS pools
[racktables] / inc / pagetitles.php
index 11a88271679beb2bb43545809cc1be5372d443e6..b572db22c650ae90334a66506ddf553669c79c66 100644 (file)
@@ -1,4 +1,4 @@
-<?
+<?php
 /*
 *
 *  This file is a library of title generation functions for RackTables.
@@ -39,7 +39,7 @@ function dynamic_title_row ()
                        $rack = getRackData ($_REQUEST['rack_id']);
                        if ($rack == NULL)
                        {
-                               showError ('getRackData() failed in dynamic_title_row()');
+                               showError ('getRackData() failed', __FUNCTION__);
                                return NULL;
                        }
                        $ret['name'] = $rack['row_name'];
@@ -50,7 +50,7 @@ function dynamic_title_row ()
                        $rowInfo = getRackRowInfo ($_REQUEST['row_id']);
                        if ($rowInfo == NULL)
                        {
-                               showError ('getRackRowInfo() failed in dynamic_title_row()');
+                               showError ('getRackRowInfo() failed', __FUNCTION__);
                                return NULL;
                        }
                        $ret['name'] = $rowInfo['dict_value'];
@@ -79,7 +79,7 @@ function dynamic_title_object ()
                        $object = getObjectInfo ($_REQUEST['object_id']);
                        if ($object == NULL)
                        {
-                               showError ('getObjectInfo() failed in dynamic_title_object()');
+                               showError ('getObjectInfo() failed', __FUNCTION__);
                                return NULL;
                        }
                        $ret['name'] = $object['dname'];
@@ -91,6 +91,41 @@ function dynamic_title_object ()
        return $ret;
 }
 
+function dynamic_title_vservice ()
+{
+       global $pageno;
+       $ret = array();
+       switch ($pageno)
+       {
+               case 'vservice':
+                       assertUIntArg ('id');
+                       $ret['name'] = buildVServiceName (getVServiceInfo ($_REQUEST['id']));
+                       $ret['params']['id'] = $_REQUEST['id'];
+                       break;
+               default:
+                       return NULL;
+       }
+       return $ret;
+}
+
+function dynamic_title_rspool ()
+{
+       global $pageno;
+       $ret = array();
+       switch ($pageno)
+       {
+               case 'rspool':
+                       assertUIntArg ('id');
+                       $poolInfo = getRSPoolInfo ($_REQUEST['id']);
+                       $ret['name'] = empty ($poolInfo['name']) ? '' : 'ANONYMOUS' . $poolInfo['name'];
+                       $ret['params']['id'] = $_REQUEST['id'];
+                       break;
+               default:
+                       return NULL;
+       }
+       return $ret;
+}
+
 function dynamic_title_search ()
 {
        if (isset ($_REQUEST['q']))
@@ -117,7 +152,7 @@ function dynamic_title_objgroup ()
                        $groupInfo = getObjectGroupInfo ($_REQUEST['group_id']);
                        if ($groupInfo == NULL)
                        {
-                               showError ('getObjectGroupInfo() failed in dynamic_title_objgroup()');
+                               showError ('getObjectGroupInfo() failed', __FUNCTION__);
                                return NULL;
                        }
                        $ret['name'] = $groupInfo['name'];
@@ -128,7 +163,7 @@ function dynamic_title_objgroup ()
                        $objectInfo = getObjectInfo ($_REQUEST['object_id']);
                        if ($objectInfo == NULL)
                        {
-                               showError ('getObjectInfo() failed in dynamic_title_objgroup()');
+                               showError ('getObjectInfo() failed', __FUNCTION__);
                                return NULL;
                        }
                        $ret['name'] = $objectInfo['objtype_name'];
@@ -140,58 +175,4 @@ function dynamic_title_objgroup ()
        return $ret;
 }
 
-function static_title ($pageno)
-{
-       $ret['params'] = array();
-       switch ($pageno)
-       {
-               case 'index':
-                       $ret['name'] = 'Main page';
-                       break;
-               case 'ipv4space':
-                       $ret['name'] = 'IPv4 space';
-                       break;
-               case 'rackspace':
-                       $ret['name'] = 'Rackspace';
-                       break;
-               case 'objects':
-                       $ret['name'] = 'Objects';
-                       break;
-               case 'perms':
-                       $ret['name'] = 'Permissions';
-                       break;
-               case 'config':
-                       $ret['name'] = 'Configuration';
-                       break;
-               case 'accounts':
-                       $ret['name'] = 'Accounts';
-                       break;
-               case 'portmap':
-                       $ret['name'] = 'Port compatibility map';
-                       break;
-               case 'attrs':
-                       $ret['name'] = 'Attributes';
-                       break;
-               case 'dict':
-                       $ret['name'] = 'Dictionary';
-                       break;
-               case 'ui':
-                       $ret['name'] = '[ User interface ]';
-                       break;
-               case 'ro':
-                       $ret['name'] = 'config.php';
-                       break;
-               case 'reports':
-                       $ret['name'] = '[ Reports ]';
-                       break;
-               case 'help':
-                       $ret['name'] = '[ Help ]';
-                       break;
-               default:
-                       $ret['name'] = 'UNKNOWN';
-                       break;
-       }
-       return $ret;
-}
-
 ?>