new NotifyWidgetFailure(_T("Failed to delete files", "pkgs")); } header("Location: " . urlStrRedirect("pkgs/pkgs/edit", array('p_api' => $_GET['p_api'], 'pid' => $_GET['pid']))); } if (count($package) == 0) { $title = _T("Edit a package", "pkgs"); $activeItem = "index"; # get existing package $pid = base64_decode($_GET['pid']); $package = getPackageDetail($p_api_id, $pid); if ($package['do_reboot']) { $package['reboot'] = $package['do_reboot']; } $formElt = new HiddenTpl("id"); $selectpapi = new HiddenTpl('p_api'); $p_api_number = count(getUserPackageApi()); } else { $formElt = new HiddenTpl("id"); $selectpapi = new HiddenTpl('p_api'); } /* * Page form */ // display an edit package form (description, version, ...) $f = new ValidatingForm(); $f->push(new Table()); $p_api_id = $_GET['p_api'] ? base64_decode($_GET['p_api']) : base64_decode($_POST['p_api']); $selectpapi = new HiddenTpl('p_api'); if ($p_api_number > 1) { $f->add(new TrFormElement(_T("Package API", "pkgs"), $selectpapi), array("value" => $p_api_id, "hide" => $hide)); } else {
header("Location: " . urlStrRedirect("pkgs/pkgs/index", array('location' => base64_encode($p_api_id)))); exit; } else { $reason = ''; if (count($ret) > 1) { $reason = sprintf(" : <br/>%s", $ret[1]); } new NotifyWidgetFailure(sprintf(_T("Failed to associate files%s", "pkgs"), $reason)); } } else { new NotifyWidgetFailure(_T("Failed to associate files", "pkgs")); } } } else { // Get number of PackageApi $res = getUserPackageApi(); // set first Package Api found as default Package API $p_api_id = $res[0]['uuid']; $list_val = $list = array(); if (!isset($_SESSION['PACKAGEAPI'])) { $_SESSION['PACKAGEAPI'] = array(); } foreach ($res as $mirror) { $list_val[$mirror['uuid']] = $mirror['uuid']; $list[$mirror['uuid']] = $mirror['mountpoint']; $_SESSION['PACKAGEAPI'][$mirror['uuid']] = $mirror; } $span = new SpanElement(_T("Choose package source", "pkgs"), "pkgs-title"); $selectpapi = new SelectItem('p_api'); $selectpapi->setElements($list); $selectpapi->setElementsVal($list_val);
} } // ================================================================================== // Add or Edit if (!empty($_GET['p_api'])) { $p = new PageGenerator(_T("Edit bundle", "pkgs")); } else { $p = new PageGenerator(_T("Add bundle", "pkgs")); } $p->setSideMenu($sidemenu); $p->display(); // display an edit config form $f = new ValidatingForm(); $f->push(new Table()); // Package API $papis = getUserPackageApi(); $papis_by_uuid = array(); $list_val = $list = array(); if (!isset($_SESSION['PACKAGEAPI'])) { $_SESSION['PACKAGEAPI'] = array(); } foreach ($papis as $mirror) { $list_val[$mirror['uuid']] = $mirror['uuid']; $list[$mirror['uuid']] = $mirror['mountpoint']; $_SESSION['PACKAGEAPI'][$mirror['uuid']] = $mirror; $papis_by_uuid[$mirror['uuid']] = $mirror; } // Edition mode if (isset($_GET['p_api'], $_GET['pid'])) { $p_api = base64_decode($_GET['p_api']); $pid = base64_decode($_GET['pid']);