示例#1
0
$a_logs = array();
$a_info = array();
$l_im = array();
foreach ($images as $image) {
    $name = $image['name'];
    $l_params = $params;
    $l_params["itemid"] = $image['imaging_uuid'];
    $l_params["itemlabel"] = urlencode($name);
    $l_params["target_uuid"] = $_GET['target_uuid'];
    if (isset($image['read_only']) && $image['read_only']) {
        $is_in_profile = True;
    }
    if (in_array("dyngroup", $_SESSION["modulesList"])) {
        require_once "../../../modules/dyngroup/includes/xmlrpc.php";
        if (isProfilesEnable()) {
            $machinesInProfile = arePartOfAProfile(array($_GET['target_uuid']));
            if (in_array($_GET['target_uuid'], array_keys($machinesInProfile))) {
                $is_in_profile = True;
            }
        }
    }
    if ($is_in_profile) {
        $addActions[] = $emptyAction;
    } elseif (!isset($image['menu_item'])) {
        $addActions[] = $addAction;
    } else {
        $addActions[] = $delAction;
        $l_params['mi_itemid'] = $image['menu_item']['imaging_uuid'];
    }
    if ($_GET['target_uuid'] == $image['mastered_on_target_uuid']) {
        $editActions[] = $editAction;
示例#2
0
    print "<table><tr><td>";
    print _T('Click on "Force Generation" if you want to force the update of the boot menu', 'imaging');
    print "</td><td>";
    $f = new ValidatingForm();
    $f->addButton("bsync", _T("Force Generation", "imaging"));
    $f->display();
    print "</td></tr></table>";
} else {
    print "<table><tr><td>";
    print _T('This target\'s boot menu is up-to-date.', 'imaging');
    print "</td></tr></table>";
}
if ($CUSTOM_MENU == 1) {
    /* This is a machine custom menu, so we propose to restore default location
     * menu */
    print "<table><tr><td>";
    printf(_T('This computer has a <u>custom boot menu</u>. <a href="%s">Click here</a> to get back the default one.', 'imaging'), $_SERVER['REQUEST_URI'] . '&reset_defaultMenu=1');
    print "</td></tr></table>";
}
if ($IN_GROUP == 1) {
    /* This machine is in an imaging group, so we propose to leave the group */
    $params = getParams();
    $uuid = $params['uuid'];
    if (count($group = arePartOfAProfile(array($uuid)))) {
        $groupname = $group[$uuid]['groupname'];
        $groupid = $group[$uuid]['groupid'];
        print "<table><tr><td>";
        printf(_T('This computer is currently member of "%s". <a href="%s">Click here</a> to leave the group and customize the boot menu.', 'imaging'), $groupname, $_SERVER['REQUEST_URI'] . '&leave_group=1&group_uuid=' . $groupid);
        print "</td></tr></table>";
    }
}
示例#3
0
function drawGroupList($machines, $members, $listOfMembers, $visibility, $diff, $gid, $name, $filter = '', $type = 0)
{
    if ($type == 0) {
        $label_name = _T('Group name', 'dyngroup');
        $label_visible = _T('Make favourite', 'dyngroup');
        $label_members = _T("Group members", "dyngroup");
    } else {
        $label_name = _T('Group name', 'dyngroup');
        // Imaging group
        $label_visible = _T('Make favourite', 'dyngroup');
        $label_members = _T("Group members", "dyngroup");
    }
    $willBeUnregistered = array();
    if ($type == 1) {
        $listOfMembersUuids = array_keys($listOfMembers);
        foreach ($listOfMembersUuids as $target_uuid) {
            $ret = xmlrpc_canIRegisterThisComputer($target_uuid);
            if (!$ret[0]) {
                $willBeUnregistered[] = $target_uuid;
            } elseif ($ret[0] && isset($ret[1]) && $ret[1] != False) {
                $willBeUnregistered[] = $target_uuid;
            }
        }
    }
    $currentGroup = getPGobject($gid, true);
    if ($type == 1) {
        // Check if machines who are displayed are part of an existing profile
        $machinesInProfile = arePartOfAProfile(array_keys($listOfMembers));
        // If we edit an imaging group, exclude machines of current group. else they
        // will be reported as machines in imaging group
        $computersgroupedit = 0;
        if (isset($_GET['action']) && $_GET['action'] == 'computersgroupedit') {
            $computersgroupedit = 1;
            $i = 0;
            foreach ($machinesInProfile as $uuid => $group) {
                if ($group['groupname'] == $currentGroup->name) {
                    unset($machinesInProfile[$uuid]);
                    unset($willBeUnregistered[array_search($uuid, $willBeUnregistered)]);
                }
                $i++;
            }
        }
    }
    ?>

<form action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
" method="post">
<table style="border: none;" cellspacing="0">
<tr><td><?php 
    echo $label_name;
    ?>
</td><td></td><td><input name="name" value="<?php 
    echo $name;
    ?>
" type="text"/></td></tr>
<tr><td><?php 
    echo $label_visible;
    ?>
</td><td></td><td>
    <input name='visible' value='show' <?php 
    if ($visibility == 'show') {
        echo 'checked';
    }
    ?>
 type='radio'/><?php 
    echo _T('Yes', 'dyngroup');
    ?>
 
    <input name='visible' value='hide' <?php 
    if ($visibility != 'show') {
        echo 'checked';
    }
    ?>
 type='radio'/><?php 
    echo _T('No', 'dyngroup');
    ?>
</td></tr>
<!-- add all group inupts -->
</table>

<div id="grouplist">
<table style="border: none;" cellspacing="0">
<tr>
 <td style="border: none;">
  <div class="list">
    <h3><?php 
    echo _T("All machines", "dyngroup");
    ?>
</h3>
    <input name='filter' type='text' value='<?php 
    echo $filter;
    ?>
'/>
    <input type="image" name="bfiltmachine" style="padding: 5px;" src="img/common/icn_show.gif" value = "-->"/>
    <br/><br/>
    <select multiple size="13" class="list" name="machines[]">
    <?php 
    foreach ($diff as $idx => $machine) {
        if ($machine == "") {
            unset($machines[$idx]);
            continue;
        }
        echo "<option value=\"" . $idx . "\">" . $machine . "</option>\n";
    }
    ?>
    </select>
    <br/>
  </div>
 </td>
 <td style="border: none;">
  <div>
   <input type="image" name="baddmachine" style="padding: 5px;" src="img/common/icn_arrowright.gif" value = "-->"/><br/>
   <input type="image" name="bdelmachine" style="padding: 5px;" src="img/common/icn_arrowleft.gif" value="<--" />
  </div>
 </td>
 <td style="border: none;">
  <div class="list" style="padding-left: 10px;">
    <h3><?php 
    echo $label_members;
    ?>
</h3>
    <select multiple size="15" class="list" name="members[]">
    <?php 
    foreach ($members as $idx => $member) {
        $currentUuid = explode('##', $idx);
        $currentUuid = $currentUuid[1];
        if ($member == "") {
            unset($members[$idx]);
            continue;
        }
        $style = '';
        if ($type == 1) {
            // Imaging group
            // Check if machines who are displayed are part of an existing profile
            if (in_array($currentUuid, array_keys($machinesInProfile))) {
                $style = 'background: red; color: white;';
            } elseif (in_array($currentUuid, $willBeUnregistered)) {
                $style = 'background: purple; color: white;';
            }
        }
        echo "<option style=\"" . $style . "\" value=\"" . $idx . "\">" . $member . "</option>\n";
    }
    ?>
    </select>
    <br/>
  </div>
  <div class="clearer"></div>
 </td>
</tr>
</table>
</div>

<?php 
    if ($type == 1) {
        // Imaging group
        $warningMessage = False;
        if (count($machinesInProfile) > 0) {
            $warningMessage = True;
            print '<p>';
            print _T('Computers listed below are already part of another imaging group.', 'dyngroup');
            echo '<ul>';
            foreach ($machinesInProfile as $machineUuid => $group) {
                printf(_T('<li>%s is part of <a href="%s">%s</a></li>'), $listOfMembers[$machineUuid]['hostname'], urlStrRedirect('imaging/manage/display', array('gid' => $group['groupid'], 'groupname' => $group['groupname'])), $group['groupname']);
            }
            echo '</ul>';
            print '</p>';
        }
        $standAloneImagingRegistered = array_diff($willBeUnregistered, array_keys($machinesInProfile));
        if (count($standAloneImagingRegistered) > 0) {
            $warningMessage = True;
            print '<p>';
            print _T('Computers listed below are already stand-alone registered in imaging.', 'dyngroup');
            echo '<ul>';
            foreach ($standAloneImagingRegistered as $machineUuid) {
                printf('<li>%s</li>', $listOfMembers[$machineUuid]['hostname']);
            }
            echo '</ul>';
            print '</p>';
        }
        if ($warningMessage) {
            echo _T('<p>These computers will move to this group and their bootmenus <strong>will be rewritten</strong></p>', 'dyngroup');
            echo '<p>' . _T('All related images to these computers will be <strong>DELETED</strong>', 'dyngroup') . '</p>';
        }
    }
    ?>

<input type="hidden" name="type" value="<?php 
    echo $type;
    ?>
" />
<input type="hidden" name="lmachines" value="<?php 
    echo base64_encode(serialize($machines));
    ?>
" />
<input type="hidden" name="lmembers" value="<?php 
    echo base64_encode(serialize($members));
    ?>
" />
<input type="hidden" name="lsmembers" value="<?php 
    echo base64_encode(serialize($listOfMembers));
    ?>
" />
<input type="hidden" name="willBeUnregistered" value="<?php 
    echo base64_encode(serialize($willBeUnregistered));
    ?>
" />
<input type="hidden" name="computersgroupedit" value="<?php 
    echo $computersgroupedit;
    ?>
" />
<input type="hidden" name="id" value="<?php 
    echo $gid;
    ?>
" />
<input type="submit" name="bconfirm" class="btnPrimary" value="<?php 
    echo _("Confirm");
    ?>
" />
<input type="submit" name="breset" class="btnSecondary" value="<?php 
    echo _("Cancel");
    ?>
" />
</form>

<style type="text/css">
<!--
#grouplist
{
        color: #666;
        background-color: #F0F4F7;
        border: solid 1px #CCC;
        padding: 10px 5px 5px 10px;
        margin: 0 5px 20px 0;
        width: 632px;
}

#grouplist div.list
{
        float: left;
}

select.list
{
        width: 250px;
}
-->
</style>

<?php 
}