WebUI: Implement limit/offset.

This commit is contained in:
Vladimir Golovnev (Glassez)
2014-11-25 09:27:22 +03:00
parent 59ff08c107
commit e279dcf904
3 changed files with 26 additions and 4 deletions

View File

@@ -186,12 +186,20 @@ void RequestHandler::action_public_images()
printFile(path);
}
// GET params:
// - filter (string): all, downloading, completed, paused, active, inactive
// - label (string): torrent label for filtering by it (empty string means "unlabeled"; no "label" param presented means "any label")
// - sort (string): name of column for sorting by its value
// - reverse (bool): enable reverse sorting
// - limit (int): set limit number of torrents returned (if greater than 0, otherwise - unlimited)
// - offset (int): set offset (if less than 0 - offset from end)
void RequestHandler::action_json_torrents()
{
const QStringMap& gets = request().gets;
print(btjson::getTorrents(
gets["filter"], gets["label"], gets["sort"], gets["reverse"] == "true"
gets["filter"], gets["label"], gets["sort"], gets["reverse"] == "true",
gets["limit"].toInt(), gets["offset"].toInt()
), CONTENT_TYPE_JS);
}