diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-08 13:45:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-14 12:02:13 +0200 |
commit | e28ab8f48c891c03cf4b3a8ed88b98d38a561960 (patch) | |
tree | 0ae1dbb54e497fc797e5a73fcf3dd2dc487a5572 /brep/package-search.cxx | |
parent | a31dfac365feef7838b01b1efd3fe058c89484d7 (diff) |
Separate brep module configuration from Apache server configuration
Diffstat (limited to 'brep/package-search.cxx')
-rw-r--r-- | brep/package-search.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/brep/package-search.cxx b/brep/package-search.cxx index f2f922c..62b162b 100644 --- a/brep/package-search.cxx +++ b/brep/package-search.cxx @@ -14,9 +14,10 @@ #include <web/module> #include <web/mime-url-encoding> -#include <brep/page> #include <brep/types> #include <brep/utility> + +#include <brep/page> #include <brep/options> #include <brep/package> #include <brep/package-odb> @@ -33,6 +34,9 @@ init (scanner& s) options_ = make_shared<options::package_search> ( s, unknown_mode::fail, unknown_mode::fail); + if (options_->root ().empty ()) + options_->root (dir_path ("/")); + db_ = shared_database (options_->db_host (), options_->db_port ()); } @@ -48,7 +52,7 @@ search_param (const brep::string& q) ")"; } -void brep::package_search:: +bool brep::package_search:: handle (request& rq, response& rs) { using namespace web::xhtml; @@ -58,17 +62,14 @@ handle (request& rq, response& rs) // The module options object is not changed after being created once per // server process. // - static const size_t res_page (options_->results_on_page ()); - static const dir_path& root ( - options_->root ().empty () - ? dir_path ("/") - : options_->root ()); + static const size_t res_page (options_->search_results ()); + static const dir_path& root (options_->root ()); params::package_search params; try { - param_scanner s (rq.parameters ()); + name_value_scanner s (rq.parameters ()); params = params::package_search (s, unknown_mode::fail, unknown_mode::fail); } catch (const unknown_argument& e) @@ -137,9 +138,11 @@ handle (request& rq, response& rs) t.commit (); - s << DIV_PAGER (page, pkg_count, res_page, options_->pages_in_pager (), + s << DIV_PAGER (page, pkg_count, res_page, options_->pager_pages (), root.string () + squery_param) << ~DIV << ~BODY << ~HTML; + + return true; } |