mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-05-06 17:51:36 +02:00
Added a skeleton StaticPage and StaticFolderPage classes and a few notes.
This commit is contained in:
parent
e240034626
commit
10af49898f
12
modules/folder_pages/SCsub
Normal file
12
modules/folder_pages/SCsub
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
Import("env_mod")
|
||||||
|
Import("env")
|
||||||
|
|
||||||
|
env_mod.core_sources = []
|
||||||
|
|
||||||
|
env_mod.add_source_files(env_mod.core_sources, "*.cpp")
|
||||||
|
|
||||||
|
# Build it all as a library
|
||||||
|
lib = env_mod.add_library("paged_list", env_mod.core_sources)
|
||||||
|
env.Prepend(LIBS=[lib])
|
27
modules/folder_pages/detect.py
Normal file
27
modules/folder_pages/detect.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def is_active():
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def get_name():
|
||||||
|
return "paged_list"
|
||||||
|
|
||||||
|
|
||||||
|
def can_build():
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def get_opts():
|
||||||
|
return []
|
||||||
|
|
||||||
|
def get_flags():
|
||||||
|
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def configure(env):
|
||||||
|
pass
|
21
modules/folder_pages/static_folder_page.cpp
Normal file
21
modules/folder_pages/static_folder_page.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "static_folder_page.h"
|
||||||
|
|
||||||
|
#include "core/http/request.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "core/file_cache.h"
|
||||||
|
#include "core/database/database_manager.h"
|
||||||
|
#include "core/html/html_builder.h"
|
||||||
|
|
||||||
|
void StaticFolderPage::handle_request_main(Request *request) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void StaticFolderPage::load() {
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticFolderPage::StaticFolderPage() :
|
||||||
|
WebNode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticFolderPage::~StaticFolderPage() {
|
||||||
|
}
|
34
modules/folder_pages/static_folder_page.h
Normal file
34
modules/folder_pages/static_folder_page.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef STATIC_FOLDER_PAGE_H
|
||||||
|
#define STATIC_FOLDER_PAGE_H
|
||||||
|
|
||||||
|
#include "core/string.h"
|
||||||
|
|
||||||
|
#include "core/http/web_node.h"
|
||||||
|
|
||||||
|
//StaticFolderPage
|
||||||
|
//Just serve files
|
||||||
|
//404 if doesnt exist
|
||||||
|
|
||||||
|
//staticsitefolderpage
|
||||||
|
//index file support per dir
|
||||||
|
//could render md -> if .md -> check if changed -> cache -> file date
|
||||||
|
//could render bbcode -> if .bb
|
||||||
|
|
||||||
|
//static file list
|
||||||
|
//same as StaticFolderPage but can render file list
|
||||||
|
|
||||||
|
class StaticFolderPage : public WebNode {
|
||||||
|
RCPP_OBJECT(StaticFolderPage, WebNode);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void handle_request_main(Request *request);
|
||||||
|
|
||||||
|
void load();
|
||||||
|
|
||||||
|
StaticFolderPage();
|
||||||
|
~StaticFolderPage();
|
||||||
|
|
||||||
|
String folder;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -8,6 +8,10 @@
|
|||||||
#include "modules/list_page/list_page.h"
|
#include "modules/list_page/list_page.h"
|
||||||
#include "modules/paged_article/paged_article.h"
|
#include "modules/paged_article/paged_article.h"
|
||||||
|
|
||||||
|
// inherit from StaticPage
|
||||||
|
// (make the module a dependency)
|
||||||
|
// Add PagedArticle as child -> rout everything to it the same way as now
|
||||||
|
|
||||||
class PagedList : public WebNode {
|
class PagedList : public WebNode {
|
||||||
RCPP_OBJECT(PagedList, WebNode);
|
RCPP_OBJECT(PagedList, WebNode);
|
||||||
|
|
||||||
|
12
modules/static_pages/SCsub
Normal file
12
modules/static_pages/SCsub
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
Import("env_mod")
|
||||||
|
Import("env")
|
||||||
|
|
||||||
|
env_mod.core_sources = []
|
||||||
|
|
||||||
|
env_mod.add_source_files(env_mod.core_sources, "*.cpp")
|
||||||
|
|
||||||
|
# Build it all as a library
|
||||||
|
lib = env_mod.add_library("paged_list", env_mod.core_sources)
|
||||||
|
env.Prepend(LIBS=[lib])
|
27
modules/static_pages/detect.py
Normal file
27
modules/static_pages/detect.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def is_active():
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def get_name():
|
||||||
|
return "paged_list"
|
||||||
|
|
||||||
|
|
||||||
|
def can_build():
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def get_opts():
|
||||||
|
return []
|
||||||
|
|
||||||
|
def get_flags():
|
||||||
|
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def configure(env):
|
||||||
|
pass
|
18
modules/static_pages/static_page.cpp
Normal file
18
modules/static_pages/static_page.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "static_page.h"
|
||||||
|
|
||||||
|
#include "core/http/request.h"
|
||||||
|
#include "core/file_cache.h"
|
||||||
|
#include "core/html/html_builder.h"
|
||||||
|
|
||||||
|
void StaticPage::handle_request_main(Request *request) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void StaticPage::load() {
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticPage::StaticPage() :
|
||||||
|
WebNode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticPage::~StaticPage() {
|
||||||
|
}
|
33
modules/static_pages/static_page.h
Normal file
33
modules/static_pages/static_page.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef STATIC_PAGE_H
|
||||||
|
#define STATIC_PAGE_H
|
||||||
|
|
||||||
|
#include "core/string.h"
|
||||||
|
|
||||||
|
#include "core/http/web_node.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
StaticPage -> string data (serve it)
|
||||||
|
load_md(path) + parse_md(data)
|
||||||
|
load_bbcode(path) + ...
|
||||||
|
load_html(path)
|
||||||
|
load_file(path)
|
||||||
|
|
||||||
|
bool add menu -> handle
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
class StaticPage : public WebNode {
|
||||||
|
RCPP_OBJECT(StaticPage, WebNode);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void handle_request_main(Request *request);
|
||||||
|
|
||||||
|
void load();
|
||||||
|
|
||||||
|
StaticPage();
|
||||||
|
~StaticPage();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user