UrlProvider: Add Links to specify rendertype in allpages / category view

This commit is contained in:
Albert S. 2022-04-03 11:13:01 +02:00
parent 622ef5af6a
commit 1c1416934b
4 changed files with 23 additions and 2 deletions

View File

@ -78,7 +78,9 @@ Config::Config(const std::map<std::string, std::string> &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");

View File

@ -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;

View File

@ -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);

View File

@ -22,6 +22,7 @@ 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();
@ -48,6 +49,7 @@ 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);