Esempio n. 1
0
void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item)
{
	if (item == "landmark")
	{
		LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();

		if(landmark == NULL)
		{
			LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
		}
		else
		{
			LLSideTray::getInstance()->showPanel("panel_places",
					LLSD().with("type", "landmark").with("id",landmark->getUUID()));
		}
	}
	else if (item == "copy")
	{
		LLSLURL slurl;
		LLAgentUI::buildSLURL(slurl, false);
		LLUIString location_str(slurl.getSLURLString());

		gClipboard.copyFromString(location_str);
	}
}
Esempio n. 2
0
// static
void LLPanelLogin::updateStartSLURL()
{
	if (!sInstance) return;
	
	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
	S32 index = combo->getCurrentIndex();
	
	switch (index)
	{
		case 0:
		{
			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
			break;
		}			
		case 1:
		{
			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
			break;
		}
		default:
		{
			LLSLURL slurl = LLSLURL(combo->getValue().asString());
			if(slurl.getType() == LLSLURL::LOCATION)
			{
				// we've changed the grid, so update the grid selection
				LLStartUp::setStartSLURL(slurl);
			}
			break;
		}			
	}
}
Esempio n. 3
0
	void slurlTestObject::test<2>()
	{
		LLSLURL slurl = LLSLURL("mygrid.com", "my region");
		ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("grid/region", slurl.getSLURLString(), 
					  "https://mygrid.com/region/my%20region/128/128/0");	
		
		slurl = LLSLURL("mygrid.com", "my region", LLVector3(1,2,3));
		ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" grid/region/vector", slurl.getSLURLString(), 
					  "https://mygrid.com/region/my%20region/1/2/3");			

		LLGridManager::getInstance()->setGridChoice("foo.bar.com.bar");			
		slurl = LLSLURL("my region", LLVector3(1,2,3));
		ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" grid/region/vector", slurl.getSLURLString(), 
					  "https://foo.bar.com.bar/region/my%20region/1/2/3");	
		
		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");	
		slurl = LLSLURL("my region", LLVector3(1,2,3));
		ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" default grid/region/vector", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/my%20region/1/2/3");	
		
	}
Esempio n. 4
0
	void slurlTestObject::test<2>()
	{
		llofstream gridfile(TEST_FILENAME);
		gridfile << gSampleGridFile;
		gridfile.close();

		LLGridManager::getInstance()->initialize(TEST_FILENAME);

		LLSLURL slurl = LLSLURL("my.grid.com", "my region");
		ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("grid/region", slurl.getSLURLString(),
					  "https://my.grid.com/region/my%20region/128/128/0");

		slurl = LLSLURL("my.grid.com", "my region", LLVector3(1,2,3));
		ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" grid/region/vector", slurl.getSLURLString(),
					  "https://my.grid.com/region/my%20region/1/2/3");

		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
		slurl = LLSLURL("my region", LLVector3(1,2,3));
		ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" default grid/region/vector", slurl.getSLURLString(),
					  "http://maps.secondlife.com/secondlife/my%20region/1/2/3");

		LLGridManager::getInstance()->setGridChoice("MyGrid");
		slurl = LLSLURL("my region", LLVector3(1,2,3));
		ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" default grid/region/vector", slurl.getSLURLString(),
					  "https://my.grid.com/region/my%20region/1/2/3");

	}
