mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Added a new paged list module.
This commit is contained in:
parent
4c0ec16bdc
commit
9b0a8eb970
12
modules/paged_list/SCsub
Normal file
12
modules/paged_list/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/paged_list/detect.py
Normal file
27
modules/paged_list/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
|
45
modules/paged_list/paged_list.cpp
Normal file
45
modules/paged_list/paged_list.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "paged_list.h"
|
||||
|
||||
#include "core/http/request.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#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;
|
||||
}
|
26
modules/paged_list/paged_list.h
Normal file
26
modules/paged_list/paged_list.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef PAGED_LIST_H
|
||||
#define PAGED_LIST_H
|
||||
|
||||
#include "core/object.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#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
|
Loading…
Reference in New Issue
Block a user