summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersearch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersearch.cpp')
-rw-r--r--indra/newview/llfloatersearch.cpp45
1 files changed, 38 insertions, 7 deletions
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index 904263e2c2..4c83530f43 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -40,6 +40,17 @@ LLFloaterSearch::LLFloaterSearch(const LLSD& key) :
LLFloater(key),
mBrowser(NULL)
{
+ // declare a map that transforms a category name into
+ // the URL suffix that is used to search that category
+ mCategoryPaths = LLSD::emptyMap();
+ mCategoryPaths["all"] = "search";
+ mCategoryPaths["people"] = "search/people";
+ mCategoryPaths["places"] = "search/places";
+ mCategoryPaths["events"] = "search/events";
+ mCategoryPaths["groups"] = "search/groups";
+ mCategoryPaths["wiki"] = "search/wiki";
+ mCategoryPaths["destinations"] = "destinations";
+ mCategoryPaths["classifieds"] = "classifieds";
}
BOOL LLFloaterSearch::postBuild()
@@ -79,13 +90,33 @@ void LLFloaterSearch::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent eve
void LLFloaterSearch::search(const LLSD &key)
{
- if (mBrowser)
+ if (! mBrowser)
+ {
+ return;
+ }
+
+ // get the URL for the search page
+ std::string url = getString("search_url");
+ if (! LLStringUtil::endsWith(url, "/"))
{
- std::string query = getString("search_url");
- if (key.has("id"))
- {
- query += std::string("?q=") + key["id"].asString();
- }
- mBrowser->navigateTo(query);
+ url += "/";
}
+
+ // work out the subdir to use based on the requested category
+ std::string category = key.has("category") ? key["category"].asString() : "";
+ if (mCategoryPaths.has(category))
+ {
+ url += mCategoryPaths[category].asString();
+ }
+ else
+ {
+ url += mCategoryPaths["all"].asString();
+ }
+
+ // append the search query string
+ std::string search_text = key.has("id") ? key["id"].asString() : "";
+ url += std::string("?q=") + search_text;
+
+ // and load the URL in the web view
+ mBrowser->navigateTo(url);
}