예제 #1
0
파일: tooltips.inc.php 프로젝트: edt82/ona
function ws_tooltips_submit($window_name, $form = '')
{
    global $conf, $self, $onadb, $tip_style;
    global $font_family, $color, $style, $images;
    $html = $js = '';
    // If an array in a string was provided, build the array and store it in $form
    $form = parse_options_string($form);
    printmsg("DEBUG => Displaying tooltip: {$form['tooltip']}", 4);
    switch ($form['tooltip']) {
        case 'sys_alert':
            list($html, $js) = get_sys_alert_html($form);
            break;
        case 'loginform':
            list($html, $js) = get_loginform_html($form);
            break;
        case 'start_menu':
            list($html, $js) = get_start_menu_html();
            break;
        case 'local_menu':
            list($html, $js) = get_local_menu_html();
            break;
        case 'location':
            $record['location_id'] = $form['location_id'];
            $extravars['tipstyle'] = 'style="color: #FFFFFF;background-color: #4c4c4c;border: none;"';
            $wspl = workspace_plugin_loader('location_detail', $record, $extravars);
            $html .= $wspl[0];
            $js .= $wspl[1];
            break;
        case 'subnet':
            list($html, $js) = get_subnet_html($form['subnet_ip']);
            break;
        case 'qf_subnet':
            list($html, $js) = quick_subnet_search($form);
            break;
        case 'qf_location':
            list($html, $js) = quick_location_search($form);
            break;
        case 'qf_vlan':
            list($html, $js) = quick_vlan_search($form);
            break;
        case 'qf_free_ip':
            list($html, $js) = quick_free_ip_search($form);
            break;
        case 'qf_pool_server':
            list($html, $js) = quick_pool_server_search($form);
            break;
        case 'quick_interface_menu':
            list($html, $js) = quick_interface_menu($form);
            break;
        case 'quick_interface_move':
            list($html, $js) = quick_interface_move($form);
            break;
        case 'quick_interface_nat':
            list($html, $js) = quick_interface_nat($form);
            break;
        case 'quick_interface_share':
            list($html, $js) = quick_interface_share($form);
            break;
        case 'qf_tag':
            list($html, $js) = quick_tag_add($form);
            break;
        case 'host_interface_list':
            list($html, $js) = get_host_interface_list_html($form);
            break;
        case 'cainfo':
            list($html, $js) = get_custom_attribute_info_html($form);
            break;
        case 'interface_cluster_list':
            list($html, $js) = get_interface_cluster_list_html($form);
            break;
        case 'switchport_template_select':
            list($html, $js) = get_switchport_template_select($form);
            break;
    }
    // Okay here's what we do:
    //   1. Hide the tool-tip
    //   2. Update it's content
    //   3. Reposition it
    //   4. Unhide it
    $response = new xajaxResponse();
    $response->addScript("el('{$form['id']}').style.visibility = 'hidden';");
    $response->addAssign($form['id'], "innerHTML", $html);
    $response->addScript("wwTT_position('{$form['id']}'); el('{$form['id']}').style.visibility = 'visible';");
    if ($js) {
        $response->addScript($js);
    }
    return $response->getXML();
}
예제 #2
0


            <!-- END OF FIRST COLUMN OF SMALL BOXES -->
            </td>


        </tr>
        <tr>
            <td nowrap="true" valign="top" style="padding: 15px;">
EOL;
// Get all the plugin based worspace items
$wspl_list = plugin_list('wspl_item');
// Load all the dynamic plugins
foreach ($wspl_list as $p) {
    list($wspl, $wsjs) = workspace_plugin_loader($p['path'], $record, $extravars);
    print $wspl;
    $ws_plugin_js .= $wsjs;
}
print <<<EOL
            </td>
        </tr>
        </table>

        <!-- Print the MOTD info if any -->
        <div>{$MOTD}</div>

        </div>
        <!-- END OF TOP SECTION -->

예제 #3
0
파일: main.inc.php 프로젝트: edt82/ona
}
// print the tag section into the workspace
$taghtml = <<<EOL
                <tr>
                    <td align="right" nowrap="true"><b>Tags</b>&nbsp;</td>
                    <td nowrap="true" class="tag" align="left" >
                       {$addtaghtml}
                       <span id='taglist_{$extravars['window_name']}'></span>
                    </td>
                </tr>
EOL;
$modbodyhtml .= <<<EOL
            <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px;">
                <tr>
                    <td align="right" nowrap="true" title="Device type ID: {$record['device_type_id']}"><b>Device Type</b>&nbsp;</td>
                    <td nowrap="true" class="padding" align="left" title="{$record['devicefull']}">{$record['device']}</td>
                </tr>

                {$taghtml}

                <tr>
                    <td align="right" {$notes_valign} nowrap="true"><b>Notes</b>&nbsp;</td>
                    <td nowrap="true" class="padding" align="left" {$notes_width}><textarea readonly size="256" cols=25 rows=3 class="display_notes">{$record['notes']}</textarea></td>
                </tr>
EOL;
$modbodyhtml .= <<<EOL
            </table>
