void LLPanelDirFindAll::search(const std::string& search_text)
{
	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))
	{
		LLNotifications::instance().add("NoContentToSearch");
		return;
	}
	
	if (!search_text.empty())
	{
		std::string selected_collection = childGetValue( "Category" ).asString();
		std::string url = buildSearchURL(search_text, selected_collection, inc_pg, inc_mature, inc_adult);
		if (mWebBrowser)
		{
			mWebBrowser->navigateTo(url);
		}
	}
	else
	{
		// empty search text
		navigateToDefaultPage();
	}

	childSetText("search_editor", search_text);
}
BOOL LLPanelDirFind::postBuild()
{
	LLPanelDirBrowser::postBuild();

	childSetAction("back_btn", onClickBack, this);
	childSetAction("home_btn", onClickHome, this);
	childSetAction("forward_btn", onClickForward, this);
	childSetCommitCallback("search_editor", onCommitSearch, this);
	childSetAction("search_btn", onClickSearch, this);
	childSetAction("?", onClickHelp, this);

	// showcase doesn't have maturity flags -- it's all PG
	if (hasChild("incmature"))
	{
		// Teens don't get mature checkbox
		if (gAgent.wantsPGOnly())
		{
			childSetValue("incmature", FALSE);
			childSetValue("incadult", FALSE);
			childHide("incmature");
			childHide("incadult");
			childSetValue("incpg", TRUE);
			childDisable("incpg");
		}		
		
		if (!gAgent.canAccessMature())
		{
			childSetValue("incmature", FALSE);
			childDisable("incmature");
		}
		
		if (!gAgent.canAccessAdult())
		{
			childSetValue("incadult", FALSE);
			childDisable("incadult");
		}
	}
	
	
	mWebBrowser = getChild<LLMediaCtrl>(mBrowserName);
	if (mWebBrowser)
	{
		mWebBrowser->addObserver(this);
		
		// new pages appear in same window as the results page now
		mWebBrowser->setOpenInInternalBrowser( false );
		mWebBrowser->setOpenInExternalBrowser( false );	

		// need to handle inworldz:///app/ URLs for direct teleports
		mWebBrowser->setTrusted( true );

		// redirect 404 pages from S3 somewhere else
		mWebBrowser->set404RedirectUrl( getString("redirect_404_url") );

		navigateToDefaultPage();
	}

	return TRUE;
}
	void onConfirmChangeMarketplaceURL(const S32 option, const std::string& url)
	{
		if (option == 1) return; //no
		else //yes
		{
			mMarketplaceURL = url;
			if (option == 2) navigateToDefaultPage();
		}
	}
