2021-10-31 23:11:48 +01:00
|
|
|
#ifndef ADMIN_PANEL_H
|
|
|
|
#define ADMIN_PANEL_H
|
|
|
|
|
2022-01-07 16:36:39 +01:00
|
|
|
#include "core/http/web_node.h"
|
2021-10-31 23:11:48 +01:00
|
|
|
|
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;
|
2022-01-07 16:36:39 +01:00
|
|
|
class AdminNode;
|
2021-10-31 23:11:48 +01:00
|
|
|
|
2022-01-07 16:36:39 +01:00
|
|
|
class AdminPanel : public WebNode {
|
|
|
|
RCPP_OBJECT(AdminPanel, WebNode);
|
2021-10-31 23:11:48 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
void handle_request_main(Request *request);
|
2021-11-01 00:39:39 +01:00
|
|
|
|
|
|
|
virtual void render_admin_panel_list(Request *request);
|
2022-01-07 16:36:39 +01:00
|
|
|
virtual void render_controller_panel(Request *request, AdminNode *controller);
|
2021-11-01 00:39:39 +01:00
|
|
|
|
2022-01-07 16:36:39 +01:00
|
|
|
void register_admin_controller(const String §ion, AdminNode *controller);
|
2021-11-01 00:39:39 +01:00
|
|
|
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;
|
2022-01-07 16:36:39 +01:00
|
|
|
AdminNode *controller;
|
2021-11-01 00:39:39 +01:00
|
|
|
};
|
|
|
|
|
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
|