Exemplo n.º 1
0
 $new_file_size = $response['data']['new_file_size'];
 $count = count($backup_nums);
 $params = array();
 $times = array();
 for ($i = 0; $i < $count; $i++) {
     $params[] = array('host' => $uuid, 'backupnum' => $backup_nums[$i], 'cn' => $_GET['cn']);
     preg_match("#.+ (.+)#", $start_dates[$i], $result);
     $time = time() - floatval($ages[$i]) * 24 * 60 * 60;
     $times[] = strftime(_T("%A, %B %e %Y"), $time) . ' - ' . $result[1];
     $durations[$i] = max(1, intval($durations[$i]));
     $total_file_count[$i] .= ' (' . $new_file_count[$i] . ')';
     $total_file_size[$i] = intval($total_file_size[$i]) . ' (' . intval($new_file_size[$i]) . ')';
     $types[$i] = _T($types[$i], 'backuppc');
 }
 $n = new OptimizedListInfos($times, _T("Backup time", "backuppc"));
 $n->addExtraInfo($types, _T("Type", "backuppc"));
 $n->addExtraInfo($durations, _T("Duration (min.)", "backuppc"));
 $n->addExtraInfo($xfer_errs, _T("Errors", "backuppc"));
 $n->addExtraInfo($total_file_count, _T("File count (new)", "backuppc"));
 $n->addExtraInfo($total_file_size, _T("Backup size (new) [Mb]", "backuppc"));
 $n->setCssClass("file");
 // CSS for icons
 $n->setItemCount($count);
 $n->setNavBar(new AjaxNavBar($count, $filter1));
 $n->start = 0;
 $n->end = 50;
 $n->setParamInfo($params);
 // Setting url params
 $n->addActionItem(new ActionItem(_T("Browse", "backuppc"), "BrowseShareNames", "display", "host", "backuppc", "backuppc"));
 $n->addActionItem(new ActionPopupItem(_T("View errors"), "viewXferLog", "file", "dir", "backuppc", "backuppc"));
 print "<br/><br/>";
