r1421 + testing the new tabhandler array
authorDenis Ovsienko <infrastation@yandex.ru>
Mon, 24 Dec 2007 17:48:00 +0000 (17:48 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Mon, 24 Dec 2007 17:48:00 +0000 (17:48 +0000)
inc/navigation.php
inc/pagehandlers.php
index.php

index b21408aa0545c5e6477c70450d3cc326db4188cb..b33f8ad064b261a607c6ab6fc8aa14d5d455134c 100644 (file)
@@ -53,7 +53,6 @@ $page['objgroup']['bypass'] = 'group_id';
 $page['objgroup']['parent'] = 'objects';
 
 $page['object']['title'] = 'dynamic_title_object';
 $page['objgroup']['parent'] = 'objects';
 
 $page['object']['title'] = 'dynamic_title_object';
-$page['object']['handler'] = 'handler_object';
 $page['object']['bypass'] = 'object_id';
 $page['object']['parent'] = 'objgroup';
 $tab['object']['default'] = 'View';
 $page['object']['bypass'] = 'object_id';
 $page['object']['parent'] = 'objgroup';
 $tab['object']['default'] = 'View';
@@ -64,6 +63,14 @@ $tab['object']['network'] = 'IPv4';
 $tab['object']['portfwrd'] = 'NATv4';
 $tab['object']['switchvlans'] = 'Live VLANs';
 $tab['object']['snmpportfinder'] = 'SNMP port finder';
 $tab['object']['portfwrd'] = 'NATv4';
 $tab['object']['switchvlans'] = 'Live VLANs';
 $tab['object']['snmpportfinder'] = 'SNMP port finder';
+$tabhandler['object']['default'] = 'renderRackObject';
+$tabhandler['object']['edit'] = 'renderEditObjectForm';
+$tabhandler['object']['rackspace'] = 'renderRackSpaceForObject';
+$tabhandler['object']['ports'] = 'renderPortsForObject';
+$tabhandler['object']['network'] = 'renderNetworkForObject';
+$tabhandler['object']['portfwrd'] = 'renderIPAddressPortForwarding';
+$tabhandler['object']['switchvlans'] = 'renderVLANMembership';
+$tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
 $helptab['object']['network'] = 'nets';
 $helptab['object']['ports'] = 'ports';
 $helptab['object']['portfwrd'] = 'nets';
 $helptab['object']['network'] = 'nets';
 $helptab['object']['ports'] = 'ports';
 $helptab['object']['portfwrd'] = 'nets';
index d4d220a7f4c6aeede0bff412d883d172102b1789..d2a7783632b2dc8d54890cc43a417f2752cccb57 100644 (file)
@@ -110,40 +110,6 @@ function handler_rack ($tabno)
        }
 }
 
        }
 }
 
-function handler_object ($tabno)
-{
-       assertUIntArg ('object_id');
-       switch ($tabno)
-       {
-               case 'default':
-                       renderRackObject ($_REQUEST['object_id']);
-                       break;
-               case 'rackspace':
-                       renderRackSpaceForObject ($_REQUEST['object_id']);
-                       break;
-               case 'ports':
-                       renderPortsForObject ($_REQUEST['object_id']);
-                       break;
-               case 'network':
-                       renderNetworkForObject ($_REQUEST['object_id']);
-                       break;
-               case 'edit':
-                       renderEditObjectForm ($_REQUEST['object_id']);
-                       break;
-               case 'portfwrd':
-                       renderIPAddressPortForwarding($_REQUEST['object_id']);
-                       break;
-               case 'switchvlans':
-                       renderVLANMembership($_REQUEST['object_id']);
-                       break;
-               case 'snmpportfinder':
-                       renderSNMPPortFinder($_REQUEST['object_id']);
-                       break;
-               default:
-                       showError ("Invalid tab '${tabno}' requested in handler_object().");
-       }
-}
-
 function handler_objects ($tabno)
 {
        switch ($tabno)
 function handler_objects ($tabno)
 {
        switch ($tabno)
index 9f5edf1b5dd36b7caff77b42e557520dbedb5959..c990c6221070c84296a92b26672dfb6e6c30348b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -69,7 +69,14 @@ foreach (array ('F', 'A', 'U', 'T', 'Th', 'Tw', 'Thw') as $statecode)
  <tr>
   <td colspan=2>
 <?php
  <tr>
   <td colspan=2>
 <?php
-if (isset ($page[$pageno]['handler']))
+if (isset ($tabhandler[$pageno][$tabno]))
+{
+       if (isset ($page[$pageno]['bypass']))
+               $tabhandler[$pageno][$tabno] ($page[$pageno]['bypass']);
+       else
+               $tabhandler[$pageno][$tabno] ();
+}
+elseif (isset ($page[$pageno]['handler']))
        $page[$pageno]['handler'] ($tabno);
 else
        showError ("Failed to find handler for page '${pageno}'");
        $page[$pageno]['handler'] ($tabno);
 else
        showError ("Failed to find handler for page '${pageno}'");