Пример #1
0
$editAction = new ActionItem(_T("edit static host", "network"), "subnetedithost", "edit", "ipaddress", "network", "network");
$emptyAction = new EmptyActionItem();
foreach ($lines as $ipaddress => $infos) {
    $hosts[] = $infos["hostname"];
    $ipaddresses[] = long2ip($ipaddress);
    $macaddresses[] = $infos["macaddress"];
    $types[] = $infos["type"];
    $params[] = array("host" => $infos["hostname"], "macaddress" => $infos["macaddress"], "subnet" => $subnet);
    if ($infos["type"] == _T("Static", "network")) {
        $actionsAdd[] = $emptyAction;
        $actionsDel[] = $deleteAction;
        $actionsEdit[] = $editAction;
    } else {
        $actionsAdd[] = $addAction;
        $actionsDel[] = $emptyAction;
        $actionsEdit[] = $emptyAction;
    }
}
$n = new ListInfos($ipaddresses, _T("IP address", "network"));
$n->setNavBar(new AjaxNavBar(count($ipaddresses), $filter));
$n->disableFirstColumnActionLink();
$n->setTableHeaderPadding(1);
$n->addExtraInfo($hosts, _T("Host name", "network"));
$n->addExtraInfo($macaddresses, _T("MAC address", "network"));
$n->addExtraInfo($types, _T("Type", "network"));
$n->setName(_T("Host", "network"));
$n->setParamInfo($params);
$n->addActionItemArray($actionsAdd);
$n->addActionItemArray($actionsEdit);
$n->addActionItemArray($actionsDel);
$n->display();
Пример #2
0
            $states[] = _T('Downloading', 'msc');
            $flengths[] = '';
            $actionsdl[] = new EmptyActionItem();
            $actionsrm[] = new EmptyActionItem();
        } else {
            if ($file[0] == '' && $file[3] == -1) {
                $states[] = _T('Error', 'msc');
                $flengths[] = '';
                $actionsdl[] = new EmptyActionItem();
                $actionsrm[] = $actionRemove;
            } else {
                $states[] = _T('Ready', 'msc');
                $flengths[] = $file[3];
                $actionsdl[] = $actionDownload;
                $actionsrm[] = $actionRemove;
            }
        }
    }
}
$l = new ListInfos($ftimestamps, _T('Timestamp', 'msc'));
$l->addExtraInfo($fcomputers, _T('From computer', 'msc'));
$l->addExtraInfo($fnames, _T('File name', 'msc'));
$l->addExtraInfo($flengths, _T('Length', 'msc'));
$l->addExtraInfo($states, _T('Status', 'msc'));
$l->addActionItemArray($actionsdl);
$l->addActionItemArray($actionsrm);
$l->setTableHeaderPadding(1);
$l->disableFirstColumnActionLink();
$l->setParamInfo($finodes);
$l->setNavBar(new AjaxNavBar(count($fnames), $filter));
$l->display();
Пример #3
0
} else {
    $status[] = _T("Stopped");
    $actionsStart[] = $startAction;
    $actionsStop[] = $emptyAction;
    $actionsRestart[] = $emptyAction;
}
$actionsLog[] = $logAction;
$actionsReload[] = $reloadAction;
if (dnsService("status")) {
    $status[] = _T("Started");
    $actionsStart[] = $emptyAction;
    $actionsStop[] = $stopAction;
    $actionsRestart[] = $restartAction;
} else {
    $status[] = _T("Stopped");
    $actionsStart[] = $startAction;
    $actionsStop[] = $emptyAction;
    $actionsRestart[] = $emptyAction;
}
$l = new ListInfos(array("DHCP", "DNS"), _T("Services"));
$l->setName(_T("Network services status"));
$l->addExtraInfo($status, _T("Status"));
$l->setParamInfo(array(array("service" => "DHCP"), array("service" => "DNS")));
$l->setTableHeaderPadding(1);
$l->disableFirstColumnActionLink();
$l->addActionItemArray($actionsStart);
$l->addActionItemArray($actionsStop);
$l->addActionItemArray($actionsRestart);
$l->addActionItemArray($actionsReload);
$l->addActionItemArray($actionsLog);
$l->display(0);
Пример #4
0
$inventoriesDates = array();
$inventoriesId = array();
$detailsParams = array();
$detailsButtons = array();
$i = 0;
// Call the methods to get the inventory history
$count = countMachineInventoryHistory($params);
$inventory_history = getMachineInventoryHistory($params);
// Loop through the inventory history to extract infos
foreach ($inventory_history as $inventory) {
    $inventoriesDates[] = _toDate($inventory[1]);
    // Add the details link (unless we are on the last line)
    if ($i < count($inventory_history) - 1) {
        $detailsButtons[] = new ActionItem(_T("View differences since previous inventory", "inventory"), "invdiff", "display");
    } else {
        $detailsButtons[] = new EmptyActionItem();
    }
    $detailsParams[$i]['inventoryId'] = $inventory[0];
    $detailsParams[$i++]['uuid'] = $params['uuid'];
}
// Create a ListInfos that will display the inventories dates
$list = new ListInfos($inventoriesDates, _T("Inventory Date", "inventory"));
// Add extra params in the "details" link
$list->setParamInfo($detailsParams);
$list->disableFirstColumnActionLink();
$list->setName(_T("Inventory", "inventory"));
$list->addActionItemArray($detailsButtons);
$list->setTableHeaderPadding(0);
$list->start = 0;
$list->end = count($inventoriesDates);
$list->display();
Пример #5
0
$list = getRules("", $src, $dst, $filter);
$src_zones = getZonesInterfaces($src);
$dst_zones = getZonesInterfaces($dst);
$deleteAction = new ActionPopupItem(_T("Delete rule"), "delete_" . $page . "_rule", "delete", "");
$ids = array();
$decision = array();
$service = array();
$source = array();
$destination = array();
$proto = array();
$port = array();
$actionsDelete = array();
foreach ($list as $index => $rule) {
    include 'rule_list.inc.php';
}
$n = new ListInfos($decision, _T("Decision"));
$n->first_elt_padding = 1;
$n->disableFirstColumnActionLink();
$n->addExtraInfo($service, _T("Service"));
if (count($src_zones) > 1) {
    $n->addExtraInfo($source, _T("Source"));
}
if (count($dst_zones) > 1) {
    $n->addExtraInfo($destination, _T("Destination"));
}
$n->addExtraInfo($proto, _T("Protocol"));
$n->addExtraInfo($port, _T("Port(s)"));
$n->setParamInfo($ids);
$n->addActionItemArray($actionsDelete);
$n->setNavBar(new AjaxNavBar(count($ids), $filter));
$n->display();
Пример #6
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();
}
Пример #7
0
        $a_desc[] = $entry['image']['desc'];
        $default_name = $entry['image']['name'];
        $kind = 'IM';
    } else {
        $a_desc[] = $entry['boot_service']['default_desc'];
        $default_name = $entry['boot_service']['default_name'];
        $kind = 'BS';
    }
    $list_params[$i]["itemlabel"] = urlencode($default_name);
    $a_label[] = sprintf("%s%s", $kind == 'IM' ? '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" /> ' : '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" /> ', $default_name);
    $a_default[] = $entry['default'];
    $a_display[] = $entry['hidden'] ? False : True;
    $a_defaultWOL[] = $entry['default_WOL'];
    $a_displayWOL[] = $entry['hidden_WOL'] ? False : True;
}
$t = new TitleElement(_T("Default boot menu configuration", "imaging"), 3);
$t->display();
$l = new ListInfos($a_label, _T("Label", "imaging"));
$l->setParamInfo($list_params);
$l->addExtraInfo($a_desc, _T("Description", "imaging"));
$l->addExtraInfo($a_default, _T("Default", "imaging"));
$l->addExtraInfo($a_display, _T("Displayed", "imaging"));
$l->addExtraInfo($a_defaultWOL, _T("Default on WOL", "imaging"));
$l->addExtraInfo($a_displayWOL, _T("Displayed on WOL", "imaging"));
$l->addActionItemArray($actionsUp);
$l->addActionItemArray($actionsDown);
$l->addActionItem(new ActionItem(_T("Edit"), "bootmenu_edit", "edit", "item", "imaging", "manage"));
$l->setTableHeaderPadding(19);
$l->disableFirstColumnActionLink();
$l->display();
require "../includes/ajaxcommon_bottom.inc.php";
Пример #8
0
 function quickDisplay($actions = array(), $params = array())
 {
     if (!$this->db_cmd) {
         # user do not have the right permissions
         $widget = new RenderedMSCCommandDontExists();
         $widget->display();
         return false;
     }
     $n = null;
     foreach ($this->values as $col) {
         if ($col[2]) {
             if ($n) {
                 $n->addExtraInfo(array($col[1]), $col[0]);
             } else {
                 $n = new ListInfos(array($col[1]), $col[0]);
                 $n->first_elt_padding = 0;
             }
         }
     }
     $params = array_merge($params, array('cmd_id' => $_GET['cmd_id'], 'gid' => $_GET['gid'], 'from' => 'msc|logs|viewLogs'));
     $n->setParamInfo(array($params));
     foreach ($actions as $a) {
         $n->addActionItem($a);
     }
     // Start/Stop buttons
     $n->addActionItem(new ActionPopupItem(_T("Start", "msc"), "msctabsplay", "start", "msc", "base", "computers"));
     $n->addActionItem(new ActionPopupItem(_T("Stop", "msc"), "msctabsstop", "stop", "msc", "base", "computers"));
     $n->addActionItem(new ActionPopupItem(_T("Reschedule", "msc"), "reschedule", "reschedule", "msc", "base", "computers"));
     $n->disableFirstColumnActionLink();
     $n->drawTable(0);
     print '<br/>';
     return true;
 }
