Esempio n. 1
0
 function quickDisplay($actions = array(), $params = array())
 {
     $statusTable = getStatusTable();
     $n = null;
     $coh_id = isset($_GET['coh_id']) ? $_GET['coh_id'] : $this->db_coh['id'];
     $params = array_merge($params, array('cmd_id' => $_GET['cmd_id'], 'bundle_id' => quickGet('bundle_id'), 'coh_id' => $coh_id, 'uuid' => quickGet('uuid'), 'from' => 'msc|logs|viewLogs', 'tab' => 'tablogs', 'hostname' => $this->db_coh['host']));
     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));
     $n->first_elt_padding = 0;
     $n->disableFirstColumnActionLink();
     $n->addActionItem(new ActionPopupItem(_T("Start", "msc"), "msctabsplay", "start", "msc", "base", "computers"));
     if ($this->db_coh['current_state'] == 'scheduled') {
         $n->addActionItem(new ActionPopupItem(_T("Stop", "msc"), "msctabsstop", "stop", "msc", "base", "computers"));
     }
     foreach ($actions as $a) {
         $n->addActionItem($a);
     }
     $n->col_width = array("50px", "50px", "50px", "50px", "50px", "50px", "50px", "50px", "50px");
     $n->drawTable(0);
     print "<br/>";
 }
Esempio n. 2
0
function addQuery($Form, $p, $pack, $field = 'Installed+software', $limit = 3, $extracriterion = '', $style = '')
{
    $module = in_array('inventory', $_SESSION['modulesList']) ? 'inventory' : 'glpi';
    $criterion = clean(quickGet('add_param'));
    $auto = new Autocomplete($p[0], 'main.php?module=pkgs&submod=pkgs&action=ajaxAutocompleteSearch', $module, $field, $value = $pack[$p[0]], $limit, $extracriterion);
    $tooltip = _T('Please type 3 characters for suggestion.<br>
            Wildcard is \'%\', %text% matches any string containing \'text\'.<br>
            If unsure, leave Vendor and Version fields blank.', pkgs);
    $Form->add(new TrFormElement($p[1], $auto, array('class' => 'associateinventory', 'style' => $style, 'tooltip' => $tooltip)), array("value" => $pack[$p[0]]));
}
Esempio n. 3
0
 * (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, see <http://www.gnu.org/licenses/>.
 */
require_once "modules/dyngroup/includes/includes.php";
$gid = quickGet('gid');
$group = new Group($gid, true);
$machine = quickGet('hostname');
$uuid = quickGet('objectUUID');
if (quickGet('valid')) {
    $group->delMember(array("{$uuid}" => array("uuid" => $uuid)));
    header("Location: " . urlStrRedirect("base/computers/display", array('gid' => $gid)));
    exit;
}
?>
 <h2><?php 
echo _T("Remove a computer", "dyngroup");
?>
</h2> <?php 
?>

<form action="<?php 
echo urlStr("base/computers/remove_machine", array('gid' => $gid, 'hostname' => $machine, 'objectUUID' => $uuid));
?>
" method="post">
Esempio n. 4
0
 * 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 "localSidebar.php";
require "graph/navbar.inc.php";
require_once "modules/pulse2/includes/utilities.php";
# for quickGet method
require_once "modules/pkgs/includes/xmlrpc.php";
$package = array();
$p_api_id = base64_decode(quickGet('p_api'));
$pid = base64_decode(quickGet('pid'));
$plabel = base64_decode(quickGet('plabel'));
$pversion = base64_decode(quickGet('pversion'));
$mode = quickGet('mode');
$random_dir = base64_decode(quickGet('random_dir'));
$level = 0;
if ($mode == "creation") {
    $level = 1;
}
#if (isset($_POST["bassoc"]) || isset($_POST["bempty"])) {
$cbx = array($random_dir);
#if (!isset($_POST["bempty"])) {
#    /* Get selected directory only if the user don't want to create an
#       empty package */
#    /* FIXME: maybe this cbx stuff is no more needed ? */
#    foreach ($_POST as $post => $v) {
#        if (preg_match("/cbx_/", $post) > 0) {
#            $cbx[] = preg_replace("/cbx_/", "", $post);
#        }
#    }
Esempio n. 5
0
    var name = jQuery(this).attr('name');
    var value = jQuery(this).val();
    var input = jQuery(this);

    // Special case: computername regex
    var cname_regex = /^([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9])$/;
    if (name=='computer_name' && !cname_regex.test(value)) {
        alert('<?php 
print _T('Invalid hostname', 'glpi');
?>
');
        return;
    }

    // Posting ajax request
    jQuery.get('<?php 
echo urlStrRedirect("base/computers/ajaxSetGlpiEditableValue");
?>
&uuid=<?php 
echo quickGet('uuid');
?>
&name='+name+'&value='+value).success(function(){
        var label = jQuery('label.editableField[name="'+name+'"]').first();
        label.html(value).show();
        input.hide();
    });
});


