function ws_display($window_name, $form = '') { global $conf, $self, $onadb, $base; global $images, $color, $style, $msgtype; $html = ''; $js = ''; $debug_val = 3; // used in the auth() calls to supress logging // If the user supplied an array in a string, build the array and store it in $form $form = parse_options_string($form); // Load the host record if ($form['device_id']) { list($status, $rows, $record) = ona_get_device_record(array('id' => $form['device_id'])); } else { if ($form['device']) { // FIXME.. no find_device yet list($status, $rows, $record) = ona_find_device($form['device']); } } if ($status or !$rows) { array_pop($_SESSION['ona']['work_space']['history']); $html .= "<br><center><font color=\"red\"><b>Device doesn't exist!</b></font></center>"; $response = new xajaxResponse(); $response->addAssign("work_space_content", "innerHTML", $html); return $response->getXML(); } // Update History Title (and tell the browser to re-draw the history div) $history = array_pop($_SESSION['ona']['work_space']['history']); $js .= "xajax_window_submit('work_space', ' ', 'rewrite_history');"; if ($history['title'] == $window_name) { $history['title'] = $record['name']; array_push($_SESSION['ona']['work_space']['history'], $history); } // Create some javascript to refresh the current page $refresh = htmlentities(str_replace(array("'", '"'), array("\\'", '\\"'), $history['url']), ENT_QUOTES, $conf['php_charset']); $refresh = "xajax_window_submit('work_space', '{$refresh}');"; // Interface (and find out how many there are) list($status, $interfaces, $interface) = ona_get_interface_record(array('host_id' => $record['id']), ''); $record['ip_address'] = ip_mangle($interface['ip_addr'], 'dotted'); $interface_style = ''; if ($interfaces > 1) { $interface_style = 'font-weight: bold;'; } // Subnet description list($status, $rows, $subnet) = ona_get_subnet_record(array('ID' => $interface['subnet_id'])); $record['subnet'] = $subnet['name']; $record['ip_subnet_mask'] = ip_mangle($subnet['ip_mask'], 'dotted'); $record['ip_subnet_mask_cidr'] = ip_mangle($subnet['ip_mask'], 'cidr'); // Device Description list($status, $rows, $device_type) = ona_get_device_type_record(array('id' => $record['device_type_id'])); list($status, $rows, $role) = ona_get_role_record(array('id' => $device_type['role_id'])); list($status, $rows, $model) = ona_get_model_record(array('id' => $device_type['model_id'])); list($status, $rows, $manufacturer) = ona_get_manufacturer_record(array('id' => $model['manufacturer_id'])); $record['devicefull'] = "{$manufacturer['name']}, {$model['name']} ({$role['name']})"; $record['device'] = str_replace('Unknown', '?', $record['devicefull']); // Get location_number from the location_id list($status, $rows, $location) = ona_get_location_record(array('id' => $record['location_id'])); // extra stuff to pass to ws_plugins $extravars['refresh'] = $refresh; $extravars['window_name'] = $window_name; $style['content_box'] = <<<EOL margin: 10px 20px; padding: 2px 4px; background-color: #FFFFFF; vertical-align: top; EOL; $style['label_box'] = <<<EOL font-weight: bold; padding: 2px 4px; border: solid 1px {$color['border']}; background-color: {$color['window_content_bg']}; EOL; // Escape data for display in html foreach (array_keys($record) as $key) { $record[$key] = htmlentities($record[$key], ENT_QUOTES, $conf['php_charset']); } // force 300px width to Notes field if the length is longer than 50 characters and put Notes at the top of the td $notes_width = ""; $notes_valign = ""; if (strlen($record['notes']) > 50) { $notes_width = ' style="width: 300px" '; $notes_valign = ' valign="top" '; } $html .= <<<EOL <!-- FORMATTING TABLE --> <div style="{$style['content_box']}"> <table cellspacing="0" border="0" cellpadding="0"><tr> <!-- START OF FIRST COLUMN OF SMALL BOXES --> <td nowrap="true" valign="top" style="padding-right: 15px;"> <form id="form_device_{$record['id']}" ><input type="hidden" name="device_id" value="{$record['id']}" ><input type="hidden" name="js" value="{$refresh}" ></form> EOL; $wspl = workspace_plugin_loader('host_detail', $record, $extravars); $html .= $wspl[0]; $js .= $wspl[1]; $wspl = workspace_plugin_loader('location_detail', $record, $extravars); $html .= $wspl[0]; $js .= $wspl[1]; $html .= <<<EOL <!-- END OF FIRST COLUMN OF SMALL BOXES --> </td> <!-- START OF SECOND COLUMN OF SMALL BOXES --> <td valign="top" style="padding-right: 15px;"> EOL; $html .= <<<EOL <!-- END OF SECOND COLUMN OF SMALL BOXES --> </td> <!-- START OF THIRD COLUMN OF SMALL BOXES --> <td valign="top"> EOL; // START MESSAGES BOX // $tablename is a reference directly to the table that contains the item // we are displaying to the user. // It is possible that you can have the same ID in multiple tables, currently. $tablename = 'devices'; require_once 'winc/tooltips.inc.php'; list($lineshtml, $linesjs) = get_message_lines_html("table_id_ref = {$record['id']} AND table_name_ref LIKE '{$tablename}'"); if ($lineshtml) { $html .= <<<EOL <!-- MESSAGES LIST --> <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px;"> <tr><td colspan="99" nowrap="true" style="{$style['label_box']}"> Messages </td></tr> <tr><td> EOL; $html .= $lineshtml; $js .= $linesjs; $html .= "</td></tr></table>"; } // END MESSAGES LIST $html .= <<<EOL </td> <!-- END OF THIRD COLUMN OF SMALL BOXES --> </tr></table> </div> <!-- END OF TOP SECTION --> EOL; // RECORD LIST $tab = 'hosts'; $submit_window = "list_{$tab}"; $form_id = "{$submit_window}_filter_form"; $_SESSION['ona'][$form_id]['tab'] = $tab; $content_id = "{$window_name}_{$submit_window}"; $html .= <<<EOL <!-- INTERFACE LIST --> <div style="border: 1px solid {$color['border']}; margin: 10px 20px;"> <!-- Tab & Quick Filter --> <table id="{$form_id}_table" cellspacing="0" border="0" cellpadding="0"> <tr> <td id="{$form_id}_{$tab}_tab" class="table-tab-active"> Associated Hosts {$tab} <span id="{$form_id}_{$tab}_count"></span> </td> <td id="{$form_id}_quick_filter" class="padding" align="right" width="100%"> <form id="{$form_id}" onSubmit="return false;"> <input id="{$form_id}_page" name="page" value="1" type="hidden"> <input name="content_id" value="{$content_id}" type="hidden"> <input name="form_id" value="{$form_id}" type="hidden"> <input name="device_id" value="{$record['id']}" type="hidden"> <div id="{$form_id}_filter_overlay" title="Filter" style="position: relative; display: inline; color: #CACACA; cursor: text;" onClick="this.style.display = 'none'; el('{$form_id}_filter').focus();" >Name</div> <input id="{$form_id}_filter" name="filter" class="filter" type="text" value="" size="10" maxlength="20" alt="Quick Filter" onFocus="el('{$form_id}_filter_overlay').style.display = 'none';" onBlur="if (this.value == '') el('{$form_id}_filter_overlay').style.display = 'inline';" onKeyUp=" if (typeof(timer) != 'undefined') clearTimeout(timer); code = 'if ({$form_id}_last_search != el(\\'{$form_id}_filter\\').value) {' + ' {$form_id}_last_search = el(\\'{$form_id}_filter\\').value;' + ' document.getElementById(\\'{$form_id}_page\\').value = 1;' + ' xajax_window_submit(\\'{$submit_window}\\', xajax.getFormValues(\\'{$form_id}\\'), \\'display_list\\');' + '}'; timer = setTimeout(code, 700);" > </form> </td> </tr> </table> <div id='{$content_id}'> {$conf['loading_icon']} </div> EOL; if (auth('host_add', $debug_val)) { $html .= <<<EOL <!-- ADD RECORD LINK --> <div class="act-box" style="padding: 2px 4px; border-top: 1px solid {$color['border']}"> <form id="form_record_{$record['id']}" ><input type="hidden" name="host_id" value="{$record['id']}" ><input type="hidden" name="js" value="{$refresh}" ></form> <a title="Add host" class="act" onClick="xajax_window_submit('edit_host', xajax.getFormValues('form_record_{$record['id']}'), 'editor');" ><img src="{$images}/silk/font_add.png" border="0"></a> <a title="Add host" class="act" onClick="xajax_window_submit('edit_host', xajax.getFormValues('form_record_{$record['id']}'), 'editor');" >Add host</a> </div> EOL; } $html .= " </div>"; $js .= <<<EOL /* Setup the quick filter */ el('{$form_id}_filter_overlay').style.left = (el('{$form_id}_filter_overlay').offsetWidth + 10) + 'px'; {$form_id}_last_search = ''; /* Tell the browser to load/display the list */ xajax_window_submit('{$submit_window}', xajax.getFormValues('{$form_id}'), 'display_list'); EOL; // Insert the new html into the window // Instantiate the xajaxResponse object $response = new xajaxResponse(); $response->addAssign("work_space_content", "innerHTML", $html); if ($js) { $response->addScript($js); } return $response->getXML(); }
function host_modify($options = "") { global $conf, $self, $onadb; // Version - UPDATE on every edit! $version = '1.07'; printmsg("DEBUG => host_modify({$options}) called", 3); // Parse incoming options string to an array $options = parse_options($options); // Return the usage summary if we need to if ($options['help'] or !$options['interface'] and !$options['host'] or !$options['set_host'] and !$options['set_type'] and !$options['set_location'] and !$options['set_notes']) { // NOTE: Help message lines should not exceed 80 characters for proper display on a console $self['error'] = 'ERROR => Insufficient parameters'; return array(1, <<<EOM host_modify-v{$version} Modify a host record Synopsis: host_modify [KEY=VALUE] ... Where: host=NAME[.DOMAIN] or ID Select host by hostname or ID or interface=[ID|IP|MAC] Select host by IP or MAC Update: set_type=TYPE or ID Change device/model type or ID set_notes=NOTES Change the textual notes set_location=REF Reference for location set_device=NAME|ID Name or ID of the device this host is associated with EOM ); } // clean up what is passed in $options['interface'] = trim($options['interface']); $options['host'] = trim($options['host']); // // Find the host record we're modifying // // If they provided a hostname / ID let's look it up if ($options['host']) { list($status, $rows, $host) = ona_find_host($options['host']); } else { if ($options['interface']) { // Find an interface record by something in that interface's record list($status, $rows, $interface) = ona_find_interface($options['interface']); if ($status or !$rows) { printmsg("DEBUG => Interface not found ({$options['interface']})!", 3); $self['error'] = "ERROR => Interface not found ({$options['interface']})!"; return array(4, $self['error'] . "\n"); } // Load the associated host record list($status, $rows, $host) = ona_get_host_record(array('id' => $interface['host_id'])); } } // If we didn't get a record then exit if (!$host['id']) { printmsg("DEBUG => Host not found ({$options['host']})!", 3); $self['error'] = "ERROR => Host not found ({$options['host']})!"; return array(4, $self['error'] . "\n"); } // Get related Device record info list($status, $rows, $device) = ona_get_device_record(array('id' => $host['device_id'])); // // Define the records we're updating // // This variable will contain the updated info we'll insert into the DB $SET = array(); // Set options['set_type']? if ($options['set_type']) { // Find the Device Type ID (i.e. Type) to use list($status, $rows, $device_type) = ona_find_device_type($options['set_type']); if ($status or $rows != 1 or !$device_type['id']) { printmsg("DEBUG => The device type specified, {$options['set_type']}, does not exist!", 3); $self['error'] = "ERROR => The device type specified, {$options['set_type']}, does not exist!"; return array(6, $self['error'] . "\n"); } printmsg("DEBUG => Device type ID: {$device_type['id']}", 3); // Everything looks ok, add it to $SET if it changed... if ($device['device_type_id'] != $device_type['id']) { $SET_DEV['device_type_id'] = $device_type['id']; } } // Set options['set_notes'] (it can be a null string!) if (array_key_exists('set_notes', $options)) { // There is an issue with escaping '=' and '&'. We need to avoid adding escape characters $options['set_notes'] = str_replace('\\=', '=', $options['set_notes']); $options['set_notes'] = str_replace('\\&', '&', $options['set_notes']); // If it changed... if ($host['notes'] != $options['set_notes']) { $SET['notes'] = $options['set_notes']; } } if (array_key_exists('set_device', $options)) { list($status, $rows, $devid) = ona_find_device($options['set_device']); if (!$rows) { printmsg("DEBUG => The device specified, {$options['set_device']}, does not exist!", 3); $self['error'] = "ERROR => The device specified, {$options['set_device']}, does not exist!"; return array(7, $self['error'] . "\n"); } // set the device id if ($host['device_id'] != $devid['id']) { $SET['device_id'] = $devid['id']; } } if (array_key_exists('set_location', $options)) { if (!$options['set_location']) { unset($SET_DEV['location_id']); } else { list($status, $rows, $loc) = ona_find_location($options['set_location']); if (!$rows) { printmsg("DEBUG => The location specified, {$options['set_location']}, does not exist!", 3); $self['error'] = "ERROR => The location specified, {$options['set_location']}, does not exist!"; return array(7, $self['error'] . "\n"); } // If location is changing, then set the variable if ($device['location_id'] != $loc['id']) { $SET_DEV['location_id'] = $loc['id']; } } } // Check permissions if (!auth('host_modify')) { $self['error'] = "Permission denied!"; printmsg($self['error'], 0); return array(10, $self['error'] . "\n"); } // Get the host record before updating (logging) $original_host = $host; // Update the host record if necessary if (count($SET) > 0) { list($status, $rows) = db_update_record($onadb, 'hosts', array('id' => $host['id']), $SET); if ($status or !$rows) { $self['error'] = "ERROR => host_modify() SQL Query failed for host: " . $self['error']; printmsg($self['error'], 0); return array(8, $self['error'] . "\n"); } } // Update device table if necessary if (count($SET_DEV) > 0) { list($status, $rows) = db_update_record($onadb, 'devices', array('id' => $host['device_id']), $SET_DEV); if ($status or !$rows) { $self['error'] = "ERROR => host_modify() SQL Query failed for device type: " . $self['error']; printmsg($self['error'], 0); return array(9, $self['error'] . "\n"); } } // Get the host record after updating (logging) list($status, $rows, $new_host) = ona_get_host_record(array('id' => $host['id'])); // Return the success notice $self['error'] = "INFO => Host UPDATED:{$host['id']}: {$new_host['fqdn']}"; $log_msg = "INFO => Host UPDATED:{$host['id']}: "; $more = ""; foreach (array_keys($host) as $key) { if ($host[$key] != $new_host[$key]) { $log_msg .= "{$more}{$key}: {$host[$key]} => {$new_host[$key]}"; $more = "; "; } } // only print to logfile if a change has been made to the record if ($more != '') { printmsg($self['error'], 0); printmsg($log_msg, 0); } return array(0, $self['error'] . "\n"); }
function ws_display_list($window_name, $form = '') { global $conf, $self, $onadb; global $images, $color, $style; $html = ''; $js = ''; // If the user supplied an array in a string, build the array and store it in $form $form = parse_options_string($form); // Find the "tab" we're on $tab = $_SESSION['ona'][$form['form_id']]['tab']; // Build js to refresh this list $refresh = "xajax_window_submit('{$window_name}', xajax.getFormValues('{$form['form_id']}'), 'display_list');"; // Search results go in here $results = array(); $count = 0; // NETWORK ID if (is_numeric($form['subnet_id'])) { } // Do the SQL Query list($status, $count, $results) = db_get_records($onadb, 'interfaces', "subnet_id = " . $onadb->qstr($form['subnet_id']), 'ip_addr', -1, -1); // make an array of ips from our results $iplist = array(); foreach ($results as $record) { $iplist["{$record['ip_addr']}"] = 'used'; } list($status, $rows, $subnet) = ona_find_subnet($form['subnet_id']); // Create a few variables that will be handy later $num_ips = 0xffffffff - $subnet['ip_mask']; $last_ip = $subnet['ip_addr'] + $num_ips - 1; $currip = $subnet['ip_addr'] + 1; // Get a list of blocks that touches this subnet list($status, $blockrows, $blocks) = db_get_records($onadb, 'blocks', "{$subnet['ip_addr']} BETWEEN ip_addr_start AND ip_addr_end OR {$last_ip} BETWEEN ip_addr_start AND ip_addr_end OR ip_addr_start BETWEEN {$subnet['ip_addr']} and {$last_ip}"); // Get a list of dhcp pools on the selected subnet list($status, $rows, $pools) = db_get_records($onadb, 'dhcp_pools', array('subnet_id' => $subnet['id'])); // Add DHCP pool addresses into the list of used ips foreach ($pools as $pool) { for ($ip = $pool['ip_addr_start']; $ip <= $pool['ip_addr_end']; $ip++) { $iplist["{$ip}"] = 'pool-' . $pool['id']; } } // // *** BUILD HTML LIST *** // $html .= <<<EOL <!-- Host Results --> <table id="{$form['form_id']}_full_host_list" class="list-box" cellspacing="0" border="0" cellpadding="0"> <!-- Table Header --> <tr> <td class="list-header" align="center" style="{$style['borderR']};" title="IP Block Association">B</td> <td class="list-header" align="center" style="{$style['borderR']};">IP Address</td> <td class="list-header" align="center" style="{$style['borderR']};">Last Response</td> <td class="list-header" align="center" style="{$style['borderR']};">[Name] Desc</td> <td class="list-header" align="center" style="{$style['borderR']};">Host Name</td> <td class="list-header" align="center" style="{$style['borderR']};">Device Type</td> <td class="list-header" align="center" style="{$style['borderR']};">Host Notes</td> </tr> EOL; // Loop and display each ip on the subnet while ($currip <= $last_ip) { $loc = array(); $host = array(); $interface = array(); $interfaces = 0; $record = array(); $interface_style = ''; $clusterhtml = ''; $rowstyle = 'background-color: #E9FFE1'; $rowid = 'byip_available'; $currip_txt = ip_mangle($currip, 'dotted'); $interface['desc'] = '<span style="color: #aaaaaa;">AVAILABLE</span>'; $nameval = <<<EOL <a title="Add host" class="act" onClick="xajax_window_submit('edit_host', 'ip_addr=>{$currip_txt}', 'editor');" ></a> <a title="Add host" class="act" onClick="xajax_window_submit('edit_host', 'ip_addr=>{$currip_txt}', 'editor');" >Add a new host</a> <a title="Add interface" class="act" onClick="xajax_window_submit('edit_interface', 'ip_addr=>{$currip_txt}', 'editor');" ></a> <a title="Add interface" class="act" onClick="xajax_window_submit('edit_interface', 'ip_addr=>{$currip_txt}', 'editor');" >Add interface to an existing host</a> EOL; // If the current ip is one allocated on this subnet lets do some stuff if (array_key_exists($currip, $iplist)) { $rowid = 'byip_allocated'; $rowstyle = ''; // check if it is a pool range list($pooltype, $poolid) = explode('-', $iplist[$currip]); if ($pooltype == 'pool') { $interface['desc'] = '<span style="color: #aaaaaa;">DHCP Pool</span>'; $rowstyle = 'background-color: #FFFBD6'; $nameval = <<<EOL <a title="Edit Pool" class="act" onClick="xajax_window_submit('edit_dhcp_pool', 'subnet=>{$subnet['id']},id=>{$poolid}', 'editor');" ><img src="{$images}/silk/page_add.png" border="0"></a> <a title="Edit Pool" class="act" onClick="xajax_window_submit('edit_dhcp_pool', 'subnet=>{$subnet['id']},id=>{$poolid}', 'editor');" >Edit DHCP Pool</a> EOL; } else { // Get host record list($status, $rows, $host) = ona_find_host($currip); // Get the interface info list($status, $rows, $interface) = ona_find_interface($currip); // Count how many interface rows this host hasand assign it back to the interfaces variable list($status, $interfaces, $records) = db_get_records($onadb, 'interfaces', 'host_id = ' . $onadb->qstr($host['id']), "", 0); // get interface cluster info list($status, $intclusterrows, $intcluster) = db_get_records($onadb, 'interface_clusters', "interface_id = {$interface['id']}"); if ($intclusterrows > 0) { $clusterscript = "onMouseOver=\"wwTT(this, event,\n 'id', 'tt_interface_cluster_list_{$interface['id']}',\n 'type', 'velcro',\n 'styleClass', 'wwTT_niceTitle',\n 'direction', 'south',\n 'javascript', 'xajax_window_submit(\\'tooltips\\', \\'tooltip=>interface_cluster_list,id=>tt_interface_cluster_list_{$interface['id']},interface_id=>{$interface['id']}\\');'\n );\""; $clusterhtml .= <<<EOL <img src="{$images}/silk/sitemap.png" {$clusterscript} /> EOL; } // set the name value for an allocated host $nameval = <<<EOL <a title="View host. ID: {$host['id']}" class="nav" onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_host\\', \\'host_id=>{$host['id']}\\', \\'display\\')');" >{$host['name']}</a >.<a title="View domain. ID: {$host['domain_id']}" class="domain" onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_domain\\', \\'domain_id=>{$host['domain_id']}\\', \\'display\\')');" >{$host['domain_fqdn']}</a> EOL; // Make it bold if we have more than one interface on this host if ($interfaces > 1) { $interface_style = 'font-weight: bold;'; } // Device Description list($status, $rows, $device) = ona_find_device($host['device_id']); list($status, $rows, $device_type) = ona_get_device_type_record(array('id' => $device['device_type_id'])); list($status, $rows, $role) = ona_get_role_record(array('id' => $device_type['role_id'])); list($status, $rows, $model) = ona_get_model_record(array('id' => $device_type['model_id'])); list($status, $rows, $manufacturer) = ona_get_manufacturer_record(array('id' => $model['manufacturer_id'])); $record['device'] = "{$manufacturer['name']}, {$model['name']} ({$role['name']})"; $record['device'] = str_replace('Unknown', '?', $record['device']); $record['notes_short'] = truncate($host['notes'], 40); $interface['description_short'] = truncate($interface['description'], 40); if ($interface['name']) { $interface['name'] = "[{$interface['name']}]"; } $interface['desc'] = "{$interface['name']} {$interface['description_short']}"; // Format the date and colorize if its older than 2 months if ($interface['last_response']) { $interface['last_response'] = date($conf['date_format'], strtotime($interface['last_response'])); if (strtotime($interface['last_response']) < strtotime('-2 month')) { $interface['last_response_fmt'] = 'style=color:red;'; } } // Get location info list($status, $rows, $loc) = ona_get_location_record(array('id' => $device['location_id'])); } // end real host ifblock } // end while loop // Escape data for display in html foreach (array_keys($record) as $key) { $record[$key] = htmlentities($record[$key], ENT_QUOTES, $conf['php_charset']); } $html .= <<<EOL <tr {$rowid}=true style="{$rowstyle}" onMouseOver="this.className='row-highlight'" onMouseOut="this.className='row-normal'"> EOL; // Print color info for any matching blocks $c = 0; $blockcolors = array('#CD5C5C', '#588C7E', '#8C4646', '#FFD700', '#1E90F0', '#8A2BE2', '#32CD32', '#D96459'); if ($blockrows) { $html .= "<td class='list-row' nowrap style='padding:0'>"; foreach ($blocks as $block) { if ($currip >= $block['ip_addr_start'] && $currip <= $block['ip_addr_end']) { $html .= "<span title='{$block['name']}' style='background-color:{$blockcolors[$c]};padding-bottom:4px;float:left;'>  </span> "; } $c++; } } else { // print an empty table cell $html .= "<td class='list-row'>"; } $html .= <<<EOL </td> <td class="list-row" align="left"> EOL; // if it is used, show an edit interface link if ($rowid == 'byip_allocated') { $html .= <<<EOL <a class="nav" style="{$interface_style}" title="Edit interface ID: {$interface['id']}" onClick="xajax_window_submit('edit_interface', 'interface_id=>{$interface['id']}', 'editor');" EOL; if ($interfaces > 1) { $html .= <<<EOL onMouseOver="wwTT(this, event, 'id', 'tt_host_interface_list_{$host['id']}', 'type', 'velcro', 'styleClass', 'wwTT_niceTitle', 'direction', 'south', 'javascript', 'xajax_window_submit(\\'tooltips\\', \\'tooltip=>host_interface_list,id=>tt_host_interface_list_{$host['id']},host_id=>{$host['id']}\\');' );" EOL; } $html .= '>'; } //print out the IP address $html .= $currip_txt; // close the A tag if used above if ($rowid == 'byip_allocated') { $html .= '</a>'; } // Keep on goin with the rest of the line $html .= <<<EOL <span>{$clusterhtml}</span> </td> <td class="list-row" {$interface['last_response_fmt']}>{$interface['last_response']} </td> <td class="list-row"> <span title="{$interface['description']}">{$interface['desc']}</span> </td> <td class="list-row" style="border-left: 1px solid; border-left-color: #aaaaaa;"> {$nameval} </td> <td class="list-row">{$record['device']} </td> <td class="list-row"> <span title="{$host['notes']}">{$record['notes_short']}</span> </td> </tr> EOL; // increment the currip $currip++; } $html .= <<<EOL </table> EOL; $js .= <<<EOL /* Make sure this table is 100% wide */ el('{$form['form_id']}_full_host_list').style.width = el('{$form['form_id']}_table').offsetWidth + 'px'; function togglebyip(name) { tr=document.getElementsByTagName('tr') for (i=0;i<tr.length;i++){ if (tr[i].getAttribute(name)){ if (tr[i].style.display=='none'){tr[i].style.display = '';} else {tr[i].style.display = 'none';} } } } EOL; // Insert the new html into the content div specified // Instantiate the xajaxResponse object $response = new xajaxResponse(); $response->addAssign("{$form['form_id']}_{$tab}_count", "innerHTML", "({$count})"); $response->addAssign($form['content_id'], "innerHTML", $html); if ($js) { $response->addScript($js); } return $response->getXML(); }