Пример #9
0
function item_list() {

    if(isset($_GET['gid'])) {
        $type = 'group';
        list($count, $menu) = xmlrpc_getProfileBootMenu($_GET['gid']);
    } else {
        $type = '';
        list($count, $menu) = xmlrpc_getComputerBootMenu($_GET['uuid']);
    }

    $params = getParams();

    // forge params
    $upAction = new ActionItem(_T("Move Up"), $type."imgtabs", "up", "item", "base", "computers", $type."tabbootmenu", "up");
    $downAction = new ActionItem(_T("Move down"), $type."imgtabs", "down", "item", "base", "computers", $type."tabbootmenu", "down");
    $editAction = new ActionItem(_T("Edit"), $type."imgtabs", "edit", "item", "base", "computers", $type."tabbootmenu", "edit");
    $deleteAction = new ActionPopupItem(_T("Delete"), "bootmenu_remove", "delete", "item", "base", "computers", $type."tabbootmenu", 300, "delete");

    $emptyAction = new EmptyActionItem();
    $actionUp = array();
    $actionDown = array();
    $actionEdit = array();
    $actionDelete = array();

    $nbItems = $count;

    $a_label = array();
    $a_desc = array();
    $a_default = array();
    $a_display = array();
    $a_defaultWOL = array();
    $a_displayWOL = array();
    $params['from'] = 'tabbootmenu';

    $i = -1;
    $root_len = 0;
    foreach ($menu as $entry) {
        $i = $i + 1;
        $is_image = False;
        if (isset($entry['image'])) {
            $is_image = True;
        }

        if ($is_image) { # TODO $entry has now a cache for desc.
            $a_desc[] = $entry['image']['desc'];
            $entry['default_name'] = $entry['image']['name'];
            $kind = 'IM';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/imaging-action-ro.png" style="vertical-align: middle" alt="'._T('master from the profile', 'imaging').'"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" alt="'._T('master', 'imaging').'"/> ';
            }
        } else {
            $a_desc[] = $entry['boot_service']['default_desc'];
            $entry['default_name'] = $entry['boot_service']['default_name'];
            $kind = 'BS';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/service-action-ro.png" style="vertical-align: middle" alt="'._T('boot service from profile', 'imaging').'"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" alt="'._T('boot service', 'imaging').'"/> ';
            }
        }

        $list_params[$i] = $params;
        $list_params[$i]["itemid"] = $entry['imaging_uuid'];
        $list_params[$i]["itemlabel"] = urlencode($entry['default_name']);

        if ($entry['read_only']) {
            $actionsDown[] = $emptyAction;
            $actionsUp[] = $emptyAction;
            $root_len += 1;
            $actionEdit[] = $emptyAction;
            $actionDelete[] = $emptyAction;
        } else {
            $actionEdit[] = $editAction;
            $actionDelete[] = $deleteAction;
            if ($i == $root_len) {
                if ($count == 1 || $root_len == $count - 1) {
                    $actionsDown[] = $emptyAction;
                    $actionsUp[] = $emptyAction;
                } else {
                    $actionsDown[] = $downAction;
                    $actionsUp[] = $emptyAction;
                }
            } elseif ($i > $root_len && $i == $nbItems-1) {
                $actionsDown[] = $emptyAction;
                $actionsUp[] = $upAction;
            } elseif ($i > $root_len) {
                $actionsDown[] = $downAction;
                $actionsUp[] = $upAction;
            }
        }

        $a_label[] = sprintf("%s%s", $url, $entry['default_name']); # should be replaced by the label in the good language
        $a_default[] = $entry['default'];
        $a_display[] = ($entry['hidden'] ? False:True);
        $a_defaultWOL[] = $entry['default_WOL'];
        $a_displayWOL[] = ($entry['hidden_WOL'] ? False:True);
    }
    $firstp = "<p>" . _T("\"Preselected choice\" and \"Preselected choice on WOL\" values will be used to set the default imaging client menu item to run, if no choice is made by the user on the client side prior to the menu timeout.", "imaging") . "</p>";
    /* Build tooltip text on column name */
    if ($type == "") {
        $text = $firstp . "<p>" . _T("Once the operation triggered by a choice is successfull, the preselected choice will default to the first item of the boot menu.", "imaging") . "</p>";
    } else {
        $text = $firstp . "<p>" . _T("When you modify the \"Preselected choice\" or \"Preselected choice on WOL\" values on a profile, those values will be set on all the boot menu of the computers owned by the profile.", "imaging") . "</p>" . "<p>" . _T("Then for each computer, once the operation triggered by a choice is successfull, the preselected choice will default to the first item of the boot menu.", "imaging") . "</p>";
    }
    $l = new ListInfos($a_label, _T("Label"));
    $l->setParamInfo($list_params);
    $l->addExtraInfo($a_desc, _T("Description", "imaging"));
    $l->addExtraInfo($a_default, _T("Preselected choice", "imaging")
                     , "", $text);
    $l->addExtraInfo($a_display, _T("Displayed", "imaging"));
    $l->addExtraInfo($a_defaultWOL, _T("Preselected choice on WOL", "imaging")
                     , "", $text);
    $l->addExtraInfo($a_displayWOL, _T("Displayed on WOL", "imaging"));
    $l->addActionItemArray($actionsUp);
    $l->addActionItemArray($actionsDown);
    $l->addActionItemArray($actionEdit);
    if ($count > 1) {
        $l->addActionItemArray($actionDelete);
    }
    $l->disableFirstColumnActionLink();
    $l->setTableHeaderPadding(19);
    $l->display();
}
Пример #10
0
function item_list()
{
    if (isset($_GET['gid'])) {
        $type = 'group';
        list($count, $menu) = xmlrpc_getProfileBootMenu($_GET['gid']);
    } else {
        $type = '';
        list($count, $menu) = xmlrpc_getComputerBootMenu($_GET['uuid']);
    }
    $params = getParams();
    // forge params
    if ($type == 'group') {
        $module = "imaging";
        $submod = "manage";
    } else {
        $module = "base";
        $submod = "computers";
    }
    $upAction = new ActionItem(_T("Move Up"), $type . "imgtabs", "up", "item", $module, $submod, $type . "tabbootmenu", "up");
    $downAction = new ActionItem(_T("Move down"), $type . "imgtabs", "down", "item", $module, $submod, $type . "tabbootmenu", "down");
    $editAction = new ActionItem(_T("Edit"), $type . "imgtabs", "edit", "item", $module, $submod, $type . "tabbootmenu", "edit");
    $deleteAction = new ActionPopupItem(_T("Delete"), $type . "bootmenu_remove", "delete", "item", $module, $submod, $type . "tabbootmenu", 300, "delete");
    $emptyAction = new EmptyActionItem();
    $actionUp = array();
    $actionDown = array();
    $actionEdit = array();
    $actionDelete = array();
    $nbItems = $count;
    $a_label = array();
    $a_desc = array();
    $a_default = array();
    $a_display = array();
    $a_defaultWOL = array();
    $a_displayWOL = array();
    $params['from'] = 'tabbootmenu';
    $i = -1;
    $root_len = 0;
    foreach ($menu as $entry) {
        $i = $i + 1;
        $is_image = False;
        if (isset($entry['image'])) {
            $is_image = True;
        }
        if ($is_image) {
            # TODO $entry has now a cache for desc.
            $a_desc[] = $entry['image']['desc'];
            $entry['default_name'] = $entry['image']['name'];
            $kind = 'IM';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/imaging-action-ro.png" style="vertical-align: middle" alt="' . _T('master from the profile', 'imaging') . '"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" alt="' . _T('master', 'imaging') . '"/> ';
            }
        } else {
            $a_desc[] = $entry['boot_service']['default_desc'];
            $entry['default_name'] = $entry['boot_service']['default_name'];
            $kind = 'BS';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/service-action-ro.png" style="vertical-align: middle" alt="' . _T('boot service from profile', 'imaging') . '"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" alt="' . _T('boot service', 'imaging') . '"/> ';
            }
        }
        $list_params[$i] = $params;
        $list_params[$i]["itemid"] = $entry['imaging_uuid'];
        $list_params[$i]["itemlabel"] = urlencode($entry['default_name']);
        if ($entry['read_only']) {
            $actionsDown[] = $emptyAction;
            $actionsUp[] = $emptyAction;
            $root_len += 1;
            $actionEdit[] = $emptyAction;
            $actionDelete[] = $emptyAction;
        } else {
            $actionEdit[] = $editAction;
            $actionDelete[] = $deleteAction;
            if ($i == $root_len) {
                if ($count == 1 || $root_len == $count - 1) {
                    $actionsDown[] = $emptyAction;
                    $actionsUp[] = $emptyAction;
                } else {
                    $actionsDown[] = $downAction;
                    $actionsUp[] = $emptyAction;
                }
            } elseif ($i > $root_len && $i == $nbItems - 1) {
                $actionsDown[] = $emptyAction;
                $actionsUp[] = $upAction;
            } elseif ($i > $root_len) {
                $actionsDown[] = $downAction;
                $actionsUp[] = $upAction;
            }
        }
        $a_label[] = sprintf("%s%s", $url, $entry['default_name']);
        # should be replaced by the label in the good language
        $a_default[] = $entry['default'];
        $a_display[] = $entry['hidden'] ? False : True;
        $a_defaultWOL[] = $entry['default_WOL'];
        $a_displayWOL[] = $entry['hidden_WOL'] ? False : True;
    }
    $firstp = "<p>" . _T("Use \"Preselected choice\" or \"Preselected choice on WOL\" to define the default boot entry.", "imaging") . "</p>";
    /* Build tooltip text on column name */
    if ($type == "") {
        $text = $firstp . "<p>" . _T("If the default entry is an image creation or restore, the following network boots will fall back to the first menu entry.", "imaging") . "</p>";
    } else {
        $text = $firstp . "<p>" . _T("When changing \"Preselected choice\" or \"Preselected choice on WOL\" entry, this value will be set on all the computers in this group.", "imaging") . "</p>" . "<p>" . _T("If the default entry is an image creation or restore, the following network boots will fall back to the first menu entry.", "imaging") . "</p>";
    }
    $l = new ListInfos($a_label, _T("Label"));
    $l->setParamInfo($list_params);
    $l->addExtraInfo($a_desc, _T("Description", "imaging"));
    $l->addExtraInfo($a_default, _T("Preselected choice", "imaging"), "", $text);
    $l->addExtraInfo($a_display, _T("Displayed", "imaging"));
    $l->addExtraInfo($a_defaultWOL, _T("Preselected choice on WOL", "imaging"), "", $text);
    $l->addExtraInfo($a_displayWOL, _T("Displayed on WOL", "imaging"));
    $l->addActionItemArray($actionsUp);
    $l->addActionItemArray($actionsDown);
    $l->addActionItemArray($actionEdit);
    if ($count > 1) {
        $l->addActionItemArray($actionDelete);
    }
    $l->disableFirstColumnActionLink();
    $l->setTableHeaderPadding(19);
    $l->display();
}
Пример #11
0
 function displayReqListInfos($canbedeleted = false, $default_params = array())
 {
     if (!$default_params['target']) {
         $default_params['target'] = 'creator';
     }
     if (!strlen($default_params['tab'])) {
         $default_params['tab'] = null;
     }
     $parameters = array();
     $parts = array();
     foreach ($this->subs as $id => $sub) {
         array_push($parts, $sub->display());
         $p = $default_params;
         $p['subedition'] = 1;
         #$p['delete'] = $id;
         $p['sub_id'] = $id;
         $p['request'] = $this->toS();
         array_push($parameters, $p);
     }
     $n = new ListInfos($parts, _T('Search part', 'dyngroup'), "&amp;id=" . $default_params['gid']);
     if ($canbedeleted) {
         $n->setParamInfo($parameters);
         $n->addActionItem(new ActionItem(_T("Edit", 'dyngroup'), $default_params['target_edit'], "edit", "params", null, null, $default_params['tab']));
         $n->addActionItem(new ActionItem(_T("Delete", 'dyngroup'), $default_params['target_del'], "delete", "params", null, null, $default_params['tab']));
     }
     $n->disableFirstColumnActionLink();
     $n->display();
     print "<br/>";
     // or the previous/next will be on the next line...
 }
Пример #12
0
 function quickDisplay($actions = array(), $params = array())
 {
     if (!$this->db_cmd) {
         # user do not have the right permissions
         $widget = new RenderedMSCCommandDontExists();
         $widget->display();
         return false;
     }
     $n = null;
     foreach ($this->values as $col) {
         if ($col[2]) {
             if ($n) {
                 $n->addExtraInfo(array($col[1]), $col[0]);
             } else {
                 $n = new ListInfos(array($col[1]), $col[0]);
             }
         }
     }
     $n->setParamInfo(array($params));
     foreach ($actions as $a) {
         $n->addActionItem($a);
     }
     $n->drawTable(0);
     return true;
 }