Finish up replacing LL web search with Firestorm Search FIRE-8593

Cinders 2013-03-11 18:26:04 -06:00
parent f77c100cc7
commit 0927d82fe5
6 changed files with 70 additions and 41 deletions

View File

@ -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"
/>
<command name="snapshot"
available_in_toybox="true"

View File

@ -268,11 +268,16 @@ public:
}
};
FSFloaterSearch::SearchQuery::SearchQuery()
: category("category", ""),
query("query")
{}
////////////////////////////////////////
// The floater itself //
////////////////////////////////////////
FSFloaterSearch::FSFloaterSearch(const LLSD& key)
FSFloaterSearch::FSFloaterSearch(const Params& key)
: LLFloater(key)
{
mRemoteParcelObserver = new FSSearchRemoteParcelInfoObserver(this);
@ -295,13 +300,16 @@ void FSFloaterSearch::onOpen(const LLSD& key)
FSPanelSearchEvents* panel_events = findChild<FSPanelSearchEvents>("panel_ls_events");
FSPanelSearchLand* panel_land = findChild<FSPanelSearchLand>("panel_ls_land");
FSPanelSearchClassifieds* panel_classifieds = findChild<FSPanelSearchClassifieds>("panel_ls_classifieds");
FSPanelSearchWeb* panel_web = findChild<FSPanelSearchWeb>("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<LLMediaCtrl>("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");
}

View File

@ -47,7 +47,22 @@ class FSFloaterSearch
{
LOG_CLASS(FSFloaterSearch);
public:
FSFloaterSearch(const LLSD& key);
struct SearchQuery : public LLInitParam::Block<SearchQuery>
{
Optional<std::string> category;
Optional<std::string> query;
SearchQuery();
};
struct _Params : public LLInitParam::Block<_Params, LLFloater::Params>
{
Optional<SearchQuery> 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<SearchQuery>
{
Optional<std::string> category;
Optional<std::string> query;
SearchQuery();
};
FSPanelSearchWeb();
/*virtual*/ BOOL postBuild();
std::string loadURL();
void loadURL(const FSFloaterSearch::SearchQuery &query);
private:
~FSPanelSearchWeb();

View File

@ -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<FSFloaterSearch>("search_legacy");
FSFloaterSearch* legacy_search = LLFloaterReg::findTypedInstance<FSFloaterSearch>("search");
if (legacy_search) // The floater exists, send the results
legacy_search->displayEventDetails(eventId, eventEpoch, eventDateStr, eventName, eventDesc, simName, eventDuration, eventFlags, eventCover, eventGlobalPos);
else

View File

@ -339,7 +339,8 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>);
LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
// <FS:CR> Replacing LL search with Firestorm Search below
//LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
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<LLFloaterCamera>);
LLFloaterReg::add("publish_classified_fs", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSPublishClassifiedFloater>);
LLFloaterReg::add("quickprefs", "floater_quickprefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FloaterQuickPrefs>);
LLFloaterReg::add("search_legacy", "floater_fs_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterSearch>);
LLFloaterReg::add("search", "floater_fs_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterSearch>);
LLFloaterReg::add("search_replace", "floater_search_replace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearchReplace>);
LLFloaterReg::add("secondary_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
LLFloaterReg::add("script_recover", "floater_script_recover.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptRecover>);

View File

@ -1704,10 +1704,10 @@
shortcut="control|F">
<menu_item_check.on_check
function="Floater.Visible"
parameter="search_legacy" />
parameter="search" />
<menu_item_check.on_click
function="Floater.Toggle"
parameter="search_legacy" />
parameter="search" />
</menu_item_check>
<menu_item_call