Exemplo n.º 1
0
function search()
{
    $ocs = new ocs();
    $page = CurrentPageName();
    $sql = $ocs->COMPUTER_SEARCH_QUERY($_GET["search"]);
    $q = new mysql();
    $FILEID = $_GET["FILEID"];
    $results = $q->QUERY_SQL($sql, "ocsweb");
    if (!$q->ok) {
        echo "<p>&nbsp;</p><p style='font-size:15px'>{$q->mysql_error}<hr>{$sql}</p>";
        return;
    }
    $html = "\n\t<table style='width:100%;'>\n\t<tr>\n\t\t<th colspan=2>{computer}</th>\n\t\t<th>{ip_address}</th>\n\t\t<th>{affected}</th>\n\t</tr>";
    $hash = $ocs->PACKAGE_HASH_AFFECTED_COMPUTERS($FILEID);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["IPADDRESS"] == "0.0.0.0") {
            continue;
        }
        $HARDWARE_ID = $ligne["ID"];
        $html = $html . "\n\t\t<tr " . CellRollOver() . ">\n\t\t<td width=1%><img src='img/laptop-32.png'></td>\n\t\t\t<td style='font-size:13px'>{$ligne["NAME"]}</td>\n\t\t\t<td style='font-size:13px'>{$ligne["IPSRC"]}</td>\n\t\t\t<td>" . Field_checkbox("ID_{$HARDWARE_ID}", 1, $hash[$HARDWARE_ID], "OCSPackageAffectID({$HARDWARE_ID})") . "</td>\n\t\t</tr>\n\t\t";
    }
    $html = $html . "</table>\n\t<script>\n\t\tvar x_OCSPackageAffectID=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif (results.length>0){\n\t\t\t\talert(results);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(document.getElementById('packages-list')){\n\t\t\t\tRefreshOCSPackageList();\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction OCSPackageAffectID(HARDWARE_ID){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tif(document.getElementById('ID_'+HARDWARE_ID).checked){\n\t\t\t\t\tXHR.appendData('AffectPackageToValue','1');\n\t\t\t\t}else{\n\t\t\t\t\tXHR.appendData('AffectPackageToValue','0');\n\t\t\t\t}\n\t\t\t\tXHR.appendData('FILEID','{$FILEID}');\n\t\t\t\tXHR.appendData('HARDWARE_ID',HARDWARE_ID);\n\t\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_OCSPackageAffectID);\n\t\t}\t\n\t\n\t</script>\n\t\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}