/* static */
void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{

  // we can't teleport cross grid at this point
	HippoGridInfo* new_grid = gHippoGridManager->getGrid(slurl.getGrid());
	if(   new_grid
	   != gHippoGridManager->getCurrentGrid())
	{
		LLSD args;
		args["SLURL"] = slurl.getLocationString();
		args["CURRENT_GRID"] = gHippoGridManager->getCurrentGrid()->getGridName();

		std::string grid_label = new_grid ? new_grid->getGridName() : "";
		
		if(!grid_label.empty())
		{
			args["GRID"] = grid_label;
		}
		else 
		{
			args["GRID"] = slurl.getGrid() + " (Unrecognized)";
		}
		LLNotificationsUtil::add("CantTeleportToGrid", args);
		return;
	}
	
	LLVector3d global_pos = from_region_handle(region_handle);
	LLVector3 local_pos = slurl.getPosition();
	global_pos += LLVector3d(local_pos);
	if (teleport)
	{
		
		gAgent.teleportViaLocation(global_pos);
		if(gFloaterWorldMap)
		{
			gFloaterWorldMap->trackLocation(global_pos);
		}
	}
	else
	{
		// display informational floater, allow user to click teleport btn
		LLFloaterURLDisplay* url_displayp = LLFloaterURLDisplay::getInstance(LLSD());


		url_displayp->displayParcelInfo(region_handle, local_pos);
		if(snapshot_id.notNull())
		{
			url_displayp->setSnapshotDisplay(snapshot_id);
		}
		std::string locationString = llformat("%s %i, %i, %i", slurl.getRegion().c_str(), (S32)local_pos.mV[VX],(S32)local_pos.mV[VY],(S32)local_pos.mV[VZ]);
		url_displayp->setLocationString(locationString);
	}
}
Esempio n. 6
0
/* static */
void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{

  // we can't teleport cross grid at this point
	if(   LLGridManager::getInstance()->getGrid(slurl.getGrid())
	   != LLGridManager::getInstance()->getGrid())
	{
		LLSD args;
		args["SLURL"] = slurl.getLocationString();
		args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
		std::string grid_label = 
			LLGridManager::getInstance()->getGridLabel(slurl.getGrid());
		
		if(!grid_label.empty())
		{
			args["GRID"] = grid_label;
		}
		else 
		{
			args["GRID"] = slurl.getGrid();
		}
		LLNotificationsUtil::add("CantTeleportToGrid", args);
		return;
	}
	
	LLVector3d global_pos = from_region_handle(region_handle);
	global_pos += LLVector3d(slurl.getPosition());
	
	if (teleport)
	{	
		gAgent.teleportViaLocation(global_pos);
		LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
		if(instance)
		{
			instance->trackLocation(global_pos);
		}
	}
	else
	{
		LLSD key;
		key["type"] = "remote_place";
		key["x"] = global_pos.mdV[VX];
		key["y"] = global_pos.mdV[VY];
		key["z"] = global_pos.mdV[VZ];

		LLFloaterSidePanelContainer::showPanel("places", key);
	}
}
Esempio n. 7
0
/*static*/
void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{
      
  if(slurl.getType() == LLSLURL::LOCATION)
    {        
      regionHandleCallback(region_handle, slurl, snapshot_id, teleport);
    }
}
// static
bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, 
									  const std::string& nav_type,
									  bool right_mouse,
									  LLMediaCtrl* web,
									  bool trusted_browser)
{
	llinfos << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << llendl;
	const LLSD& query_map = LLURI::queryMap(slurl.getAppQuery());
	bool handled = LLCommandDispatcher::dispatch(
			slurl.getAppCmd(), slurl.getAppPath(), query_map, web, nav_type, trusted_browser);

	// alert if we didn't handle this secondlife:///app/ SLURL
	// (but still return true because it is a valid app SLURL)
	if (! handled)
	{
		LLNotificationsUtil::add("UnsupportedCommandSLURL");
	}
	return true;
}
void LLLocationInputCtrl::changeLocationPresentation()
{
	if (!mTextEntry)
		return;

	//change location presentation only if user does not select/paste anything and 
	//human-readable region name is being displayed
	std::string text = mTextEntry->getText();
	LLStringUtil::trim(text);
	if(!mTextEntry->hasSelection() && text == mHumanReadableLocation)
	{
		//needs unescaped one
		LLSLURL slurl;
		LLAgentUI::buildSLURL(slurl, false);
		mTextEntry->setText(LLURI::unescape(slurl.getSLURLString()));
		mTextEntry->selectAll();

		mMaturityButton->setVisible(FALSE);

		isHumanReadableLocationVisible = false;
	}
}
void LLFacebookCheckinPanel::sendCheckin()
{
	// Get the location SLURL
	LLSLURL slurl;
	LLAgentUI::buildSLURL(slurl);
	std::string slurl_string = slurl.getSLURLString();

	// Use a valid http:// URL if the scheme is secondlife:// 
	LLURI slurl_uri(slurl_string);
	if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
	{
		slurl_string = DEFAULT_CHECKIN_LOCATION_URL;
	}

	// Add query parameters so Google Analytics can track incoming clicks!
	slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS;
    
	// Get the region name
	std::string region_name("");
    LLViewerRegion *regionp = gAgent.getRegion();
    if (regionp)
    {
        region_name = regionp->getName();
    }
    
	// Get the region description
	std::string description;
	LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent());
    
	// Optionally add the region map view
	bool add_map_view = mMapCheckBox->getValue().asBoolean();
    std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL);
    
	// Get the caption
	std::string caption = mMessageTextEditor->getValue().asString();

	// Post to Facebook
	LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption);
}
Esempio n. 11
0
// static
void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl)
{
	if (!sInstance) return;

	LL_DEBUGS("AppInit")<<new_start_slurl.asString()<<LL_ENDL;

	LLComboBox* location_combo = sInstance->getChild<LLComboBox>("start_location_combo");
	/*
	 * Determine whether or not the new_start_slurl modifies the grid.
	 *
	 * Note that some forms that could be in the slurl are grid-agnostic.,
	 * such as "home".  Other forms, such as
	 * https://grid.example.com/region/Party%20Town/20/30/5 
	 * specify a particular grid; in those cases we want to change the grid
	 * and the grid selector to match the new value.
	 */
	enum LLSLURL::SLURL_TYPE new_slurl_type = new_start_slurl.getType();
	switch ( new_slurl_type )
	{
	case LLSLURL::LOCATION:
	{
		location_combo->setCurrentByIndex( 2 );
		location_combo->setTextEntry(new_start_slurl.getLocationString());
	}
	break;
	case LLSLURL::HOME_LOCATION:
		location_combo->setCurrentByIndex( 0 );	// home location
		break;
	case LLSLURL::LAST_LOCATION:
		location_combo->setCurrentByIndex( 1 ); // last location
		break;
	default:
		LL_WARNS("AppInit")<<"invalid login slurl, using home"<<LL_ENDL;
		location_combo->setCurrentByIndex(1); // home location
		break;
	}

	updateLocationSelectorsVisibility();
}
Esempio n. 12
0
void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item)
{
	if (item == "landmark")
	{
// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5
		if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
		{
// [/RLVa:KB]
			LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();

			if(landmark == NULL)
			{
				LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark"));
			}
			else
			{
				LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID()));
			}
// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5
		}