</script>
Esempio n. 6
0
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */
require "modules/base/computers/localSidebar.php";
require "graph/navbar.inc.php";
require_once "modules/dyngroup/includes/includes.php";
$gid = quickGet('gid');
if (!$gid) {
    // TODO !!
    $request = quickGet('request');
    $r = new Request();
    $r->parse($request);
    $result = new Result($r, $group->getBool());
    $result->replyToRequest();
    $result->displayResListInfos();
} else {
    $group = getPGobject($gid, true);
    if (isset($items[$gid])) {
        $item = $items[$gid];
    } else {
        $item = null;
    }
    if ($group->type == 0) {
        __my_header(sprintf(_T("Group '%s' content", "dyngroup"), $group->getName()), $sidemenu, $item, $group);
    } else {
Esempio n. 7
0
            $_params['finished'] = $history;
        }
        list($count, $cmds) = displayLogs($_params);
    } else {
        $_params = array('uuid' => $uuid, 'min' => $start, 'max' => $start + $maxperpage, 'filt' => $filter);
        if ($history == 1 || $history == 0) {
            $_params['finished'] = $history;
        }
        list($count, $cmds) = displayLogs($_params);
        $areCommands = True;
    }
    $action = "viewLogs";
} elseif ($gid) {
    # FIXME: same thing to do on groups
    if ($_GET['cmd_id']) {
        $_params = array('gid' => $gid, 'b_id' => quickGet('bundle_id'), 'cmd_id' => $_GET['cmd_id'], 'min' => $start, 'max' => $start + $maxperpage, 'filt' => $filter);
        if ($history == 1 || $history == 0) {
            $_params['finished'] = $history;
        }
        if (isset($_GET['cbx_state'])) {
            $_params['state'] = $_GET['cbx_state'];
        }
        list($count, $cmds) = displayLogs($_params);
    } else {
        $_params = array('gid' => $gid, 'b_id' => $_GET['bundle_id'], 'min' => $start, 'max' => $start + $maxperpage, 'filt' => $filter);
        if ($history == 1 || $history == 0) {
            $_params['finished'] = $history;
        }
        list($count, $cmds) = displayLogs($_params);
        $areCommands = True;
    }
Esempio n. 8
0
{
        width: 250px;
}
-->
</style>


<?php 
    }
}
/* class */
function format($computer)
{
    return array("hostname" => $computer[1]["cn"][0], "uuid" => $computer[1]["objectUUID"][0]);
}
$id = quickGet('gid');
$group = new Group($id, true);
if (isset($_POST["lpmembers"])) {
    $right = unserialize(base64_decode($_POST["lpmembers"]));
    $machines = unserialize(base64_decode($_POST["lpmachines"]));
}
if (isset($_POST["bdelmachine_x"])) {
    if (isset($_POST["members"])) {
        foreach ($_POST["members"] as $member) {
            $ma = preg_split("/##/", $member);
            unset($right[$member]);
        }
    }
} elseif (isset($_POST["baddmachine_x"])) {
    if (isset($_POST["machines"])) {
        foreach ($_POST["machines"] as $machine) {
Esempio n. 9
0
 * (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, see <http://www.gnu.org/licenses/>.
 */
require_once "modules/pulse2/includes/utilities.php";
# for quickGet method
require_once "modules/dyngroup/includes/dyngroup.php";
$name = quickGet('groupname');
$gid = quickGet('gid');
$location = quickGet('location');
ob_end_clean();
/* The two following lines make the CSV export works for IE 6.x on HTTPS ! */
header("Pragma: ");
header("Cache-Control: ");
header("Content-type: text/txt");
header('Content-Disposition: attachment; filename="' . $name . '.csv"');
function get_first($val)
{
    return $val[0];
}
function get_second($val)
{
    return _T($val[1], "base");
}
function get_values($h, $values)
Esempio n. 10
0
function quickGet1($s)
{
    return quickGet($s, false, false);
}
Esempio n. 11
0
     displayBreadCrumb();
     $coh->quickDisplay(array(), $params);
     //array(new ActionItem(_T("Details", "msc"),"msctabs","detail","msc", "base", "computers")));
     // display the command on host details
     $coh_id = $_GET['coh_id'];
     $ch = new CommandHistory($coh_id);
     $ch->display();
 } elseif (strlen($_GET['cmd_id'])) {
     # Display a specific command for a specific group
     // =========+> HERE DEPLOY ON GROUP
     $params = array('tab' => quickGet('tab'), 'gid' => $_GET['gid']);
     if (isset($_history)) {
         $params['history'] = $_history;
     }
     $bdlink = '';
     if (quickGet('bundle_id')) {
         $params['bundle_id'] = $_GET['bundle_id'];
         // FIXME: the following part (esp. $act) seems to always be overriden by the code below ?!
         $bdl = new Bundle($_GET['bundle_id']);
         displayBreadCrumb();
         $act = $bdl->quickDisplay(array(new ActionItem(_T("Details", "msc"), "viewLogs", "detail", "msc", "msc", "logs")), $params);
         $bdlink = "&bundle_id=" . $_GET['bundle_id'];
     }
     if ($_GET['cmd_id'] == -2) {
         new NotifyWidgetFailure(_T("The group you are working on is empty.", "msc"));
     }
     // display just the selected command
     $cmd = new Command($_GET['cmd_id']);
     displayBreadCrumb();
     $act = $cmd->quickDisplay();
     if ($act) {
Esempio n. 12
0
 * 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, see <http://www.gnu.org/licenses/>.
 */
require_once "modules/dyngroup/includes/xmlrpc.php";
require_once "modules/pulse2/includes/utilities.php";
# for quickGet method
ob_end_clean();
$module = quickGet("modulename");
$criterion = quickGet("criterion");
$search = quickGet("data");
$extracriterion = quickGet("extracriterion");
$field = quickGet("field");
if (!$search) {
    $search = '';
}
$res = array();
if (strlen($search) >= 2) {
    //TODO: the limit should be passed as an argument, moreover it is already partly controlled by 'min keyword length' in autocomplete.php
    if (strlen($extracriterion)) {
        if (in_array('inventory', $_SESSION['modulesList'])) {
            $criterion = $field == 'Qsoftware' ? 'Software/Company:ProductName' : $criterion;
            $res = getPossiblesValuesForCriterionInModuleFuzzyWhere($module, $criterion, $extracriterion, $search);
        } else {
            $res = getPossiblesValuesForCriterionInModuleFuzzyWhere($module, $criterion, $search, $extracriterion);
        }
    } else {
        $res = getPossiblesValuesForCriterionInModuleFuzzy($module, $criterion, $search);
Esempio n. 13
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "modules/dyngroup/includes/xmlrpc.php";
require_once "modules/pulse2/includes/utilities.php";
# for quickGet method
ob_end_clean();
$module = quickGet("modulename");
$criterion = quickGet("criterion");
$search = quickGet("data");
if (!$search) {
    $search = '';
}
$value1 = quickGet("value1");
$res = array();
if (strlen($search) > 2) {
    if (strlen($value1)) {
        $res = getPossiblesValuesForCriterionInModuleFuzzyWhere($module, $criterion, $value1, $search);
    } else {
        $res = getPossiblesValuesForCriterionInModuleFuzzy($module, $criterion, $search);
    }
}
header("Content-type: application/json");
$output = array_combine($res, $res);
print json_encode($output);
return;
print '<ul>';
foreach ($res as $items) {
    ?>
Esempio n. 14
0
        }
    }
    return;
} else {
    /* Form displaying */
    $from = quickGet('from');
    $hostname = quickGet("hostname");
    $groupname = quickGet("groupname");
    $uuid = quickGet("uuid");
    $cmd_id = quickGet("cmd_id");
    $coh_id = quickGet("coh_id");
    $gid = quickGet("gid");
    $bundle_id = quickGet('bundle_id');
    $cmd = command_detail($cmd_id);
    $name = $cmd['title'];
    if (!$name && quickGet('title')) {
        $name = $_GET['title'];
    }
    $action_type = _T('action', 'msc');
    if (strlen($bundle_id)) {
        $action_type = _T('bundle', 'msc');
    }
    if (strlen($gid) && !strlen($coh_id)) {
        $title = sprintf(_T("Start %s %s on this group", 'msc'), $action_type, $name);
    } else {
        $title = sprintf(_T("Start %s %s on host %s", 'msc'), $action_type, $name, $hostname);
    }
    $f = new PopupForm($title, 'startPopupForm');
    $f->add(new HiddenTpl("name"), array("value" => $hostname, "hide" => True));
    $f->add(new HiddenTpl("from"), array("value" => $from, "hide" => True));
    $f->add(new HiddenTpl("cmd_id"), array("value" => $cmd_id, "hide" => True));
Esempio n. 15
0
function idGet()
{
    return quickGet('id');
}
Esempio n. 16
0
                }
                print "<select name='value'>";
                print "<option name='True' value='True'>" . _T("Yes", "dyngroup") . "</option>";
                print "<option name='False' value='False'>" . _T("No", "dyngroup") . "</option>";
                print "</select>";
                print "<input class='btnPrimary' value='" . _T("Add", "dyngroup") . "' name='Add' type='submit'/>";
                break;
            case 'true':
                print "<input type='hidden' value='True' name='value'/><input type='text' readonly value='" . _T("Yes", "dyngroup") . "'/>";
                print "<input class='btnPrimary' value='" . _T("Add", "dyngroup") . "' name='Add' type='submit'/>";
                break;
        }
    }
    print "</td><td>";
    print "<input type='hidden' name='req' value='" . quickGet('req') . "'/>";
    print "<input type='hidden' name='param' value='" . quickGet('add_param') . "'/>";
    print "<input type='hidden' name='request' value='" . $request->toURL() . "'/>";
    print "<input type='hidden' name='id' value='{$id}'/>";
    print "</td></tr>";
    print "</table></form>";
}
// display the request in detail
if (!$request->isEmpty()) {
    print "<hr/>";
    print "<h3>" . _T("The request is : ", "dyngroup") . "</h3>";
    if ($edition) {
        $request->displayReqListInfos(true, array('id' => $id, 'gid' => $id, 'target' => $target, 'target_edit' => 'computersgroupsubedit', 'target_del' => 'computersgroupsubdel', 'request' => $request->toS()));
    } else {
        $request->displayReqListInfos(true, array('id' => $id, 'gid' => $id, 'target' => $target, 'target_edit' => 'computersgroupcreatesubedit', 'target_del' => 'computersgroupcreatesubdel', 'request' => $request->toS(), 'tab' => 'tabdyn'));
    }
}
Esempio n. 17
0
    $request = $group->getRequest();
}
if (!$request) {
    exit(0);
}
$save_type = quickGet('save_type', true);
if (!$save_type && $group) {
    $save_type = $group->isRequest() ? 1 : 2;
}
$name = quickGet('name', true, False);
$visible = quickGet('visible', true);
# TODO check all this!
if (!$visible && $group) {
    $visible = $group->show;
}
$bool = quickGet('equ_bool', true);
if (!$bool && $group) {
    if (isset($_POST['checkBool']) || isset($_POST['btnPrimary'])) {
        $bool = '';
    } else {
        $bool = $group->getBool();
    }
}
$r = new Request();
$r->parse($request);
$check = checkBoolEquation($bool, $r, isset($_POST['checkBool']));
if ($check && isset($_POST['displayTmp'])) {
    $_SESSION['request'] = $r->toS();
    header("Location: " . urlStrRedirect("base/computers/tmpdisplay", array('id' => $id, 'request' => 'stored_in_session', 'is_group' => $is_group, 'equ_bool' => $bool, 'name' => urlencode($name), 'save_type' => $save_type, 'visible' => $visible, 'imaging_server' => $imaging_server)));
    exit;
}
Esempio n. 18
0
 * 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, see <http://www.gnu.org/licenses/>.
 */
require_once "modules/pulse2/includes/utilities.php";
# for quickGet method
require "modules/dyngroup/includes/groups.inc.php";
$name = quickGet('name', $p_first = True, $urldecode = False);
$id = quickGet('id');
$visibility = quickGet('visible');
$already_exists = false;
$type = $_GET['type'];
$imaging_server = quickGet('imaging_server');
if ($id) {
    $group = getPGobject($id, true);
    $type = $group->type;
    if (!$name) {
        $name = $group->getName();
    }
    if (!$visibility) {
        $visibility = $group->canShow();
    }
    if ($type == 1) {
        $imaging_server = $group->getImagingServer();
    }
    $already_exists = true;
} else {
    if ($type == 0) {
Esempio n. 19
0
 * 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, see <http://www.gnu.org/licenses/>.
 */
require_once "modules/pulse2/includes/utilities.php";
# for quickGet method
require "modules/dyngroup/includes/groups.inc.php";
require_once "modules/dyngroup/includes/querymanager_xmlrpc.php";
$groupname = quickGet('groupname');
$visibility = quickGet('visible');
if (!isset($visibility) || $visibility == '') {
    $visibility = 'hidden';
}
$elementare = quickGet('elementare');
# check group name
if (isset($groupname) && $groupname != '' && !xmlrpc_group_name_exists($groupname)) {
    $group = new Group();
    $group->create($groupname, $visibility == 'visible');
    $content = file($_FILES['importfile']['tmp_name']);
    $content = array_map('chop', $content);
    $group->importMembers($elementare, $content);
    new NotifyWidgetSuccess(_T("Group successfully created", "dyngroup"));
    header("Location: " . urlStrRedirect("base/computers/display", array('gid' => $group->id)));
    exit;
} elseif (xmlrpc_group_name_exists($groupname)) {
    new NotifyWidgetFailure(sprintf(_T("A group already exists with name '%s'", "dyngroup"), $groupname));
}
$f = new ValidatingForm(array('enctype' => "multipart/form-data"));
$f->push(new Table());