Handler: queryOption: Take default sort order param. History: default descending
Šī revīzija ir iekļauta:
vecāks
b9ff4068bd
revīzija
0c66fdf70d
@ -50,7 +50,7 @@ std::string Handler::createPageTitle(std::string title)
|
|||||||
return replacer.parse(this->handlersConfig->page_title_template);
|
return replacer.parse(this->handlersConfig->page_title_template);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryOption Handler::queryOption(const Request &r) const
|
QueryOption Handler::queryOption(const Request &r, SORT_ORDER defaultSort) const
|
||||||
{
|
{
|
||||||
QueryOption result;
|
QueryOption result;
|
||||||
result.includeInvisible = false;
|
result.includeInvisible = false;
|
||||||
@ -71,11 +71,18 @@ QueryOption Handler::queryOption(const Request &r) const
|
|||||||
result.offset = 0;
|
result.offset = 0;
|
||||||
}
|
}
|
||||||
std::string order = r.get("sort");
|
std::string order = r.get("sort");
|
||||||
result.order = ASCENDING;
|
result.order = defaultSort;
|
||||||
|
if(order != "")
|
||||||
|
{
|
||||||
if(order == "1")
|
if(order == "1")
|
||||||
{
|
{
|
||||||
result.order = DESCENDING;
|
result.order = DESCENDING;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.order = ASCENDING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class Handler
|
|||||||
|
|
||||||
// TODO: may not to find a better place for this method
|
// TODO: may not to find a better place for this method
|
||||||
Permissions effectivePermissions(std::string page);
|
Permissions effectivePermissions(std::string page);
|
||||||
QueryOption queryOption(const Request &r) const;
|
QueryOption queryOption(const Request &r, SORT_ORDER defaultSort = ASCENDING) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Handler(HandlerConfig &handlersConfig, Template &templ, Database &db, Session &userSession, UrlProvider &provider,
|
Handler(HandlerConfig &handlersConfig, Template &templ, Database &db, Session &userSession, UrlProvider &provider,
|
||||||
|
@ -25,7 +25,7 @@ SOFTWARE.
|
|||||||
#include "../database/exceptions.h"
|
#include "../database/exceptions.h"
|
||||||
Response HandlerHistory::handleRequest(const Request &r)
|
Response HandlerHistory::handleRequest(const Request &r)
|
||||||
{
|
{
|
||||||
QueryOption qo = queryOption(r);
|
QueryOption qo = queryOption(r, DESCENDING);
|
||||||
std::string page = r.get("page");
|
std::string page = r.get("page");
|
||||||
std::string title;
|
std::string title;
|
||||||
if(page.empty())
|
if(page.empty())
|
||||||
|
Notiek ielāde…
Atsaukties uz šo jaunā problēmā
Block a user