void LLPanelDirFind::navigateToDefaultPage()
{
	std::string start_url = "";
	// Note: we use the web panel in OpenSim as well as Second Life -- MC
	if (gHippoGridManager->getConnectedGrid()->getSearchUrl().empty() && 
		!gHippoGridManager->getConnectedGrid()->isSecondLife())
	{
		// OS-based but doesn't have its own web search url -- MC
		start_url = gSavedSettings.getString("SearchURLDefaultOpenSim");
	}
	else
	{
		if (gHippoGridManager->getConnectedGrid()->isSecondLife()) 
		{
			if (mBrowserName == "showcase_browser")
			{
				// note that the showcase URL in floater_directory.xml is no longer used
				start_url = gSavedSettings.getString("ShowcaseURLDefault");
			}
			else
			{
				start_url = gSavedSettings.getString("SearchURLDefault");
			}
		}
		else
		{
			// OS-based but has its own web search url -- MC
			start_url = gHippoGridManager->getConnectedGrid()->getSearchUrl();
			start_url += "panel=" + getName() + "&";
		}

		if (hasChild("incmature"))
		{
			bool inc_pg = childGetValue("incpg").asBoolean();
			bool inc_mature = childGetValue("incmature").asBoolean();
			bool inc_adult = childGetValue("incadult").asBoolean();
			if (!(inc_pg || inc_mature || inc_adult))
			{
				// if nothing's checked, just go for pg; we don't notify in
				// this case because it's a default page.
				inc_pg = true;
			}
	
			start_url += getSearchURLSuffix(inc_pg, inc_mature, inc_adult, true);
		}
	}

	llinfos << "default web search url: "  << start_url << llendl;

	if (mWebBrowser)
	{
		mWebBrowser->navigateTo( start_url );
	}
}
예제 #2
0
const std::string LLPanelDirFind::buildSearchURL(const std::string& search_text, const std::string& collection,
										   bool inc_pg, bool inc_mature, bool inc_adult, bool is_web) const
{
	std::string url;
	if (search_text.empty()) 
	{
		url = gHippoGridManager->getConnectedGrid()->getSearchUrl(HippoGridInfo::SEARCH_ALL_EMPTY, is_web);
	} 
	else 
	{
		// Replace spaces with "+" for use by Google search appliance
		// Yes, this actually works for double-spaces
		// " foo  bar" becomes "+foo++bar" and works fine. JC
		std::string search_text_with_plus = search_text;
		std::string::iterator it = search_text_with_plus.begin();
		for ( ; it != search_text_with_plus.end(); ++it )
		{
			if ( std::isspace( *it ) )
			{
				*it = '+';
			}
		}

		// Our own special set of allowed chars (RFC1738 http://www.ietf.org/rfc/rfc1738.txt)
		// Note that "+" is one of them, so we can do "+" addition first.
		const char* allowed =   
			"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
			"0123456789"
			"-._~$+!*'()";
		std::string query = LLURI::escape(search_text_with_plus, allowed);

		url = gHippoGridManager->getConnectedGrid()->getSearchUrl(HippoGridInfo::SEARCH_ALL_QUERY, is_web);
		std::string substring = "[QUERY]";
		std::string::size_type where = url.find(substring);
		if (where != std::string::npos)
		{
			url.replace(where, substring.length(), query);
		}

		// replace the collection name with the one selected from the combo box
		// std::string selected_collection = childGetValue( "Category" ).asString();
		substring = "[COLLECTION]";
		where = url.find(substring);
		if (where != std::string::npos)
		{
			url.replace(where, substring.length(), collection);
		}

	}
	url += getSearchURLSuffix(inc_pg, inc_mature, inc_adult, is_web);
	llinfos << "web search url " << url << llendl;
	return url;
}
예제 #3
0
void LLPanelDirFind::navigateToDefaultPage()
{
	std::string start_url = getString("default_search_page");
	bool mature = childGetValue( "mature_check" ).asBoolean();
	start_url += getSearchURLSuffix( mature );

	llinfos << "default url: "  << start_url << llendl;

	if (mWebBrowser)
	{
		mWebBrowser->navigateTo( start_url );
	}
}
void LLPanelDirFind::navigateToDefaultPage()
{
	bool showcase(mBrowserName == "showcase_browser");
	std::string start_url = showcase ? LLWeb::expandURLSubstitutions(LFSimFeatureHandler::instance().destinationGuideURL(), LLSD()) : getSearchUrl();
	bool secondlife(gHippoGridManager->getConnectedGrid()->isSecondLife());
	// Note: we use the web panel in OpenSim as well as Second Life -- MC
	if (start_url.empty() && !secondlife)
	{
		// OS-based but doesn't have its own web search url -- MC
		start_url = gSavedSettings.getString("SearchURLDefaultOpenSim");
	}
	else
	{
		if (!showcase)
		{
			if (secondlife) // Legacy Web Search
				start_url = gSavedSettings.getString("SearchURLDefault");
			else // OS-based but has its own web search url -- MC
				start_url += "panel=" + getName() + "&";

			if (hasChild("incmature"))
			{
				bool inc_pg = getChildView("incpg")->getValue().asBoolean();
				bool inc_mature = getChildView("incmature")->getValue().asBoolean();
				bool inc_adult = getChildView("incadult")->getValue().asBoolean();
				if (!(inc_pg || inc_mature || inc_adult))
				{
					// if nothing's checked, just go for pg; we don't notify in
					// this case because it's a default page.
					inc_pg = true;
				}

				start_url += getSearchURLSuffix(inc_pg, inc_mature, inc_adult, true);
			}
		}
	}

	LL_INFOS() << "default web search url: "  << start_url << LL_ENDL;

	if (mWebBrowser)
	{
		mWebBrowser->navigateTo( start_url );
	}
}
예제 #5
0
void LLPanelDirFind::navigateToDefaultPage()
{
	std::string start_url = getString("default_search_page");
	BOOL inc_pg = childGetValue("incpg").asBoolean();
	BOOL inc_mature = childGetValue("incmature").asBoolean();
	BOOL inc_adult = childGetValue("incadult").asBoolean();
	if (!(inc_pg || inc_mature || inc_adult))
	{
		// if nothing's checked, just go for pg; we don't notify in
		// this case because it's a default page.
		inc_pg = true;
	}
	
	start_url += getSearchURLSuffix(inc_pg, inc_mature, inc_adult);

	llinfos << "default url: "  << start_url << llendl;

	if (mWebBrowser)
	{
		mWebBrowser->navigateTo( start_url );
	}
}