Exemplo n.º 2
0
            $params[] = array('name' => $package->label, 'version' => $package->version, 'pid' => $package->id, 'uuid' => $_GET['uuid'], 'hostname' => $_GET['hostname'], 'from' => 'base|computers|msctabs|tablogs', 'papi' => $p_api->toURI());
        } else {
            $params[] = array('name' => $package->label, 'version' => $package->version, 'pid' => $package->id, 'gid' => $group->id, 'from' => 'base|computers|groupmsctabs|tablogs', 'papi' => $p_api->toURI(), 'editConvergence' => $param_convergence_edit);
        }
        if ($type == 0) {
            $a_css[] = 'primary_list';
        } else {
            $a_css[] = 'secondary_list';
        }
    }
}
if ($err) {
    new NotifyWidgetFailure(implode('<br/>', array_merge($err, array(_T("Please contact your administrator.", "msc")))));
}
$n = new OptimizedListInfos($a_packages, _T("Package", "msc"));
$n->addExtraInfo($a_description, _T("Description", "msc"));
$n->addExtraInfo($a_pversions, _T("Version", "msc"));
$n->addExtraInfo($a_sizes, _T("Package size", "msc"));
if ($group != null) {
    $n->addExtraInfo($a_convergence_status, _T("Convergence", "msc"));
}
$n->setCssClasses($a_css);
$n->setParamInfo($params);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter['filter']));
$n->setTableHeaderPadding(1);
$n->disableFirstColumnActionLink();
$n->start = 0;
$n->end = $count;
$n->addActionItem(new ActionItem(_T("Advanced launch", "msc"), "start_adv_command", "advanced", "msc", "base", "computers"));
$n->addActionItem(new ActionItem(_T("Direct launch", "msc"), "start_command", "start", "msc", "base", "computers"));
Exemplo n.º 3
0
    $hosts[] = $r["hostname"];
    //rtrim($r[1],".");
    $types[] = $r["type"];
    $values[] = getRecordValueDescription($zone, $r["type"], $r["value"]);
    $params[] = array("zone" => $zone, "reverse" => $reverse, "id" => $r["id"], "serial" => $serial);
    $actionsMod[] = $editAction;
    if ($r["hostname"] === $curzone . "." && $r["type"] === "TXT" || $r["type"] == "SOA") {
        $actionsDel[] = $emptyAction;
    } else {
        $actionsDel[] = $delAction;
    }
}
//print_r($values);
$typeAsc = $sortby == "type" ? intval(!$asc) : "1";
$hostnameAsc = $sortby == "hostname" ? intval(!$asc) : "1";
$typeUrl = urlStr("network/network/zonerecords", array("zone" => $zone, "reverse" => $reverse, "sortby" => "type", "asc" => $typeAsc));
$hostnameUrl = urlStr("network/network/zonerecords", array("zone" => $zone, "reverse" => $reverse, "sortby" => "hostname", "asc" => $hostnameAsc));
$n = new OptimizedListInfos($hosts, "<a href='" . $hostnameUrl . "'>" . _T("Host name", "network") . "</a>");
$n->setTableHeaderPadding(1);
$n->setNavBar(new AjaxNavBar(count($records), $filter));
$n->setItemCount(count($records));
$n->start = 0;
$n->end = count($recordsatpage) - 1;
$n->addExtraInfo($types, "<a href='" . $typeUrl . "'>" . _T("Record type", "network")) . "</a>";
$n->addExtraInfo($values, _T("Record parameters", "network"));
$n->setName(_T("Host", "network"));
$n->setParamInfo($params);
$n->disableFirstColumnActionLink();
$n->addActionItemArray($actionsMod);
$n->addActionItemArray($actionsDel);
$n->display();
Exemplo n.º 4
0
        $a_create[] = $script['fk_boot_service'] ? $bsCreatedAction : $createAction;
    } else {
        $url = '<img src="modules/imaging/graph/images/postinst-action-ro.png" style="vertical-align: middle" /> ';
        $a_edit[] = $emptyAction;
        $a_delete[] = $emptyAction;
        // Don't display "Create Boot Service" icon if a Boot Service already created
        // from this PostInstall entry
        $a_create[] = $script['fk_boot_service'] ? $bsCreatedAction : $createAction;
    }
    $a_label[] = sprintf("%s%s", $url, $script['default_name']);
    $a_desc[] = $script["default_desc"];
    $l_params = array();
    $l_params["itemid"] = $script['imaging_uuid'];
    $l_params["itemlabel"] = $script["default_name"];
    $list_params[] = $l_params;
}
// show scripts list
$l = new OptimizedListInfos($a_label, _T("Name", "imaging"));
$l->addExtraInfo($a_desc, _T("Description", "imaging"));
$l->setParamInfo($list_params);
$l->addActionItemArray($a_edit);
$l->addActionItem($a_create);
$l->addActionItem(new ActionItem(_T("Duplicate", "imaging"), "postinstall_duplicate", "duplicatescript", "image", "imaging", "manage"));
$l->addActionItemArray($a_delete);
$l->setTableHeaderPadding(19);
$l->disableFirstColumnActionLink();
$l->setItemCount($count);
$l->setNavBar(new AjaxNavBar($count, $filter, "updateSearchParamformLevel2"));
$l->start = 0;
$l->end = $maxperpage;
$l->display();
Exemplo n.º 5
0
            if ($licensescount > $p['licenses']) {
                // highlights the exceeded license count
                $tmp_licenses = '<font color="FF0000">' . $tmp_licenses . '</font>';
            }
        }
        $licenses[] = $tmp_licenses;
        // #### end licenses ####
        $size[] = prettyOctetDisplay($p['size']);
        $params[] = array('p_api' => $_GET['location'], 'pid' => base64_encode($p['id']));
    }
}
if ($err) {
    new NotifyWidgetFailure(implode('<br/>', array_merge($err, array(_T("Please contact your administrator.", "pkgs")))));
}
$n = new OptimizedListInfos($names, _T("Package name", "pkgs"));
$n->setCssClass("package");
$n->disableFirstColumnActionLink();
$n->addExtraInfo($desc, _T("Description", "pkgs"));
$n->addExtraInfo($versions, _T("Version", "pkgs"));
$n->addExtraInfo($licenses, _T("Licenses", "pkgs"));
$n->addExtraInfo($size, _T("Package size", "pkgs"));
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter1));
$n->setParamInfo($params);
$n->start = 0;
$n->end = $count;
$n->addActionItem(new ActionItem(_T("Edit a bundle", "pkgs"), "editBundle", "edit", "pkgs", "pkgs", "pkgs"));
$n->addActionItem(new ActionPopupItem(_T("Delete a package", "pkgs"), "deleteBundle", "delete", "pkgs", "pkgs", "pkgs"));
print "<br/><br/>";
// to go below the location bar : FIXME, really ugly as line height dependent
$n->display();
Exemplo n.º 6
0
function display_part($part, $get, $simpleTableParts, $displayNavBar = True, $partTitle = null)
{
    $uuid = '';
    if (isset($get['uuid'])) {
        $uuid = $get['uuid'];
    } elseif (isset($get['objectUUID'])) {
        $uuid = $get['objectUUID'];
    }
    $maxperpage = isset($get['maxperpage']) ? $get['maxperpage'] : 0;
    $filter = isset($get["filter"]) ? $get['filter'] : '';
    if (isset($get["start"])) {
        $start = $get["start"];
    } else {
        $start = 0;
    }
    $end = $start + $maxperpage;
    $hide_win_updates = isset($get['hide_win_updates']) ? $get['hide_win_updates'] : False;
    $hide_win_updates = strtolower($hide_win_updates) == 'true' ? True : False;
    $history_delta = isset($get['history_delta']) ? $get['history_delta'] : False;
    $options = array('hide_win_updates' => $hide_win_updates, 'history_delta' => $history_delta);
    // Get current part inventory
    $inv = getLastMachineGlpiPart($uuid, $part, $start, $end, $filter, $options);
    $itemCount = countLastMachineGlpiPart($uuid, $part, $filter, $options);
    if (!is_array($inv)) {
        $inv = array();
    }
    // this piece of code re-format inventory array
    // $all variable will contain part's inventory
    $all = array();
    $i = 0;
    foreach ($inv as $line) {
        foreach ($line as $vals) {
            /*
             * If $vals[1] is an empty string or an array, don't use the _T() function
             * Empty fields are replaced by a trademark text by transifex
             * if it's an array, it's an editable field
             */
            $vals[1] = str_replace('@@FALSE_POSITIVE@@', _T(' (Not an antivirus)', 'glpi'), $vals[1]);
            $all[$vals[0]][$i] = '';
            if (!is_array($vals[1]) && $vals[1] != '') {
                // translatable fields
                $all[$vals[0]][$i] = _T($vals[1]);
            } elseif (is_array($vals[1])) {
                // editable fields
                $all[$vals[0]][$i] = $vals[1];
            }
        }
        $i++;
    }
    /*
     * simpleTableParts are parts who are *not* displayed
     * in a multi-line table
     */
    // Simple table
    if (in_array($part, $simpleTableParts)) {
        $key = array();
        $val = array();
        foreach (array_keys($all) as $k) {
            $key[] = _T($k, 'glpi');
            if ($k == 'Serial Number') {
                $val[] = str_replace('@@WARRANTY_LINK_TEXT@@', _T('Click here to see this computer on manufacturer website', 'glpi'), $all[$k][0]);
            } else {
                /*
                 * if $all[$k][0] is an array, it's an editable value
                 * $editable = array(uniquename, type, value)
                 */
                if (is_array($all[$k][0])) {
                    $editable = $all[$k][0];
                    $val[] = sprintf('<label class="editableField" name="%s" data="%s" style="height:1em;">%s</label>', $editable[0], $editable[1], $editable[2]) . sprintf('<input type="text" class="editableField" name="%s" value="%s" style="display:none" />', $editable[0], $editable[2]);
                } else {
                    $val[] = $all[$k][0];
                }
            }
        }
        $n = new ListInfos($key, _T("Properties", "glpi"));
        $n->addExtraInfo($val, _T("Value", "glpi"));
        /*
         * $_GET['maxperpage'] is set to 10 by default
         * If there is more than 10 elements, they don't be displayed
         * So setRowsPerPage equal to number of elements to display
         */
        $n->setRowsPerPage(count($all));
        $n->drawTable(0);
    } else {
        $n = null;
        // If nothing found, display a "nothing found" message
        // except on Hardware tab (identified by $partTitle == null) => display nothing
        if (count($all) == 0 && $partTitle == null) {
            switch ($part) {
                case 'History':
                    printf('<p>%s</p>', _T('No record found for this period.', 'glpi'));
                    break;
                case 'Antivirus':
                    printf('<p>%s</p>', _T('Unable to detect any Antivirus software on this machine.', 'glpi'));
                    printf('<p>%s</p>', _T('Please ensure you are running GLPI with FusionInventory plugin and FusionInventory Agent on this client.', 'glpi'));
                    break;
                default:
                    printf('<p>%s</p>', _T('No record found.', 'glpi'));
            }
        }
        // Put datas in a ListInfos object
        foreach ($all as $k => $v) {
            if ($n == null) {
                $n = new OptimizedListInfos($v, _T($k, 'glpi'));
            } else {
                $n->addExtraInfo($v, _T($k, 'glpi'));
            }
        }
        // display table
        if ($n) {
            $n->setItemCount($itemCount);
            $n->setNavBar(new AjaxNavBar($itemCount, $filter));
            $n->disableFirstColumnActionLink();
            $n->setTableHeaderPadding(1);
            $n->start = 0;
            $n->end = $itemCount;
            // Display a title (it happens in Hardware tab)
            if ($partTitle) {
                printf("<h2>%s</h2>", $partTitle);
            }
            // Display table with (or not) NavBar
            $n->display($displayNavBar, $displayNavBar);
            if ($partTitle) {
                echo "<br />";
            }
        }
    }
}
Exemplo n.º 7
0
          $date = '<img src="modules/imaging/graph/images/backup.png" style="vertical-align: bottom"/>&nbsp;'.$date;
      } elseif (ereg('restore', $status)) {
          $date = '<img src="modules/imaging/graph/images/restore.png" style="vertical-align: bottom"/>&nbsp;'.$date;
      }*/
    // get status
    if (!array_key_exists($status, $logStates)) {
        $status = 'unknow';
    }
    // complete status display
    $led = new LedElement($logStates[$status][1]);
    $status = $logStates[$status][0];
    //$status = $led->value.'&nbsp;'.$logStates[$status][0];
    $a_level[] = $log['imaging_log_level'];
    $a_date[] = $date;
    $a_target[] = $log['target']['name'];
    $a_desc[] = $status . ' - ' . $log['detail'];
    $a_states[] = $status;
}
$l = new OptimizedListInfos($a_date, _T("Timestamp", "imaging"));
// $l->addExtraInfo($a_level, _T("Log level", "imaging"));
$l->addExtraInfo($a_target, _T("Target", "imaging"));
$l->addExtraInfo($a_desc, _T("Message", "imaging"));
//$l->addExtraInfo($a_states, _T("State", "imaging"));
$l->setParamInfo($list_params);
$l->setItemCount($count);
$l->setNavBar(new AjaxNavBar($count, $filter, "updateSearchParamLogs"));
$l->disableFirstColumnActionLink();
$l->setTableHeaderPadding(1);
$l->start = 0;
$l->end = $maxperpage;
$l->display();
Exemplo n.º 8
0
    $l_im[] = array($master['imaging_uuid'], null, null);
}
if (count($l_im) != 0) {
    $ret = xmlrpc_areImagesUsed($l_im);
    foreach ($masters as $image) {
        if ($ret[$image['imaging_uuid']]) {
            $a_destroy[] = $showImAction;
        } else {
            $a_destroy[] = $destroyAction;
        }
    }
}
// show images list
$l = new OptimizedListInfos($a_label, _T("Label", "imaging"));
$l->setParamInfo($list_params);
$l->addExtraInfo($a_desc, _T("Description", "imaging"));
$l->addExtraInfo($a_date, _T("Created", "imaging"));
$l->addExtraInfo($a_size, _T("Size (compressed)", "imaging"));
$l->addExtraInfo($a_is_in_menu, _T("In default boot menu", "imaging"));
$l->addActionItemArray($addActions);
$l->addActionItem(new ActionPopupItem(_T("Create bootable iso", "imaging"), "master_iso", "backup", "master", "imaging", "manage"));
$l->addActionItem(new ActionItem(_T("Edit image", "imaging"), "master_edit", "edit", "master", "imaging", "manage"));
$l->addActionItemArray($a_destroy);
$l->setTableHeaderPadding(1);
$l->disableFirstColumnActionLink();
$l->setItemCount($count);
$l->setNavBar(new AjaxNavBar($count, $filter, "updateSearchParamformLevel2"));
$l->start = 0;
$l->end = $maxperpage;
$l->display();
?>
Exemplo n.º 9
0
}
if ($is_gp != 1) {
    // Simple Group
    $n = new OptimizedListInfos($name, _T('Group name', 'dyngroup'));
} else {
    // Imaging group
    $n = new OptimizedListInfos($name, _T('Group name', 'dyngroup'));
}
$n->setTableHeaderPadding(0);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter));
$n->start = 0;
$n->end = $conf["global"]["maxperpage"];
if ($is_gp != 1) {
    // Simple group
    $n->addExtraInfo($type, _T('Type', 'dyngroup'));
}
$n->addExtraInfo($show, _T('Display', 'dyngroup'));
$n->setParamInfo($ids);
if ($is_gp != 1) {
    // Simple group
    $n->addActionItem(new ActionItem(_T("Display this group's content", 'dyngroup'), "display", "display", "id", "base", "computers"));
    if (in_array("inventory", $_SESSION["supportModList"])) {
        $n->addActionItem(new ActionItem(_T("Inventory on this group", "dyngroup"), "groupinvtabs", "inventory", "inventory", "base", "computers"));
    } else {
        # TODO implement the glpi inventory on groups
        #    $n->addActionItem(new ActionItem(_T("Inventory on this group", "dyngroup"),"groupglpitabs","inventory","inventory", "base", "computers"));
    }
    $n->addActionItem(new ActionItem(_T("Edit this group", 'dyngroup'), "computersgroupedit", "edit", "id", "base", "computers"));
    $n->addActionItem(new ActionItem(_T("Share this group", 'dyngroup'), "edit_share", "groupshare", "id", "base", "computers"));
    if (in_array("msc", $_SESSION["supportModList"])) {
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require_once "modules/pkgs/includes/xmlrpc.php";
$packages = getActivatedAppstreamPackages();
$count = count($packages);
$expiration_dates = $params = $labels = array();
foreach ($packages as $key => $data) {
    $labels[] = $data['label'];
    $expiration_dates[] = date('Y-m-d', $data['expiration_ts']);
    $params[] = array('package_name' => $key, 'id' => $data['id']);
}
print '<br/><h3>Activated packages</h3>';
$n = new OptimizedListInfos($labels, _T("Package name", "pkgs"));
$n->setCssClass("package");
$n->disableFirstColumnActionLink();
$n->addExtraInfo($expiration_dates, _T("Expiration date", "pkgs"));
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter1));
$n->setParamInfo($params);
$n->start = 0;
$n->end = 100;
$n->addActionItem(new EmptyActionItem());
//print "<br/><br/><br/>"; // start display below the location bar, yes it's quiet ugly, so : FIXME !
$n->display();
Exemplo n.º 11
0
            $params[] = array('name'=>$package->label, 'version'=>$package->version, 'pid'=>$package->id, 'gid'=>$group->id, 'from'=>'base|computers|groupmsctabs|tablogs', 'papi'=>$p_api->toURI());
        }
        if ($type==0) {
            $a_css[] = 'primary_list';
        } else {
            $a_css[] = 'secondary_list';
        }
    }
}

