aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-03-13 10:45:24 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2024-03-13 13:09:27 +0300
commita03a2b613f5d36de5617c50e76cced95fda188ac (patch)
tree1cf01f2c16d64f0052dc1fab99490ef1b334a96b
parent962c725f9fba6b7b4803f31dbcd497169b237f57 (diff)
Add search-description configuration option
-rw-r--r--etc/brep-module.conf7
-rw-r--r--etc/private/install/brep-module.conf7
-rw-r--r--mod/mod-packages.cxx10
-rw-r--r--mod/module.cli8
-rw-r--r--mod/types-parsers.cxx4
5 files changed, 34 insertions, 2 deletions
diff --git a/etc/brep-module.conf b/etc/brep-module.conf
index 654c260..d5a5e78 100644
--- a/etc/brep-module.conf
+++ b/etc/brep-module.conf
@@ -14,6 +14,13 @@
# search-title Packages
+# Package search page description. If specified, it is displayed before the
+# search form on the first page only. The value is treated as an XHTML5
+# fragment.
+#
+# search-description ""
+
+
# Web page logo. It is displayed in the page header aligned to the left edge.
# The value is treated as an XHTML5 fragment.
#
diff --git a/etc/private/install/brep-module.conf b/etc/private/install/brep-module.conf
index 01bba63..bfaa8f6 100644
--- a/etc/private/install/brep-module.conf
+++ b/etc/private/install/brep-module.conf
@@ -14,6 +14,13 @@
# search-title Packages
+# Package search page description. If specified, it is displayed before the
+# search form on the first page only. The value is treated as an XHTML5
+# fragment.
+#
+# search-description ""
+
+
# Web page logo. It is displayed in the page header aligned to the left edge.
# The value is treated as an XHTML5 fragment.
#
diff --git a/mod/mod-packages.cxx b/mod/mod-packages.cxx
index cee3806..914a841 100644
--- a/mod/mod-packages.cxx
+++ b/mod/mod-packages.cxx
@@ -136,6 +136,16 @@ handle (request& rq, response& rs)
<< DIV_HEADER (options_->logo (), options_->menu (), root, tenant)
<< DIV(ID="content");
+ // On the first page print the search page description, if specified.
+ //
+ if (page == 0)
+ {
+ const web::xhtml::fragment& desc (options_->search_description ());
+
+ if (!desc.empty ())
+ s << DIV(ID="search-description") << desc << ~DIV;
+ }
+
// If the tenant is empty then we are in the global view and will display
// packages from all the public tenants.
//
diff --git a/mod/module.cli b/mod/module.cli
index 552a60b..ec86b7b 100644
--- a/mod/module.cli
+++ b/mod/module.cli
@@ -494,6 +494,14 @@ namespace brep
"Package search page title. It is placed inside XHTML5 <title>
element."
}
+
+ web::xhtml::fragment search-description
+ {
+ "<xhtml>",
+ "Package search page description. If specified, it is displayed
+ before the search form on the first page only. The value is
+ treated as an XHTML5 fragment."
+ }
};
class package_details: package, search, package_db, page, handler
diff --git a/mod/types-parsers.cxx b/mod/types-parsers.cxx
index 60d70d7..f135608 100644
--- a/mod/types-parsers.cxx
+++ b/mod/types-parsers.cxx
@@ -204,9 +204,9 @@ namespace brep
{
x = fragment (v, o);
}
- catch (const xml::parsing&)
+ catch (const xml::parsing& e)
{
- throw invalid_value (o, v);
+ throw invalid_value (o, v, e.what ());
}
}