Esempio n. 1
0
                $xtpl->form_add_select(_("Swap with") . ':', 'swap_vps', get_vps_swap_list($vps));
                if ($_SESSION["is_admin"]) {
                    $xtpl->form_add_checkbox(_("Swap owner") . ':', 'owner', '1', true);
                }
                $xtpl->form_add_checkbox(_("Swap hostname") . ':', 'hostname', '1', true);
                if ($_SESSION["is_admin"]) {
                    $xtpl->form_add_checkbox(_("Swap IP addresses") . ':', 'ips', '1', true);
                    $xtpl->form_add_checkbox(_("Swap configs") . ':', 'configs', '1', true);
                    $xtpl->form_add_checkbox(_("Swap expirations") . ':', 'expiration', '1', true);
                    $xtpl->form_add_checkbox(_("Swap backup settings") . ':', 'backups', '1', true);
                }
                $xtpl->form_add_checkbox(_("Swap DNS servers") . ':', 'dns', '1', true);
                $xtpl->form_out(_("Go >>"));
            }
            // Backuper
            $xtpl->form_create('?page=adminvps&action=setbackuper&veid=' . $vps->veid, 'post');
            if ($_SESSION["is_admin"]) {
                $xtpl->form_add_checkbox(_("Backup enabled") . ':', 'backup_enabled', '1', $vps->ve["vps_backup_enabled"]);
                $xtpl->form_add_select(_("Export") . ':', 'backup_export', get_nas_export_list(false), $vps->ve["vps_backup_export"]);
                $xtpl->form_add_checkbox(_("Notify owner") . ':', 'notify_owner', '1', true);
            }
            $xtpl->form_add_textarea(_("Exclude files") . ':', 60, 10, "backup_exclude", $vps->ve["vps_backup_exclude"], _("One path per line"));
            $xtpl->table_add_category(_("Backuper"));
            $xtpl->table_add_category(' ');
            $xtpl->form_out(_("Go >>"));
        }
    }
    $xtpl->sbar_out(_("Manage VPS"));
} else {
    $xtpl->perex(_("Access forbidden"), _("You have to log in to be able to access vpsAdmin's functions"));
}
Esempio n. 2
0
function mount_edit_form($target, $m, $default = false)
{
    global $STORAGE_MOUNT_MODES_RO_RW, $STORAGE_MOUNT_TYPES, $xtpl;
    $e_list = get_nas_export_list($default);
    $nodes = list_servers();
    $empty = array("" => "---");
    $xtpl->table_title(_("Edit mount") . " " . $m["dst"]);
    $xtpl->form_create($target . '&id=' . $_GET["id"], 'post');
    $xtpl->form_add_select(_("Export") . ':', 'export_id', $empty + $e_list, $_POST["export_id"] ? $_POST["export_id"] : (int) $m["storage_export_id"]);
    $xtpl->form_add_select(_("VPS") . ':', 'vps_id', get_user_vps_list(), $_POST["vps_id"] ? $_POST["vps_id"] : $m["vps_id"]);
    $xtpl->form_add_select(_("Access mode") . ':', 'access_mode', $STORAGE_MOUNT_MODES_RO_RW, $_POST["mode"] ? $_POST["mode"] : $m["mode"]);
    if ($_SESSION["is_admin"]) {
        $xtpl->form_add_select(_("Source node") . ':', 'source_node_id', $empty + $nodes, $_POST["source_node_id"] ? $_POST["source_node_id"] : $m["server_id"], _("Has no effect if export is selected."));
        $xtpl->form_add_input(_("Source") . ':', 'text', '50', 'src', $_POST["src"] ? $_POST["src"] : $m["src"], _("Path is relative to source node root if specified, otherwise absolute. Has no effect if export is selected."));
    }
    $xtpl->form_add_input(_("Destination") . ':', 'text', '50', 'dst', $_POST["dst"] ? $_POST["dst"] : $m["dst"], _("Path is relative to VPS root,<br>allowed chars: a-Z A-Z 0-9 _ - . /"));
    if ($_SESSION["is_admin"]) {
        $xtpl->form_add_input(_("Mount options") . ':', 'text', '50', 'm_opts', $_POST["m_opts"] ? $_POST["m_opts"] : $m["mount_opts"], '');
        $xtpl->form_add_input(_("Umount options") . ':', 'text', '50', 'u_opts', $_POST["u_opts"] ? $_POST["u_opts"] : $m["umount_opts"], '');
        $xtpl->form_add_select(_("Type") . ':', 'type', $STORAGE_MOUNT_TYPES, $_POST["type"] ? $_POST["type"] : $m["mount_type"]);
    }
    $xtpl->form_add_input(_("Pre-mount command") . ':', 'text', '50', 'cmd_premount', $_POST["cmd_premount"] ? $_POST["cmd_premount"] : $m["cmd_premount"], _("Command that is executed within VPS context <strong>before</strong> mount"));
    $xtpl->form_add_input(_("Post-mount command") . ':', 'text', '50', 'cmd_postmount', $_POST["cmd_postmount"] ? $_POST["cmd_postmount"] : $m["cmd_postmount"], _("Command that is executed within VPS context <strong>after</strong> mount"));
    $xtpl->form_add_input(_("Pre-umount command") . ':', 'text', '50', 'cmd_preumount', $_POST["cmd_preumount"] ? $_POST["cmd_preumount"] : $m["cmd_preumount"], _("Command that is executed within VPS context <strong>before</strong> umount"));
    $xtpl->form_add_input(_("Post-umount command") . ':', 'text', '50', 'cmd_postumount', $_POST["cmd_postumount"] ? $_POST["cmd_postumount"] : $m["cmd_postumount"], _("Command that is executed within VPS context <strong>after</strong> umount"));
    $xtpl->form_add_checkbox(_("Remount on save") . ':', 'remount_immediately', '1', $_POST["type"] ? $_POST["remount_immediately"] : true, "<strong>" . _("Recommended") . "</strong>");
    $xtpl->form_out(_("Save"));
}