if ($err) {
    new NotifyWidgetFailure(implode('<br/>', array_merge($err, array(_T("Please contact your administrator.", "msc")))));
}

$n = new OptimizedListInfos($a_packages, _T("Package", "msc"));
$n->addExtraInfo($a_pversions, _T("Version", "msc"));
$n->addExtraInfo($a_sizes, _T("Package size", "msc"));
$n->setCssClasses($a_css);
$n->setParamInfo($params);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter['filter']));
$n->setTableHeaderPadding(1);
$n->disableFirstColumnActionLink();
$n->start = 0;
$n->end = $count;

$n->addActionItem(new ActionItem(_T("Advanced launch", "msc"), "start_adv_command", "advanced", "msc", "base", "computers"));
$n->addActionItem(new ActionItem(_T("Direct launch", "msc"), "start_command", "start", "msc", "base", "computers"));
$n->addActionItem(new ActionPopupItem(_T("Details", "msc"), "package_detail", "detail", "msc", "base", "computers"));

$n->display();
Exemplo n.º 12
0
// Create an array with the inventory dates
$inventories = array();
// Create an array with the "new_machine" booleans
$new_machines = array();
// Create an array with $params needed for cliquable first column
$params = array();
foreach ($incoming as $inc) {
    $machines[] = $inc[0];
    $inventories[] = _toDate($inc[1]);
    $new_machines[] = $inc[2];
    $params[] = array('hostname' => $inc[0], 'uuid' => $inc[3]);
}
// Create the listinfos widget, the first column is the machine name
$l = new OptimizedListInfos($machines, _T("Computer name"));
// Add the second column, which is the inventory date
$l->addExtraInfo($inventories, _T("Inventory date"));
// Add the third column, which is the boolean "new_machine"
$l->addExtraInfo($new_machines, _T("New computer"));
// Add actions item, to make first column cliquable
$l->addActionItem(new ActionItem(_T("View", "inventory"), "invtabs", "display", "inventory", "base", "computers"));
$l->addActionItem(new ActionPopupItem(_T("Information", "inventory"), "infos", "info", "inventory", "inventory", "inventory"));
$l->setParamInfo($params);
// Navbar for an Ajax widget
$l->setItemCount($count);
$l->setNavBar(new AjaxNavBar($count, $filter));
// Item counter label
$l->setName(_T("Elements"));
$l->setTableHeaderPadding(0);
$l->start = 0;
$l->end = count($machines);
$l->display();
Exemplo n.º 13
0
    } elseif ($coh['current_state'] != 'done') {
        $a_details[] = $actiondetails_logs;
    } else {
        $a_details[] = $actiondetails_hist;
    }
}
# TODO: add the command end timestamp
if ($type == -1 || $type == 0) {
    $datelabel = _T("Date", "msc");
} elseif ($history) {
    $datelabel = _T("End date", "msc");
} else {
    $datelabel = _T("Start date", "msc");
}
$n = new OptimizedListInfos($a_date, $datelabel);
$n->addExtraInfo($a_cmd, _T("Command", "msc"));
$n->addExtraInfo($a_current, _T("Current state", "msc"));
$n->addActionItemArray($a_details);
$n->addActionItemArray($a_start);
//$n->addActionItemArray($a_pause);
$n->addActionItemArray($a_stop);
$n->disableFirstColumnActionLink();
$n->setParamInfo($params);
$n->setTableHeaderPadding(1);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter));
$n->start = 0;
$n->end = $maxperpage;
$n->display();
?>
<!-- inject styles -->
Exemplo n.º 14
0
        $addActions[] = $delAction;
    }
    if ($entry['id'] >= 1000) {
        $remActions[] = $entry['used_bs_id'] ? $showAction : $remAction;
    } else {
        $remActions[] = $emptyAction;
    }
    $icon = '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" /> ';
    $a_label[] = sprintf("%s%s", $icon, $entry['default_name']);
    $a_desc[] = $entry['default_desc'];
    $a_in_boot_menu[] = isset($entry['menu_item']) ? True : False;
}
// show images list
$l = new OptimizedListInfos($a_label, _T("Label", "imaging"));
$l->setParamInfo($list_params);
$l->addExtraInfo($a_desc, _T("Description", "imaging"));
$l->addExtraInfo($a_in_boot_menu, _T("In boot menu", "imaging"));
$l->addActionItemArray($addActions);
/* should we be able to to that ?!
$l->addActionItem(
    new ActionItem(_T("Edit service", "imaging"),
    "service_edit", "edit", "master", "imaging", "manage")
);*/
$l->addActionItemArray($remActions);
$l->setTableHeaderPadding(19);
$l->disableFirstColumnActionLink();
$l->setItemCount($count);
$l->setNavBar(new AjaxNavBar($count, $filter, "updateSearchParamformLevel2"));
$l->start = 0;
$l->end = $maxperpage;
$l->display();
Exemplo n.º 15
0
    $start = $_GET["start"];
} else {
    $start = 0;
}
$params = array('min' => $start, 'max' => $start + $maxperpage, 'filters' => array());
if (isset($_GET["filter"]) && $_GET["filter"]) {
    $params['like_filters']['name'] = $_GET["filter"];
}
extract(getAllEntitiesPowered($params));
if (!$count) {
    print _T('No entry found', 'glpi');
    return;
}
//  Listinfo params
$listinfoParams = array();
foreach ($data as $row) {
    $listinfoParams[] = array('id' => $row['id']);
}
$cols = listInfoFriendly($data);
$n = new OptimizedListInfos($cols['completename'], _T('Entity name', 'glpi'), '');
$n->first_elt_padding = '0';
$n->addExtraInfo($cols['comment'], _T("Comment", "glpi"));
$n->addActionItem(new ActionItem(_T("Edit entity", "glpi"), "addEntity", "edit", "entity", "base", "computers"));
//$n->addActionItem(new ActionPopupItem(_T("Delete", "glpi"), "deleteEntity", "delete", "id", "base", "computers"));
$n->setParamInfo($listinfoParams);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $status));
$n->start = 0;
$n->end = $maxperpage;
$n->disableFirstColumnActionLink();
$n->display();
Exemplo n.º 16
0
    }
    if ($is_in_profile) {
        $addActions[] = $emptyAction;
    } elseif (!isset($entry['menu_item'])) {
        $addActions[] = $addAction;
    } else {
        $addActions[] = $delAction;
        $l_params["mi_itemid"] = $entry['menu_item']['imaging_uuid'];
    }
    $list_params[] = $l_params;
    $icon = '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" /> ';
    $a_label[] = sprintf("%s%s", $icon, $entry['default_name']);
    $a_desc[] = $entry['default_desc'];
    $a_in_boot_menu[] = isset($entry['menu_item']) ? True : False;
    $a_from_profile[] = isset($entry['menu_item']) ? $entry['menu_item']['read_only'] ? True : False : False;
}
$l = new OptimizedListInfos($a_label, _T("Label", "imaging"));
$l->addExtraInfo($a_desc, _T("Description", "imaging"));
$l->addExtraInfo($a_in_boot_menu, _T("In bootmenu", "imaging"));
if ($is_in_profile) {
    $l->addExtraInfo($a_from_profile, _T("From profile", "imaging"));
}
$l->setParamInfo($list_params);
$l->addActionItemArray($addActions);
$l->disableFirstColumnActionLink();
$l->setItemCount($count);
$l->setNavBar(new AjaxNavBar($count, $filter, "updateSearchParamLevel2"));
$l->start = 0;
$l->end = $maxperpage;
$l->setTableHeaderPadding(19);
$l->display();
Exemplo n.º 17
0
if (!$actions) {
    if (count($l_im) != 0) {
        $ret = xmlrpc_areImagesUsed($l_im);
        foreach ($images as $image) {
            if ($ret[$image['imaging_uuid']]) {
                $a_destroy[] = $showImAction;
            } else {
                $a_destroy[] = $destroyAction;
            }
        }
    }
}
// show images list
$l = new OptimizedListInfos($a_label, _T("Label", "imaging"));
$l->setParamInfo($list_params);
$l->addExtraInfo($a_desc, _T("Description", "imaging"));
$l->addExtraInfo($a_date, _T("Created", "imaging"));
$l->addExtraInfo($a_size, _T("Size (compressed)", "imaging"));
$l->addExtraInfo($a_inbootmenu, _T("In boot menu", "imaging"));
if ($is_in_profile) {
    $l->addExtraInfo($a_fromprofile, _T("From profile", "imaging"));
}
$l->addActionItemArray($addActions);
$l->addActionItem(new ActionPopupItem(_T("Create bootable iso", "imaging"), "images_iso", "backup", "image", "base", "computers"));
// if not in boot menu
if ($actions) {
    $l->addActionItem(new ActionItem(_T("Edit image", "imaging"), "imgtabs", "edit", "image", "base", "computers", $type . "tabimages", "edit"));
    $l->addActionItem($logAction);
    $l->addActionItem($destroyAction);
} else {
    $l->addActionItemArray($editActions);
Exemplo n.º 18
0
    $checkboxes[] = '<input type="checkbox" name="selected_updates[]" value="' . $row['id'] . '">';
}
$check_all = '<input type="checkbox" id="check_all" />';
$cols = listInfoFriendly($data);
// Update types strings
$cols['type_str'] = array_map('getUpdateTypeLabel', $cols['type_id']);
// Creating installed/total col
$cols['targets'] = array();
for ($i = 0; $i < count($cols['total_targets']); $i++) {
    $cols['targets'][] = $cols['total_installed'][$i] . ' / ' . $cols['total_targets'][$i];
}
// Printing selected updates form
print '<form id="sel_updates_form">';
$n = new OptimizedListInfos($checkboxes, $check_all, '', '10px');
$n->first_elt_padding = '0';
$n->addExtraInfo($cols['title'], _T("Update title", "update"));
$n->addExtraInfo($cols['uuid'], _T("UUID", "update"));
$n->addExtraInfo($cols['type_str'], _T("Type", "update"));
$n->addExtraInfo($cols['targets'], _T("Installed count", "update"));
$n->addActionItem(new ActionPopupItem(_T("Enable", "update"), "enableUpdate", "enable", "id", "update", "update"));
$n->addActionItem(new ActionPopupItem(_T("Disable", "update"), "disableUpdate", "disable", "id", "update", "update"));
$n->setParamInfo($listinfoParams);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $status));
$n->start = 0;
$n->end = $maxperpage;
$n->disableFirstColumnActionLink();
$n->display();
// End selected updates form
print '</form>';
?>
Exemplo n.º 19
0
        }
        $param_ = array('cn' => $cn, 'objectUUID' => 'UUID' . $matches[1]);
    } else {
        $param_ = array('cn' => $data['hosts'][$i]);
        $cnames_ = $cn;
    }
    if (!empty($_GET['filter']) && stripos($cn, $_GET['filter']) === FALSE) {
        continue;
    }
    $cnames[] = $cnames_;
    $params[] = $param_;
}
$_SESSION['backup_hosts'] = array_combine($data['hosts'], $cnames);
$count = count($data['hosts']);
$n = new OptimizedListInfos($cnames, _T("Host name", "backuppc"));
$n->addExtraInfo($data['full'], _T("Full number", "backuppc"));
$n->addExtraInfo($data['full_size'], _T("Full size (GB)", "backuppc"));
$n->addExtraInfo($data['incr'], _T("incr. number", "backuppc"));
$n->addExtraInfo($data['last_backup'], _T("Last backup (days)", "backuppc"));
$n->addExtraInfo($data['state'], _T("Current state", "backuppc"));
$n->addExtraInfo($data['last_attempt'], _T("Last message", "backuppc"));
$n->addActionItem(new ActionPopupItem(_T("Start backup"), "startBackup", "start", "host", "backuppc", "backuppc"));
$n->addActionItem(new ActionPopupItem(_T("Stop backup"), "stopBackup", "stop", "host", "backuppc", "backuppc"));
$n->addActionItem(new ActionPopupItem(_T("View errors"), "viewHostLog", "file", "host", "backuppc", "backuppc"));
$n->addActionItem(new ActionConfirmItem(_T("Unset backup", 'backuppc'), "index", "delete", "uuid", "backuppc", "backuppc", _T('Are you sure you want to unset backup for this computer?', 'backuppc')));
$n->setParamInfo($params);
$n->setCssClass("machineName");
// CSS for icons
$n->setItemCount($count);
$filter1 = $_GET['location'];
$n->setNavBar(new AjaxNavBar($count, $filter1));
Exemplo n.º 20
0
        }
        //if ($icons['pause'] == '') {
        //$a_pause[] = $actionempty;
        //} else {
        //$a_pause[] = $actionpause;
        //}
        if ((!isset($bid) || $bid == '') && (!isset($gid) || $gid == '')) {
            # gid
            $a_details[] = $actionsinglestatus;
        } else {
            $a_details[] = $actionstatus;
        }
    }
}
$n = new OptimizedListInfos($a_cmd, _T("Command", "msc"));
$n->addExtraInfo($a_creator, _T("Creator", "msc"));
//$n->addExtraInfo($a_date, _T("Creation date", "msc"));
$n->addExtraInfo($start_dates, _T("Start date", "msc"));
$n->addExtraInfo($end_dates, _T("End date", "msc"));
$n->addExtraInfo($a_deployment_intervals, _T("Deployment interval", "msc"));
$n->addExtraInfo($a_target, _T("Target", "msc"));
$n->addExtraInfo($a_donepercent, _T("Success percent", "msc"));
$n->addActionItemArray($a_start);
//$n->addActionItemArray($a_pause);
$n->addActionItemArray($a_stop);
$n->addActionItemArray($a_delete);
//$n->addActionItemArray($a_details);
$n->disableFirstColumnActionLink();
# TODO put several columns actions
$n->setParamInfo($params);
$n->setTableHeaderPadding(1);
Exemplo n.º 21
0
}
if ($is_gp != 1) {
    // Simple Group
    $n = new OptimizedListInfos($name, _T('Group name', 'dyngroup'));
} else {
    // Imaging group
    $n = new OptimizedListInfos($name, _T('Group name', 'dyngroup'));
}
$n->setTableHeaderPadding(0);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter));
$n->start = 0;
$n->end = $conf["global"]["maxperpage"];
if ($is_gp != 1) {
    // Simple group
    $n->addExtraInfo($type, _T('Type', 'dyngroup'));
}
$n->addExtraInfo($show, _T('Favourite', 'dyngroup'));
$n->setParamInfo($ids);
if ($is_gp != 1) {
    // Simple group
    $n->addActionItem(new ActionItem(_T("Display this group's content", 'dyngroup'), "display", "display", "id", "base", "computers"));
    if (in_array("inventory", $_SESSION["supportModList"])) {
        $n->addActionItem(new ActionItem(_T("Inventory on this group", "dyngroup"), "groupinvtabs", "inventory", "inventory", "base", "computers"));
    } else {
        # TODO implement the glpi inventory on groups
        #    $n->addActionItem(new ActionItem(_T("Inventory on this group", "dyngroup"),"groupglpitabs","inventory","inventory", "base", "computers"));
    }
    $n->addActionItem(new ActionItem(_T("Edit this group", 'dyngroup'), "computersgroupedit", "edit", "id", "base", "computers"));
    $n->addActionItem(new ActionItem(_T("Share this group", 'dyngroup'), "edit_share", "groupshare", "id", "base", "computers"));
    if (in_array("msc", $_SESSION["supportModList"])) {
Exemplo n.º 22
0
         if (web_def_allow_delete()) {
             $a_delete[] = $actiondelete;
         } else {
             $a_delete[] = $actionempty;
         }
     }
 }
 # TODO: add the command end timestamp
 if ($history) {
     $datelabel = _T("End date", "msc");
 } else {
     $datelabel = _T("Start date", "msc");
 }
 $n = new OptimizedListInfos($a_mode, _T("Mode", "msc"));
 if ($uuid) {
     $n->addExtraInfo($a_client, _T("Command", "msc"));
 } else {
     $n->addExtraInfo($a_client, _T("Client", "msc"));
 }
 //$n->addExtraInfo($a_date, $datelabel);
 $n->addExtraInfo($a_current, _T("Global State", "msc"));
 //$n->addExtraInfo($a_current, _T("Global State", "msc"));
 $n->addExtraInfo($a_step_state, _T("Current step", "msc"));
 $n->addActionItemArray($a_details);
 if (!$history) {
     $n->addActionItemArray($a_start);
     //$n->addActionItemArray($a_pause);
     $n->addActionItemArray($a_stop);
 }
 $n->addActionItemArray($a_delete);
 $n->col_width = array("30px", "", "", "", "", "");
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require_once "modules/pkgs/includes/xmlrpc.php";
$packages = getAvailableAppstreamPackages();
if (!isset($packages['product'])) {
    return;
}
$packages = $packages['product'];
$count = count($packages);
$params = $labels = $durations = array();
foreach ($packages as $p) {
    $labels[] = $p['options']['package_label'];
    $durations[] = $p['expire_month'];
    $params[] = array('package_name' => $p['options']['package_name'], 'package_label' => $p['options']['package_label'], 'duration' => $p['expire_month'], 'id' => $p['id']);
}
print '<br/><h3>Available packages</h3>';
$n = new OptimizedListInfos($labels, _T("Package name", "pkgs"));
$n->setCssClass("package");
$n->disableFirstColumnActionLink();
$n->addExtraInfo($durations, _T("Validity (months)", "pkgs"));
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter1));
$n->setParamInfo($params);
$n->start = 0;
$n->end = $count - 1;
$n->addActionItem(new ActionPopupItem(_T("Activate this Appstream stream", "pkgs"), "activateAppstreamFlow", "activate", "pkgs", "pkgs", "pkgs"));
//print "<br/><br/><br/>"; // start display below the location bar, yes it's quiet ugly, so : FIXME !
$n->display();
Exemplo n.º 24
0
/**
 * (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com
 * (c) 2007-2008 Mandriva, http://www.mandriva.com/
 *
 * $Id$
 *
 * This file is part of Mandriva Management Console (MMC).
 *
 * MMC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
function list_computers($names, $filter, $count = 0, $delete_computer = false, $remove_from_result = false, $is_group = false, $msc_can_download_file = false, $msc_vnc_show_icon = false)
{
    /* $pull_list is an array with UUIDs of pull machines */
    $pull_list = in_array("pulse2", $_SESSION["modulesList"]) ? get_pull_targets() : array();
    $emptyAction = new EmptyActionItem();
    $inventAction = new ActionItem(_("Inventory"), "invtabs", "inventory", "inventory", "base", "computers");
    $glpiAction = new ActionItem(_("GLPI Inventory"), "glpitabs", "inventory", "inventory", "base", "computers");
    $logAction = new ActionItem(_("Read log"), "msctabs", "logfile", "computer", "base", "computers", "tablogs");
    $mscAction = new ActionItem(_("Software deployment"), "msctabs", "install", "computer", "base", "computers");
    $imgAction = new ActionItem(_("Imaging management"), "imgtabs", "imaging", "computer", "base", "computers");
    $downloadFileAction = new ActionItem(_("Download file"), "download_file", "download", "computer", "base", "computers");
    $vncClientAction = new ActionPopupItem(_("Remote control"), "vnc_client", "vncclient", "computer", "base", "computers");
    $profileAction = new ActionItem(_("Show Profile"), "computersgroupedit", "logfile", "computer", "base", "computers");
    $actionInventory = array();
    $actionLogs = array();
    $actionMsc = array();
    $actionImaging = array();
    $actionDownload = array();
    $actionVncClient = array();
    $actionProfile = array();
    $params = array();
    $cssClasses = array();
    $headers = getComputersListHeaders();
    $columns = array();
    foreach ($headers as $header) {
        $columns[$header[0]] = array();
    }
    function getUUID($machine)
    {
        return $machine['objectUUID'];
    }
    $uuids = array_map("getUUID", $names);
    /*if (in_array("dyngroup", $_SESSION["modulesList"])) {
          $profiles = xmlrpc_getmachinesprofiles($uuids);
          $h_profiles = array();
          $i = 0;
          foreach ($uuids as $uuid) {
              $h_profiles[$uuid] = $profiles[$i++];
          }
      }*/
    foreach ($names as $value) {
        $cssClasses[] = in_array($value['objectUUID'], $pull_list) ? 'machinePull' : 'machineName';
        foreach ($headers as $header) {
            if (!empty($value[$header[0]])) {
                $v = $value[$header[0]];
            } else {
                $v = '';
            }
            $columns[$header[0]][] = $v;
        }
        if (isset($filter['gid'])) {
            $value['gid'] = $filter['gid'];
        }
        if (in_array("inventory", $_SESSION["supportModList"])) {
            $actionInventory[] = $inventAction;
        } else {
            $actionInventory[] = $glpiAction;
        }
        if (in_array("msc", $_SESSION["supportModList"])) {
            $actionMsc[] = $mscAction;
            $actionLogs[] = $logAction;
        }
        if (in_array("imaging", $_SESSION["supportModList"])) {
            $actionImaging[] = $imgAction;
        }
        /*
        if (in_array("dyngroup", $_SESSION["modulesList"])) {
            $profile = $h_profiles[$value['objectUUID']];
            if ($profile) {
                $actionProfile[] = $profileAction;
                $value['id'] = $profile;
            } else {
                $actionProfile[] = $emptyAction;
            }
        }
        */
        if ($msc_can_download_file) {
            $actionDownload[] = $downloadFileAction;
        }
        if ($msc_vnc_show_icon) {
            $actionVncClient[] = $vncClientAction;
        }
        $params[] = $value;
    }
    if (isset($filter['location'])) {
        $filter = $filter['hostname'] . '##' . $filter['location'];
    } else {
        $filter = $filter['hostname'] . '##';
    }
    $n = null;
    if ($count) {
        foreach ($headers as $header) {
            if ($n == null) {
                if (in_array("glpi", $_SESSION["modulesList"])) {
                    $n = new OptimizedListInfos($columns[$header[0]], _T($header[1], 'glpi'));
                } else {
                    $n = new OptimizedListInfos($columns[$header[0]], _($header[1]));
                }
            } else {
                if (in_array("glpi", $_SESSION["modulesList"])) {
                    $n->addExtraInfo($columns[$header[0]], _T($header[1], 'glpi'));
                } else {
                    $n->addExtraInfo($columns[$header[0]], _($header[1]));
                }
            }
        }
        $n->setItemCount($count);
        $n->setNavBar(new AjaxNavBar($count, $filter));
        $n->start = 0;
        $n->end = $count - 1;
    } else {
        foreach ($headers as $header) {
            if ($n == null) {
                $n = new ListInfos($columns[$header[0]], _($header[1]));
            } else {
                $n->addExtraInfo($columns[$header[0]], _($header[1]));
            }
        }
        $n->setNavBar(new AjaxNavBar(count($columns[$headers[0][0]]), $filter));
    }
    $n->setName(_("Computers list"));
    $n->setParamInfo($params);
    //$n->setCssClass("machineName");
    $n->setMainActionClasses($cssClasses);
    $n->addActionItemArray($actionInventory);
    if ($msc_can_download_file) {
        $n->addActionItemArray($actionDownload);
    }
    if (in_array("backuppc", $_SESSION["supportModList"])) {
        $n->addActionItem(new ActionItem(_("Backup status"), "hostStatus", "backuppc", "backuppc", "backuppc", "backuppc"));
    }
    if ($msc_vnc_show_icon) {
        $n->addActionItemArray($actionVncClient);
    }
    /*if (in_array("dyngroup", $_SESSION["modulesList"])) {
          $n->addActionItemArray($actionProfile);
      }*/
    if (in_array("msc", $_SESSION["supportModList"])) {
        $n->addActionItemArray($actionLogs);
        $n->addActionItemArray($actionMsc);
    }
    if (in_array("imaging", $_SESSION["supportModList"])) {
        $n->addActionItemArray($actionImaging);
    }
    if ($delete_computer && canDelComputer()) {
        // set popup window to 400px width
        $n->addActionItem(new ActionPopupItem(_("Delete computer"), "delete", "delete", "computer", "base", "computers", null, 400));
    }
    if ($remove_from_result) {
        $n->addActionItem(new ActionPopupItem(_("Remove machine from group"), "remove_machine", "remove_machine", "name", "base", "computers"));
    }
    $n->display();
}
Exemplo n.º 25
0
        $a_pause[] = $actionempty;
        $a_details[] = $actionempty;
    } else {    
        if ($icons['play'] == '') { $a_start[] = $actionempty; } else { $a_start[] = $actionplay; }
        if ($icons['stop'] == '') { $a_stop[] = $actionempty; } else { $a_stop[] = $actionstop; }
        if ($icons['pause'] == '') { $a_pause[] = $actionempty; } else { $a_pause[] = $actionpause; }
        if ((!isset($bid) || $bid == '') && (!isset($gid) || $gid == '')) { # gid
            $a_details[] = $actionsinglestatus;
        } else {
            $a_details[] = $actionstatus;
        }
    }
}

