Handler: queryOption: Take default sort order param. History: default descending
Cette révision appartient à :
Parent
b9ff4068bd
révision
0c66fdf70d
@ -50,7 +50,7 @@ std::string Handler::createPageTitle(std::string title)
|
||||
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;
|
||||
result.includeInvisible = false;
|
||||
@ -71,10 +71,17 @@ QueryOption Handler::queryOption(const Request &r) const
|
||||
result.offset = 0;
|
||||
}
|
||||
std::string order = r.get("sort");
|
||||
result.order = ASCENDING;
|
||||
if(order == "1")
|
||||
result.order = defaultSort;
|
||||
if(order != "")
|
||||
{
|
||||
result.order = DESCENDING;
|
||||
if(order == "1")
|
||||
{
|
||||
result.order = DESCENDING;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.order = ASCENDING;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -21,7 +21,7 @@ class Handler
|
||||
|
||||
// TODO: may not to find a better place for this method
|
||||
Permissions effectivePermissions(std::string page);
|
||||
QueryOption queryOption(const Request &r) const;
|
||||
QueryOption queryOption(const Request &r, SORT_ORDER defaultSort = ASCENDING) const;
|
||||
|
||||
public:
|
||||
Handler(HandlerConfig &handlersConfig, Template &templ, Database &db, Session &userSession, UrlProvider &provider,
|
||||
|
@ -25,7 +25,7 @@ SOFTWARE.
|
||||
#include "../database/exceptions.h"
|
||||
Response HandlerHistory::handleRequest(const Request &r)
|
||||
{
|
||||
QueryOption qo = queryOption(r);
|
||||
QueryOption qo = queryOption(r, DESCENDING);
|
||||
std::string page = r.get("page");
|
||||
std::string title;
|
||||
if(page.empty())
|
||||
|
Chargement…
Référencer dans un nouveau ticket
Block a user