diff --git a/frontend/module.admin.containers.create.php b/frontend/module.admin.containers.create.php index f4eddc3..2c259cc 100644 --- a/frontend/module.admin.containers.create.php +++ b/frontend/module.admin.containers.create.php @@ -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'])) { $_POST['node'] = $router->uParameters[1]; } +if(!empty($router->uVariables['prefilled_user'])) +{ + $_POST['user'] = $router->uParameters[1]; +} + $result = $database->CachedQuery("SELECT * FROM nodes"); $sNodes = array(); @@ -186,8 +196,7 @@ foreach($result->data as $row) $sUsers[] = array( 'id' => $sUserOption->sId, - 'username' => $sUserOption->sUsername, - 'selected' => (!empty($router->uVariables['prefilled_user']) && $sUserOption->sId == $router->uParameters[1]) + 'username' => $sUserOption->sUsername ); } diff --git a/frontend/rewrite.php b/frontend/rewrite.php index d64be44..d628c9d 100644 --- a/frontend/rewrite.php +++ b/frontend/rewrite.php @@ -129,6 +129,14 @@ try 'auth_error' => "error.access.php", '_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/containers/?$' => array( 'target' => "module.admin.containers.php", diff --git a/frontend/templates/default/admin/user/lookup.tpl b/frontend/templates/default/admin/user/lookup.tpl index b9dd171..ef0cd47 100644 --- a/frontend/templates/default/admin/user/lookup.tpl +++ b/frontend/templates/default/admin/user/lookup.tpl @@ -1,5 +1,6 @@