diff --git a/modules/paged_list/SCsub b/modules/paged_list/SCsub new file mode 100644 index 0000000..e184b7a --- /dev/null +++ b/modules/paged_list/SCsub @@ -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]) diff --git a/modules/paged_list/detect.py b/modules/paged_list/detect.py new file mode 100644 index 0000000..3132192 --- /dev/null +++ b/modules/paged_list/detect.py @@ -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 diff --git a/modules/paged_list/paged_list.cpp b/modules/paged_list/paged_list.cpp new file mode 100644 index 0000000..c3c3472 --- /dev/null +++ b/modules/paged_list/paged_list.cpp @@ -0,0 +1,45 @@ +#include "paged_list.h" + +#include "core/http/request.h" + +#include + +#include "core/file_cache.h" + +#include "core/http/handler_instance.h" + +#include "core/database/database_manager.h" + +#include "core/html/html_builder.h" + +void PagedList::index(Request *request) { + const std::string path = request->get_current_path_segment(); + + if (request->get_remaining_segment_count() == 0) { + main_page->index(request); + return; + } + + articles->index(request); +} + +void PagedList::load() { + main_page->folder = folder; + main_page->load(); + + articles->base_path = base_path; + articles->folder = folder; + articles->load(); +} + +PagedList::PagedList() : + Object() { + + main_page = new ListPage(); + articles = new PagedArticle(); +} + +PagedList::~PagedList() { + delete main_page; + delete articles; +} diff --git a/modules/paged_list/paged_list.h b/modules/paged_list/paged_list.h new file mode 100644 index 0000000..481f54a --- /dev/null +++ b/modules/paged_list/paged_list.h @@ -0,0 +1,26 @@ +#ifndef PAGED_LIST_H +#define PAGED_LIST_H + +#include "core/object.h" + +#include + +#include "modules/list_page/list_page.h" +#include "modules/paged_article/paged_article.h" + +class PagedList : public Object { +public: + void index(Request *request); + + void load(); + + PagedList(); + ~PagedList(); + + ListPage *main_page; + PagedArticle *articles; + std::string folder; + std::string base_path; +}; + +#endif \ No newline at end of file