navigation.php: replace function call with a static string, which will be overridden upon loading the config
interface.php: move $image array and 7 functions to interface-lib.php (new file)
init.php: require interface-lib.php unconditionally, gather require stements at top
require_once 'config.php';
require_once 'functions.php';
require_once 'database.php';
+require_once 'auth.php';
+require_once 'navigation.php';
+require_once 'triggers.php';
+require_once 'gateways.php';
+require_once 'IPv6.php';
+require_once 'interface-lib.php';
// Always have default values for these options, so if a user didn't
// care to set, something would be working anyway.
$user_auth_src = 'database';
$_SERVER['REMOTE_USER'] = escapeString ($_SERVER['REMOTE_USER']);
loadConfigDefaults();
+$tab['reports']['local'] = getConfigVar ('enterprise');
if (getConfigVar ('DB_VERSION') != CODE_VERSION)
{
$tagtree = treeFromList ($taglist);
sortTree ($tagtree, 'taginfoCmp');
-require_once 'auth.php';
$auto_tags = array();
// Initial chain for the current user.
$user_given_tags = array();
}
alterConfigWithUserPreferences();
-
-require_once 'navigation.php';
-require_once 'triggers.php';
-
-
$op = '';
-require_once 'gateways.php';
// local.php may be missing, this case requires no special treatment
// and must not generate any warnings
ob_start();
// Initial chain for the current target.
$target_given_tags = array();
-require_once 'IPv6.php';
-
?>
--- /dev/null
+<?php
+
+// Let's have it here, so extensions can add their own images.
+$image = array();
+$image['logo']['path'] = 'pix/defaultlogo.png';
+$image['logo']['width'] = 210;
+$image['logo']['height'] = 40;
+$image['rackspace']['path'] = 'pix/racks.png';
+$image['rackspace']['width'] = 218;
+$image['rackspace']['height'] = 200;
+$image['objects']['path'] = 'pix/server.png';
+$image['objects']['width'] = 218;
+$image['objects']['height'] = 200;
+$image['depot']['path'] = 'pix/server.png';
+$image['depot']['width'] = 218;
+$image['depot']['height'] = 200;
+$image['files']['path'] = 'pix/files.png';
+$image['files']['width'] = 218;
+$image['files']['height'] = 200;
+$image['ipv4space']['path'] = 'pix/addressspace.png';
+$image['ipv4space']['width'] = 218;
+$image['ipv4space']['height'] = 200;
+$image['ipv6space']['path'] = 'pix/addressspacev6.png';
+$image['ipv6space']['width'] = 218;
+$image['ipv6space']['height'] = 200;
+$image['ipv4slb']['path'] = 'pix/slb.png';
+$image['ipv4slb']['width'] = 218;
+$image['ipv4slb']['height'] = 200;
+$image['config']['path'] = 'pix/configuration.png';
+$image['config']['width'] = 218;
+$image['config']['height'] = 200;
+$image['reports']['path'] = 'pix/report.png';
+$image['reports']['width'] = 218;
+$image['reports']['height'] = 200;
+$image['8021q']['path'] = 'pix/8021q.png';
+$image['8021q']['width'] = 218;
+$image['8021q']['height'] = 200;
+$image['objectlog']['path'] = 'pix/crystal-mimetypes-shellscript-218x200.png';
+$image['objectlog']['width'] = 218;
+$image['objectlog']['height'] = 200;
+$image['virtual']['path'] = 'pix/virtualresources.png';
+$image['virtual']['width'] = 218;
+$image['virtual']['height'] = 200;
+$image['download']['path'] = 'pix/download.png';
+$image['download']['width'] = 16;
+$image['download']['height'] = 16;
+$image['DOWNLOAD']['path'] = 'pix/download-big.png';
+$image['DOWNLOAD']['width'] = 32;
+$image['DOWNLOAD']['height'] = 32;
+$image['plug']['path'] = 'pix/tango-network-wired.png';
+$image['plug']['width'] = 16;
+$image['plug']['height'] = 16;
+$image['cut']['path'] = 'pix/tango-edit-cut-16x16.png';
+$image['cut']['width'] = 16;
+$image['cut']['height'] = 16;
+$image['Cut']['path'] = 'pix/tango-edit-cut-22x22.png';
+$image['Cut']['width'] = 22;
+$image['Cut']['height'] = 22;
+$image['CUT']['path'] = 'pix/tango-edit-cut-32x32.png';
+$image['CUT']['width'] = 32;
+$image['CUT']['height'] = 32;
+$image['add']['path'] = 'pix/tango-list-add.png';
+$image['add']['width'] = 16;
+$image['add']['height'] = 16;
+$image['ADD']['path'] = 'pix/tango-list-add-big.png';
+$image['ADD']['width'] = 32;
+$image['ADD']['height'] = 32;
+$image['delete']['path'] = 'pix/tango-list-remove.png';
+$image['delete']['width'] = 16;
+$image['delete']['height'] = 16;
+$image['DELETE']['path'] = 'pix/tango-list-remove-32x32.png';
+$image['DELETE']['width'] = 32;
+$image['DELETE']['height'] = 32;
+$image['destroy']['path'] = 'pix/tango-user-trash-16x16.png';
+$image['destroy']['width'] = 16;
+$image['destroy']['height'] = 16;
+$image['nodestroy']['path'] = 'pix/tango-user-trash-16x16-gray.png';
+$image['nodestroy']['width'] = 16;
+$image['nodestroy']['height'] = 16;
+$image['NODESTROY']['path'] = 'pix/tango-user-trash-32x32-gray.png';
+$image['NODESTROY']['width'] = 32;
+$image['NODESTROY']['height'] = 32;
+$image['DESTROY']['path'] = 'pix/tango-user-trash-32x32.png';
+$image['DESTROY']['width'] = 32;
+$image['DESTROY']['height'] = 32;
+$image['nodelete']['path'] = 'pix/tango-list-remove-shadow.png';
+$image['nodelete']['width'] = 16;
+$image['nodelete']['height'] = 16;
+$image['inservice']['path'] = 'pix/tango-emblem-system.png';
+$image['inservice']['width'] = 16;
+$image['inservice']['height'] = 16;
+$image['notinservice']['path'] = 'pix/tango-dialog-error.png';
+$image['notinservice']['width'] = 16;
+$image['notinservice']['height'] = 16;
+$image['find']['path'] = 'pix/tango-system-search.png';
+$image['find']['width'] = 16;
+$image['find']['height'] = 16;
+$image['next']['path'] = 'pix/tango-go-next.png';
+$image['next']['width'] = 32;
+$image['next']['height'] = 32;
+$image['prev']['path'] = 'pix/tango-go-previous.png';
+$image['prev']['width'] = 32;
+$image['prev']['height'] = 32;
+$image['COMMIT']['path'] = 'pix/tango-go-prev-next-32x32.png';
+$image['COMMIT']['width'] = 32;
+$image['COMMIT']['height'] = 32;
+$image['COMMIT gray']['path'] = 'pix/tango-go-prev-next-gray-32x32.png';
+$image['COMMIT gray']['width'] = 32;
+$image['COMMIT gray']['height'] = 32;
+$image['RECALC']['path'] = 'pix/tango-view-refresh-32x32.png';
+$image['RECALC']['width'] = 32;
+$image['RECALC']['height'] = 32;
+$image['clear']['path'] = 'pix/tango-edit-clear.png';
+$image['clear']['width'] = 16;
+$image['clear']['height'] = 16;
+$image['CLEAR']['path'] = 'pix/tango-edit-clear-big.png';
+$image['CLEAR']['width'] = 32;
+$image['CLEAR']['height'] = 32;
+$image['CLEAR gray']['path'] = 'pix/tango-edit-clear-gray-32x32.png';
+$image['CLEAR gray']['width'] = 32;
+$image['CLEAR gray']['height'] = 32;
+$image['save']['path'] = 'pix/tango-document-save-16x16.png';
+$image['save']['width'] = 16;
+$image['save']['height'] = 16;
+$image['SAVE']['path'] = 'pix/tango-document-save-32x32.png';
+$image['SAVE']['width'] = 32;
+$image['SAVE']['height'] = 32;
+$image['NOSAVE']['path'] = 'pix/tango-document-save-32x32-gray.png';
+$image['NOSAVE']['width'] = 32;
+$image['NOSAVE']['height'] = 32;
+$image['create']['path'] = 'pix/tango-document-new.png';
+$image['create']['width'] = 16;
+$image['create']['height'] = 16;
+$image['CREATE']['path'] = 'pix/tango-document-new-big.png';
+$image['CREATE']['width'] = 32;
+$image['CREATE']['height'] = 32;
+$image['DENIED']['path'] = 'pix/tango-dialog-error-big.png';
+$image['DENIED']['width'] = 32;
+$image['DENIED']['height'] = 32;
+$image['node-collapsed']['path'] = 'pix/node-collapsed.png';
+$image['node-collapsed']['width'] = 16;
+$image['node-collapsed']['height'] = 16;
+$image['node-expanded']['path'] = 'pix/node-expanded.png';
+$image['node-expanded']['width'] = 16;
+$image['node-expanded']['height'] = 16;
+$image['node-expanded-static']['path'] = 'pix/node-expanded-static.png';
+$image['node-expanded-static']['width'] = 16;
+$image['node-expanded-static']['height'] = 16;
+$image['dragons']['path'] = 'pix/mitsudragon.png';
+$image['dragons']['width'] = 195;
+$image['dragons']['height'] = 33;
+$image['LB']['path'] = 'pix/loadbalancer.png';
+$image['LB']['width'] = 32;
+$image['LB']['height'] = 32;
+$image['RS pool']['path'] = 'pix/serverpool.png';
+$image['RS pool']['width'] = 48;
+$image['RS pool']['height'] = 16;
+$image['VS']['path'] = 'pix/servicesign.png';
+$image['VS']['width'] = 39;
+$image['VS']['height'] = 62;
+$image['router']['path'] = 'pix/router.png';
+$image['router']['width'] = 32;
+$image['router']['height'] = 32;
+$image['object']['path'] = 'pix/bracket-16x16.png';
+$image['object']['width'] = 16;
+$image['object']['height'] = 16;
+$image['OBJECT']['path'] = 'pix/bracket-32x32.png';
+$image['OBJECT']['width'] = 32;
+$image['OBJECT']['height'] = 32;
+$image['attach']['path'] = 'pix/tango-mail-attachment-16x16.png';
+$image['attach']['width'] = 16;
+$image['attach']['height'] = 16;
+$image['Attach']['path'] = 'pix/tango-mail-attachment-22x22.png';
+$image['Attach']['width'] = 22;
+$image['Attach']['height'] = 22;
+$image['ATTACH']['path'] = 'pix/tango-mail-attachment-32x32.png';
+$image['ATTACH']['width'] = 32;
+$image['ATTACH']['height'] = 32;
+$image['favorite']['path'] = 'pix/tango-emblem-favorite.png';
+$image['favorite']['width'] = 16;
+$image['favorite']['height'] = 16;
+$image['computer']['path'] = 'pix/tango-computer.png';
+$image['computer']['width'] = 16;
+$image['computer']['height'] = 16;
+$image['empty file']['path'] = 'pix/crystal-file-empty-32x32.png';
+$image['empty file']['width'] = 32;
+$image['empty file']['height'] = 32;
+$image['text file']['path'] = 'pix/crystal-file-text-32x32.png';
+$image['text file']['width'] = 32;
+$image['text file']['height'] = 32;
+$image['image file']['path'] = 'pix/crystal-file-image-32x32.png';
+$image['image file']['width'] = 32;
+$image['image file']['height'] = 32;
+$image['text']['path'] = 'pix/tango-text-x-generic-16x16.png';
+$image['text']['width'] = 16;
+$image['text']['height'] = 16;
+$image['NET']['path'] = 'pix/crystal-network_local-32x32.png';
+$image['NET']['width'] = 32;
+$image['NET']['height'] = 32;
+$image['net']['path'] = 'pix/crystal-network_local-16x16.png';
+$image['net']['width'] = 16;
+$image['net']['height'] = 16;
+$image['USER']['path'] = 'pix/crystal-edit-user-32x32.png';
+$image['USER']['width'] = 32;
+$image['USER']['height'] = 32;
+$image['setfilter']['path'] = 'pix/pgadmin3-viewfiltereddata.png';
+$image['setfilter']['width'] = 32;
+$image['setfilter']['height'] = 32;
+$image['setfilter gray']['path'] = 'pix/pgadmin3-viewfiltereddata-grayscale.png';
+$image['setfilter gray']['width'] = 32;
+$image['setfilter gray']['height'] = 32;
+$image['resetfilter']['path'] = 'pix/pgadmin3-viewdata.png';
+$image['resetfilter']['width'] = 32;
+$image['resetfilter']['height'] = 32;
+$image['resetfilter gray']['path'] = 'pix/pgadmin3-viewdata-grayscale.png';
+$image['resetfilter gray']['width'] = 32;
+$image['resetfilter gray']['height'] = 32;
+$image['knight']['path'] = 'pix/smiley_knight.png';
+$image['knight']['width'] = 72;
+$image['knight']['height'] = 33;
+$image['Zoom']['path'] = 'pix/tango-system-search-22x22.png';
+$image['Zoom']['width'] = 22;
+$image['Zoom']['height'] = 22;
+$image['Zooming']['path'] = 'pix/tango-view-fullscreen-22x22.png';
+$image['Zooming']['width'] = 22;
+$image['Zooming']['height'] = 22;
+$image['UNLOCK']['path'] = 'pix/crystal-actions-unlock-32x32.png';
+$image['UNLOCK']['width'] = 32;
+$image['UNLOCK']['height'] = 32;
+$image['CLOCK']['path'] = 'pix/tango-appointment-32x32.png';
+$image['CLOCK']['width'] = 32;
+$image['CLOCK']['height'] = 32;
+$image['DQUEUE done']['path'] = 'pix/crystal-ok-32x32.png';
+$image['DQUEUE done']['width'] = 32;
+$image['DQUEUE done']['height'] = 32;
+$image['DQUEUE sync_aging']['path'] = 'pix/tango-appointment-32x32.png';
+$image['DQUEUE sync_aging']['width'] = 32;
+$image['DQUEUE sync_aging']['height'] = 32;
+$image['DQUEUE resync_aging']['path'] = 'pix/tango-appointment-32x32.png';
+$image['DQUEUE resync_aging']['width'] = 32;
+$image['DQUEUE resync_aging']['height'] = 32;
+$image['DQUEUE sync_ready']['path'] = 'pix/tango-emblem-system-32x32.png';
+$image['DQUEUE sync_ready']['width'] = 32;
+$image['DQUEUE sync_ready']['height'] = 32;
+$image['DQUEUE resync_ready']['path'] = 'pix/tango-emblem-important-32x32.png';
+$image['DQUEUE resync_ready']['width'] = 32;
+$image['DQUEUE resync_ready']['height'] = 32;
+$image['DQUEUE failed']['path'] = 'pix/tango-emblem-unreadable-32x32.png';
+$image['DQUEUE failed']['width'] = 32;
+$image['DQUEUE failed']['height'] = 32;
+$image['DQUEUE disabled']['path'] = 'pix/tango-emblem-readonly-32x32.png';
+$image['DQUEUE disabled']['width'] = 32;
+$image['DQUEUE disabled']['height'] = 32;
+$image['COPY']['path'] = 'pix/tango-edit-copy-32x32.png';
+$image['COPY']['width'] = 32;
+$image['COPY']['height'] = 32;
+$image['html']['path'] = 'pix/tango-text-html.png';
+$image['html']['width'] = 16;
+$image['html']['height'] = 16;
+
+function printSelect ($optionList, $select_attrs = array(), $selected_id = NULL)
+{
+ echo getSelect ($optionList, $select_attrs, $selected_id);
+}
+
+// Input array keys are OPTION VALUEs and input array values are OPTION text.
+function getSelect ($optionList, $select_attrs = array(), $selected_id = NULL)
+{
+ $ret = '';
+ if (!array_key_exists ('name', $select_attrs))
+ return '';
+ // handle two corner cases in a specific way
+ if (count ($optionList) == 0)
+ return '(none)';
+ if (count ($optionList) == 1)
+ {
+ foreach ($optionList as $key => $value) { break; }
+ return "<input type=hidden name=${select_attrs['name']} id=${select_attrs['name']} value=${key}>" . $value;
+ }
+ if (!array_key_exists ('id', $select_attrs))
+ $select_attrs['id'] = $select_attrs['name'];
+ $ret .= '<select';
+ foreach ($select_attrs as $attr_name => $attr_value)
+ $ret .= " ${attr_name}=${attr_value}";
+ $ret .= '>';
+ foreach ($optionList as $dict_key => $dict_value)
+ $ret .= "<option value='${dict_key}'" . ($dict_key == $selected_id ? ' selected' : '') . ">${dict_value}</option>";
+ $ret .= '</select>';
+ return $ret;
+}
+
+function printNiftySelect ($groupList, $select_attrs = array(), $selected_id = NULL, $autocomplete = false)
+{
+ echo getNiftySelect ($groupList, $select_attrs, $selected_id);
+}
+
+// Input is a cooked list of OPTGROUPs, each with own sub-list of OPTIONs in the same
+// format as printSelect() expects.
+function getNiftySelect ($groupList, $select_attrs, $selected_id = NULL)
+{
+ // special treatment for ungrouped data
+ if (count ($groupList) == 1 and isset ($groupList['other']))
+ return getSelect ($groupList['other'], $select_attrs, $selected_id);
+ if (!array_key_exists ('name', $select_attrs))
+ return '';
+ if (!array_key_exists ('id', $select_attrs))
+ $select_attrs['id'] = $select_attrs['name'];
+ $ret = '<select';
+ foreach ($select_attrs as $attr_name => $attr_value)
+ $ret .= " ${attr_name}=${attr_value}";
+ $ret .= '>';
+ foreach ($groupList as $groupname => $groupdata)
+ {
+ $ret .= "<optgroup label='${groupname}'>";
+ foreach ($groupdata as $dict_key => $dict_value)
+ $ret .= "<option value='${dict_key}'" . ($dict_key == $selected_id ? ' selected' : '') . ">${dict_value}</option>";
+ $ret .= '</optgroup>';
+ }
+ $ret .= '</select>';
+ return $ret;
+}
+
+function printImageHREF ($tag, $title = '', $do_input = FALSE, $tabindex = 0)
+{
+ echo getImageHREF ($tag, $title, $do_input, $tabindex);
+}
+
+// this would be better called mkIMG(), make "IMG" HTML element
+function getImageHREF ($tag, $title = '', $do_input = FALSE, $tabindex = 0)
+{
+ global $image;
+ if (!isset ($image[$tag]))
+ $tag = 'error';
+ $img = $image[$tag];
+ $img['path'] = TSURI ($img['path']);
+ if ($do_input == TRUE)
+ return
+ "<input type=image name=submit class=icon " .
+ "src='${img['path']}' " .
+ "border=0 " .
+ ($tabindex ? "tabindex=${tabindex}" : '') .
+ (!strlen ($title) ? '' : " title='${title}'") . // JT: Add title to input hrefs too
+ ">";
+ else
+ return
+ "<img " .
+ "src='${img['path']}' " .
+ "width=${img['width']} " .
+ "height=${img['height']} " .
+ "border=0 " .
+ (!strlen ($title) ? '' : "title='${title}'") .
+ ">";
+}
+
+function renderAccessDenied ($and_exit = TRUE)
+{
+ header ('Content-Type: text/html; charset=UTF-8');
+ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
+ echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
+ echo "<head><title>RackTables: access denied</title>\n";
+ printPageHeaders();
+ echo "</head><body>";
+ global $pageno, $tabno,
+ $user_given_tags,
+ $target_given_tags,
+ $auto_tags,
+ $expl_tags,
+ $impl_tags;
+ echo "<table border=1 cellspacing=0 cellpadding=3 width='50%' align=center>\n";
+ echo '<tr><th colspan=2><h3>';
+ printImageHREF ('DENIED');
+ echo ' access denied ';
+ printImageHREF ('DENIED');
+ echo '</h3></th></tr>';
+ echo "<tr><th width='50%' class=tagchain>User given tags:</th><td class=tagchain>";
+ echo serializeTags ($user_given_tags) . " </td></tr>\n";
+ echo "<tr><th width='50%' class=tagchain>Target given tags:</th><td class=tagchain>";
+ echo serializeTags ($target_given_tags) . " </td></tr>\n";
+ echo "<tr><th width='50%' class=tagchain>Effective explicit tags:</th><td class=tagchain>";
+ echo serializeTags ($expl_tags) . " </td></tr>\n";
+ echo "<tr><th width='50%' class=tagchain>Effective implicit tags:</th><td class=tagchain>";
+ echo serializeTags ($impl_tags) . " </td></tr>\n";
+ echo "<tr><th width='50%' class=tagchain>Automatic tags:</th><td class=tagchain>";
+ echo serializeTags ($auto_tags) . " </td></tr>\n";
+ echo "<tr><th width='50%' class=tdright>Requested page:</th><td class=tdleft>${pageno}</td></tr>\n";
+ echo "<tr><th width='50%' class=tdright>Requested tab:</th><td class=tdleft>${tabno}</td></tr>\n";
+ echo "<tr><td colspan=2 align=center>Click <a href='index.php?logout'>here</a> to logout.</td></tr>\n";
+ echo "</table>\n";
+ echo "</body></html>";
+ if ($and_exit)
+ exit;
+}
+
+?>
# 'alien' => 'never touch',
);
-// Let's have it here, so extensions can add their own images.
-$image = array();
-$image['logo']['path'] = 'pix/defaultlogo.png';
-$image['logo']['width'] = 210;
-$image['logo']['height'] = 40;
-$image['rackspace']['path'] = 'pix/racks.png';
-$image['rackspace']['width'] = 218;
-$image['rackspace']['height'] = 200;
-$image['objects']['path'] = 'pix/server.png';
-$image['objects']['width'] = 218;
-$image['objects']['height'] = 200;
-$image['depot']['path'] = 'pix/server.png';
-$image['depot']['width'] = 218;
-$image['depot']['height'] = 200;
-$image['files']['path'] = 'pix/files.png';
-$image['files']['width'] = 218;
-$image['files']['height'] = 200;
-$image['ipv4space']['path'] = 'pix/addressspace.png';
-$image['ipv4space']['width'] = 218;
-$image['ipv4space']['height'] = 200;
-$image['ipv6space']['path'] = 'pix/addressspacev6.png';
-$image['ipv6space']['width'] = 218;
-$image['ipv6space']['height'] = 200;
-$image['ipv4slb']['path'] = 'pix/slb.png';
-$image['ipv4slb']['width'] = 218;
-$image['ipv4slb']['height'] = 200;
-$image['config']['path'] = 'pix/configuration.png';
-$image['config']['width'] = 218;
-$image['config']['height'] = 200;
-$image['reports']['path'] = 'pix/report.png';
-$image['reports']['width'] = 218;
-$image['reports']['height'] = 200;
-$image['8021q']['path'] = 'pix/8021q.png';
-$image['8021q']['width'] = 218;
-$image['8021q']['height'] = 200;
-$image['objectlog']['path'] = 'pix/crystal-mimetypes-shellscript-218x200.png';
-$image['objectlog']['width'] = 218;
-$image['objectlog']['height'] = 200;
-$image['virtual']['path'] = 'pix/virtualresources.png';
-$image['virtual']['width'] = 218;
-$image['virtual']['height'] = 200;
-$image['download']['path'] = 'pix/download.png';
-$image['download']['width'] = 16;
-$image['download']['height'] = 16;
-$image['DOWNLOAD']['path'] = 'pix/download-big.png';
-$image['DOWNLOAD']['width'] = 32;
-$image['DOWNLOAD']['height'] = 32;
-$image['plug']['path'] = 'pix/tango-network-wired.png';
-$image['plug']['width'] = 16;
-$image['plug']['height'] = 16;
-$image['cut']['path'] = 'pix/tango-edit-cut-16x16.png';
-$image['cut']['width'] = 16;
-$image['cut']['height'] = 16;
-$image['Cut']['path'] = 'pix/tango-edit-cut-22x22.png';
-$image['Cut']['width'] = 22;
-$image['Cut']['height'] = 22;
-$image['CUT']['path'] = 'pix/tango-edit-cut-32x32.png';
-$image['CUT']['width'] = 32;
-$image['CUT']['height'] = 32;
-$image['add']['path'] = 'pix/tango-list-add.png';
-$image['add']['width'] = 16;
-$image['add']['height'] = 16;
-$image['ADD']['path'] = 'pix/tango-list-add-big.png';
-$image['ADD']['width'] = 32;
-$image['ADD']['height'] = 32;
-$image['delete']['path'] = 'pix/tango-list-remove.png';
-$image['delete']['width'] = 16;
-$image['delete']['height'] = 16;
-$image['DELETE']['path'] = 'pix/tango-list-remove-32x32.png';
-$image['DELETE']['width'] = 32;
-$image['DELETE']['height'] = 32;
-$image['destroy']['path'] = 'pix/tango-user-trash-16x16.png';
-$image['destroy']['width'] = 16;
-$image['destroy']['height'] = 16;
-$image['nodestroy']['path'] = 'pix/tango-user-trash-16x16-gray.png';
-$image['nodestroy']['width'] = 16;
-$image['nodestroy']['height'] = 16;
-$image['NODESTROY']['path'] = 'pix/tango-user-trash-32x32-gray.png';
-$image['NODESTROY']['width'] = 32;
-$image['NODESTROY']['height'] = 32;
-$image['DESTROY']['path'] = 'pix/tango-user-trash-32x32.png';
-$image['DESTROY']['width'] = 32;
-$image['DESTROY']['height'] = 32;
-$image['nodelete']['path'] = 'pix/tango-list-remove-shadow.png';
-$image['nodelete']['width'] = 16;
-$image['nodelete']['height'] = 16;
-$image['inservice']['path'] = 'pix/tango-emblem-system.png';
-$image['inservice']['width'] = 16;
-$image['inservice']['height'] = 16;
-$image['notinservice']['path'] = 'pix/tango-dialog-error.png';
-$image['notinservice']['width'] = 16;
-$image['notinservice']['height'] = 16;
-$image['find']['path'] = 'pix/tango-system-search.png';
-$image['find']['width'] = 16;
-$image['find']['height'] = 16;
-$image['next']['path'] = 'pix/tango-go-next.png';
-$image['next']['width'] = 32;
-$image['next']['height'] = 32;
-$image['prev']['path'] = 'pix/tango-go-previous.png';
-$image['prev']['width'] = 32;
-$image['prev']['height'] = 32;
-$image['COMMIT']['path'] = 'pix/tango-go-prev-next-32x32.png';
-$image['COMMIT']['width'] = 32;
-$image['COMMIT']['height'] = 32;
-$image['COMMIT gray']['path'] = 'pix/tango-go-prev-next-gray-32x32.png';
-$image['COMMIT gray']['width'] = 32;
-$image['COMMIT gray']['height'] = 32;
-$image['RECALC']['path'] = 'pix/tango-view-refresh-32x32.png';
-$image['RECALC']['width'] = 32;
-$image['RECALC']['height'] = 32;
-$image['clear']['path'] = 'pix/tango-edit-clear.png';
-$image['clear']['width'] = 16;
-$image['clear']['height'] = 16;
-$image['CLEAR']['path'] = 'pix/tango-edit-clear-big.png';
-$image['CLEAR']['width'] = 32;
-$image['CLEAR']['height'] = 32;
-$image['CLEAR gray']['path'] = 'pix/tango-edit-clear-gray-32x32.png';
-$image['CLEAR gray']['width'] = 32;
-$image['CLEAR gray']['height'] = 32;
-$image['save']['path'] = 'pix/tango-document-save-16x16.png';
-$image['save']['width'] = 16;
-$image['save']['height'] = 16;
-$image['SAVE']['path'] = 'pix/tango-document-save-32x32.png';
-$image['SAVE']['width'] = 32;
-$image['SAVE']['height'] = 32;
-$image['NOSAVE']['path'] = 'pix/tango-document-save-32x32-gray.png';
-$image['NOSAVE']['width'] = 32;
-$image['NOSAVE']['height'] = 32;
-$image['create']['path'] = 'pix/tango-document-new.png';
-$image['create']['width'] = 16;
-$image['create']['height'] = 16;
-$image['CREATE']['path'] = 'pix/tango-document-new-big.png';
-$image['CREATE']['width'] = 32;
-$image['CREATE']['height'] = 32;
-$image['DENIED']['path'] = 'pix/tango-dialog-error-big.png';
-$image['DENIED']['width'] = 32;
-$image['DENIED']['height'] = 32;
-$image['node-collapsed']['path'] = 'pix/node-collapsed.png';
-$image['node-collapsed']['width'] = 16;
-$image['node-collapsed']['height'] = 16;
-$image['node-expanded']['path'] = 'pix/node-expanded.png';
-$image['node-expanded']['width'] = 16;
-$image['node-expanded']['height'] = 16;
-$image['node-expanded-static']['path'] = 'pix/node-expanded-static.png';
-$image['node-expanded-static']['width'] = 16;
-$image['node-expanded-static']['height'] = 16;
-$image['dragons']['path'] = 'pix/mitsudragon.png';
-$image['dragons']['width'] = 195;
-$image['dragons']['height'] = 33;
-$image['LB']['path'] = 'pix/loadbalancer.png';
-$image['LB']['width'] = 32;
-$image['LB']['height'] = 32;
-$image['RS pool']['path'] = 'pix/serverpool.png';
-$image['RS pool']['width'] = 48;
-$image['RS pool']['height'] = 16;
-$image['VS']['path'] = 'pix/servicesign.png';
-$image['VS']['width'] = 39;
-$image['VS']['height'] = 62;
-$image['router']['path'] = 'pix/router.png';
-$image['router']['width'] = 32;
-$image['router']['height'] = 32;
-$image['object']['path'] = 'pix/bracket-16x16.png';
-$image['object']['width'] = 16;
-$image['object']['height'] = 16;
-$image['OBJECT']['path'] = 'pix/bracket-32x32.png';
-$image['OBJECT']['width'] = 32;
-$image['OBJECT']['height'] = 32;
-$image['attach']['path'] = 'pix/tango-mail-attachment-16x16.png';
-$image['attach']['width'] = 16;
-$image['attach']['height'] = 16;
-$image['Attach']['path'] = 'pix/tango-mail-attachment-22x22.png';
-$image['Attach']['width'] = 22;
-$image['Attach']['height'] = 22;
-$image['ATTACH']['path'] = 'pix/tango-mail-attachment-32x32.png';
-$image['ATTACH']['width'] = 32;
-$image['ATTACH']['height'] = 32;
-$image['favorite']['path'] = 'pix/tango-emblem-favorite.png';
-$image['favorite']['width'] = 16;
-$image['favorite']['height'] = 16;
-$image['computer']['path'] = 'pix/tango-computer.png';
-$image['computer']['width'] = 16;
-$image['computer']['height'] = 16;
-$image['empty file']['path'] = 'pix/crystal-file-empty-32x32.png';
-$image['empty file']['width'] = 32;
-$image['empty file']['height'] = 32;
-$image['text file']['path'] = 'pix/crystal-file-text-32x32.png';
-$image['text file']['width'] = 32;
-$image['text file']['height'] = 32;
-$image['image file']['path'] = 'pix/crystal-file-image-32x32.png';
-$image['image file']['width'] = 32;
-$image['image file']['height'] = 32;
-$image['text']['path'] = 'pix/tango-text-x-generic-16x16.png';
-$image['text']['width'] = 16;
-$image['text']['height'] = 16;
-$image['NET']['path'] = 'pix/crystal-network_local-32x32.png';
-$image['NET']['width'] = 32;
-$image['NET']['height'] = 32;
-$image['net']['path'] = 'pix/crystal-network_local-16x16.png';
-$image['net']['width'] = 16;
-$image['net']['height'] = 16;
-$image['USER']['path'] = 'pix/crystal-edit-user-32x32.png';
-$image['USER']['width'] = 32;
-$image['USER']['height'] = 32;
-$image['setfilter']['path'] = 'pix/pgadmin3-viewfiltereddata.png';
-$image['setfilter']['width'] = 32;
-$image['setfilter']['height'] = 32;
-$image['setfilter gray']['path'] = 'pix/pgadmin3-viewfiltereddata-grayscale.png';
-$image['setfilter gray']['width'] = 32;
-$image['setfilter gray']['height'] = 32;
-$image['resetfilter']['path'] = 'pix/pgadmin3-viewdata.png';
-$image['resetfilter']['width'] = 32;
-$image['resetfilter']['height'] = 32;
-$image['resetfilter gray']['path'] = 'pix/pgadmin3-viewdata-grayscale.png';
-$image['resetfilter gray']['width'] = 32;
-$image['resetfilter gray']['height'] = 32;
-$image['knight']['path'] = 'pix/smiley_knight.png';
-$image['knight']['width'] = 72;
-$image['knight']['height'] = 33;
-$image['Zoom']['path'] = 'pix/tango-system-search-22x22.png';
-$image['Zoom']['width'] = 22;
-$image['Zoom']['height'] = 22;
-$image['Zooming']['path'] = 'pix/tango-view-fullscreen-22x22.png';
-$image['Zooming']['width'] = 22;
-$image['Zooming']['height'] = 22;
-$image['UNLOCK']['path'] = 'pix/crystal-actions-unlock-32x32.png';
-$image['UNLOCK']['width'] = 32;
-$image['UNLOCK']['height'] = 32;
-$image['CLOCK']['path'] = 'pix/tango-appointment-32x32.png';
-$image['CLOCK']['width'] = 32;
-$image['CLOCK']['height'] = 32;
-$image['DQUEUE done']['path'] = 'pix/crystal-ok-32x32.png';
-$image['DQUEUE done']['width'] = 32;
-$image['DQUEUE done']['height'] = 32;
-$image['DQUEUE sync_aging']['path'] = 'pix/tango-appointment-32x32.png';
-$image['DQUEUE sync_aging']['width'] = 32;
-$image['DQUEUE sync_aging']['height'] = 32;
-$image['DQUEUE resync_aging']['path'] = 'pix/tango-appointment-32x32.png';
-$image['DQUEUE resync_aging']['width'] = 32;
-$image['DQUEUE resync_aging']['height'] = 32;
-$image['DQUEUE sync_ready']['path'] = 'pix/tango-emblem-system-32x32.png';
-$image['DQUEUE sync_ready']['width'] = 32;
-$image['DQUEUE sync_ready']['height'] = 32;
-$image['DQUEUE resync_ready']['path'] = 'pix/tango-emblem-important-32x32.png';
-$image['DQUEUE resync_ready']['width'] = 32;
-$image['DQUEUE resync_ready']['height'] = 32;
-$image['DQUEUE failed']['path'] = 'pix/tango-emblem-unreadable-32x32.png';
-$image['DQUEUE failed']['width'] = 32;
-$image['DQUEUE failed']['height'] = 32;
-$image['DQUEUE disabled']['path'] = 'pix/tango-emblem-readonly-32x32.png';
-$image['DQUEUE disabled']['width'] = 32;
-$image['DQUEUE disabled']['height'] = 32;
-$image['COPY']['path'] = 'pix/tango-edit-copy-32x32.png';
-$image['COPY']['width'] = 32;
-$image['COPY']['height'] = 32;
-$image['html']['path'] = 'pix/tango-text-html.png';
-$image['html']['width'] = 16;
-$image['html']['height'] = 16;
-
// This may be populated later onsite, report rendering function will use it.
// See the $systemreport for structure.
$localreports = array();
finishPortlet();
}
-function printSelect ($optionList, $select_attrs = array(), $selected_id = NULL)
-{
- echo getSelect ($optionList, $select_attrs, $selected_id);
-}
-
-// Input array keys are OPTION VALUEs and input array values are OPTION text.
-function getSelect ($optionList, $select_attrs = array(), $selected_id = NULL)
-{
- $ret = '';
- if (!array_key_exists ('name', $select_attrs))
- return '';
- // handle two corner cases in a specific way
- if (count ($optionList) == 0)
- return '(none)';
- if (count ($optionList) == 1)
- {
- foreach ($optionList as $key => $value) { break; }
- return "<input type=hidden name=${select_attrs['name']} id=${select_attrs['name']} value=${key}>" . $value;
- }
- if (!array_key_exists ('id', $select_attrs))
- $select_attrs['id'] = $select_attrs['name'];
- $ret .= '<select';
- foreach ($select_attrs as $attr_name => $attr_value)
- $ret .= " ${attr_name}=${attr_value}";
- $ret .= '>';
- foreach ($optionList as $dict_key => $dict_value)
- $ret .= "<option value='${dict_key}'" . ($dict_key == $selected_id ? ' selected' : '') . ">${dict_value}</option>";
- $ret .= '</select>';
- return $ret;
-}
-
-function printNiftySelect ($groupList, $select_attrs = array(), $selected_id = NULL, $autocomplete = false)
-{
- echo getNiftySelect ($groupList, $select_attrs, $selected_id);
-}
-
-// Input is a cooked list of OPTGROUPs, each with own sub-list of OPTIONs in the same
-// format as printSelect() expects.
-function getNiftySelect ($groupList, $select_attrs, $selected_id = NULL)
-{
- // special treatment for ungrouped data
- if (count ($groupList) == 1 and isset ($groupList['other']))
- return getSelect ($groupList['other'], $select_attrs, $selected_id);
- if (!array_key_exists ('name', $select_attrs))
- return '';
- if (!array_key_exists ('id', $select_attrs))
- $select_attrs['id'] = $select_attrs['name'];
- $ret = '<select';
- foreach ($select_attrs as $attr_name => $attr_value)
- $ret .= " ${attr_name}=${attr_value}";
- $ret .= '>';
- foreach ($groupList as $groupname => $groupdata)
- {
- $ret .= "<optgroup label='${groupname}'>";
- foreach ($groupdata as $dict_key => $dict_value)
- $ret .= "<option value='${dict_key}'" . ($dict_key == $selected_id ? ' selected' : '') . ">${dict_value}</option>";
- $ret .= '</optgroup>';
- }
- $ret .= '</select>';
- return $ret;
-}
-
// used by renderGridForm() and renderRackPage()
function renderRackInfoPortlet ($rackData)
{
finishPortlet();
}
-function printImageHREF ($tag, $title = '', $do_input = FALSE, $tabindex = 0)
-{
- echo getImageHREF ($tag, $title, $do_input, $tabindex);
-}
-
-// this would be better called mkIMG(), make "IMG" HTML element
-function getImageHREF ($tag, $title = '', $do_input = FALSE, $tabindex = 0)
-{
- global $image;
- if (!isset ($image[$tag]))
- $tag = 'error';
- $img = $image[$tag];
- $img['path'] = TSURI ($img['path']);
- if ($do_input == TRUE)
- return
- "<input type=image name=submit class=icon " .
- "src='${img['path']}' " .
- "border=0 " .
- ($tabindex ? "tabindex=${tabindex}" : '') .
- (!strlen ($title) ? '' : " title='${title}'") . // JT: Add title to input hrefs too
- ">";
- else
- return
- "<img " .
- "src='${img['path']}' " .
- "width=${img['width']} " .
- "height=${img['height']} " .
- "border=0 " .
- (!strlen ($title) ? '' : "title='${title}'") .
- ">";
-}
-
function renderSystemReports ()
{
$tmp = array
}
-
-
-function renderAccessDenied ($and_exit = TRUE)
-{
- header ('Content-Type: text/html; charset=UTF-8');
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
- echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
- echo "<head><title>RackTables: access denied</title>\n";
- printPageHeaders();
- echo "</head><body>";
- global $pageno, $tabno,
- $user_given_tags,
- $target_given_tags,
- $auto_tags,
- $expl_tags,
- $impl_tags;
- echo "<table border=1 cellspacing=0 cellpadding=3 width='50%' align=center>\n";
- echo '<tr><th colspan=2><h3>';
- printImageHREF ('DENIED');
- echo ' access denied ';
- printImageHREF ('DENIED');
- echo '</h3></th></tr>';
- echo "<tr><th width='50%' class=tagchain>User given tags:</th><td class=tagchain>";
- echo serializeTags ($user_given_tags) . " </td></tr>\n";
- echo "<tr><th width='50%' class=tagchain>Target given tags:</th><td class=tagchain>";
- echo serializeTags ($target_given_tags) . " </td></tr>\n";
- echo "<tr><th width='50%' class=tagchain>Effective explicit tags:</th><td class=tagchain>";
- echo serializeTags ($expl_tags) . " </td></tr>\n";
- echo "<tr><th width='50%' class=tagchain>Effective implicit tags:</th><td class=tagchain>";
- echo serializeTags ($impl_tags) . " </td></tr>\n";
- echo "<tr><th width='50%' class=tagchain>Automatic tags:</th><td class=tagchain>";
- echo serializeTags ($auto_tags) . " </td></tr>\n";
- echo "<tr><th width='50%' class=tdright>Requested page:</th><td class=tdleft>${pageno}</td></tr>\n";
- echo "<tr><th width='50%' class=tdright>Requested tab:</th><td class=tdleft>${tabno}</td></tr>\n";
- echo "<tr><td colspan=2 align=center>Click <a href='index.php?logout'>here</a> to logout.</td></tr>\n";
- echo "</table>\n";
- echo "</body></html>";
- if ($and_exit)
- exit;
-}
-
function renderMyAccount ()
{
global $remote_username, $remote_displayname;
$tab['reports']['ipv6'] = 'IPv6';
$tab['reports']['ports'] = 'Ports';
$tab['reports']['8021q'] = '802.1Q';
-$tab['reports']['local'] = getConfigVar ('enterprise');
+$tab['reports']['local'] = 'local'; // this one is set later in init.php
$trigger['reports']['local'] = 'trigger_localreports';
$tabhandler['reports']['default'] = 'renderSystemReports';
$tabhandler['reports']['rackcode'] = 'renderRackCodeReports';
break;
case 'popup' == $_REQUEST['module']:
require_once 'inc/popup.php';
- require_once 'inc/interface.php';
require_once 'inc/init.php';
renderPopupHTML();
break;