2 => 9
);
+$virtual_obj_types = array
+(
+ 1504,
+ 1505,
+ 1506,
+ 1507
+);
+
$netmaskbylen = array
(
32 => '255.255.255.255',
function renderEditObjectForm ($object_id)
{
- global $pageno;
+ global $pageno, $virtual_obj_types;
$object = spotEntity ('object', $object_id);
startPortlet ();
printOpFormIntro ('update');
echo "<tr><td> </td><th colspan=2><h2>Attributes</h2></th></tr>";
// baseline info
echo "<tr><td> </td><th class=tdright>Common name:</th><td class=tdleft><input type=text name=object_name value='${object['name']}'></td></tr>\n";
- if (considerConfiguredConstraint ($object, 'VIRTUAL_OBJ_LISTSRC'))
+ if (in_array($object['objtype_id'], $virtual_obj_types))
{
echo "<input type=hidden name=object_label value=''>\n";
echo "<input type=hidden name=object_asset_no value=''>\n";
function renderRackObject ($object_id)
{
- global $nextorder, $aac;
+ global $nextorder, $aac, $virtual_obj_types;
$info = spotEntity ('object', $object_id);
// FIXME: employ amplifyCell() instead of calling loader functions directly
amplifyCell ($info);
// After left column we have (surprise!) right column with rackspace portlet only.
echo "<td class=pcright>";
- if (!considerConfiguredConstraint ($info, 'VIRTUAL_OBJ_LISTSRC'))
+ if (!in_array($info['objtype_id'], $virtual_obj_types))
{
// rackspace portlet
startPortlet ('rackspace allocation');
function renderAddMultipleObjectsForm ()
{
+ global $virtual_obj_types;
$typelist = readChapter (CHAP_OBJTYPE, 'o');
$typelist[0] = 'select type...';
$typelist = cookOptgroups ($typelist);
$max = getConfigVar ('MASSCOUNT');
$tabindex = 100;
- $virt_obj_listsrc = getConfigVar ('VIRTUAL_OBJ_LISTSRC');
// create a list containing only physical object types
- // FIXME: find a cleaner way of checking whether or not an object type exists in the config var
$phys_typelist = $typelist;
foreach ($phys_typelist['other'] as $key => $value)
{
- if ($key > 0 && substr_count($virt_obj_listsrc, 'typeid_'.$key.'}') > 0)
+ if ($key > 0 && in_array($key, $virtual_obj_types))
unset($phys_typelist['other'][$key]);
}
startPortlet ('Physcial objects');
finishPortlet();
// create a list containing only virtual object types
- // FIXME: find a cleaner way of checking whether or not an object type exists in the config var
$virt_typelist = $typelist;
foreach ($virt_typelist['other'] as $key => $value)
{
- if ($key > 0 && substr_count($virt_obj_listsrc, 'typeid_'.$key.'}') == 0)
+ if ($key > 0 && !in_array($key, $virtual_obj_types))
unset($virt_typelist['other'][$key]);
}
startPortlet ('Virtual objects');
setConfigVar ('SHRINK_TAG_TREE_ON_CLICK', 'yes');
setConfigVar ('MAX_UNFILTERED_ENTITIES', '0');
setConfigVar ('SYNCDOMAIN_MAX_PROCESSES', '0');
- setConfigVar ('VIRTUAL_OBJ_LISTSRC', '{$typeid_1504} or {$typeid_1505} or {$typeid_1506} or {$typeid_1507}');
setConfigVar ('PORT_EXCLUSION_LISTSRC', '{$typeid_3} or {$typeid_10} or {$typeid_11} or {$typeid_1505} or {$typeid_1506}');
return buildRedirectURL (__FUNCTION__, 'OK');
}
function trigger_rackspace ()
{
- // Hide the tab if the object type exists in the virtual config option
+ global $virtual_obj_types;
+
+ // Hide the tab if the object type is virtual
assertUIntArg ('object_id');
- if (considerConfiguredConstraint (spotEntity ('object', $_REQUEST['object_id']), 'VIRTUAL_OBJ_LISTSRC'))
+ $object = spotEntity ('object', $_REQUEST['object_id']);
+ if (in_array($object['objtype_id'], $virtual_obj_types))
return '';
$rackspace = getRackspaceStats();
('SHRINK_TAG_TREE_ON_CLICK','yes','string','no','no','yes','Dynamically hide useless tags in tagtree'),
('MAX_UNFILTERED_ENTITIES','0','uint','no','no','yes','Max item count to display on unfiltered result page'),
('SYNCDOMAIN_MAX_PROCESSES','0','uint','yes','no', 'no', 'How many worker proceses syncdomain cron script should create'),
-('VIRTUAL_OBJ_LISTSRC','{\$typeid_1504} or {\$typeid_1505} or {\$typeid_1506} or {\$typeid_1507}','string','yes','no','no','List source: virtual objects'),
('PORT_EXCLUSION_LISTSRC','{\$typeid_3} or {\$typeid_10} or {\$typeid_11} or {\$typeid_1505} or {\$typeid_1506}','string','yes','no','no','List source: objects without ports'),
('DB_VERSION','0.19.0','string','no','yes','no','Database version.');
$query[] = "INSERT INTO `ObjectParentCompat` (`parent_objtype_id`, `child_objtype_id`) VALUES (1505,1506)";
$query[] = "INSERT INTO `ObjectParentCompat` (`parent_objtype_id`, `child_objtype_id`) VALUES (1505,1507)";
$query[] = "INSERT INTO `ObjectParentCompat` (`parent_objtype_id`, `child_objtype_id`) VALUES (1506,1504)";
- $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, is_userdefined, description) VALUES ('VIRTUAL_OBJ_LISTSRC','{\$typeid_1504} or {\$typeid_1505} or {\$typeid_1506} or {\$typeid_1507}','string','yes','no','no','List source: virtual objects')";
$query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, is_userdefined, description) VALUES ('PORT_EXCLUSION_LISTSRC','{\$typeid_3} or {\$typeid_10} or {\$typeid_11} or {\$typeid_1505} or {\$typeid_1506}','string','yes','no','no','List source: objects without ports')";
$query[] = "UPDATE Config SET varvalue = CONCAT(varvalue, ' or {\$typeid_2} or {\$typeid_6} or {\$typeid_1502} or {\$typeid_1503} or {\$typeid_1504} or {\$typeid_1507}') WHERE varname = 'IPV4OBJ_LISTSRC'";
$query[] = "UPDATE Config SET varvalue = '8' WHERE varname = 'MASSCOUNT'";