function export_edit_form($target, $e) { global $xtpl, $NAS_EXPORT_TYPES; $q = nas_quota_to_val_unit($e["export_quota"]); $xtpl->table_title(_("Edit export") . " " . $e["server_name"] . ": " . $e["path"]); $xtpl->form_create($target . '&id=' . $_GET["id"], 'post'); $xtpl->table_td(_("Quota") . ':'); $xtpl->form_add_input_pure('text', '30', 'quota_val', $q[0]); $xtpl->form_add_select_pure('quota_unit', array("m" => "MiB", "g" => "GiB", "t" => "TiB"), $q[1]); $xtpl->table_td(_("0 is none")); $xtpl->table_tr(); if ($_SESSION["is_admin"]) { $xtpl->form_add_checkbox(_("User editable") . ':', 'user_editable', '1', $e["user_editable"]); $xtpl->form_add_select(_("Type") . ':', 'type', $NAS_EXPORT_TYPES, $e["export_type"]); } $xtpl->form_out(_("Save")); }
function nas_size_to_humanreadable($val) { global $NAS_QUOTA_UNITS; if (!$val) { return _("none"); } $res = nas_quota_to_val_unit($val); return round($res[0], 2) . " " . $NAS_QUOTA_UNITS[$res[1]]; }
$xtpl->form_add_textarea(_("Availability icon (if you wish)") . ':', 28, 4, 'server_availstat', $node->s["server_availstat"], _("Paste HTML link here")); switch ($node->s["server_type"]) { case "node": $xtpl->form_add_input(_("Max VPS count") . ':', 'text', '8', 'max_vps', $node->role["max_vps"]); $xtpl->form_add_input(_("Path to VE private") . ':', 'text', '30', 've_private', $node->role["ve_private"], _("%{veid} - VPS ID")); $xtpl->form_add_select(_("FS type") . ':', 'fstype', $NODE_FSTYPES, $node->role["fstype"]); break; default: break; } $xtpl->form_out(_("Save")); switch ($node->s["server_type"]) { case "storage": $xtpl->table_title(_("Export roots")); foreach ($node->storage_roots as $root) { $q = nas_quota_to_val_unit($root["quota"]); $xtpl->table_add_category(''); $xtpl->table_add_category(''); $xtpl->form_create('?page=cluster&action=node_storage_root_save&node_id=' . $node->s["server_id"] . '&root_id=' . $root["id"], 'post'); $xtpl->form_add_input(_("Label") . ':', 'text', '30', 'storage_label', $root["label"]); $xtpl->form_add_input(_("Root dataset") . ':', 'text', '30', 'storage_root_dataset', $root["root_dataset"]); $xtpl->form_add_input(_("Root path") . ':', 'text', '30', 'storage_root_path', $root["root_path"]); $xtpl->form_add_select(_("Storage type") . ':', 'storage_type', $STORAGE_TYPES, $root["storage_layout"]); $xtpl->form_add_checkbox(_("User export") . ':', 'storage_user_export', '1', $root["user_export"], _("Can user manage exports?")); $xtpl->form_add_select(_("User mount") . ':', 'storage_user_mount', $STORAGE_MOUNT_MODES, $root["user_mount"]); $xtpl->table_td(_("Quota") . ':'); $xtpl->form_add_input_pure('text', '30', 'quota_val', $q[0]); $xtpl->form_add_select_pure('quota_unit', $NAS_QUOTA_UNITS, $q[1]); $xtpl->table_tr(); $xtpl->form_add_input(_("Share options") . ':', 'text', '30', 'share_options', $root["share_options"], _("Passed directly to zfs sharenfs")); $xtpl->form_out(_("Save"));