handlers: handlerpageedit: Handle [cmd:parentpage]
This commit is contained in:
parent
0fb0457dbb
commit
daed17848c
@ -79,7 +79,15 @@ Response HandlerPageEdit::handleRequest(PageDao &pageDao, std::string pagename,
|
|||||||
std::string visiblecmd = parser.extractCommand("visible", newContent);
|
std::string visiblecmd = parser.extractCommand("visible", newContent);
|
||||||
std::string rename = parser.extractCommand("rename", newContent);
|
std::string rename = parser.extractCommand("rename", newContent);
|
||||||
std::string customtitle = parser.extractCommand("pagetitle", newContent);
|
std::string customtitle = parser.extractCommand("pagetitle", newContent);
|
||||||
|
std::string parentpage = parser.extractCommand("parentpage", newContent);
|
||||||
std::vector<std::string> perms = parser.extractCommands("permissions", newContent);
|
std::vector<std::string> perms = parser.extractCommands("permissions", newContent);
|
||||||
|
|
||||||
|
if(parentpage != "" && !pageDao.find(parentpage))
|
||||||
|
{
|
||||||
|
return this->errorResponse("Invalid parent",
|
||||||
|
"Specified parent page " + parentpage + " does not exist");
|
||||||
|
}
|
||||||
|
|
||||||
Page page;
|
Page page;
|
||||||
std::optional<Page> currentPage = pageDao.find(pagename);
|
std::optional<Page> currentPage = pageDao.find(pagename);
|
||||||
if(currentPage)
|
if(currentPage)
|
||||||
@ -134,6 +142,7 @@ Response HandlerPageEdit::handleRequest(PageDao &pageDao, std::string pagename,
|
|||||||
page.listed = !(visiblecmd == "0");
|
page.listed = !(visiblecmd == "0");
|
||||||
page.name = pagename;
|
page.name = pagename;
|
||||||
page.title = customtitle;
|
page.title = customtitle;
|
||||||
|
page.parentpage = parentpage;
|
||||||
if(page.title.empty())
|
if(page.title.empty())
|
||||||
{
|
{
|
||||||
page.title = page.name;
|
page.title = page.name;
|
||||||
|
Loading…
Reference in New Issue
Block a user