2021-10-31 23:11:48 +01:00
|
|
|
#ifndef ADMIN_PANEL_H
|
|
|
|
#define ADMIN_PANEL_H
|
|
|
|
|
|
|
|
#include "core/http/controller.h"
|
|
|
|
|
2021-11-01 00:39:39 +01:00
|
|
|
#include "core/string.h"
|
|
|
|
#include "core/containers/vector.h"
|
2021-10-31 23:11:48 +01:00
|
|
|
|
|
|
|
class Request;
|
|
|
|
class FormValidator;
|
2021-11-01 00:39:39 +01:00
|
|
|
class AdminController;
|
2021-10-31 23:11:48 +01:00
|
|
|
|
|
|
|
class AdminPanel : public Controller {
|
|
|
|
RCPP_OBJECT(AdminPanel, Controller);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void handle_request_main(Request *request);
|
2021-11-01 00:39:39 +01:00
|
|
|
|
|
|
|
virtual void render_admin_panel_list(Request *request);
|
|
|
|
virtual void render_controller_panel(Request *request, AdminController *controller);
|
|
|
|
|
|
|
|
void register_admin_controller(const String §ion, AdminController *controller);
|
|
|
|
void clear();
|
2021-10-31 23:11:48 +01:00
|
|
|
|
2021-11-14 22:11:35 +01:00
|
|
|
virtual void render_headers(Request *request);
|
2021-11-14 22:25:19 +01:00
|
|
|
virtual void render_main_body_top(Request *request);
|
|
|
|
virtual void render_segment_body_top(Request *request);
|
2021-11-14 22:11:35 +01:00
|
|
|
virtual void render_footer(Request *request);
|
|
|
|
|
|
|
|
void set_default_header(const String &val);
|
2021-11-14 22:25:19 +01:00
|
|
|
void set_default_main_body_top(const String &val);
|
|
|
|
void set_default_segment_body_top(const String &val);
|
2021-11-14 22:11:35 +01:00
|
|
|
void set_default_footer(const String &val);
|
|
|
|
|
2021-10-31 23:11:48 +01:00
|
|
|
static AdminPanel *get_singleton();
|
|
|
|
|
|
|
|
AdminPanel();
|
|
|
|
~AdminPanel();
|
|
|
|
|
|
|
|
protected:
|
2021-11-01 00:39:39 +01:00
|
|
|
struct AdminPanelSection {
|
|
|
|
String section_url;
|
2021-11-01 21:21:03 +01:00
|
|
|
String name;
|
2021-11-01 00:39:39 +01:00
|
|
|
AdminController *controller;
|
|
|
|
};
|
|
|
|
|
2021-10-31 23:11:48 +01:00
|
|
|
static AdminPanel *_self;
|
2021-11-01 00:39:39 +01:00
|
|
|
|
|
|
|
Vector<AdminPanelSection> _controllers;
|
2021-11-14 22:11:35 +01:00
|
|
|
|
|
|
|
String _default_headers;
|
2021-11-14 22:25:19 +01:00
|
|
|
String _default_main_body_top;
|
|
|
|
String _default_segment_body_top;
|
2021-11-14 22:11:35 +01:00
|
|
|
String _default_footer;
|
2021-10-31 23:11:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|