$n = new OptimizedListInfos($a_cmd, _T("Command", "msc"));
$n->addExtraInfo($a_creator, _T("Creator", "msc"));
$n->addExtraInfo($a_date, _T("Creation date", "msc"));
$n->addExtraInfo($a_target, _T("Target", "msc"));

$n->addActionItemArray($a_start);
$n->addActionItemArray($a_pause);
$n->addActionItemArray($a_stop);
$n->addActionItemArray($a_details);

$n->disableFirstColumnActionLink(); # TODO put several columns actions
$n->setParamInfo($params);
$n->setTableHeaderPadding(1);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter));
$n->start = 0;
$n->end = $maxperpage;
Exemplo n.º 26
0
if (isset($_GET["filter"]) && $_GET["filter"]) {
    $params['filters'] = $_GET["filter"];
}
extract(parse_file_rule($params));
if (!$count) {
    print _T('No entry found', 'inventory');
    return;
}
//  Listinfo params
$listinfoParams = array();
foreach ($data as $row) {
    $listinfoParams[] = array('numRule' => $row['numRule'], 'entitie' => $row['entitie']);
}
$cols = listInfoFriendly($data);
$n = new OptimizedListInfos($cols['numRule'], _T('Rule', 'inventory'), '', '10px');
$n->addExtraInfo($cols['actif'], _T('actif', 'inventory'));
$n->addExtraInfo($cols['entitie'], _T('entitie', 'inventory'));
$n->addExtraInfo($cols['aggregator'], _T('aggregator', 'inventory'));
$n->addExtraInfo($cols['operand1'], _T('lvalue', 'inventory'));
$n->addExtraInfo($cols['operator'], _T('operator', 'inventory'));
$n->addExtraInfo($cols['operand2'], _T('rvalue', 'inventory'));
$n->first_elt_padding = '0';
$n->addActionItem(new ActionItem(_T("Edit rule", "inventory"), "addEntityRule", "edit", "rule", "base", "computers"));
$n->addActionItem(new ActionPopupItem(_T("Move rule up", "inventory"), "moveRuleUp", "up", "rule", "base", "computers"));
$n->addActionItem(new ActionPopupItem(_T("Move rule down", "inventory"), "moveRuleDown", "down", "rule", "base", "computers"));
$n->addActionItem(new ActionPopupItem(_T("Delete rule", "inventory"), "deleteEntityRule", "delete", "rule", "base", "computers"));
$n->setParamInfo($listinfoParams);
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $status));
$n->start = 0;
$n->end = $maxperpage;
Exemplo n.º 27
0
         $viewVersionsActions[] = $viewVersionsAction;
     }
     $names[$i] = sprintf('<input type="checkbox" name="f%d" value="%s" /> &nbsp;&nbsp;', $i, $paths[$i]) . $names[$i];
 }
 if ($folder != '/') {
     $parentfolderlink = '<a href="#" onclick="BrowseDir(\'' . dirname($folder) . '/\')">.. (Parent dir)</a>';
     $names = array_merge(array($parentfolderlink), $names);
     $cssClasses = array_merge(array('folder'), $cssClasses);
     $sizes = array_merge(array(''), $sizes);
     $params = array_merge(array(''), $params);
     $viewVersionsActions = array_merge(array($emptyAction), $viewVersionsActions);
 }
 $count = count($names);
 $n = new OptimizedListInfos($names, $z);
 $n->disableFirstColumnActionLink();
 $n->addExtraInfo($sizes, _T("Size", "backuppc"));
 $n->setMainActionClasses($cssClasses);
 $n->setItemCount($count);
 $filter = $_GET['folder'] . '|mDvPulse|' . $_GET['location'];
 $n->setNavBar(new AjaxNavBar($count, $filter));
 $n->start = isset($_GET['start']) ? $_GET['start'] : 0;
 $n->end = isset($_GET['end']) ? $_GET['end'] : $maxperpage;
 $n->setParamInfo($params);
 // Setting url params
 $n->addActionItemArray($viewVersionsActions);
 print '<br/><br/><form id="restorefiles" method="post" action="">';
 printf('<input type="hidden" name="host" value="%s" />', $_GET['host']);
 printf('<input type="hidden" name="backupnum" value="%s" />', $_GET['backupnum']);
 printf('<input type="hidden" name="sharename" value="%s" />', $_GET['sharename']);
 printf('<input type="hidden" name="dir" value="%s" />', $folder);
 print '<input type="hidden"  name="restoredir" id="restoredir" value=""  />';