// [/RLVa:KB]
	}
	else if (item == "copy")
	{
// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5
		if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
		{
// [/RLVa:KB]
			LLSLURL slurl;
			LLAgentUI::buildSLURL(slurl, false);
			LLUIString location_str(slurl.getSLURLString());

			gClipboard.copyFromString(location_str);
// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5
		}
// [/RLVa:KB]
	}
}
Esempio n. 13
0
// static
bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse)
{
	if(slurl.getType() != LLSLURL::LOCATION)
    {
		return false;
    }
	// Before we're logged in, need to update the startup screen
	// to tell the user where they are going.
	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
	{
		// We're at the login screen, so make sure user can see
		// the login location box to know where they are going.
		
		LLPanelLogin::setLocation(slurl);
		return true;
	}

	// Request a region handle by name
	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
									  LLURLDispatcherImpl::regionNameCallback,
									  slurl.getSLURLString(),
									  LLUI::sConfigGroup->getBOOL("SLURLTeleportDirectly"));	// don't teleport
	return true;
}
void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item)
{
	if (item == "landmark")
	{
		LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();

		if(landmark == NULL)
		{
			LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark"));
		}
		else
		{
			LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID()));
		}
	}
	else if (item == "copy")
	{
		LLSLURL slurl;
		LLAgentUI::buildSLURL(slurl, false);
		LLUIString location_str(slurl.getSLURLString());

		LLClipboard::instance().copyToClipboard(location_str,0,location_str.length());
	}
}
Esempio n. 15
0
// static
bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, 
									  const std::string& nav_type,
									  bool right_mouse,
									  LLMediaCtrl* web,
									  bool trusted_browser)
{
	llinfos << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << llendl;
	const LLSD& query_map = LLURI::queryMap(slurl.getAppQuery());

// <FS:AW handle hop app teleports properly>
// 	bool handled = LLCommandDispatcher::dispatch(
// 			slurl.getAppCmd(), slurl.getAppPath(), query_map, web, nav_type, trusted_browser);
	LLSD path;
#ifdef HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
	if ("teleport" == slurl.getAppCmd())
	{
		path = LLSD::emptyArray();
		path.append(slurl.getGrid());
		for(int i=0; slurl.getAppPath().size() > i; i++)
		{
			path.append(slurl.getAppPath()[i].asString());
		}
	}
	else
#endif // HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
	{
		path = slurl.getAppPath();
	}

	bool handled = LLCommandDispatcher::dispatch(
			slurl.getAppCmd(), path, query_map, web, nav_type, trusted_browser);
// </FS:AW handle hop app teleports properly>

	// alert if we didn't handle this secondlife:///app/ SLURL
	// (but still return true because it is a valid app SLURL)
	if (! handled)
	{
		LLNotificationsUtil::add("UnsupportedCommandSLURL");
	}
	return true;
}
Esempio n. 16
0
	void slurlTestObject::test<3>()
	{
		LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
		ensure_equals("login string", slurl.getLoginString(), "uri:my region&amp;1&amp;2&amp;3");
		ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3");
		ensure_equals("grid", slurl.getGrid(), "my.grid.com");
		ensure_equals("region", slurl.getRegion(), "my region");
		ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3));
		
	}
