From c01f7bf989dedcc61e4e812fd57d6d73997cfd85 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Fri, 14 Sep 2007 14:07:30 +0000 Subject: added subnets of CHILD_SAs to xml interface a first design of Managers IKE_SA list page --- src/manager/controller/gateway_controller.c | 40 +++++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'src/manager/controller/gateway_controller.c') diff --git a/src/manager/controller/gateway_controller.c b/src/manager/controller/gateway_controller.c index 32576216e..1ebb51192 100644 --- a/src/manager/controller/gateway_controller.c +++ b/src/manager/controller/gateway_controller.c @@ -72,6 +72,7 @@ static void list(private_gateway_controller_t *this, } enumerator->destroy(enumerator); t->set(t, "action", "select"); + t->set(t, "title", "Choose gateway"); t->render(t, response); t->destroy(t); } @@ -90,16 +91,7 @@ static void _select(private_gateway_controller_t *this, return; } } - response->printf(response, "selecting dings failed: %s", id); -} - -/** - * redirect to authentication login - */ -static void login(private_gateway_controller_t *this, - request_t *request, response_t *response) -{ - response->redirect(response, "auth/login"); + response->printf(response, "selecting gateway failed: %s", id); } /** @@ -111,16 +103,30 @@ static char* get_name(private_gateway_controller_t *this) } /** - * Implementation of controller_t.get_handler + * Implementation of controller_t.handle */ -static controller_handler_t get_handler(private_gateway_controller_t *this, char *name) +static void handle(private_gateway_controller_t *this, + request_t *request, response_t *response, char *action) { - if (!this->manager->logged_in(this->manager)) return (controller_handler_t)login; - if (streq(name, "list")) return (controller_handler_t)list; - if (streq(name, "select")) return (controller_handler_t)_select; - return NULL; + if (!this->manager->logged_in(this->manager)) + { + return response->redirect(response, "auth/login"); + } + if (action) + { + if (streq(action, "list")) + { + return list(this, request, response); + } + else if (streq(action, "select")) + { + return _select(this, request, response); + } + } + response->redirect(response, "gateway/list"); } + /** * Implementation of controller_t.destroy */ @@ -137,7 +143,7 @@ controller_t *gateway_controller_create(context_t *context, void *param) private_gateway_controller_t *this = malloc_thing(private_gateway_controller_t); this->public.controller.get_name = (char*(*)(controller_t*))get_name; - this->public.controller.get_handler = (controller_handler_t(*)(controller_t*,char*))get_handler; + this->public.controller.handle = (void(*)(controller_t*,request_t*,response_t*,char*,char*,char*,char*,char*))handle; this->public.controller.destroy = (void(*)(controller_t*))destroy; this->manager = (manager_t*)context; -- cgit v1.2.3