コード例 #1
0
global $conf;
$maxperpage = $conf["global"]["maxperpage"];
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
$filter['filter'] = $_GET["filter"];
if (!empty($_GET['uuid'])) {
    $filter['machine'] = $_GET['hostname'];
    $filter['uuid'] = $_GET['uuid'];
} else {
    $filter['group'] = $group->id;
}
# TODO : decide what we want to do with groups : do we only get the first machine local packages
list($count, $packages) = advGetAllPackages($filter, $start, $start + $maxperpage);
$err = array();
foreach ($packages as $c_package) {
    $package = to_package($c_package[0]);
    $type = $c_package[1];
    $p_api = new ServerAPI($c_package[2]);
    if ($c_package[0]['ERR'] && $c_package[0]['ERR'] == 'PULSE2ERROR_GETALLPACKAGE') {
        $err[] = sprintf(_T("MMC failed to contact package server %s.", "msc"), $c_package[0]['mirror']);
    } else {
        $a_packages[] = $package->label;
        $a_description[] = $package->description;
        $a_pversions[] = $package->version;
        $a_sizes[] = prettyOctetDisplay($package->size);
        if ($group != null) {
            $current_convergence_status = getConvergenceStatus($p_api->mountpoint, $package->id, $group_convergence_status, $package->associateinventory);
            // set param_convergence_edit to True if convergence status is active or inactive
コード例 #2
0
 function loadList()
 {
     $filter = array('group' => $this->group->id, 'filter' => '');
     list($count, $packages) = advGetAllPackages($filter, 0, -1);
     $this->list = array();
     foreach ($packages as $c_package) {
         $p_api = new ServerAPI($c_package[2]);
         if ($c_package[0]['ERR'] && $c_package[0]['ERR'] == 'PULSE2ERROR_GETALLPACKAGE') {
             $this->err[] = sprintf(_T("MMC failed to contact package server %s.", "msc"), $c_package[0]['mirror']);
         } else {
             $this->list[$c_package[0]['id'] . '##' . base64_encode(serialize($p_api->toURI()))] = $c_package[0]['label'] . " (" . $c_package[0]['version'] . ")";
         }
     }
 }
コード例 #3
0
ファイル: editBundle.php プロジェクト: psyray/mmc
// Edition mode
if (isset($_GET['p_api'], $_GET['pid'])) {
    $p_api = base64_decode($_GET['p_api']);
    $pid = base64_decode($_GET['pid']);
    $package = getPackageDetail($p_api, $pid);
    $f->add(new HiddenTpl("p_api"), array("value" => $p_api, "hide" => True));
    $f->add(new HiddenTpl("pid"), array("value" => $pid, "hide" => True));
    $papi = $papis_by_uuid[$p_api];
} else {
    $selectpapi = new SelectItem('p_api');
    $selectpapi->setElements($list);
    $selectpapi->setElementsVal($list_val);
    $papi = $papis[0];
    $f->add(new TrFormElement(_T('Package respository', 'pkgs'), $selectpapi), array("value" => "", "required" => True));
}
$papi_packages = advGetAllPackages(array('filter' => '', 'bundle' => 0, 'packageapi' => $papi), 0, -1);
$papi_packages_pids = array();
$papi_packages_labels = array();
foreach ($papi_packages[1] as $p) {
    $papi_packages_pids[] = $p[0]['id'];
    $papi_packages_labels[] = $p[0]['label'];
}
// Bundle title
$f->add(new TrFormElement(_T('Bundle title', 'pkgs'), new InputTpl('label')), array("value" => $package['label'], "required" => True));
// Bundle version
$f->add(new TrFormElement(_T('Version', 'pkgs'), new InputTpl('version')), array("value" => $package['version'], "required" => True));
// Bundle description
$f->add(new TrFormElement(_T('Description', 'pkgs'), new InputTpl('description')), array("value" => $package['description'], "required" => True));
// Need reboot
$f->add(new TrFormElement(_T('Need a reboot', 'pkgs'), new CheckboxTpl('do_reboot')), array("value" => $package['reboot'] == 1 ? 'checked' : ''));
// Associate inventory
コード例 #4
0
require_once "modules/msc/includes/package_api.php";
require_once "modules/msc/includes/utilities.php";
global $conf;
$maxperpage = $conf["global"]["maxperpage"];
$filter = array('filter' => $_GET["filter"], 'location' => $_GET['location'], 'bundle' => 1);
$filter1 = $_GET["filter"] . '##' . $_GET['location'];
if ($_GET['location']) {
    $filter['packageapi'] = getPApiDetail(base64_decode($_GET['location']));
}
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
$_SESSION['pkgs_selected'] = base64_decode($filter['location']);
$packages = advGetAllPackages($filter, $start, $start + $maxperpage);
$count = $packages[0];
$packages = $packages[1];
$desc = $params = $names = $versions = $licenses = $size = array();
$err = array();
foreach ($packages as $p) {
    $p = $p[0];
    if (isset($p['ERR']) && $p['ERR'] == 'PULSE2ERROR_GETALLPACKAGE') {
        $err[] = sprintf(_T("MMC failed to contact package server %s.", "pkgs"), $p['mirror']);
    } else {
        $names[] = $p['label'];
        $versions[] = $p['version'];
        $desc[] = $p['description'];
        // #### begin licenses ####
        $tmp_licenses = '';
        if ($p['associateinventory'] == 1 && isset($p['licenses']) && !empty($p['licenses'])) {
コード例 #5
0
$filter1 = $_GET["filter"] . '##' . $_GET['location'];
if ($_GET['location']) {
    $filter['packageapi'] = getPApiDetail(base64_decode($_GET['location']));
    //    $_SESSION['PACKAGEAPI'][base64_decode($_GET['location'])];
}
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
if (isset($_GET["end"])) {
    $end = $_GET["end"];
} else {
    $end = 9;
}
$packages = advGetAllPackages($filter, $start, $end);
$count = $packages[0];
$packages = $packages[1];
$empty = new EmptyActionItem();
$assoc = new ActionItem(_T("Associate package", "pkgs"), "associate_files", "associate_files", "pkgs", "pkgs", "pkgs");
$assoc_list = array();
$desc = $params = $names = $versions = array();
foreach ($packages as $p) {
    $p = $p[0];
    if ($p['why'] || $p['why'] == 'association') {
        $assoc_list[] = $assoc;
    } else {
        $assoc_list[] = $empty;
    }
    $names[] = $p['label'];
    $versions[] = $p['version'];