示例#1
0
/* Get MMC includes */
require "../../../includes/config.inc.php";
require "../../../includes/i18n.inc.php";
require "../../../includes/acl.inc.php";
require "../../../includes/session.inc.php";
require "../../../includes/PageGenerator.php";
require "../includes/includes.php";
require '../includes/xmlrpc.inc.php';
$params = getParams();
$location = $_SESSION['imaging_location']['used'];
global $conf;
$maxperpage = $conf["global"]["maxperpage"];
$start = empty($_GET["start"]) || $_GET["start"] == '' ? 0 : $_GET["start"];
$end = empty($_GET["end"]) || $_GET["end"] == '' ? $maxperpage : $_GET["end"];
$filter = empty($_GET["filter"]) ? '' : $_GET['filter'];
list($count, $scripts) = xmlrpc_getAllPostInstallScripts($location, $start, $end, $filter);
$createAction = new ActionPopupItem(_T("Create Boot Service", "imaging"), "postinstall_create_boot_service", "createbootservice", "image", "imaging", "manage");
$editAction = new ActionItem(_T("Edit script", "imaging"), "postinstall_edit", "edit", "image", "imaging", "manage");
$deleteAction = new ActionPopupItem(_T("Delete", "imaging"), "postinstall_delete", "delete", "image", "imaging", "manage");
$bsCreatedAction = new ActionPopupItem(_T("Boot Service already created", "imaging"), "postinstall_redirect_to_boot_service", "bootserviceexists", "image", "imaging", "manage");
$emptyAction = new EmptyActionItem();
$a_create = array();
$a_edit = array();
$a_delete = array();
$a_label = array();
$a_desc = array();
foreach ($scripts as $script) {
    if ($script['is_local']) {
        // 'is_local' is a duplicated PostInstallScript
        $url = '<img src="modules/imaging/graph/images/postinst-action.png" style="vertical-align: middle" /> ';
        $a_edit[] = $editAction;
示例#2
0
if (count($_POST) == 0) {
    // get current values
    $master = $masters[$id];
    $label = $master['name'];
    $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;