Add 'create VPS' option to the user lookup page

feature/node-rewrite
Sven Slootweg 12 years ago
parent 99b204c8ae
commit c53bf78cae

@ -142,11 +142,21 @@ if(isset($_POST['submit']))
} }
} }
/* This is a bit hacky - there's no better method for this yet. If the node or user has to be
* pre-determined (according to the requested URL), it is stored in the relevant POST variable
* so that the templater will think it was an already selected option, thereby causing the
* desired behaviour: pre-selecting the particular option. */
if(!empty($router->uVariables['prefilled_node'])) if(!empty($router->uVariables['prefilled_node']))
{ {
$_POST['node'] = $router->uParameters[1]; $_POST['node'] = $router->uParameters[1];
} }
if(!empty($router->uVariables['prefilled_user']))
{
$_POST['user'] = $router->uParameters[1];
}
$result = $database->CachedQuery("SELECT * FROM nodes"); $result = $database->CachedQuery("SELECT * FROM nodes");
$sNodes = array(); $sNodes = array();
@ -186,8 +196,7 @@ foreach($result->data as $row)
$sUsers[] = array( $sUsers[] = array(
'id' => $sUserOption->sId, 'id' => $sUserOption->sId,
'username' => $sUserOption->sUsername, 'username' => $sUserOption->sUsername
'selected' => (!empty($router->uVariables['prefilled_user']) && $sUserOption->sId == $router->uParameters[1])
); );
} }

@ -129,6 +129,14 @@ try
'auth_error' => "error.access.php", 'auth_error' => "error.access.php",
'_menu' => "admin" '_menu' => "admin"
), ),
/* Admin - Users - Create VPS */
'^/admin/user/([0-9]+)/add/?$' => array(
'target' => "module.admin.containers.create.php",
'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php",
'_menu' => "admin",
'_prefilled_user' => true
),
/* Admin - VPSes - Overview */ /* Admin - VPSes - Overview */
'^/admin/containers/?$' => array( '^/admin/containers/?$' => array(
'target' => "module.admin.containers.php", 'target' => "module.admin.containers.php",

@ -1,5 +1,6 @@
<div class="toolbar"> <div class="toolbar">
<a href="/admin/user/{%?id}/add/">{%!toolbar-edituser}</a> <a href="/admin/user/{%?id}/add/">{%!toolbar-createvps}</a>
<a href="/admin/user/{%?id}/edit/">{%!toolbar-edituser}</a>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

Loading…
Cancel
Save