r1245 + initial frame coding for the new gateway (SNMP port finder)
authorDenis Ovsienko <infrastation@yandex.ru>
Tue, 6 Nov 2007 12:15:13 +0000 (12:15 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 6 Nov 2007 12:15:13 +0000 (12:15 +0000)
inc/interface.php
inc/navigation.php
inc/pagehandlers.php
inc/triggers.php

index 89815855a0e318f417cc48077250e21801fbba9e..1c1a93d559a137c8002012e920f96c5a52a1e733 100644 (file)
@@ -3112,4 +3112,22 @@ function renderVLANMembership ($object_id = 0)
        echo '</td></tr></table>';
 }
 
+// This snippet either renders a form inviting the user to start SNMP query
+// on the current device or displays the result of the scan.
+function renderSNMPPortFinder ($object_id = 0)
+{
+       global $root, $pageno, $tabno, $remote_username;
+       if ($object_id <= 0)
+       {
+               showError ('Invalid object_id in renderSNMPPortFinder()');
+               return;
+       }
+       if (isset ($_REQUEST['do_scan']))
+       {
+               echo "Here come the scan results.";
+               return;
+       }
+       echo "Does this look like a form?";
+}
+
 ?>
index 6f26cda408b059e47840cb1813582b185a187fa9..d6b11652736718c9d74dd477c876e71b8fc21e20 100644 (file)
@@ -61,11 +61,13 @@ $tab['object']['ports'] = 'Ports';
 $tab['object']['network'] = 'IPv4';
 $tab['object']['portfwrd'] = 'NATv4';
 $tab['object']['switchvlans'] = 'VLANs';
+$tab['object']['snmpportfinder'] = 'SNMP port finder';
 $helptab['object']['network'] = 'nets';
 $helptab['object']['ports'] = 'ports';
 $helptab['object']['portfwrd'] = 'nets';
 $helptab['object']['rackspace'] = 'rackspace';
 $trigger['object']['switchvlans'] = 'trigger_switchvlans';
+$trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
 $ophandler['object']['ports']['addPort'] = 'addPortForObject';
 $ophandler['object']['ports']['delPort'] = 'delPortFromObject';
 $ophandler['object']['ports']['editPort'] = 'editPortForObject';
index d1861b81daf44840a0ed78793c46ca5058c3e630..8136e272afd62789ad0aed85074f58236202f9e7 100644 (file)
@@ -136,6 +136,9 @@ function handler_object ($tabno)
                case 'switchvlans':
                        renderVLANMembership($_REQUEST['object_id']);
                        break;
+               case 'snmpportfinder':
+                       renderSNMPPortFinder($_REQUEST['object_id']);
+                       break;
                default:
                        showError ("Invalid tab '${tabno}' requested in handler_object().");
        }
index b554814f6d6769ffbc79be5abad8e3cd673b7904..efd5136fcdba13aac680f6681030ed8e50eaeab8 100644 (file)
@@ -35,4 +35,20 @@ function trigger_switchvlans ()
        return FALSE;
 }
 
+// SNMP port finder tab trigger. At the moment we decide on showing it
+// for pristine switches only. Once a user has begun
+// filling the data in, we stop showing the tab.
+function trigger_snmpportfinder ()
+{
+       assertUIntArg ('object_id');
+       $object_id = $_REQUEST['object_id'];
+       $object = getObjectInfo ($object_id);
+       if ($object['objtype_id'] != 8)
+               return FALSE;
+       $tails = getObjectPortsAndLinks ($object_id);
+       if (count ($tails))
+               return FALSE;
+       return TRUE;
+}
+
 ?>