Esempio n. 17
0
bool LLSLURL::operator==(const LLSLURL& rhs)
{
	if(rhs.mType != mType) return false;
	switch(mType)
	{
	case LOCATION:
		return ((mGrid == rhs.mGrid) &&
		        (mRegion == rhs.mRegion) &&
		        (mPosition == rhs.mPosition));
	case APP:
		return getSLURLString() == rhs.getSLURLString();

	case HOME_LOCATION:
	case LAST_LOCATION:
		return true;
	default:
		return false;
	}
}
/* static */
void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{

  // we can't teleport cross grid at this point
	if((!LLGridManager::getInstance()->isSystemGrid(slurl.getGrid()) || !LLGridManager::getInstance()->isSystemGrid()) &&
	   (slurl.getGrid() != LLGridManager::getInstance()->getGrid()))
	{
		LLSD args;
		args["SLURL"] = slurl.getLocationString();
		args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
		LLSD grid_info;
		LLGridManager::getInstance()->getGridInfo(slurl.getGrid(), grid_info);
		
		if(grid_info.has(GRID_LABEL_VALUE))
		{
			args["GRID"] = grid_info[GRID_LABEL_VALUE].asString();
		}
		else 
		{
			args["GRID"] = slurl.getGrid();
		}
		LLNotificationsUtil::add("CantTeleportToGrid", args);
		return;
	}
	
	LLVector3d global_pos = from_region_handle(region_handle);
	global_pos += LLVector3d(slurl.getPosition());
	
	if (teleport)
	{	
		gAgent.teleportViaLocation(global_pos);
		LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
		if(instance)
		{
			instance->trackLocation(global_pos);
		}
	}
	else
	{
		LLSD key;
		key["type"] = "remote_place";
		key["x"] = global_pos.mdV[VX];
		key["y"] = global_pos.mdV[VY];
		key["z"] = global_pos.mdV[VZ];

		LLSideTray::getInstance()->showPanel("panel_places", key);
	}
}
Esempio n. 19
0
	void slurlTestObject::test<3>()
	{
		llofstream gridfile(TEST_FILENAME);
		gridfile << gSampleGridFile;
		gridfile.close();

		LLGridManager::getInstance()->initialize(TEST_FILENAME);

		LLGridManager::getInstance()->setGridChoice("my.grid.com");
		LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
		ensure_equals("login string", slurl.getLoginString(), "uri:my region&amp;1&amp;2&amp;3");
		ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3");
		ensure_equals("grid", slurl.getGrid(), "my.grid.com");
		ensure_equals("region", slurl.getRegion(), "my region");
		ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3));

	}
