コード例 #1
0
function renderNetVLAN($cell)
{
    if (empty($cell['8021q'])) {
        return;
    }
    $links = array();
    foreach ($cell['8021q'] as $vi) {
        $links[] = mkA($vi['vlan_id'], 'vlan', "{$vi['domain_id']}-{$vi['vlan_id']}");
    }
    $noun = count($cell['8021q']) > 1 ? 'VLANs' : 'VLAN';
    echo "<div class='vlan'><strong><small>{$noun}</small> " . implode(', ', $links) . '</strong></div>';
}
コード例 #2
0
function printTagsPicker($preselect = NULL)
{
    global $taglist;
    if (!count($taglist)) {
        printf('(None exist yet, %s?)', mkA('configure', 'tagtree', NULL, 'edit'));
        return;
    }
    printTagsPickerInput();
    printTagsPickerUl($preselect);
    enableTagsPicker();
}
コード例 #3
0
ファイル: ophandlers.php プロジェクト: xtha/salt
function cloneRSPool()
{
    assertUIntArg('pool_id');
    $pool = spotEntity('ipv4rspool', $_REQUEST['pool_id']);
    $rs_list = getRSListInPool($pool['id']);
    $tagidlist = array();
    foreach ($pool['etags'] as $taginfo) {
        $tagidlist[] = $taginfo['id'];
    }
    $new_id = commitCreateRSPool($pool['name'] . ' (copy)', $pool['vsconfig'], $pool['rsconfig'], $tagidlist);
    foreach ($rs_list as $rs) {
        addRStoRSPool($new_id, $rs['rsip_bin'], $rs['rsport'], $rs['inservice'], $rs['rsconfig'], $rs['comment']);
    }
    showSuccess('Created a copy of pool  ' . mkA($pool['name'], 'ipv4rspool', $pool['id']));
    return buildRedirectURL('ipv4rspool', 'default', array('pool_id' => $new_id));
}
コード例 #4
0
/**
 *
 * Fing tab handler
 *
 */