Example #4
0
void LLPanelDirFindAll::search(const std::string& search_text)
{
	if (!search_text.empty())
	{
		bool mature = childGetValue( "mature_check" ).asBoolean();
		std::string selected_collection = childGetValue( "Category" ).asString();
		std::string url = buildSearchURL(search_text, selected_collection, mature);
		if (mWebBrowser)
		{
			mWebBrowser->navigateTo(url);
		}
	}
	else
	{
		// empty search text
		navigateToDefaultPage();
	}

	childSetText("search_editor", search_text);
}
Example #5
0
BOOL LLPanelDirFind::postBuild()
{
	LLPanelDirBrowser::postBuild();

	childSetAction("back_btn", onClickBack, this);
	childSetAction("home_btn", onClickHome, this);
	childSetAction("forward_btn", onClickForward, this);
	childSetCommitCallback("search_editor", onCommitSearch, this);
	childSetAction("search_btn", onClickSearch, this);

	if (gAgent.isTeen())
	{
		// Showcase tab does not have mature checkbox
		if (hasChild("mature_check"))
		{
			childSetVisible("mature_check", false);
			childSetValue("mature_check", false);
		}
	}

	mWebBrowser = getChild<LLWebBrowserCtrl>(mBrowserName);
	if (mWebBrowser)
	{
		// new pages appear in same window as the results page now
		mWebBrowser->setOpenInInternalBrowser( false );
		mWebBrowser->setOpenInExternalBrowser( false );	

		// need to handle secondlife:///app/ URLs for direct teleports
		mWebBrowser->setOpenAppSLURLs( true );

		// redirect 404 pages from S3 somewhere else
		mWebBrowser->set404RedirectUrl( getString("redirect_404_url") );

		// Track updates for progress display.
		mWebBrowser->addObserver(this);

		navigateToDefaultPage();
	}

	return TRUE;
}
void LLPanelDirFindAll::search(const std::string& search_text)
{
	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))
	{
		LLNotificationsUtil::add("NoContentToSearch");
		return;
	}
	
	if (!search_text.empty())
	{
		// Check whether or not we're on the old or web search All -- MC
		bool is_web = false;
		LLPanel* tabs_panel = mFloaterDirectory->getChild<LLTabContainer>("Directory Tabs")->getCurrentPanel();
		if (tabs_panel)
		{
			is_web = tabs_panel->getName() == "find_all_panel";
		}
		else
		{
			llwarns << "search panel not found! How can this be?!" << llendl;
		}

		std::string selected_collection = childGetValue( "Category" ).asString();
		std::string url = buildSearchURL(search_text, selected_collection, inc_pg, inc_mature, inc_adult, is_web);
		if (mWebBrowser)
		{
			mWebBrowser->navigateTo(url);
		}
	}
	else
	{
		// empty search text
		navigateToDefaultPage();
	}

	childSetText("search_editor", search_text);
}
	void setMarketplaceURL(LLTabContainer* container)
	{
		if (LLViewerRegion* region = gAgent.getRegion())
		{
			LLSD info;
			region->getSimulatorFeatures(info);
			if (info.has("MarketplaceURL"))
			{
				std::string url = info["MarketplaceURL"].asString();
				if (mMarketplaceURL == url) return;

				if (mMarketplaceURL.empty())
				{
					container->addTabPanel(this, getLabel());
					mMarketplaceURL = url;
					navigateToDefaultPage();
				}
				else
				{
					LLNotificationsUtil::add("MarketplaceURLChanged", LLSD(), LLSD(),
							boost::bind(&LLPanelDirMarket::onConfirmChangeMarketplaceURL, this, boost::bind(LLNotificationsUtil::getSelectedOption, _1, _2), url));
				}
			}
			else if (!mMarketplaceURL.empty())
			{
				if (gFloaterView->getParentFloater(this)->getVisible()) // Notify the user that they're no longer on the region with the marketplace when search is open
				{
					LLNotificationsUtil::add("MarketplaceURLGone");
				}
				else // Search is not in use, remove the marketplace
				{
					mMarketplaceURL = "";
					container->removeTabPanel(this);
				}
			}
		}
	}
	/*virtual*/ void search(const std::string& url)
	{
		if (url.empty()) navigateToDefaultPage();
	}
BOOL LLPanelDirFind::postBuild()
{
	LLPanelDirBrowser::postBuild();

	getChild<LLButton>("back_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickBack,this));
	if (hasChild("home_btn"))
		getChild<LLButton>("home_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickHome,this));
	getChild<LLButton>("forward_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickForward,this));
	getChild<LLButton>("reload_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickRefresh,this));
	if (hasChild("search_editor"))
		getChild<LLButton>("search_editor")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickSearch,this));
	if (hasChild("search_btn"))
		getChild<LLButton>("search_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickSearch,this));
	if (hasChild("?"))
		getChild<LLButton>("?")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickHelp,this));

	// showcase doesn't have maturity flags -- it's all PG
	if (hasChild("incmature"))
	{
		// Teens don't get mature checkbox
		if (gAgent.wantsPGOnly())
		{
			childSetValue("incmature", FALSE);
			childSetValue("incadult", FALSE);
			childHide("incmature");
			childHide("incadult");
			childSetValue("incpg", TRUE);
			childDisable("incpg");
		}		
		
		if (!gAgent.canAccessMature())
		{
			childSetValue("incmature", FALSE);
			childDisable("incmature");
		}
		
		if (!gAgent.canAccessAdult())
		{
			childSetValue("incadult", FALSE);
			childDisable("incadult");
		}
	}
	
	
	mWebBrowser = getChild<LLMediaCtrl>(mBrowserName);
	if (mWebBrowser)
	{
		mWebBrowser->addObserver(this);

		// need to handle secondlife:///app/ URLs for direct teleports
		mWebBrowser->setTrustedContent( true );

		// redirect 404 pages from S3 somewhere else
		mWebBrowser->set404RedirectUrl( getString("redirect_404_url") );

		navigateToDefaultPage();
	}

	if (LLUICtrl* ctrl = findChild<LLUICtrl>("filter_gaming"))
	{
		const LLViewerRegion* region(gAgent.getRegion());
		ctrl->setVisible(region && (region->getGamingFlags() & REGION_GAMING_PRESENT) && !(region->getGamingFlags() & REGION_GAMING_HIDE_FIND_ALL));
	}

	return TRUE;
}