function popup_packages_list() { $page = CurrentPageName(); $ocs = new ocs(); $document_root = "/var/lib/ocsinventory-reports"; $sql = "SELECT * FROM download_available ORDER BY FILEID DESC"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "ocsweb"); if (!$q->ok) { echo "<p> </p><p style='font-size:15px'>{$q->mysql_error}<hr>{$sql}</p>"; return; } $html = "<table style='width:100%'>\n\t<tr>\n\t\t<th colspan=2>{package}</th>\n\t\t<th>{size}</th>\n\t\t<th>{action}</th>\n\t\t<th>{system_os_mini}</th>\n\t\t<th>{affected}</th>\n\t\t<th> </th>\n\t\t<th> </th>\n\t</tr>\n\t\t\n\t\t"; $sock = new sockets(); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $FILEID = $ligne["FILEID"]; $computersnb = $ocs->PACKAGE_AFFECT_COUNT_COMPUTERS($FILEID); $NAME = $ligne["NAME"]; $SIZE = FormatBytes($ligne["SIZE"] / 1024); $date = date("l d F H:i (Y) ", $FILEID); $infos = unserialize(base64_decode($sock->getFrameWork("cmd.php?ocs-package-infos={$FILEID}"))); $ACT = $infos["ACT"]; $affected = "-"; $HASH = $ocs->PACKAGE_DOWNLOAD_INFOS_HASH($FILEID); $text = "<li>{created}: {$date}</li><li>{path}: {$document_root}/{$FILEID}</li><li>https://{$HASH["INFO_LOC"]}/</li>"; $text = $text . "<li>http://{$HASH["PACK_LOC"]}/</ki>"; if ($computersnb > 0) { $affected = texttooltip("{$computersnb}", "{display_affected_computers}", "Loadjs('ocs.packages.affect.php?FILEID={$FILEID}')", 0, 0, "font-size:13px;font-weight:bolder"); } $affect = imgtootltip("package-affect-32.png", "{ocs_affect_packages_computers}", "Loadjs('ocs.packages.affect.php?FILEID={$FILEID}')"); $html = $html . "\n\t\t<tr " . CellRollOver() . ">\n\t\t\t<td width=1%><img src='img/package-32.png'></td>\n\t\t\t<td><strong style='font-size:13px' " . CellRollOver(null, $text) . ">{$NAME}</td></td>\n\t\t\t<td><strong style='font-size:13px' align='center'>{$SIZE}</td></td>\n\t\t\t<td><strong style='font-size:13px' align='center'>{{$ACT}}</td></td>\n\t\t\t<td><strong style='font-size:13px' align='center'>{$ligne["OSNAME"]}</strong></td>\n\t\t\t<td width=1% align='center'>{$affected}</td>\n\t\t\t<td width=1% align='center'>{$affect}</td>\n\t\t\t<td>" . imgtootltip("package-delete-32.png", "{delete}", "OCSDeletePackage('{$FILEID}')") . "</td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</table>\n\t\n\t<script>\n\t\n\t\tvar x_OCSDeletePackage=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif (results.length>0){alert(results);}\n\t\t\tRefreshOCSPackageList();\n\t\t\t\n\t\t}\n\t\n\t\tfunction OCSDeletePackage(FILEID){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DELETE-FILEID',FILEID);\n\t\t\tdocument.getElementById('packages-list').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_OCSDeletePackage);\t\t\t\n\t\t}\n\t</script>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }