diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 92254b52f9..91840b82fe 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -209,9 +209,9 @@ label_ref="Command_Search_Label" tooltip_ref="Command_Search_Tooltip" execute_function="Floater.Toggle" - execute_parameters="search_legacy" + execute_parameters="search" is_running_function="Floater.IsOpen" - is_running_parameters="search_legacy" + is_running_parameters="search" /> ("panel_ls_events"); FSPanelSearchLand* panel_land = findChild("panel_ls_land"); FSPanelSearchClassifieds* panel_classifieds = findChild("panel_ls_classifieds"); + FSPanelSearchWeb* panel_web = findChild("panel_ls_web"); + Params p(key); panel_people->onSearchPanelOpen(this); panel_groups->onSearchPanelOpen(this); panel_places->onSearchPanelOpen(this); panel_events->onSearchPanelOpen(this); panel_land->onSearchPanelOpen(this); panel_classifieds->onSearchPanelOpen(this); + panel_web->loadURL(p.search); } //virtual @@ -2754,43 +2762,46 @@ FSPanelSearchWeb::FSPanelSearchWeb() // the URL suffix that is used to search that category mCategoryPaths = LLSD::emptyMap(); mCategoryPaths["all"] = "search"; - // We don't use these yet, but someday we will. - //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"; + 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"; } FSPanelSearchWeb::~FSPanelSearchWeb() { } -FSPanelSearchWeb::SearchQuery::SearchQuery() -: category("category", ""), // <- Stupidnesss until we move to full webbrowser replacement -query("query") -{} - BOOL FSPanelSearchWeb::postBuild() { mWebBrowser = getChild("search_browser"); - if (mWebBrowser) - { - mWebBrowser->addObserver(this); - mWebBrowser->navigateTo(loadURL(), "text/html"); - } + if (mWebBrowser) mWebBrowser->addObserver(this); return TRUE; } -std::string FSPanelSearchWeb::loadURL() +void FSPanelSearchWeb::loadURL(const FSFloaterSearch::SearchQuery &p) { + if (! mWebBrowser || !p.validateBlock()) + { + return; + } + + // work out the subdir to use based on the requested category LLSD subs; - subs["CATEGORY"] = mCategoryPaths["all"].asString(); - + if (mCategoryPaths.has(p.category)) + { + subs["CATEGORY"] = mCategoryPaths[p.category].asString(); + } + else + { + subs["CATEGORY"] = mCategoryPaths["all"].asString(); + } + // add the search query string - subs["QUERY"] = ""; + subs["QUERY"] = LLURI::escape(p.query); // add the permissions token that login.cgi gave us // We use "search_token", and fallback to "auth_token" if not present. @@ -2817,7 +2828,13 @@ std::string FSPanelSearchWeb::loadURL() } subs["MATURITY"] = maturity; + // add the user's god status + subs["GODLIKE"] = gAgent.isGodlike() ? "1" : "0"; + + // Get the search URL and expand all of the substitutions + // (also adds things like [LANGUAGE], [VERSION], [OS], etc.) std::string url; + #ifdef OPENSIM std::string debug_url = gSavedSettings.getString("SearchURLDebug"); if (gSavedSettings.getBOOL("DebugSearch") && !debug_url.empty()) @@ -2830,11 +2847,14 @@ std::string FSPanelSearchWeb::loadURL() ? LLLoginInstance::getInstance()->getResponse("search").asString() : gSavedSettings.getString("SearchURLOpenSim"); } - else // we are in SL or SL beta + else #endif // OPENSIM { url = gSavedSettings.getString("SearchURL"); } + url = LLWeb::expandURLSubstitutions(url, subs); - return url; + + // Finally, load the URL in the webpanel + mWebBrowser->navigateTo(url, "text/html"); } diff --git a/indra/newview/fsfloatersearch.h b/indra/newview/fsfloatersearch.h index 68d785eb39..9261b0136d 100644 --- a/indra/newview/fsfloatersearch.h +++ b/indra/newview/fsfloatersearch.h @@ -47,7 +47,22 @@ class FSFloaterSearch { LOG_CLASS(FSFloaterSearch); public: - FSFloaterSearch(const LLSD& key); + struct SearchQuery : public LLInitParam::Block + { + Optional category; + Optional query; + + SearchQuery(); + }; + + struct _Params : public LLInitParam::Block<_Params, LLFloater::Params> + { + Optional search; + }; + + typedef LLSDParamAdapter<_Params> Params; + + FSFloaterSearch(const Params& key); virtual ~FSFloaterSearch(); virtual void onOpen(const LLSD& key); BOOL postBuild(); @@ -324,16 +339,9 @@ class FSPanelSearchWeb : public LLPanel, public LLViewerMediaObserver { LOG_CLASS(FSFloaterSearch); public: - struct SearchQuery : public LLInitParam::Block - { - Optional category; - Optional query; - - SearchQuery(); - }; FSPanelSearchWeb(); /*virtual*/ BOOL postBuild(); - std::string loadURL(); + void loadURL(const FSFloaterSearch::SearchQuery &query); private: ~FSPanelSearchWeb(); diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index cd08007404..ec12f8a327 100644 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -200,7 +200,7 @@ bool LLEventNotifier::add(U32 eventId, F64 eventEpoch, const std::string& eventD } else // This should always be for legacy search. If not, this will need to be refactored! { - FSFloaterSearch* legacy_search = LLFloaterReg::findTypedInstance("search_legacy"); + FSFloaterSearch* legacy_search = LLFloaterReg::findTypedInstance("search"); if (legacy_search) // The floater exists, send the results legacy_search->displayEventDetails(eventId, eventEpoch, eventDateStr, eventName, eventDesc, simName, eventDuration, eventFlags, eventCover, eventGlobalPos); else diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 6d93b0383e..f64583be22 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -339,7 +339,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + // Replacing LL search with Firestorm Search below + //LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); @@ -385,7 +386,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("phototools_camera", "floater_phototools_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("publish_classified_fs", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("quickprefs", "floater_quickprefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("search_legacy", "floater_fs_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("search", "floater_fs_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("search_replace", "floater_search_replace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("secondary_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_recover", "floater_script_recover.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index b762da7e90..8c44c2dfbc 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1704,10 +1704,10 @@ shortcut="control|F"> + parameter="search" /> + parameter="search" />