function FingTab($id)
{
    $can_import = permitted(NULL, NULL, 'importFingData');
    //
    // allocation settings
    //
    // address allocation code, IPv4 networks view
    $aac_left = array('regular' => '', 'virtual' => '<span class="aac-left" title="Loopback">L:</span>', 'shared' => '<span class="aac-left" title="Shared">S:</span>', 'router' => '<span class="aac-left" title="Router">R:</span>', 'point2point' => '<span class="aac-left" title="Point-to-point">P:</span>');
    //
    // header
    //
    global $pageno, $tabno;
    $maxperpage = getConfigVar('IPV4_ADDRS_PER_PAGE');
    $range = spotEntity('ipv4net', $id);
    loadIPAddrList($range);
    echo "<center><h1>{$range['ip']}/{$range['mask']}</h1><h2>{$range['name']}</h2></center>\n";
    //
    // execute fing
    //
    try {
        $known_ips = get_fing_scan($range['ip'], $range['mask']);
        $fing_cfg = get_fing_settings($range['ip'], $range['mask']);
        $fing_gw = $fing_cfg["gateway"];
    } catch (FingException $e) {
        render_fing_error("Could not get network scan via fing:", $e->getMessage());
        return FALSE;
    }
    echo "<table class=objview border=0 width='100%'><tr><td class=pcleft>";
    startPortlet('overlook fing (via: ' . $fing_gw . ')');
    //
    // pagination
    //
    if (isset($_REQUEST['pg'])) {
        $page = $_REQUEST['pg'];
    } else {
        $page = 0;
    }
    $startip = ip4_bin2int($range['ip_bin']);
    $endip = ip4_bin2int(ip_last($range));
    $numpages = 0;
    if ($endip - $startip > $maxperpage) {
        $numpages = ($endip - $startip) / $maxperpage;
        $startip = $startip + $page * $maxperpage;
        $endip = $startip + $maxperpage - 1;
    }
    echo "<center>";
    if ($numpages) {
        echo '<h3>' . ip4_format(ip4_int2bin($startip)) . ' ~ ' . ip4_format(ip4_int2bin($endip)) . '</h3>';
    }
    for ($i = 0; $i < $numpages; $i++) {
        if ($i == $page) {
            echo "<b>{$i}</b> ";
        } else {
            echo "<a href='" . makeHref(array('page' => $pageno, 'tab' => $tabno, 'id' => $id, 'pg' => $i)) . "'>{$i}</a> ";
        }
    }
    echo "</center>";
    if ($can_import) {
        printOpFormIntro('importFingData', array('addrcount' => $endip - $startip + 1));
        $box_counter = 1;
    }
    echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center'>\n";
    echo "<tr><th class='tdleft'>address</th><th class='tdleft'>state</th><th class='tdleft'>current name</th><th class='tdleft'>DNS name</th><th class='tdleft'>MAC</th><th class='tdleft'>Allocation</th>";
    if ($can_import) {
        echo '<th>import</th>';
    }
    echo "</tr>\n";
    //
    // Loop through all IPs
    //
    $cnt_match = $cnt_missing = $cnt_mismatch = $cnt_total = 0;
    for ($ip = $startip; $ip <= $endip; $ip++) {
        $cnt_total++;
        $print_cbox = FALSE;
        $ip_bin = ip4_int2bin($ip);
        $addr = isset($range['addrlist'][$ip_bin]) ? $range['addrlist'][$ip_bin] : array('name' => '', 'reserved' => 'no');
        $straddr = ip4_format($ip_bin);
        list($fing_hostname, $fing_state, $fing_mac_vendor) = get_fing_info($straddr, $known_ips);
        $ip_is_up = strtoupper($fing_state) == "UP" ? TRUE : FALSE;
        if ($can_import) {
            echo "<input type=hidden name=addr_{$cnt_total} value={$straddr}>\n";
            echo "<input type=hidden name=descr_{$cnt_total} value={$fing_hostname}>\n";
            echo "<input type=hidden name=rsvd_{$cnt_total} value={$addr['reserved']}>\n";
        }
        $skip_dns_check = FALSE;
        echo "<tr";
        // Ignore network and broadcast addresses
        if ($ip == $startip && $addr['name'] == 'network' || $ip == $endip && $addr['name'] == 'broadcast') {
            echo " class='trbusy'";
            $skip_dns_check = TRUE;
        } elseif (!$ip_is_up) {
            echo " class='trnull'";
        }
        // set line color depending if we have the name already in the DB
        if (!$skip_dns_check) {
            if ($addr['name'] == $fing_hostname) {
                if (strlen($fing_hostname)) {
                    echo ' class=trok';
                    $cnt_match++;
                }
            } elseif (!strlen($addr['name']) or !strlen($fing_hostname)) {
                echo ' class=trwarning';
                $print_cbox = TRUE;
                $cnt_missing++;
            } else {
                echo ' class=trerror';
                $print_cbox = TRUE;
                $cnt_mismatch++;
            }
        }
        //IP
        echo "><td class='tdleft";
        if (isset($range['addrlist'][$ip_bin]['class']) and strlen($range['addrlist'][$ip_bin]['class'])) {
            echo ' ' . $range['addrlist'][$ip_bin]['class'];
        }
        echo "'><a href='" . makeHref(array('page' => 'ipaddress', 'ip' => $straddr)) . "'>{$straddr}</a></td>";
        //other columns
        if ($skip_dns_check) {
            echo "<td class='tdleft'>&nbsp;</td>";
        } else {
            if (!$ip_is_up) {
                echo "<td class='tdleft'>" . $fing_state . "</td>";
            } else {
                echo "<td class='tdleft'><div class='strong'>" . $fing_state . "</div></td>";
            }
        }
        echo "<td class=tdleft>{$addr['name']}</td>";
        echo "<td class='tdleft'>" . $fing_hostname . "</td>";
        echo "<td class='tdleft'>" . $fing_mac_vendor . "</td>";
        //allocation
        echo "<td>";
        $delim = '';
        if ($addr['reserved'] == 'yes') {
            echo "<strong>RESERVED</strong> ";
            $delim = '; ';
        }
        foreach ($addr['allocs'] as $ref) {
            echo $delim . $aac_left[$ref['type']];
            echo makeIPAllocLink($ip_bin, $ref, TRUE);
            $delim = '; ';
        }
        if ($delim != '') {
            $delim = '<br>';
        }
        foreach ($addr['vslist'] as $vs_id) {
            $vs = spotEntity('ipv4vs', $vs_id);
            echo $delim . mkA("{$vs['name']}:{$vs['vport']}/{$vs['proto']}", 'ipv4vs', $vs['id']) . '&rarr;';
            $delim = '<br>';
        }
        foreach ($addr['vsglist'] as $vs_id) {
            $vs = spotEntity('ipvs', $vs_id);
            echo $delim . mkA($vs['name'], 'ipvs', $vs['id']) . '&rarr;';
            $delim = '<br>';
        }
        foreach ($addr['rsplist'] as $rsp_id) {
            $rsp = spotEntity('ipv4rspool', $rsp_id);
            echo "{$delim}&rarr;" . mkA($rsp['name'], 'ipv4rspool', $rsp['id']);
            $delim = '<br>';
        }
        echo "</td>";
        // import column
        if ($can_import) {
            echo '<td>';
            if ($print_cbox) {
                echo "<input type=checkbox name=import_{$cnt_total} id=atom_1_" . $box_counter++ . "_1>";
            } else {
                echo '&nbsp;';
            }
            echo '</td>';
        }
        echo "</tr>";
    }
    if ($can_import && $box_counter > 1) {
        echo '<tr><td colspan=4 align=center><input type=submit value="Import selected records"></td><td colspan=2 align=right>';
        addJS('js/racktables.js');
        echo --$box_counter ? "<a href='javascript:;' onclick=\"toggleColumnOfAtoms(1, 1, {$box_counter})\">(toggle selection)</a>" : '&nbsp;';
        echo '</td></tr>';
    }
    echo "</table>";
    if ($can_import) {
        echo '</form>';
    }
    finishPortlet();
    echo "</td><td class=pcright>";
    //
    // PING Statistics
    //
    startPortlet('ping stats');
    $cnt_ping_up = get_fing_up_count($known_ips);
    echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>";
    echo "<tr class=trok><th class=tdright>Replied to Ping</th><td class=tdleft>{$cnt_ping_up}</td></tr>\n";
    echo "<tr class=trwarning><th class=tdright>No Response</th><td class=tdleft>" . ($cnt_total - $cnt_ping_up) . "</td></tr>\n";
    echo "</table>\n";
    finishPortlet();
    //
    // DNS Statistics
    //
    startPortlet('dns stats');
    echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>";
    echo "<tr class=trok><th class=tdright>Exact matches:</th><td class=tdleft>{$cnt_match}</td></tr>\n";
    echo "<tr class=trwarning><th class=tdright>Missing from DB/DNS:</th><td class=tdleft>{$cnt_missing}</td></tr>\n";
    if ($cnt_mismatch) {
        echo "<tr class=trerror><th class=tdright>Mismatches:</th><td class=tdleft>{$cnt_mismatch}</td></tr>\n";
    }
    echo "</table>\n";
    finishPortlet();
}
コード例 #5
0
function renderVirtualService($vsid)
{
    $vsinfo = spotEntity('ipv4vs', $vsid);
    echo '<table border=0 class=objectview cellspacing=0 cellpadding=0>';
    if (strlen($vsinfo['name'])) {
        echo "<tr><td colspan=2 align=center><h1>{$vsinfo['name']}</h1></td></tr>\n";
    }
    echo '<tr>';
    echo '<td class=pcleft>';
    $summary = array();
    $summary['Name'] = $vsinfo['name'];
    $summary['Protocol'] = $vsinfo['proto'];
    $summary['Virtual IP address'] = mkA($vsinfo['vip'], 'ipaddress', $vsinfo['vip']);
    $summary['Virtual port'] = $vsinfo['vport'];
    $summary['tags'] = '';
    $summary['VS configuration'] = '<div class="dashed slbconf">' . $vsinfo['vsconfig'] . '</div>';
    $summary['RS configuration'] = '<div class="dashed slbconf">' . $vsinfo['rsconfig'] . '</div>';
    renderEntitySummary($vsinfo, 'Summary', $summary);
    echo '</td>';
    echo '<td class=pcright>';
    renderSLBTriplets($vsinfo);
    echo '</td></tr><tr><td colspan=2>';
    renderFilesPortlet('ipv4vs', $vsid);
    echo '</tr><table>';
}
コード例 #6
0
function renderEditVlan($vlan_ck)
{
    global $vtoptions;
    $vlan = getVLANInfo($vlan_ck);
    startPortlet('Modify');
    printOpFormIntro('upd');
    // static attributes
    echo '<table border=0 cellspacing=0 cellpadding=2 align=center>';
    echo '<tr><th class=tdright>Name:</th><td class=tdleft>' . "<input type=text size=40 name=vlan_descr value='" . stringForTextInputValue($vlan['vlan_descr'], 255) . "'>" . '</td></tr>';
    echo '<tr><th class=tdright>Type:</th><td class=tdleft>' . getSelect($vtoptions, array('name' => 'vlan_type'), $vlan['vlan_prop']) . '</td></tr>';
    echo '</table>';
    echo '<p>';
    echo '<input type="hidden" name="vdom_id" value="' . $vlan['domain_id'] . '">';
    echo '<input type="hidden" name="vlan_id" value="' . $vlan['vlan_id'] . '">';
    printImageHREF('SAVE', 'Update VLAN', TRUE);
    echo '</form><p>';
    // get configured ports count
    $portc = 0;
    foreach (getVLANConfiguredPorts($vlan_ck) as $subarray) {
        $portc += count($subarray);
    }
    $clear_line = '';
    $delete_line = '';
    if ($portc) {
        $clear_line .= '<p>';
        $clear_line .= getOpLink(array('op' => 'clear'), 'remove', 'clear', "remove this VLAN from {$portc} ports") . ' this VLAN from ' . mkA("{$portc} ports", 'vlan', $vlan_ck);
    }
    $reason = '';
    if ($vlan['vlan_id'] == VLAN_DFL_ID) {
        $reason = "You can not delete default VLAN";
    }
    if (!empty($reason)) {
        echo getOpLink(NULL, 'delete VLAN', 'nodestroy', $reason);
    } else {
        echo getOpLink(array('op' => 'del', 'vlan_ck' => $vlan_ck), 'delete VLAN', 'destroy', '', 'need-confirmation');
    }
    echo $clear_line;
    finishPortlet();
}
コード例 #7
0
ファイル: interface.php プロジェクト: xtha/salt
function renderExpirations()
{
    global $nextorder;
    $breakdown = array();
    $breakdown[21] = array(array('from' => -365, 'to' => 0, 'class' => 'has_problems_', 'title' => 'has expired within last year'), array('from' => 0, 'to' => 30, 'class' => 'row_', 'title' => 'expires within 30 days'), array('from' => 30, 'to' => 60, 'class' => 'row_', 'title' => 'expires within 60 days'), array('from' => 60, 'to' => 90, 'class' => 'row_', 'title' => 'expires within 90 days'));
    $breakdown[22] = $breakdown[21];
    $breakdown[24] = $breakdown[21];
    $attrmap = getAttrMap();
    foreach ($breakdown as $attr_id => $sections) {
        startPortlet($attrmap[$attr_id]['name']);
        foreach ($sections as $section) {
            $count = 1;
            $order = 'odd';
            $result = scanAttrRelativeDays($attr_id, $section['from'], $section['to']);
            echo '<table align=center width=60% border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>';
            echo "<caption>{$section['title']}</caption>\n";
            if (!count($result)) {
                echo "<tr><td colspan=4>(none)</td></tr></table><br>\n";
                continue;
            }
            echo '<tr valign=top><th align=center>Count</th><th align=center>Name</th>';
            echo "<th align=center>Asset Tag</th><th align=center>OEM S/N 1</th><th align=center>Date Warranty <br> Expires</th></tr>\n";
            foreach ($result as $row) {
                $date_value = datetimestrFromTimestamp($row['uint_value']);
                $object = spotEntity('object', $row['object_id']);
                $attributes = getAttrValues($object['id']);
                $oem_sn_1 = array_key_exists(1, $attributes) ? $attributes[1]['a_value'] : '&nbsp;';
                echo '<tr class=' . $section['class'] . $order . ' valign=top>';
                echo "<td>{$count}</td>";
                echo '<td>' . mkA($object['dname'], 'object', $object['id']) . '</td>';
                echo "<td>{$object['asset_no']}</td>";
                echo "<td>{$oem_sn_1}</td>";
                echo "<td>{$date_value}</td>";
                echo "</tr>\n";
                $order = $nextorder[$order];
                $count++;
            }
            echo "</table><br>\n";
        }
        finishPortlet();
    }
}
コード例 #8
0
ファイル: interface.php プロジェクト: peter-volkov/RackTrack
function renderRack($rack_id, $hl_obj_id = 0)
{
    $rackData = spotEntity('rack', $rack_id);
    amplifyCell($rackData);
    markAllSpans($rackData);
    if ($hl_obj_id > 0) {
        highlightObject($rackData, $hl_obj_id);
    }
    $prev_id = getPrevIDforRack($rackData['row_id'], $rack_id);
    $next_id = getNextIDforRack($rackData['row_id'], $rack_id);
    echo "<center><table border=0><tr valign=middle>";
    echo '<td><h2>' . mkA($rackData['row_name'], 'row', $rackData['row_id']) . ' :</h2></td>';
    if ($prev_id != NULL) {
        echo '<td>' . mkA(getImageHREF('prev', 'previous rack'), 'rack', $prev_id) . '</td>';
    }
    echo '<td><h2>' . mkA($rackData['name'], 'rack', $rackData['id']) . '</h2></td>';
    if ($next_id != NULL) {
        echo '<td>' . mkA(getImageHREF('next', 'next rack'), 'rack', $next_id) . '</td>';
    }
    echo "</h2></td></tr></table>\n";
    $result = usePreparedSelectBlade("SELECT * FROM racktemperature WHERE rackid = ?", array($rack_id));
    $row = $result->fetch(PDO::FETCH_ASSOC);
    if (isset($row['top'])) {
        echo "<table align=left border=1>\n";
        echo "<tr><th>Sensor</th><th>Temperature</th></tr>\n";
        for ($i = $rackData['height']; $i > 5; $i--) {
            if ($i == 40) {
                echo "<tr><td>top</td><td>{$row['top']}</td></tr>\n";
            } else {
                if ($i == 23) {
                    echo "<tr><td>middle</td><td>{$row['middle']}</td></tr>\n";
                } else {
                    if ($i == 11) {
                        echo "<tr><td>bottom</td><td>{$row['bottom']}</td></tr>\n";
                    } else {
                        echo "<tr><td>&nbsp</td><td>&nbsp</td></tr>\n";
                    }
                }
            }
        }
        echo "</table>";
    }
    echo "<table class=rack align=center border=0 cellspacing=0 cellpadding=1>\n";
    echo "<tr><th width='10%'>&nbsp;</th><th width='20%'>Front</th>";
    echo "<th width='50%'>Interior</th><th width='20%'>Back</th></tr>\n";
    for ($i = $rackData['height']; $i > 0; $i--) {
        echo "<tr><th>" . inverseRackUnit($i, $rackData) . "</th>";
        for ($locidx = 0; $locidx < 3; $locidx++) {
            if (isset($rackData[$i][$locidx]['skipped'])) {
                continue;
            }
            $state = $rackData[$i][$locidx]['state'];
            echo "<td class='atom state_{$state}";
            if (isset($rackData[$i][$locidx]['hl'])) {
                echo $rackData[$i][$locidx]['hl'];
            }
            echo "'";
            if (isset($rackData[$i][$locidx]['colspan'])) {
                echo ' colspan=' . $rackData[$i][$locidx]['colspan'];
            }
            if (isset($rackData[$i][$locidx]['rowspan'])) {
                echo ' rowspan=' . $rackData[$i][$locidx]['rowspan'];
            }
            echo ">";
            switch ($state) {
                case 'T':
                    printObjectDetailsForRenderRack($rackData[$i][$locidx]['object_id'], $hl_obj_id);
                    break;
                case 'A':
                    echo '<div title="This rackspace does not exist">&nbsp;</div>';
                    break;
                case 'F':
                    echo '<div title="Free rackspace">&nbsp;</div>';
                    break;
                case 'U':
                    echo '<div title="Problematic rackspace, you CAN\'T mount here">&nbsp;</div>';
                    break;
                default:
                    echo '<div title="No data">&nbsp;</div>';
                    break;
            }
            echo '</td>';
        }
        echo "</tr>\n";
    }
    echo "</table>\n";
    // Get a list of all of objects Zero-U mounted to this rack
    $zeroUObjects = getEntityRelatives('children', 'rack', $rack_id);
    if (count($zeroUObjects) > 0) {
        echo "<br><table width='75%' class=rack border=0 cellspacing=0 cellpadding=1>\n";
        echo "<tr><th>Zero-U:</th></tr>\n";
        foreach ($zeroUObjects as $zeroUObject) {
            $state = $zeroUObject['entity_id'] == $hl_obj_id ? 'Th' : 'T';
            echo "<tr><td class='atom state_{$state}'>";
            printObjectDetailsForRenderRack($zeroUObject['entity_id']);
            echo "</td></tr>\n";
        }
        echo "</table>\n";
    }
    echo "</center>\n";
}
コード例 #9
0
function renderReducedRack($rack_id, $hl_obj_id = 0)
{
    $rackData = spotEntity('rack', $rack_id);
    amplifyCell($rackData);
    markAllSpans($rackData);
    if ($hl_obj_id > 0) {
        highlightObject($rackData, $hl_obj_id);
    }
    // markupObjectProblems ($rackData); // Function removed in 0.20.5
    echo "<center><table border=0><tr valign=middle>";
    echo '<td><h2>' . mkA($rackData['name'], 'rack', $rackData['id']) . '</h2></td>';
    echo "</h2></td></tr></table>\n";
    echo "<table class=rackphg border=0 cellspacing=0 cellpadding=1>\n";
    echo "<tr><th width='10%'>&nbsp;</th><th width='20%'>Front</th>";
    echo "<th width='50%'>Interior</th><th width='20%'>Back</th></tr>\n";
    for ($i = $rackData['height']; $i > 0; $i--) {
        echo "<tr><td>" . inverseRackUnit($i, $rackData) . "</td>";
        for ($locidx = 0; $locidx < 3; $locidx++) {
            if (isset($rackData[$i][$locidx]['skipped'])) {
                continue;
            }
            $state = $rackData[$i][$locidx]['state'];
            echo "<td class='atom state_{$state}";
            if (isset($rackData[$i][$locidx]['hl'])) {
                echo $rackData[$i][$locidx]['hl'];
            }
            echo "'";
            if (isset($rackData[$i][$locidx]['colspan'])) {
                echo ' colspan=' . $rackData[$i][$locidx]['colspan'];
            }
            if (isset($rackData[$i][$locidx]['rowspan'])) {
                echo ' rowspan=' . $rackData[$i][$locidx]['rowspan'];
            }
            echo ">";
            switch ($state) {
                case 'T':
                    printObjectDetailsForRenderRack($rackData[$i][$locidx]['object_id']);
                    // TODO set background color based on the tag
                    $o = spotEntity('object', $rackData[$i][$locidx]['object_id']);
                    while (list($key, $val) = each($o['etags'])) {
                        echo "<div style='font: 8px Verdana,sans-serif; text-decoration:none; color=black'>";
                        echo $val['tag'];
                        echo "</div>";
                        break;
                    }
                    break;
                case 'A':
                    echo '<div title="This rackspace does not exist">&nbsp;</div>';
                    break;
                case 'F':
                    echo '<div title="Free rackspace">&nbsp;</div>';
                    break;
                case 'U':
                    echo '<div title="Problematic rackspace, you CAN\'T mount here">&nbsp;</div>';
                    break;
                default:
                    echo '<div title="No data">&nbsp;</div>';
                    break;
            }
            echo '</td>';
        }
        echo "</tr>\n";
    }
    echo "</table>\n";
    // Get a list of all of objects Zero-U mounted to this rack
    $zeroUObjects = getEntityRelatives('children', 'rack', $rack_id);
    if (count($zeroUObjects) > 0) {
        echo "<br><table width='75%' class=rack border=0 cellspacing=0 cellpadding=1>\n";
        echo "<tr><th>Zero-U:</th></tr>\n";
        foreach ($zeroUObjects as $zeroUObject) {
            $state = $zeroUObject['entity_id'] == $hl_obj_id ? 'Th' : 'T';
            echo "<tr><td class='atom state_{$state}'>";
            printObjectDetailsForRenderRack($zeroUObject['entity_id']);
            echo "</td></tr>\n";
        }
        echo "</table>\n";
    }
    echo "</center>\n";
}
コード例 #10
0
function lm_renderObjectCell($cell)
{
    echo "<table class='slbcell vscell'><tr><td rowspan=2 width='5%'>";
    printImageHREF('OBJECT');
    echo '</td><td>';
    echo mkA('<strong>' . niftyString($cell['dname']) . '</strong>', 'object', $cell['id']);
    echo '</td></tr><tr><td>';
    echo count($cell['etags']) ? "<small>" . serializeTags($cell['etags']) . "</small>" : '&nbsp;';
    echo "</td></tr></table>";
}
コード例 #11
0
ファイル: ophandlers.php プロジェクト: rhysm/racktables
function cleanupUCS()
{
    global $ucsproductmap;
    $oinfo = spotEntity('object', getBypassValue());
    $contents = getObjectContentsList($oinfo['id']);
    $clear = TRUE;
    foreach ($contents as $item_id) {
        $o = spotEntity('object', $item_id);
        $attrs = getAttrValues($item_id);
        # use HW type to decide if the object was produced by autoPopulateUCS()
        if (!array_key_exists(2, $attrs) or !in_array($attrs[2]['key'], $ucsproductmap)) {
            showWarning('Contained object ' . mkA($o['dname'], 'object', $item_id) . ' is not an automatic UCS object');
            $clear = FALSE;
        }
    }
    if (!$clear) {
        showNotice('nothing was deleted');
        return;
    }
    $done = 0;
    foreach ($contents as $item_id) {
        commitDeleteObject($item_id);
        $done++;
    }
    showSuccess("Removed {$done} items from UCS Domain '{$oinfo['name']}'");
}
コード例 #12
0
function renderDictionary()
{
    echo '<ul>';
    foreach (getChapterList() as $chapter_no => $chapter) {
        echo '<li>' . mkA($chapter['name'], 'chapter', $chapter_no) . " ({$chapter['wordc']} records)</li>";
    }
    echo '</ul>';
}