From 1c1416934bdba4beef5024650cc2748c45e5eba4 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 3 Apr 2022 11:13:01 +0200 Subject: [PATCH] UrlProvider: Add Links to specify rendertype in allpages / category view --- config.cpp | 2 ++ config.h | 2 ++ urlprovider.cpp | 15 +++++++++++++++ urlprovider.h | 6 ++++-- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/config.cpp b/config.cpp index 46172ea..898c789 100644 --- a/config.cpp +++ b/config.cpp @@ -78,7 +78,9 @@ Config::Config(const std::map &map) this->templatepath = required("templatepath"); this->urls.linkallcats = required("linkallcats"); this->urls.linkallpages = required("linkallpages"); + this->urls.linkallpagesrendertype = required ("linkallpagesrendertype"); this->urls.linkcategory = required("linkcategory"); + this->urls.linkcategoryrendertype = required("linkcategoryrendertype"); this->urls.linkdelete = required("linkdelete"); this->urls.linkedit = required("linkedit"); this->urls.linkhistory = required("linkhistory"); diff --git a/config.h b/config.h index 1558ae7..6392d37 100644 --- a/config.h +++ b/config.h @@ -23,6 +23,7 @@ struct ConfigUrls std::string linkindex; std::string linkrecent; std::string linkallpages; + std::string linkallpagesrendertype; std::string linkallcats; std::string linkshere; std::string linkpage; @@ -34,6 +35,7 @@ struct ConfigUrls std::string linkdelete; std::string linklogout; std::string linkcategory; + std::string linkcategoryrendertype; std::string loginurl; std::string linkrecentsort; std::string actionurl; diff --git a/urlprovider.cpp b/urlprovider.cpp index dde1dcf..7d45c79 100644 --- a/urlprovider.cpp +++ b/urlprovider.cpp @@ -53,6 +53,11 @@ std::string UrlProvider::allPages() return config->linkallpages; } +std::string UrlProvider::allPages(std::string rendertype) +{ + return replaceSingleVar(config->linkallpagesrendertype, "type", rendertype); +} + std::string UrlProvider::allCats() { return config->linkallcats; @@ -121,6 +126,16 @@ std::string UrlProvider::category(std::string catname) { return replaceSingleVar(config->linkcategory, "category", catname); } + +std::string UrlProvider::category(std::string catname, std::string rendertype) +{ + Varreplacer replace("{"); + replace.addKeyValue("category", catname); + replace.addKeyValue("type", rendertype); + return replace.parse(config->linkcategoryrendertype); +} + + std::string UrlProvider::login(std::string page) { return replaceOnlyPage(config->loginurl, page); diff --git a/urlprovider.h b/urlprovider.h index 49a6e9a..f2e46f0 100644 --- a/urlprovider.h +++ b/urlprovider.h @@ -22,7 +22,8 @@ class UrlProvider std::string recentSorted(unsigned int limit, unsigned int offset, unsigned int sort); std::string allPages(); - + std::string allPages(std::string rendertype); + std::string allCats(); std::string page(std::string pagename); @@ -48,7 +49,8 @@ class UrlProvider std::string refreshSession(); std::string category(std::string catname); - + std::string category(std::string catname, std::string rendertype); + std::string login(std::string page); std::string rootUrl();