Exemplo n.º 28
0
            if (in_array($head, $graph) && count($vals) > 1) {
                $type = ucfirst($_GET['part']);
                # TODO should give the tab in the from param
                $nhead = $head." <a href='main.php?module=inventory&submod=inventory&action=graphs&type=$type&from=$from&field=$head";
                foreach (array('uuid', 'hostname', 'gid', 'groupname', 'filter', 'tab', 'part') as $get) {
                    $nhead .= "&$get=".$_GET[$get];
                }
                $nhead .= "' alt='graph'><img src='modules/inventory/img/graph.png'/></a>";
                $head = $nhead;
            } else {
                $head = _T($head, 'inventory');
            }
            if ($n == null) {
                $n = new OptimizedListInfos($vals, $head);
            } else {
                $n->addExtraInfo($vals, $head);
            }
        }
    }

    print "<div style=\"overflow: auto\">";
    if ($n != null) {
        $n->addActionItem(new ActionItem(_T("View", "inventory"),"invtabs","display","inventory", "base", "computers"));
        $n->addActionItem(new ActionPopupItem(_T("Informations", "inventory"),"infos","info","inventory", "inventory", "inventory"));
        $n->setParamInfo($params);
        $n->setTableHeaderPadding(1);
        $n->setItemCount($count);
        $n->setNavBar(new AjaxNavBar($count, $filter));
        $n->start = 0;
        $n->end = $maxperpage;
        $n->display();
Exemplo n.º 29
0
            $status[] = '<img src="modules/msc/graph/images/status/inprogress.gif" alt=""/>';
            $name = sprintf('<a href="#">%s</a>', $name);
            $refresh = 1;
            // We want a refresh after X second
        } else {
            if ($dstatus['err'] == 0) {
                $status[] = '<img src="modules/msc/graph/images/status/success.png" alt=""/>';
            } else {
                $status[] = '<img src="modules/msc/graph/images/status/failed.png" alt=""/> ' . $dstatus['errtext'];
                $name = sprintf('<a href="#">%s</a>', $name);
            }
        }
        $names[] = $name;
    }
    $n = new OptimizedListInfos($names, _T("Destination", "backuppc"));
    $n->addExtraInfo($times, _T("Restore time", "backuppc"));
    $n->addExtraInfo($status, _T("Status", "backuppc"));
    $n->setCssClass("file");
    $filter1 = '';
    $n->setNavBar(new AjaxNavBar(0, $filter1));
    $n->setParamInfo($params);
    $n->addActionItemArray($actions);
    $n->start = 0;
    $n->end = 50;
    $n->setItemCount(count($names));
    $n->display();
}
print '</div>';
?>

