r2988 - displayedName(): rework into setDisplayedName(), which also sets {$nameless...
authorDenis Ovsienko <infrastation@yandex.ru>
Tue, 21 Jul 2009 08:23:36 +0000 (08:23 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 21 Jul 2009 08:23:36 +0000 (08:23 +0000)
ChangeLog
inc/database.php
inc/functions.php

index 26edd578b1bd1c190d90eb8d657a3a968743a86b..bc1581ed17d23fc3f177ef702b41d302c9a2bf87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 0.17.2
        new feature: configure default SNMP community (by jthurman)
-       new feature: "$untagged", "$portless" and "$masklen_OP_NN" autotags
+       new feature: "$untagged", "$portless", "$nameless" and "$masklen_OP_NN" autotags
        new feature: knight button in IPv4 tree
        new feature: searching by attribute value or port reservation comment
        update: show appropriate message, if a record cannot be found
index faabbbc88124271d3958dc83c69851abf97925f5..0354b172cdab377cc17b020e913f8dc4e3c7fbd1 100644 (file)
@@ -322,7 +322,7 @@ function listCells ($realm, $parent_id = 0)
                switch ($realm)
                {
                case 'object':
-                       $ret[$entity_id]['dname'] = displayedName ($ret[$entity_id]);
+                       setDisplayedName ($ret[$entity_id]);
                        break;
                case 'ipv4net':
                        $ret[$entity_id]['ip_bin'] = ip2long ($ret[$entity_id]['ip']);
@@ -400,7 +400,7 @@ function spotEntity ($realm, $id)
        switch ($realm)
        {
        case 'object':
-               $ret['dname'] = displayedName ($ret);
+               setDisplayedName ($ret);
                break;
        case 'ipv4net':
                $ret['ip_bin'] = ip2long ($ret['ip']);
index d2657b98b18956f96a9a46c400dab1a8bb7e607b..e663c83b8bf3f93143e9496bdcb9e7c7a408c426 100644 (file)
@@ -195,24 +195,17 @@ function assertIPv4Arg ($argname, $caller = 'N/A', $ok_if_empty = FALSE)
 // Objects of some types should be explicitly shown as
 // anonymous (labelless). This function is a single place where the
 // decision about displayed name is made.
-function displayedName ($objectData)
+function setDisplayedName (&$cell)
 {
-       if ($objectData['name'] != '')
-               return $objectData['name'];
-       // handle transition of argument type
-       if (isset ($objectData['realm']))
-       {
-               if (considerConfiguredConstraint ($objectData, 'NAMEWARN_LISTSRC'))
-                       return "ANONYMOUS " . $objectData['objtype_name'];
-               else
-                       return "[${objectData['objtype_name']}]";
-       }
+       if ($cell['name'] != '')
+               $cell['dname'] = $cell['name'];
        else
        {
-               if (considerConfiguredConstraint (spotEntity ('object', $objectData['id']), 'NAMEWARN_LISTSRC'))
-                       return "ANONYMOUS " . $objectData['objtype_name'];
+               $cell['atags'][] = array ('tag' => '$nameless');
+               if (considerConfiguredConstraint ($cell, 'NAMEWARN_LISTSRC'))
+                       $cell['dname'] = 'ANONYMOUS ' . $cell['objtype_name'];
                else
-                       return "[${objectData['objtype_name']}]";
+                       $cell['dname'] = '[' . $cell['objtype_name'] . ']';
        }
 }