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-details.cxx | |
parent | a31dfac365feef7838b01b1efd3fe058c89484d7 (diff) |
Separate brep module configuration from Apache server configuration
Diffstat (limited to 'brep/package-details.cxx')
-rw-r--r-- | brep/package-details.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/brep/package-details.cxx b/brep/package-details.cxx index 4b99feb..30e185e 100644 --- a/brep/package-details.cxx +++ b/brep/package-details.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_details> ( s, unknown_mode::fail, unknown_mode::fail); + if (options_->root ().empty ()) + options_->root (dir_path ("/")); + db_ = shared_database (options_->db_host (), options_->db_port ()); } @@ -51,7 +55,7 @@ search_params (const brep::string& n, const brep::string& q) ")"; } -void brep::package_details:: +bool brep::package_details:: handle (request& rq, response& rs) { using namespace web; @@ -62,11 +66,8 @@ 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 ()); const string& name (*rq.path ().rbegin ()); const string ename (mime_url_encode (name)); @@ -76,7 +77,7 @@ handle (request& rq, response& rs) try { - param_scanner s (rq.parameters ()); + name_value_scanner s (rq.parameters ()); params = params::package_details ( s, unknown_mode::fail, unknown_mode::fail); @@ -159,7 +160,7 @@ handle (request& rq, response& rs) if (const auto& d = pkg->description) s << (full ? P_DESCRIPTION (*d, id) - : P_DESCRIPTION (*d, options_->description_length (), + : P_DESCRIPTION (*d, options_->description_len (), url (!full, squery, page, id))); s << TABLE(CLASS="proplist", ID="package") @@ -231,9 +232,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 (), url (full, squery)) << ~DIV << ~BODY << ~HTML; + + return true; } |