Mercurial > thymian
diff server/web_component.h @ 0:a4671277546c tip
created the repository for the thymian project
| author | ferencd |
|---|---|
| date | Tue, 17 Aug 2021 11:19:54 +0200 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/web_component.h Tue Aug 17 11:19:54 2021 +0200 @@ -0,0 +1,44 @@ +#ifndef WEB_COMPONENT_H +#define WEB_COMPONENT_H + +#include <tnt/httprequest.h> +#include <tnt/httpreply.h> +#include <tnt/mimedb.h> + +#include "template_struct.h" + +static const std::string RECIPES_ROOT = "/recipes/"; +static const std::string path = "/theme/current/"; +static std::map<std::string, std::string> ctg_to_name = { {"0", "Soups"}, {"2", "Side Dishes"}, {"3", "Main Courses"}, {"4", "Sweets"}, {"1", "Appetizers"} }; + +class web_component +{ +public: + + // generic not found page + static const std::string WEB_NOT_FOUND; + + web_component(tnt::HttpRequest& request, tnt::HttpReply& reply, const std::string& sessionId); + virtual ~web_component() = default; + + virtual unsigned send() = 0; + + static tnt::MimeDb mimeDb; + + std::string prepareLangJs(const std::map<std::string, std::map<std::string, std::string> > &translations); + +protected: + + void prepareLanguages(); + + tnt::HttpRequest& mrequest; + tnt::HttpReply& mreply; + + std::string m_sessionId; + std::string m_originatingIp; + + std::vector<template_struct> m_languageStructs; + +}; + +#endif // WEB_COMPONENT_H