<script type="text/javascript">
Exemplo n.º 30
0
$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'];
    $desc[] = $p['description'];
    $params[] = array('p_api' => $_GET['location'], 'pid' => base64_encode($p['id']), 'from' => 'pending', 'plabel' => base64_encode($p['label']), 'pversion' => base64_encode($p['version']), 'mode' => 'edit', 'why' => $p['why']);
}
$n = new OptimizedListInfos($names, _T("Package name", "pkgs"));
$n->setCssClass("package");
$n->disableFirstColumnActionLink();
$n->addExtraInfo($desc, _T("Description", "pkgs"));
$n->addExtraInfo($versions, _T("Version", "pkgs"));
$n->setItemCount($count);
$n->setNavBar(new AjaxNavBar($count, $filter1));
$n->setParamInfo($params);
$n->start = 0;
$n->end = $count - 1;
$n->addActionItem($assoc_list);
$n->addActionItem(new ActionPopupItem(_T("Show mirrors", "pkgs"), "rsync", "info", "pkgs", "pkgs", "pkgs"));
$n->addActionItem(new ActionPopupItem(_T("Delete a package", "pkgs"), "delete", "delete", "pkgs", "pkgs", "pkgs"));
print "<br/><br/><br/>";
// start display below the location bar, yes it's quiet ugly, so : FIXME !
$n->display();