EOL;
$wspl = workspace_plugin_loader('location_detail', $record, $extravars);
$modbodyhtml .= $wspl[0];
$modbodyjs .= $wspl[1];
예제 #4
0
function ws_display($window_name, $form = '')
{
    global $conf, $self, $onadb, $base;
    global $images, $color, $style;
    $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['host_id']) {
        list($status, $rows, $record) = ona_get_host_record(array('id' => $form['host_id']));
    } else {
        if ($form['host']) {
            list($status, $rows, $record) = ona_find_host($form['host']);
        }
    }
    if ($status or !$rows) {
        array_pop($_SESSION['ona']['work_space']['history']);
        $html .= "<br><center><font color=\"red\"><b>Host 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}');";
    // FIXME: umm.. put this somewhere else
    if (!$record['name']) {
        $record['name'] = "NONE SET";
    }
    // 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['subnet_id'] = $subnet['id'];
    $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) = ona_get_device_record(array('id' => $record['device_id']));
    $record['device_type_id'] = $device['device_type_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['devicefull'] = "{$manufacturer['name']}, {$model['name']} ({$role['name']})";
    $record['device'] = str_replace('Unknown', '?', $record['devicefull']);
    $record['location_id'] = $device['location_id'];
    // Device serial number and/or asset tag
    $record['serial_number'] = $device['serial_number'];
    $record['asset_tag'] = $device['asset_tag'];
    // 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;
    // Escape data for display in html
    foreach (array_keys($record) as $key) {
        $record[$key] = htmlentities($record[$key], ENT_QUOTES, $conf['php_charset']);
    }
    // Create a div for workspace plugins to live
    $html .= "<div id='wsplugins' style='margin: 10px;'>";
    // Start displaying all the ws plugins
    $wspl = workspace_plugin_loader('host_detail', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('host_services', $record);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('custom_attributes', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('dhcp_entries', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('config_archives', $record);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    // Display the host_action workspace_plugin
    $wspl = workspace_plugin_loader('host_actions', $record);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    // Display messages
    $wspl = workspace_plugin_loader('messages', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('reports', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    // Get all the plugin based worspace items
    $wspl_list = plugin_list('wspl_item');
    // Load all the dynamic plugins
    foreach ($wspl_list as $p) {
        $wspl = workspace_plugin_loader($p['path'], $record, $extravars);
        $html .= $wspl[0];
        $js .= $wspl[1];
        $wsmenu[] = $wspl[2];
    }
    // Gather our menuitems and build the HTML
    $wsmenuhtml = build_workspace_menu($wsmenu);
    $html .= <<<EOL

    </div>
    <br style="clear:both;">

    <form id="form_host_{$record['id']}"
        ><input type="hidden" name="host_id" value="{$record['id']}"
        ><input type="hidden" name="js" value="{$refresh}"
    ></form>

    <div id='wsmenu' style='display:none;'>{$wsmenuhtml}</div>

EOL;
    // RECORD LIST
    $tab = 'records';
    $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 DNS {$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="host_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 DNS record"
               class="act"
               onClick="xajax_window_submit('edit_record', xajax.getFormValues('form_record_{$record['id']}'), 'editor');"
            ><img src="{$images}/silk/font_add.png" border="0"></a>&nbsp;

            <a title="Add DNS record"
               class="act"
               onClick="xajax_window_submit('edit_record', xajax.getFormValues('form_record_{$record['id']}'), 'editor');"
            >Add DNS record</a>&nbsp;
        </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;
    // INTERFACE LIST
    $tab = 'interfaces';
    $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 {$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="host_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();"
                    >Full IP</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 INTERFACE LINK -->
        <div class="act-box" style="padding: 2px 4px; border-top: 1px solid {$color['border']}">
            <form id="form_interface_{$record['id']}"
                ><input type="hidden" name="host_id" value="{$record['id']}"
                ><input type="hidden" name="js" value="{$refresh}"
            ></form>

            <a title="Add interface"
               class="act"
               onClick="xajax_window_submit('edit_interface', xajax.getFormValues('form_interface_{$record['id']}'), 'editor');"
            ><img src="{$images}/silk/page_add.png" border="0"></a>&nbsp;

            <a title="Add interface"
               class="act"
               onClick="xajax_window_submit('edit_interface', xajax.getFormValues('form_interface_{$record['id']}'), 'editor');"
            >Add interface</a>&nbsp;
        </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();
}
예제 #5
0
파일: main.inc.php 프로젝트: edt82/ona
}
$modbodyhtml .= <<<EOL
            <tr>
                <td align="right" nowrap="true"><b>IP Address</b>&nbsp;</td>
                <td class="padding" align="left">
                    {$record['ip_addr']}&nbsp;
                </td>
            </tr>

            <tr>
                <td align="right" nowrap="true"><b>Netmask</b>&nbsp;</td>
                <td class="padding" align="left">{$record['ip_mask']} (/{$record['ip_subnet_mask_cidr']})&nbsp;</td>
            </tr>

            <tr>
                <td align="right" nowrap="true"><b>Usage</b>&nbsp;</td>
                <td class="padding" align="left" valign="middle">{$usage_html}</td>
            </tr>

            <tr>
                <td align="right" nowrap="true"><b>Type</b>&nbsp;</td>
                <td class="padding" align="left">{$record['type']}&nbsp;</td>
            </tr>

            {$taghtml}
        </table>
EOL;
// Requires the include of the functions_network_map.inc.php file at the beginning of this file
$wspl = workspace_plugin_loader('subnet_map', $record, $extravars);
$modbodyhtml .= $wspl[0];
$modjs .= $wspl[1];
예제 #6
0
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>&nbsp;

            <a title="Add host"
               class="act"
               onClick="xajax_window_submit('edit_host', xajax.getFormValues('form_record_{$record['id']}'), 'editor');"
            >Add host</a>&nbsp;
        </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();
}
예제 #7
0
function ws_display($window_name, $form = '')
{
    global $conf, $self, $onadb;
    global $images, $color, $style;
    $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 server record
    list($status, $rows, $record) = ona_get_host_record(array('id' => $form['host_id']));
    if ($status or !$rows) {
        array_pop($_SESSION['ona']['work_space']['history']);
        $html .= "<br><center><font color=\"red\"><b>Server doesn't exist!</b></font></center>";
        $response = new xajaxResponse();
        $response->addAssign("work_space_content", "innerHTML", $html);
        return $response->getXML();
    }
    // Pick up host information
    list($status, $rows, $host) = ona_find_host($form['host_id']);
    $record['fqdn'] = $host['fqdn'];
    // Update History Title
    $history = array_pop($_SESSION['ona']['work_space']['history']);
    $js .= "xajax_window_submit('work_space', ' ', 'rewrite_history');";
    if ($history['title'] == $window_name) {
        $history['title'] = "DHCP server - " . $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}');";
    // 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']);
    }
    $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;">
EOL;
    // SERVER INFORMATION
    $html .= <<<EOL
            <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px;">
                <!-- LABEL -->
                <tr><td colspan="99" nowrap="true" style="{$style['label_box']}">
                    DHCP server <a title="View host"
                           class="nav"
                           onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_host\\', \\'host_id=>{$record['id']}\\', \\'display\\')');"
                        >{$record['name']}</a>.<a title="View domain. ID: {$record['domain_id']}"
                                                     class="domain"
                                                     onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_domain\\', \\'domain_id=>{$record['domain_id']}\\', \\'display\\')');"
                                                  >{$record['domain_fqdn']}</a>
                </td></tr>
            </table>
EOL;
    // END SERVER INFORMATION
    $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;
    // FAILOVER GROUP INFO BOX
    // get failover group information
    list($status, $rows, $failover_groups) = db_get_records($onadb, 'dhcp_failover_groups', "primary_server_id = {$record['id']} or secondary_server_id = {$record['id']}");
    if ($rows) {
        $html .= <<<EOL
            <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px;">

                <!-- LABEL -->
                <tr><td colspan="2" nowrap="true" style="{$style['label_box']}">Failover groups</td></tr>
EOL;
        foreach ($failover_groups as $failover) {
            // Get DNS name for primary and secondary servers
            list($status, $rows, $fail_pri_host) = ona_get_host_record(array('id' => $failover['primary_server_id']));
            list($status, $rows, $fail_sec_host) = ona_get_host_record(array('id' => $failover['secondary_server_id']));
            $html .= <<<EOL
                <tr onMouseOver="this.className='row-highlight';"
                    onMouseOut="this.className='row-normal';">
                    <td align="left">GROUP_ID-{$failover['id']}&#058;&nbsp;{$fail_pri_host['name']}<img src="{$images}/silk/link.png" border="0">{$fail_sec_host['name']}&nbsp;</td>
                    <td align="right">
                        <a title="Edit failover group.  ID: {$failover['id']}"
                           class="act"
                           onClick="xajax_window_submit('edit_dhcp_failover_group', '{$failover['id']}', 'editor');"
                        ><img src="{$images}/silk/page_edit.png" border="0"></a>
                    </td>
                </tr>
             </table>
EOL;
        }
    }
    // END FAILOVER GROUP INFO BOX
    $html .= <<<EOL
        <!-- END OF SECOND COLUMN OF SMALL BOXES -->
        </td>

        <!-- START OF THRID COLUMN OF SMALL BOXES -->
        <td valign="top" style="padding-right: 15px;">

EOL;
    // Start displaying all the ws plugins
    $wspl = workspace_plugin_loader('dhcp_entries', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    //DONT add the, not needed $wsmenu{}=$wspl[2];
    // This will display the server level, not global level
    $extravars['dhcpserver_id'] = $host['id'];
    $wspl = workspace_plugin_loader('dhcp_entries', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wsmenuhtml = build_workspace_menu($wsmenu);
    $html .= <<<EOL
        </td>
        <!-- END OF THIRD COLUMN OF SMALL BOXES -->
    </tr></table>
    </div>
    <form id="form_server_{$record['id']}"
        ><input type="hidden" name="server_id" value="{$host['id']}"
        ><input type="hidden" name="js" value="{$refresh}"
    ></form>
    <form id="form_global_{$record['id']}"
        ><input type="hidden" name="global_id" value="0"
        ><input type="hidden" name="js" value="{$refresh}"
    ></form>
    <div id='wsmenu' style='display:none;'>{$wsmenuhtml}</div>
    <!-- END OF TOP SECTION -->
EOL;
    // SUBNET LIST
    $tab = 'dhcp_server';
    $submit_window = "list_{$tab}";
    $form_id = "{$submit_window}_filter_form";
    $_SESSION['ona'][$form_id]['tab'] = $tab;
    $content_id = "{$window_name}_{$submit_window}";
    $html .= <<<EOL
    <!-- SUBNET 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}_subnets_tab" class="table-tab-active">
                    Assigned Subnets <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="server_id" value="{$record['id']}" type="hidden">
                    <div id="{$form_id}_filter_overlay"
                         style="position: relative;
                                display: inline;
                                color: #CACACA;
                                cursor: text;"
                         onClick="this.style.display = 'none'; el('{$form_id}_filter').focus();"
                    >Filter</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('advanced', $debug_val)) {
        $html .= <<<EOL
        <div class="act-box" style="padding: 2px 4px; border-top: 1px solid {$color['border']}">
            <form id="form_dhcp_server_{$record['id']}"
                    ><input type="hidden" name="server" value="{$record['id']}"
                    ><input type="hidden" name="js" value="{$refresh}"
            ></form>
            <!-- ADD SUBNET LINK -->
            <a title="Assign subnet to DHCP server"
               class="act"
               onClick="xajax_window_submit('edit_dhcp_server', xajax.getFormValues('form_dhcp_server_{$record['id']}'), 'editor');"
            ><img src="{$images}/silk/page_add.png" border="0"></a>&nbsp;

            <a title="Assign subnet to DHCP server"
               class="act"
               onClick="xajax_window_submit('edit_dhcp_server', xajax.getFormValues('form_dhcp_server_{$record['id']}'), 'editor');"
            >Assign subnet</a>&nbsp;
        </div>
EOL;
    }
    $html .= <<<EOL
    </div>
EOL;
    // If we have a build type set, then display the output div
    if ($conf['build_dhcp_type'] && auth('advanced', $debug_val)) {
        $html .= <<<EOL
    <div id="confoutputdiv" style="border: 1px solid rgb(26, 26, 26); margin: 10px 20px;padding-left: 8px;overflow:hidden;width: 100px;"><pre style='font-family: monospace;overflow-y:auto;' id="confoutput"><center>Generating configuration...</center><br>{$conf['loading_icon']}</pre></div>
EOL;
        $js .= "xajax_window_submit('{$window_name}', 'fqdn=>{$record['fqdn']}', 'display_config');";
    }
    $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');

        setTimeout('el(\\'confoutputdiv\\').style.width = el(\\'{$form_id}_table\\').offsetWidth-8+\\'px\\';',900);
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();
}
예제 #8
0
function ws_display($window_name, $form = '')
{
    global $conf, $self, $onadb;
    global $images, $color, $style;
    $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 subnet record
    if ($form['subnet_id']) {
        list($status, $rows, $record) = ona_get_subnet_record(array('id' => $form['subnet_id']));
    } else {
        if ($form['ip']) {
            list($status, $rows, $record) = ona_get_subnet_record("ip_addr like '" . ip_mangle($form['ip'], 'numeric') . "'");
        } else {
            if ($form['subnet']) {
                list($status, $rows, $record) = ona_get_subnet_record(array('name' => $form['subnet']));
            }
        }
    }
    if ($status or !$rows) {
        array_pop($_SESSION['ona']['work_space']['history']);
        $html .= "<br><center><font color=\"red\"><b>Subnet doesn't exist!</b></font></center>";
        $response = new xajaxResponse();
        $response->addAssign("work_space_content", "innerHTML", $html);
        return $response->getXML();
    }
    // Update History Title
    $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}');";
    // is this an ipv6 subnet?
    if (strlen($record['ip_addr']) > 11) {
        $extravars['isipv6'] = TRUE;
    }
    // Convert IP and Netmask to a presentable format
    $record['ip_addr'] = ip_mangle($record['ip_addr'], 'dotted');
    $record['ip_mask'] = ip_mangle($record['ip_mask'], 'dotted');
    $record['ip_subnet_mask_cidr'] = ip_mangle($record['ip_mask'], 'cidr');
    list($status, $rows, $type) = ona_get_subnet_type_record(array('id' => $record['subnet_type_id']));
    $record['type'] = $type['display_name'];
    // Vlan Record
    list($status, $rows, $vlan) = ona_get_vlan_record(array('id' => $record['vlan_id']));
    $record['vlan_name'] = $vlan['name'];
    $record['vlan_campus_id'] = $vlan['vlan_campus_id'];
    $record['vlan_campus_name'] = $vlan['vlan_campus_name'];
    // extra stuff to pass to ws_plugins
    $extravars['refresh'] = $refresh;
    $extravars['window_name'] = $window_name;
    // Escape data for display in html
    foreach (array_keys($record) as $key) {
        $record[$key] = htmlentities($record[$key], ENT_QUOTES, $conf['php_charset']);
    }
    // Create a div for workspace plugins to live
    $html .= "<div id='wsplugins' style='margin: 10px;'>";
    $wspl = workspace_plugin_loader('subnet_detail', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('dhcp_servers', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('dhcp_pools', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('dhcp_entries', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    $wspl = workspace_plugin_loader('custom_attributes', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    // Display messages
    $wspl = workspace_plugin_loader('messages', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    // Display messages
    $wspl = workspace_plugin_loader('reports', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $wsmenu[] = $wspl[2];
    // Get all the plugin based worspace items
    $wspl_list = plugin_list('wspl_item');
    // Load all the dynamic plugins
    foreach ($wspl_list as $p) {
        $wspl = workspace_plugin_loader($p['path'], $record, $extravars);
        $html .= $wspl[0];
        $js .= $wspl[1];
        $wsmenu[] = $wspl[2];
    }
    // Gather our menuitems and build the HTML
    $wsmenuhtml = build_workspace_menu($wsmenu);
    $html .= <<<EOL

    </div>
    <br style="clear:both;">

    <form id="form_subnet_{$record['id']}"
        ><input type="hidden" name="subnet_id" value="{$record['id']}"
        ><input type="hidden" name="js" value="{$refresh}"
    ></form>

    <div id='wsmenu' style='display:none;'>{$wsmenuhtml}</div>

EOL;
    // HOST 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
    <!-- HOST 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 {$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="subnet_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>

        <!-- ADD HOST LINK -->
        <div class="act-box" style="padding: 2px 4px; border-top: 1px solid {$color['border']}">
            <form id="form_host_add_{$record['id']}"
                ><input type="hidden" name="subnet_id" value="{$record['id']}"
                ><input type="hidden" name="js" value="{$refresh}"
            ></form>
EOL;
    if (auth('host_add', $debug_val)) {
        $html .= <<<EOL
            <a title="Add host"
               class="act"
               onClick="xajax_window_submit('edit_host', xajax.getFormValues('form_host_add_{$record['id']}'), 'editor');"
            ><img src="{$images}/silk/page_add.png" border="0"></a>&nbsp;

            <a title="Add host"
               class="act"
               onClick="xajax_window_submit('edit_host', xajax.getFormValues('form_host_add_{$record['id']}'), 'editor');"
            >Add a new host</a>&nbsp;
EOL;
    }
    if (auth('interface_modify', $debug_val)) {
        $html .= <<<EOL

             <a title="Add interface"
               class="act"
               onClick="xajax_window_submit('edit_interface', xajax.getFormValues('form_host_add_{$record['id']}'), 'editor');"
            ><img src="{$images}/silk/page_add.png" border="0"></a>&nbsp;

            <a title="Add interface"
               class="act"
               onClick="xajax_window_submit('edit_interface', xajax.getFormValues('form_host_add_{$record['id']}'), 'editor');"
            >Add interface to an existing host</a>&nbsp;
EOL;
    }
    $html .= <<<EOL

            <!-- List by IP Address LINK -->
            <a title="List Hosts by IP"
               class="act"
               onClick="xajax_window_submit('app_full_list',  xajax.getFormValues('{$form_id}'), 'display');"
            ><img src="{$images}/silk/page_white_go.png" border="0"></a>&nbsp;

            <a title="List Hosts by IP"
               class="act"
               onClick="xajax_window_submit('app_full_list',  xajax.getFormValues('{$form_id}'), 'display');"
            >List Hosts by IP</a>&nbsp;

        </div>

    </div>
EOL;
    $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;
    // Temp turn OFF of the dhcp lease list.. its not ready yet.
    $haspool = 0;
    if ($haspool == 1) {
        // DHCP Lease LIST
        $tab = 'dhcp_leases';
        $submit_window = "list_{$tab}";
        $form_id = "{$submit_window}_filter_form";
        $_SESSION['ona'][$form_id]['tab'] = $tab;
        $content_id = "{$window_name}_{$submit_window}";
        $html .= <<<EOL
    <!-- Lease 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 {$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="subnet" value="{$record['id']}" type="hidden">
                    <div id="{$form_id}_filter_overlay"
                         style="position: relative;
                                display: inline;
                                color: #CACACA;
                                cursor: text;"
                         onClick="this.style.display = 'none'; el('{$form_id}_filter').focus();"
                    >Filter</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>


    </div>
EOL;
        $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();
}
예제 #9
0
function ws_display($window_name, $form = '')
{
    global $conf, $self, $onadb;
    global $images, $color, $style;
    $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
    list($status, $rows, $record) = ona_get_vlan_record(array('id' => $form['vlan_id']));
    if ($status or !$rows) {
        array_pop($_SESSION['ona']['work_space']['history']);
        $html .= "<br><center><font color=\"red\"><b>VLAN doesn't exist!</b></font></center>";
        $response = new xajaxResponse();
        $response->addAssign("work_space_content", "innerHTML", $html);
        return $response->getXML();
    }
    // Get campus info
    list($status, $rows, $vlan_campus) = ona_get_vlan_campus_record(array('id' => $record['vlan_campus_id']));
    $record['vlan_campus_name'] = $vlan_campus['name'];
    $record['vlan_campus_id'] = $vlan_campus['id'];
    // 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}');";
    $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']);
    }
    // Create a div for workspace plugins to live
    $html .= "<div id='wsplugins' style='margin: 10px;'>";
    $html .= <<<EOL
    <!-- FORMATTING TABLE -->
      <div id="vlan_detail" class="ws_plugin_content">

EOL;
    // VLAN INFORMATION
    $html .= <<<EOL
            <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px;">

                <tr><td colspan="99" nowrap="true" style="{$style['label_box']}">
                    <!-- LABEL -->
                    <form id="form_vlan_{$record['id']}"
                        ><input type="hidden" name="vlan_id" value="{$record['id']}"
                        ><input type="hidden" name="js" value="{$refresh}"
                    ></form>
EOL;
    if (auth('vlan_del', $debug_val)) {
        $html .= <<<EOL
                    <a title="Edit Vlan. ID: {$record['id']}"
                       class="act"
                       onClick="xajax_window_submit('edit_vlan', xajax.getFormValues('form_vlan_{$record['id']}'), 'editor');"
                    ><img src="{$images}/silk/page_edit.png" border="0"></a>&nbsp;

                    <a title="Delete Vlan. ID: {$record['id']}"
                       class="act"
                       onClick="var doit=confirm('Are you sure you want to delete this vlan?');
                                if (doit == true)
                                    xajax_window_submit('edit_vlan', xajax.getFormValues('form_vlan_{$record['id']}'), 'delete');"
                    ><img src="{$images}/silk/delete.png" border="0"></a>&nbsp;
                    {$record['name']}</a>
EOL;
    } else {
        $html .= "                    &nbsp;{$record['name']}";
    }
    $html .= <<<EOL
                </td></tr>

                <tr>
                    <td align="right" nowrap="true"><b>Vlan Campus</b>&nbsp;</td>
                    <td class="padding" align="left">
                        <a title="View Vlan Campus"
                           class="nav"
                           onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_vlan_campus\\', \\'vlan_campus_id=>{$record['vlan_campus_id']}\\', \\'display\\')');"
                        >{$record['vlan_campus_name']}</a>
                    </td>
                </tr>

                <tr>
                    <td align="right" nowrap="true"><b>Vlan Name</b>&nbsp;</td>
                    <td class="padding" align="left">{$record['name']}&nbsp;</td>
                </tr>

                <tr>
                    <td align="right" nowrap="true"><b>Vlan Number</b>&nbsp;</td>
                    <td class="padding" align="left">{$record['number']}&nbsp;</td>
                </tr>

            </table>
      </div>
EOL;
    // END VLAN INFORMATION
    // extra stuff to pass to ws_plugins
    $extravars['refresh'] = $refresh;
    $extravars['window_name'] = $window_name;
    $wspl = workspace_plugin_loader('custom_attributes', $record, $extravars);
    $html .= $wspl[0];
    $js .= $wspl[1];
    $html .= "</div>";
    $html .= <<<EOL
    </div>
    <br style="clear:both;">
    <!-- END OF TOP SECTION -->
EOL;
    // SUBNET LIST
    $tab = 'subnets';
    $submit_window = "list_{$tab}";
    $form_id = "{$submit_window}_filter_form";
    $_SESSION['ona'][$form_id]['tab'] = $tab;
    $content_id = "{$window_name}_{$submit_window}";
    $html .= <<<EOL
    <!-- SUBNET 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 {$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="vlan_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>

    </div>

EOL;
    $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();
}
예제 #10
0
function ws_display($window_name, $form = '')
{
    global $conf, $self, $onadb;
    global $images, $color, $style;
    $html = '';
    $js = '';
    //$debug_val = 3;  // used in the auth() calls to suppress 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 domain record
    list($status, $rows, $record) = ona_get_domain_record(array('id' => $form['domain_id']));
    if ($status or !$rows) {
        array_pop($_SESSION['ona']['work_space']['history']);
        $html .= "<br><center><font color=\"red\"><b>Domain doesn't exist!</b></font></center>";
        $response = new xajaxResponse();
        $response->addAssign("work_space_content", "innerHTML", $html);
        return $response->getXML();
    }
    // Update History Title
    $history = array_pop($_SESSION['ona']['work_space']['history']);
    $js .= "xajax_window_submit('work_space', ' ', 'rewrite_history');";
    if ($history['title'] == $window_name) {
        $history['title'] = $record['fqdn'];
        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}');";
    // Get associated info
    if ($record['parent_id']) {
        list($status, $rows, $parent_domain) = ona_get_domain_record(array('id' => $record['parent_id']));
        $parent_domain['name'] = ona_build_domain_name($parent_domain['id']);
    } else {
        $parent_domain = "";
    }
    // Find the primary_master host to see if it is valid
    list($status, $rows, $primaster_host) = ona_find_dns_record($record['primary_master']);
    if ($primaster_host['id'] === 0) {
        $not_a_primaster = 1;
    }
    $style['content_box'] = <<<EOL
        margin: 10px 20px;
        padding: 2px 4px;
        background-color: #FFFFFF;
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']);
    }
    foreach (array_keys((array) $parent_domain) as $key) {
        $parent_domain[$key] = htmlentities($parent_domain[$key], ENT_QUOTES, $conf['php_charset']);
    }
    $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;">
EOL;
    // DOMAIN INFORMATION BOX
    $html .= <<<EOL
        <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px;">
            <tr>
            <td colspan="99" nowrap="true">
                <!-- LABEL -->
                    <form id="form_domain_{$record['id']}"
                        ><input type="hidden" name="id" value="{$record['id']}"
                        ><input type="hidden" name="js" value="{$refresh}"
                    ></form>
                    <div style="{$style['label_box']}">

EOL;
    if (auth('advanced', $debug_val)) {
        $html .= <<<EOL
                            <a title="Edit domain. ID: {$record['id']}"
                               onClick="xajax_window_submit('edit_domain', xajax.getFormValues('form_domain_{$record['id']}'), 'editor');"
                            ><img src="{$images}/silk/page_edit.png" border="0"></a>
                            <a title="Delete domain. ID: {$record['id']}"
                               class="linkact"
                               onClick="var doit=confirm('Are you sure you want to delete this domain?');
                                        if (doit == true)
                                            xajax_window_submit('edit_domain', xajax.getFormValues('form_domain_{$record['id']}'), 'delete');"
                            ><img src="{$images}/silk/delete.png"></a>
EOL;
    }
    $html .= <<<EOL
                {$record['fqdn']}
                </div>
            </td>
            </tr>
EOL;
    if ($parent_domain['id']) {
        $html .= <<<EOL
            <tr>
                <td align="right" nowrap="true"><b>Parent Domain</b>&nbsp;</td>
                <td class="padding" align="left">
                    <a title="View domain. ID: {$parent_domain['id']}"
                       class="domain"
                       onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_domain\\', \\'domain_id=>{$parent_domain['id']}\\', \\'display\\')');"
                    >{$parent_domain['name']}</a>
                </td>
            </tr>
            <tr><td colspan="2" align="left" nowrap="true">&nbsp;</td></tr>
EOL;
    }
    $html .= <<<EOL
            <tr>
                <td colspan="2" align="left" nowrap="true"><b><u>Domain SOA Parameters</u></b>&nbsp;</td>
            </tr>

EOL;
    if ($record['primary_master']) {
        if ($not_a_primaster) {
            $record['primary_master'] = "<span style='background-color: #FFDDDD;' title='INFO: This FQDN is not defined in the database.'><img src='{$images}/silk/error.png' border='0'> {$record['primary_master']}</span>";
        }
        $html .= <<<EOL
            <tr>
                <td align="right" nowrap="true"><b>Primary Master</b>&nbsp;</td>
                <td class="padding" align="left" onClick="xajax_window_submit('edit_domain', xajax.getFormValues('form_domain_{$record['id']}'), 'editor');">
                    {$record['primary_master']}&nbsp;
                </td>
            </tr>
EOL;
    } else {
        $html .= <<<EOL
            <tr style="background-color: #FFDDDD;" title="There is no defined primary master server!">
                <td align="right" nowrap="true"><b>Primary Master</b>&nbsp;</td>
                <td nowrap="true">
                    <img src='{$images}/silk/error.png' border='0'> Please assign a Primary Master server!
                </td>
            </tr>
EOL;
    }
    $html .= <<<EOL
            <tr>
                <td align="right" nowrap="true"><b>Refresh</b>&nbsp;</td>
                <td class="padding" align="left">
                    {$record['refresh']}&nbsp;
                </td>
            </tr>

            <tr>
                <td align="right" nowrap="true"><b>Retry</b>&nbsp;</td>
                <td class="padding" align="left">
                    {$record['retry']}&nbsp;
                </td>
            </tr>

            <tr>
                <td align="right" nowrap="true"><b>Expiry</b>&nbsp;</td>
                <td class="padding" align="left">
                    {$record['expiry']}&nbsp;
                </td>
            </tr>

            <tr>
                <td align="right" nowrap="true"><b>Minimum</b>&nbsp;</td>
                <td class="padding" align="left">
                    {$record['minimum']}&nbsp;
                </td>
            </tr>

            <tr>
                <td align="right" nowrap="true"><b>Default TTL</b>&nbsp;</td>
                <td class="padding" align="left">
                    {$record['default_ttl']}&nbsp;
                </td>
            </tr>
        </table>
EOL;
    // END DOMAIN INFORMATION BOX
    $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;
    // DNS SERVERS BOX
    $html .= <<<EOL
        <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px;">
            <tr>
                <td colspan="99" nowrap="true" style="{$style['label_box']}">DNS servers&nbsp;</td>
            </tr>

EOL;
    // Get a list of servers, and loop through them
    list($status, $rows, $domainservers) = db_get_records($onadb, 'dns_server_domains', array('domain_id' => $record['id']), 'role');
    if ($rows) {
        foreach ($domainservers as $domainserver) {
            $domainserver['role'] = strtoupper($domainserver['role']);
            list($status, $rows, $host) = ona_find_host($domainserver['host_id']);
            $host['fqdn'] = htmlentities($host['fqdn'], ENT_QUOTES, $conf['php_charset']);
            $html .= <<<EOL
                <tr onMouseOver="this.className='row-highlight';"
                    onMouseOut="this.className='row-normal';">

                    <td align="left" nowrap="true">
                        <a title="View server. ID: {$host['id']}"
                           class="nav"
                           onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_domain_server\\', \\'host_id=>{$host['id']}\\', \\'display\\')');"
                        >{$host['fqdn']}</a>&nbsp;
                     </td>
                     <td align="left" nowrap="true" style="border-left: 1px solid; border-left-color: #aaaaaa;padding-left: 3px;">
                            {$domainserver['role']}
                    </td>
                     <td align="right" nowrap="true">
                        <form id="{$form['form_id']}_domain_serv_{$domainserver['id']}"
                                ><input type="hidden" name="server" value="{$domainserver['host_id']}"
                                ><input type="hidden" name="domain" value="{$domainserver['domain_id']}"
                                ><input type="hidden" name="js" value="{$refresh}"
                        ></form>
EOL;
            if (auth('advanced', $debug_val)) {
                $html .= <<<EOL

                        &nbsp;<a title="Remove domain assignment"
                           class="linkact"
                           onClick="var doit=confirm('Are you sure you want to remove this domain from this DNS server?');
                           if (doit == true)
                                xajax_window_submit('edit_domain_server', xajax.getFormValues('{$form['form_id']}_domain_serv_{$domainserver['id']}'), 'delete');"
                        ><img src="{$images}/silk/page_delete.png"></a>
EOL;
            }
            $html .= <<<EOL
                   </td>

                </tr>
EOL;
        }
    } else {
        $html .= <<<EOL
            <tr style="background-color: #FFDDDD;" title="There are no defined servers for this domain!">
                <td colspan=10 nowrap="true">
                    <img src="{$images}/silk/error.png"> Please add a server for this domain!
                </td>
EOL;
    }
    if (auth('advanced', $debug_val)) {
        $html .= <<<EOL

                <tr>
                    <td colspan="3" align="left" valign="middle" nowrap="true" class="act-box">
                        <form id="form_domain_server_{$record['id']}"
                            ><input type="hidden" name="domain" value="{$record['name']}"
                            ><input type="hidden" name="js" value="{$refresh}"
                        ></form>

                        <a title="Assign server"
                           class="linkact"
                           onClick="xajax_window_submit('edit_domain_server', xajax.getFormValues('form_domain_server_{$record['id']}'), 'editor');"
                        ><img src="{$images}/silk/page_add.png">Assign to server</a>

                    </td>
                </tr>
EOL;
    }
    $html .= "          </table>";
    // END DNS SERVERS BOX
    $html .= <<<EOL
        <!-- END OF SECOND COLUMN OF SMALL BOXES -->
        </td>

        <!-- START OF THIRD COLUMN OF SMALL BOXES -->
        <td valign="top" style="padding-right: 15px;">
EOL;
    // extra stuff to pass to ws_plugins
    $extravars['refresh'] = $refresh;
    $extravars['window_name'] = $window_name;
    // Get all the plugin based worspace items
    $wspl_list = plugin_list('wspl_item');
    // Load all the dynamic plugins
    foreach ($wspl_list as $p) {
        $wspl = workspace_plugin_loader($p['path'], $record, $extravars);
        $html .= $wspl[0];
        $js .= $wspl[1];
    }
    $html .= <<<EOL
        </td>
        <!-- END OF THIRD COLUMN OF SMALL BOXES -->
    </tr></table>
    </div>
    <!-- END OF TOP SECTION -->
EOL;
    // HOST LIST
    $tab = 'records';
    $submit_window = "list_{$tab}";
    $form_id = "{$submit_window}_filter_form";
    $_SESSION['ona'][$form_id]['tab'] = $tab;
    $content_id = "{$window_name}_{$submit_window}";
    $html .= <<<EOL
    <!-- HOST 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 {$tab} <span id="{$form_id}_{$tab}_count"></span>
                </td>

                <td id="{$form_id}_quick_filter" class="padding" align="right" width="100%">
EOL;
    $html .= <<<EOL
                    <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="domain_id" value="{$record['id']}" type="hidden">

                    <div id="{$form_id}_filter_overlay"
                         style="position: relative;
                                display: inline;
                                color: #CACACA;
                                cursor: text;"
                         onClick="this.style.display = 'none'; el('{$form_id}_filter').focus();"
                    >Filter</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('dns_record_add', $debug_val)) {
        $html .= <<<EOL

        <!-- List by IP Address LINK -->
        <div class="act-box" style="padding: 2px 4px; border-top: 1px solid {$color['border']}">
            <form id="form_dns_add_{$record['id']}">
                <input type="hidden" name="js" value="{$refresh}">
                <input type="hidden" name="domain_id" value="{$record['id']}">
            </form>

            <a title="Add DNS Record"
               class="linkact"
               onClick="xajax_window_submit('edit_record', xajax.getFormValues('form_dns_add_{$record['id']}'), 'editor');"
            ><img src="{$images}/silk/page_add.png">Add a new DNS record</a>&nbsp;

        </div>
EOL;
    }
    $html .= <<<EOL
    </div>
EOL;
    // If we have a build type set, then display the output div
    if ($conf['build_dns_type'] && auth('dns_record_add', $debug_val)) {
        // Get a list of the views so we can build a select option
        if ($conf['dns_views']) {
            list($status, $rows, $recs) = db_get_records($onadb, 'dns_views', 'id >= 0', 'name');
            $dns_view_list = '';
            foreach ($recs as $rec) {
                $rec['name'] = htmlentities($rec['name']);
                $dns_view_list .= "<option value=\"{$rec['id']}\">{$rec['name']}</option>\n";
            }
            $html .= <<<EOL
    <div style="margin: 10px 20px;padding-left: 8px;">
        <form>
        Show config for DNS view: <select name="build_dns_view"
                id="build_dns_view"
                class="edit"
                onchange="xajax_window_submit('{$window_name}', 'fqdn=>{$record['fqdn']},view=>'+el('build_dns_view').value , 'display_config');"
        >
            {$dns_view_list}
        </select>
        </form>
    </div>
EOL;
        }
        $html .= <<<EOL
    <div id="confoutputdiv" style="border: 1px solid rgb(26, 26, 26); margin: 10px 20px;padding-left: 8px;overflow:hidden;width: 100px;"><pre style='font-family: monospace;overflow-y:auto;' id="confoutput"><center>Generating configuration...</center><br>{$conf['loading_icon']}</pre></div>
EOL;
        $js .= "xajax_window_submit('{$window_name}', 'fqdn=>{$record['fqdn']}', 'display_config');";
    }
    $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');

        setTimeout('el(\\'confoutputdiv\\').style.width = el(\\'{$form_id}_table\\').offsetWidth-8+\\'px\\';',900);
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();
}