Esempio n. 20
0
// static
bool LLURLDispatcherImpl::dispatchCore(const LLSLURL& slurl,
									   const std::string& nav_type,
									   bool right_mouse,
									   LLMediaCtrl* web,
									   bool trusted_browser)
{
	//if (dispatchHelp(slurl, right_mouse)) return true;
	switch(slurl.getType())
	{
		case LLSLURL::APP: 
			return dispatchApp(slurl, nav_type, right_mouse, web, trusted_browser);
		case LLSLURL::LOCATION:
			return dispatchRegion(slurl, nav_type, right_mouse);
		default:
			return false;
	}

	/*
	// Inform the user we can't handle this
	std::map<std::string, std::string> args;
	args["SLURL"] = slurl;
	r;
	*/
}
// virtual
BOOL LLFloaterReporter::postBuild()
{
	LLSLURL slurl;
	LLAgentUI::buildSLURL(slurl);
	getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString());

	enableControls(TRUE);

	// convert the position to a string
	LLVector3d pos = gAgent.getPositionGlobal();
	LLViewerRegion *regionp = gAgent.getRegion();
	if (regionp)
	{
		getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
		pos -= regionp->getOriginGlobal();
	}
	setPosBox(pos);

	// Take a screenshot, but don't draw this floater.
	setVisible(FALSE);
	takeScreenshot();
	setVisible(TRUE);

	// Default text to be blank
	getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null);
	getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null);
	mOwnerName = LLStringUtil::null;

	getChild<LLUICtrl>("summary_edit")->setFocus(TRUE);

	mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString();

	// send a message and ask for information about this region -
	// result comes back in processRegionInfo(..)
	LLMessageSystem* msg = gMessageSystem;
	msg->newMessage("RequestRegionInfo");
	msg->nextBlock("AgentData");
	msg->addUUID("AgentID", gAgent.getID());
	msg->addUUID("SessionID", gAgent.getSessionID());
	gAgent.sendReliableMessage();


	// abuser name is selected from a list
	LLUICtrl* le = getChild<LLUICtrl>("abuser_name_edit");
	le->setEnabled( false );

	LLButton* pick_btn = getChild<LLButton>("pick_btn");
	// XUI: Why aren't these in viewerart.ini?
	pick_btn->setImages(std::string("UIImgFaceUUID"),
						std::string("UIImgFaceSelectedUUID") );
	childSetAction("pick_btn", onClickObjPicker, this);
	childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this));

	childSetAction("send_btn", onClickSend, this);
	childSetAction("cancel_btn", onClickCancel, this);
	// grab the user's name
	std::string reporter;
	gAgent.buildFullname(reporter);
	getChild<LLUICtrl>("reporter_field")->setValue(reporter);

	center();

	return TRUE;
}
Esempio n. 22
0
// This is called when user presses enter in the location input
// or selects a location from the typed locations dropdown.
void LLNavigationBar::onLocationSelection()
{
	std::string typed_location = mCmbLocation->getSimple();
	LLStringUtil::trim(typed_location);

	// Will not teleport to empty location.
	if (typed_location.empty())
		return;
	//get selected item from combobox item
	LLSD value = mCmbLocation->getSelectedValue();
	if(value.isUndefined() && !mCmbLocation->getTextEntry()->isDirty())
	{
		// At this point we know that: there is no selected item in list and text field has NOT been changed
		// So there is no sense to try to change the location
		return;
	}
	/* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item,
	 * typed by user slurl or region name. Let's find out which type of item the user has selected 
	 * to make decision about adding this location into typed history. see mSaveToLocationHistory
	 * Note:
	 * Only TYPED_REGION_SLURL item will be added into LLLocationHistory 
	 */  
	
	if(value.has("item_type"))
	{

		switch(value["item_type"].asInteger())
		{
		case LANDMARK:
			
			if(value.has("AssetUUID"))
			{
				
				gAgent.teleportViaLandmark( LLUUID(value["AssetUUID"].asString()));
				return;
			}
			else
			{
				LLInventoryModel::item_array_t landmark_items =
						LLLandmarkActions::fetchLandmarksByName(typed_location,
								FALSE);
				if (!landmark_items.empty())
				{
					gAgent.teleportViaLandmark( landmark_items[0]->getAssetUUID());
					return; 
				}
			}
			break;
			
		case TELEPORT_HISTORY:
			//in case of teleport item was selected, teleport by position too.
		case TYPED_REGION_SLURL:
			if(value.has("global_pos"))
			{
				gAgent.teleportViaLocation(LLVector3d(value["global_pos"]));
				return;
			}
			break;
			
		default:
			break;		
		}
	}
	//Let's parse slurl or region name
	
	std::string region_name;
	LLVector3 local_coords(128, 128, 0);
	// Is the typed location a SLURL?
	LLSLURL slurl = LLSLURL(typed_location);
	if (slurl.getType() == LLSLURL::LOCATION)
	{
	  region_name = slurl.getRegion();
	  local_coords = slurl.getPosition();
	}
	else if(!slurl.isValid())
	{
	  // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too  
	  // but we need to know whether typed_location is a simple http url.
	  if (LLUrlRegistry::instance().isUrl(typed_location)) 
	    {
		// display http:// URLs in the media browser, or
		// anything else is sent to the search floater
		LLWeb::loadURL(typed_location);
		return;
	  }
	  else
	  {
	      // assume that an user has typed the {region name} or possible {region_name, parcel}
	      region_name  = typed_location.substr(0,typed_location.find(','));
	    }
	}
	else
	{
	  // was an app slurl, home, whatever.  Bail
	  return;
	}
	
	// Resolve the region name to its global coordinates.
	// If resolution succeeds we'll teleport.
	LLWorldMapMessage::url_callback_t cb = boost::bind(
			&LLNavigationBar::onRegionNameResponse, this,
			typed_location, region_name, local_coords, _1, _2, _3, _4);
	mSaveToLocationHistory = true;
	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false);
}
Esempio n. 23
0
// static
bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse)
{
	if(slurl.getType() != LLSLURL::LOCATION)
    {
		return false;
    }
	// Before we're logged in, need to update the startup screen
	// to tell the user where they are going.
	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
	{
		// We're at the login screen, so make sure user can see
		// the login location box to know where they are going.
		
		LLPanelLogin::setLocation(slurl);
		return true;
	}
// <FS:AW hypergrid support >
// 	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
// 
// 									  LLURLDispatcherImpl::regionNameCallback,
// 									  slurl.getSLURLString(),
	LLSLURL hyper = slurl;
#ifdef HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
	std::string grid = slurl.getGrid();
	std::string current_grid = LLGridManager::getInstance()->getGrid();

	std::string gatekeeper = LLGridManager::getInstance()->getGatekeeper(grid);

	std::string current = LLGridManager::getInstance()->getGrid();
	if((grid != current ) 
		&& (!LLGridManager::getInstance()->isInOpenSim()
			|| (!slurl.getHypergrid() && gatekeeper.empty() )
		   )
	  )
	{
 		std::string dest = hyper.getSLURLString();
		if (!dest.empty())
		{
			LLSD args;
			args["SLURL"] = dest;
			args["GRID"] = slurl.getGrid();
			args["CURRENT_GRID"] = current_grid;
			LLNotificationsUtil::add("CantTeleportToGrid", args);
			return true;
		}
	}
	else if(!gatekeeper.empty())
	{
		hyper = LLSLURL(gatekeeper + ":" + slurl.getRegion(), slurl.getPosition(), true);
	}

#endif //HAS_OPENSIM_SUPPORT
// </FS:AW optional opensim support>
	// Request a region handle by name
	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(hyper.getRegion(),
									  LLURLDispatcherImpl::regionNameCallback,
									  hyper.getSLURLString(),
// </FS:AW hypergrid support >
									  LLUI::sSettingGroups["config"]->getBOOL("SLURLTeleportDirectly"));	// don't teleport
	return true;
}
// static - called from LLStartUp::setStartSLURL
void FSPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl)
{
	if (!sInstance) return;

	LL_DEBUGS("AppInit")<<new_start_slurl.asString()<<LL_ENDL;

	LLComboBox* location_combo = sInstance->getChild<LLComboBox>("start_location_combo");
	/*
	 * Determine whether or not the new_start_slurl modifies the grid.
	 *
	 * Note that some forms that could be in the slurl are grid-agnostic.,
	 * such as "home".  Other forms, such as
	 * https://grid.example.com/region/Party%20Town/20/30/5 
	 * specify a particular grid; in those cases we want to change the grid
	 * and the grid selector to match the new value.
	 */
	enum LLSLURL::SLURL_TYPE new_slurl_type = new_start_slurl.getType();
	switch ( new_slurl_type )
	{
	case LLSLURL::LOCATION:
	  {
		std::string slurl_grid = LLGridManager::getInstance()->getGrid(new_start_slurl.getGrid());
		if ( ! slurl_grid.empty() ) // is that a valid grid?
		{
			if ( slurl_grid != LLGridManager::getInstance()->getGrid() ) // new grid?
			{
				// the slurl changes the grid, so update everything to match
				LLGridManager::getInstance()->setGridChoice(slurl_grid);

				// update the grid selector to match the slurl
				LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo");
				std::string server_label(LLGridManager::getInstance()->getGridLabel(slurl_grid));
				server_combo->setSimple(server_label);

				updateServer(); // to change the links and splash screen
			}
			location_combo->setTextEntry(new_start_slurl.getLocationString());
		}
		else
		{
			// the grid specified by the slurl is not known
			LLNotificationsUtil::add("InvalidLocationSLURL");
			LL_WARNS("AppInit")<<"invalid LoginLocation:"<<new_start_slurl.asString()<<LL_ENDL;
			location_combo->setTextEntry(LLStringUtil::null);
		}
	  }
 	break;

	case LLSLURL::HOME_LOCATION:
		location_combo->setCurrentByIndex(1); // home location
		break;
		
	case LLSLURL::LAST_LOCATION:
		location_combo->setCurrentByIndex(0); // last location
		break;

	default:
		LL_WARNS("AppInit")<<"invalid login slurl, using home"<<LL_ENDL;
		location_combo->setCurrentByIndex(1); // home location
		break;
	}
}
Esempio n. 25
0
	void slurlTestObject::test<1>()
	{
		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
		
		LLSLURL slurl = LLSLURL("");
		ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION);
		
		slurl = LLSLURL("http://slurl.com/secondlife/myregion");
		ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/myregion/128/128/0");
		
		slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3");
		ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/myregion/1/2/3");

		slurl = LLSLURL("secondlife://myregion");
		ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/myregion/128/128/0");
		
		slurl = LLSLURL("secondlife://myregion/1/2/3");
		ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/myregion/1/2/3");
		
		slurl = LLSLURL("/myregion");
		ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("/region slurl, region ", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/myregion/128/128/0");
		
		slurl = LLSLURL("/myregion/1/2/3");
		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/myregion/1/2/3");	
		
		slurl = LLSLURL("my region/1/2/3");
		ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" slurl, region + coords", slurl.getSLURLString(), 
					  "http://maps.secondlife.com/secondlife/my%20region/1/2/3");	
		
		slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
		ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), 
					  "https://my.grid.com/region/my%20region/1/2/3");	
		
		slurl = LLSLURL("https://my.grid.com/region/my region");
		ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), 
					  "https://my.grid.com/region/my%20region/128/128/0");
		
		LLGridManager::getInstance()->setGridChoice("foo.bar.com");		
		slurl = LLSLURL("/myregion/1/2/3");
		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), 
					  "https://foo.bar.com/region/myregion/1/2/3");		
		
		slurl = LLSLURL("myregion/1/2/3");
		ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals(" slurl, region + coords", slurl.getSLURLString(), 
					  "https://foo.bar.com/region/myregion/1/2/3");		
		
		slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
		ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION);

		slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST);
		ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION);
		
		slurl = LLSLURL("secondlife:///app/foo/bar?12345");
		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
		ensure_equals("apppath", slurl.getAppPath().size(), 1);
		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
		ensure_equals("appquery", slurl.getAppQuery(), "12345");
		ensure_equals("grid1", "foo.bar.com", slurl.getGrid());
	
		slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345");
		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
		ensure_equals("apppath", slurl.getAppPath().size(), 1);
		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
		ensure_equals("appquery", slurl.getAppQuery(), "12345");
		ensure_equals("grid2", "util.aditi.lindenlab.com", slurl.getGrid());		

		LLGridManager::getInstance()->setGridChoice("foo.bar.com");			
		slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3");
		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("region" , "myregion", slurl.getRegion());
		ensure_equals("grid3", "util.agni.lindenlab.com", slurl.getGrid());
				
		slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3");
		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
		ensure_equals("region" , "myregion", slurl.getRegion());
		ensure_equals("grid4", "util.aditi.lindenlab.com", slurl.getGrid());		
		
		slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345");
		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
		ensure_equals("apppath", slurl.getAppPath().size(), 1);
		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
		ensure_equals("appquery", slurl.getAppQuery(), "12345");	
		
	}
Esempio n. 26
0
void LLPanelLogin::setLocation(const LLSLURL& slurl)
{
	LL_DEBUGS("AppInit")<<"setting Location "<<slurl.asString()<<LL_ENDL;
	LLStartUp::setStartSLURL(slurl); // calls onUpdateStartSLURL, above
}