Exemple #1
0
    function create_form($is_image, $image, $target_uuid, $label, $desc) {
        if ($is_image) {
            printf("<h3>"._T("Edition of image", "imaging")." : <em>%s</em></h3>", $label);
        } else {
            printf("<h3>"._T("Edition of master", "imaging")." : <em>%s</em></h3>", $label);
        }

        $f = new ValidatingForm();
        $f->add(new HiddenTpl('target_uuid'),                   array("value" => $target_uuid,                   "hide" => True));
        $f->add(new HiddenTpl("itemlabel"),                     array("value" => $label,                         "hide" => True));
        $f->add(new HiddenTpl('target_uuid'),                   array("value" => $target_uuid,                   "hide" => True));
        $f->push(new Table());
        $f->add(
            new TrFormElement(_T("Label", "imaging"), new InputTpl("image_label")),
            array("value" => $label)
        );
        $f->add(
            new TrFormElement(_T("Description", "imaging"), new InputTpl("image_description")),
            array("value" => $desc)
        );

        $f->pop();
        if (!$is_image) {
            list($a, $post_installs) = xmlrpc_getAllTargetPostInstallScript($target_uuid);
            $f = get_post_install_scripts($f, $image['post_install_scripts'], $post_installs);
        }
        return $f;
    }
Exemple #2
0
    $desc = $master['desc'];
    $p = new PageGenerator(_T("Edit master : ", "imaging") . $label);
    $sidemenu->forceActiveItem("master");
    $p->setSideMenu($sidemenu);
    $p->display();
    $f = new ValidatingForm();
    $f->push(new Table());
    $f->add(new HiddenTpl("itemid"), array("value" => $id, "hide" => True));
    $f->add(new TrFormElement(_T("Label", "imaging"), new InputTpl("image_label")), array("value" => $label));
    $f->add(new TrFormElement(_T("Description", "imaging"), new InputTpl("image_description")), array("value" => $desc));
    $f->pop();
    list($count, $post_installs) = xmlrpc_getAllPostInstallScripts($location);
    if (isset($master['post_install_scripts'])) {
        $f = get_post_install_scripts($f, $master['post_install_scripts'], $post_installs);
    } else {
        $f = get_post_install_scripts($f, array(), $post_installs);
    }
    $f->addButton("bvalid", _T("Validate"));
    $f->display();
} else {
    $item_uuid = $_POST['itemid'];
    $loc_uuid = getCurrentLocation();
    $params = array();
    $params['name'] = $_POST['image_label'];
    $params['desc'] = $_POST['image_description'];
    $params['post_install_script'] = $_POST['post_install'];
    $params['is_master'] = True;
    $p_order = array();
    foreach ($_POST as $post_key => $post_value) {
        if (ereg('order_', $post_key)) {
            $post_key = str_replace("order_", "", $post_key);