PageRenderTime 98ms CodeModel.GetById 43ms app.highlight 49ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llpanelplaceprofile.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 666 lines | 517 code | 94 blank | 55 comment | 42 complexity | db3774d8a453986b735b10b2d2ae877c MD5 | raw file
  1/**
  2 * @file llpanelplaceprofile.cpp
  3 * @brief Displays place profile in Side Tray.
  4 *
  5 * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#include "llviewerprecompiledheaders.h"
 28
 29#include "llpanelplaceprofile.h"
 30
 31#include "llavatarnamecache.h"
 32#include "llparcel.h"
 33#include "message.h"
 34
 35#include "llexpandabletextbox.h"
 36#include "lliconctrl.h"
 37#include "lllineeditor.h"
 38#include "lltextbox.h"
 39#include "lltexteditor.h"
 40
 41#include "lltrans.h"
 42
 43#include "llaccordionctrl.h"
 44#include "llaccordionctrltab.h"
 45#include "llagent.h"
 46#include "llagentui.h"
 47#include "llappviewer.h"
 48#include "llcallbacklist.h"
 49#include "llbuycurrencyhtml.h"
 50#include "llslurl.h"
 51#include "llstatusbar.h"
 52#include "llviewercontrol.h"
 53#include "llviewerparcelmgr.h"
 54#include "llviewerregion.h"
 55
 56static LLRegisterPanelClassWrapper<LLPanelPlaceProfile> t_place_profile("panel_place_profile");
 57
 58// Statics for textures filenames
 59static std::string icon_pg;
 60static std::string icon_m;
 61static std::string icon_r;
 62static std::string icon_voice;
 63static std::string icon_voice_no;
 64static std::string icon_fly;
 65static std::string icon_fly_no;
 66static std::string icon_push;
 67static std::string icon_push_no;
 68static std::string icon_build;
 69static std::string icon_build_no;
 70static std::string icon_scripts;
 71static std::string icon_scripts_no;
 72static std::string icon_damage;
 73static std::string icon_damage_no;
 74static std::string icon_see_avs_on;
 75static std::string icon_see_avs_off;
 76
 77LLPanelPlaceProfile::LLPanelPlaceProfile()
 78:	LLPanelPlaceInfo(),
 79	mForSalePanel(NULL),
 80	mYouAreHerePanel(NULL),
 81	mSelectedParcelID(-1),
 82	mAccordionCtrl(NULL)
 83{}
 84
 85// virtual
 86LLPanelPlaceProfile::~LLPanelPlaceProfile()
 87{
 88	gIdleCallbacks.deleteFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
 89}
 90
 91// virtual
 92BOOL LLPanelPlaceProfile::postBuild()
 93{
 94	LLPanelPlaceInfo::postBuild();
 95
 96	mForSalePanel = getChild<LLPanel>("for_sale_panel");
 97	mYouAreHerePanel = getChild<LLPanel>("here_panel");
 98	gIdleCallbacks.addFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
 99
100	//Icon value should contain sale price of last selected parcel.
101	mForSalePanel->getChild<LLIconCtrl>("icon_for_sale")->
102				setMouseDownCallback(boost::bind(&LLPanelPlaceProfile::onForSaleBannerClick, this));
103
104	mParcelOwner = getChild<LLTextBox>("owner_value");
105
106	mParcelRatingIcon = getChild<LLIconCtrl>("rating_icon");
107	mParcelRatingText = getChild<LLTextBox>("rating_value");
108	mVoiceIcon = getChild<LLIconCtrl>("voice_icon");
109	mVoiceText = getChild<LLTextBox>("voice_value");
110	mFlyIcon = getChild<LLIconCtrl>("fly_icon");
111	mFlyText = getChild<LLTextBox>("fly_value");
112	mPushIcon = getChild<LLIconCtrl>("push_icon");
113	mPushText = getChild<LLTextBox>("push_value");
114	mBuildIcon = getChild<LLIconCtrl>("build_icon");
115	mBuildText = getChild<LLTextBox>("build_value");
116	mScriptsIcon = getChild<LLIconCtrl>("scripts_icon");
117	mScriptsText = getChild<LLTextBox>("scripts_value");
118	mDamageIcon = getChild<LLIconCtrl>("damage_icon");
119	mDamageText = getChild<LLTextBox>("damage_value");
120	mSeeAVsIcon = getChild<LLIconCtrl>("see_avatars_icon");
121	mSeeAVsText = getChild<LLTextBox>("see_avatars_value");
122
123	mRegionNameText = getChild<LLTextBox>("region_name");
124	mRegionTypeText = getChild<LLTextBox>("region_type");
125	mRegionRatingIcon = getChild<LLIconCtrl>("region_rating_icon");
126	mRegionRatingText = getChild<LLTextBox>("region_rating");
127	mRegionOwnerText = getChild<LLTextBox>("region_owner");
128	mRegionGroupText = getChild<LLTextBox>("region_group");
129
130	mEstateNameText = getChild<LLTextBox>("estate_name");
131	mEstateRatingText = getChild<LLTextBox>("estate_rating");
132	mEstateOwnerText = getChild<LLTextBox>("estate_owner");
133	mCovenantText = getChild<LLTextEditor>("covenant");
134
135	mSalesPriceText = getChild<LLTextBox>("sales_price");
136	mAreaText = getChild<LLTextBox>("area");
137	mTrafficText = getChild<LLTextBox>("traffic");
138	mPrimitivesText = getChild<LLTextBox>("primitives");
139	mParcelScriptsText = getChild<LLTextBox>("parcel_scripts");
140	mTerraformLimitsText = getChild<LLTextBox>("terraform_limits");
141	mSubdivideText = getChild<LLTextEditor>("subdivide");
142	mResaleText = getChild<LLTextEditor>("resale");
143	mSaleToText = getChild<LLTextBox>("sale_to");
144	mAccordionCtrl = getChild<LLAccordionCtrl>("advanced_info_accordion");
145
146	icon_pg = getString("icon_PG");
147	icon_m = getString("icon_M");
148	icon_r = getString("icon_R");
149	icon_voice = getString("icon_Voice");
150	icon_voice_no = getString("icon_VoiceNo");
151	icon_fly = getString("icon_Fly");
152	icon_fly_no = getString("icon_FlyNo");
153	icon_push = getString("icon_Push");
154	icon_push_no = getString("icon_PushNo");
155	icon_build = getString("icon_Build");
156	icon_build_no = getString("icon_BuildNo");
157	icon_scripts = getString("icon_Scripts");
158	icon_scripts_no = getString("icon_ScriptsNo");
159	icon_damage = getString("icon_Damage");
160	icon_damage_no = getString("icon_DamageNo");
161	icon_see_avs_on = getString("icon_SeeAVs_On");
162	icon_see_avs_off = getString("icon_SeeAVs_Off");
163
164	return TRUE;
165}
166
167// virtual
168void LLPanelPlaceProfile::resetLocation()
169{
170	LLPanelPlaceInfo::resetLocation();
171
172	mForSalePanel->setVisible(FALSE);
173	mYouAreHerePanel->setVisible(FALSE);
174
175	std::string loading = LLTrans::getString("LoadingData");
176	mParcelOwner->setValue(loading);
177
178	mParcelRatingIcon->setValue(loading);
179	mParcelRatingText->setText(loading);
180	mVoiceIcon->setValue(loading);
181	mVoiceText->setText(loading);
182	mFlyIcon->setValue(loading);
183	mFlyText->setText(loading);
184	mPushIcon->setValue(loading);
185	mPushText->setText(loading);
186	mBuildIcon->setValue(loading);
187	mBuildText->setText(loading);
188	mScriptsIcon->setValue(loading);
189	mScriptsText->setText(loading);
190	mDamageIcon->setValue(loading);
191	mDamageText->setText(loading);
192	mSeeAVsIcon->setValue(loading);
193	mSeeAVsText->setText(loading);
194
195	mRegionNameText->setValue(loading);
196	mRegionTypeText->setValue(loading);
197	mRegionRatingIcon->setValue(loading);
198	mRegionRatingText->setValue(loading);
199	mRegionOwnerText->setValue(loading);
200	mRegionGroupText->setValue(loading);
201
202	mEstateNameText->setValue(loading);
203	mEstateRatingText->setValue(loading);
204	mEstateOwnerText->setValue(loading);
205	mCovenantText->setValue(loading);
206
207	mSalesPriceText->setValue(loading);
208	mAreaText->setValue(loading);
209	mTrafficText->setValue(loading);
210	mPrimitivesText->setValue(loading);
211	mParcelScriptsText->setValue(loading);
212	mTerraformLimitsText->setValue(loading);
213	mSubdivideText->setValue(loading);
214	mResaleText->setValue(loading);
215	mSaleToText->setValue(loading);
216}
217
218// virtual
219void LLPanelPlaceProfile::setInfoType(EInfoType type)
220{
221	bool is_info_type_agent = type == AGENT;
222
223	mMaturityRatingIcon->setVisible(!is_info_type_agent);
224	mMaturityRatingText->setVisible(!is_info_type_agent);
225
226	getChild<LLTextBox>("owner_label")->setVisible(is_info_type_agent);
227	mParcelOwner->setVisible(is_info_type_agent);
228
229	getChild<LLAccordionCtrl>("advanced_info_accordion")->setVisible(is_info_type_agent);
230
231	// If we came from search we want larger description area, approx. 10 lines (see STORM-1311).
232	// Don't use the maximum available space because that leads to nasty artifacts
233	// in text editor and expandable text box.
234	{
235		const S32 SEARCH_DESC_HEIGHT = 150;
236
237		// Remember original geometry (once).
238		static const S32 sOrigDescVPad = getChildView("parcel_title")->getRect().mBottom - mDescEditor->getRect().mTop;
239		static const S32 sOrigDescHeight = mDescEditor->getRect().getHeight();
240		static const S32 sOrigMRIconVPad = mDescEditor->getRect().mBottom - mMaturityRatingIcon->getRect().mTop;
241		static const S32 sOrigMRTextVPad = mDescEditor->getRect().mBottom - mMaturityRatingText->getRect().mTop;
242
243		// Resize the description.
244		const S32 desc_height = is_info_type_agent ? sOrigDescHeight : SEARCH_DESC_HEIGHT;
245		const S32 desc_top = getChildView("parcel_title")->getRect().mBottom - sOrigDescVPad;
246		LLRect desc_rect = mDescEditor->getRect();
247		desc_rect.setOriginAndSize(desc_rect.mLeft, desc_top - desc_height, desc_rect.getWidth(), desc_height);
248		mDescEditor->reshape(desc_rect.getWidth(), desc_rect.getHeight());
249		mDescEditor->setRect(desc_rect);
250		mDescEditor->updateTextShape();
251
252		// Move the maturity rating icon/text accordingly.
253		const S32 mr_icon_bottom = mDescEditor->getRect().mBottom - sOrigMRIconVPad - mMaturityRatingIcon->getRect().getHeight();
254		const S32 mr_text_bottom = mDescEditor->getRect().mBottom - sOrigMRTextVPad - mMaturityRatingText->getRect().getHeight();
255		mMaturityRatingIcon->setOrigin(mMaturityRatingIcon->getRect().mLeft, mr_icon_bottom);
256		mMaturityRatingText->setOrigin(mMaturityRatingText->getRect().mLeft, mr_text_bottom);
257	}
258
259	switch(type)
260	{
261		case AGENT:
262		case PLACE:
263		default:
264			mCurrentTitle = getString("title_place");
265		break;
266
267		case TELEPORT_HISTORY:
268			mCurrentTitle = getString("title_teleport_history");
269		break;
270	}
271
272	if (mAccordionCtrl != NULL)
273	{
274		mAccordionCtrl->expandDefaultTab();
275	}
276
277	LLPanelPlaceInfo::setInfoType(type);
278}
279
280// virtual
281void LLPanelPlaceProfile::processParcelInfo(const LLParcelData& parcel_data)
282{
283	LLPanelPlaceInfo::processParcelInfo(parcel_data);
284
285	// HACK: Flag 0x2 == adult region,
286	// Flag 0x1 == mature region, otherwise assume PG
287	if (parcel_data.flags & 0x2)
288	{
289		mMaturityRatingIcon->setValue(icon_r);
290		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
291	}
292	else if (parcel_data.flags & 0x1)
293	{
294		mMaturityRatingIcon->setValue(icon_m);
295		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
296	}
297	else
298	{
299		mMaturityRatingIcon->setValue(icon_pg);
300		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
301	}
302}
303
304// virtual
305void LLPanelPlaceProfile::handleVisibilityChange(BOOL new_visibility)
306{
307	LLPanel::handleVisibilityChange(new_visibility);
308
309	LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
310	if (!parcel_mgr)
311		return;
312
313	// Remove land selection when panel hides.
314	if (!new_visibility)
315	{
316		if (!parcel_mgr->selectionEmpty())
317		{
318			parcel_mgr->deselectUnused();
319		}
320	}
321}
322
323void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
324													LLViewerRegion* region,
325													const LLVector3d& pos_global,
326													bool is_current_parcel)
327{
328	if (!region || !parcel)
329		return;
330
331	// send EstateCovenantInfo message
332	LLMessageSystem *msg = gMessageSystem;
333	msg->newMessage("EstateCovenantRequest");
334	msg->nextBlockFast(_PREHASH_AgentData);
335	msg->addUUIDFast(_PREHASH_AgentID,	gAgent.getID());
336	msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
337	msg->sendReliable(region->getHost());
338
339	LLParcelData parcel_data;
340
341	// HACK: Converting sim access flags to the format
342	// returned by remote parcel response.
343	U8 sim_access = region->getSimAccess();
344	switch(sim_access)
345	{
346	case SIM_ACCESS_MATURE:
347		parcel_data.flags = 0x1;
348
349		mParcelRatingIcon->setValue(icon_m);
350		mRegionRatingIcon->setValue(icon_m);
351		break;
352
353	case SIM_ACCESS_ADULT:
354		parcel_data.flags = 0x2;
355
356		mParcelRatingIcon->setValue(icon_r);
357		mRegionRatingIcon->setValue(icon_r);
358		break;
359
360	default:
361		parcel_data.flags = 0;
362
363		mParcelRatingIcon->setValue(icon_pg);
364		mRegionRatingIcon->setValue(icon_pg);
365	}
366
367	std::string rating = LLViewerRegion::accessToString(sim_access);
368	mParcelRatingText->setText(rating);
369	mRegionRatingText->setText(rating);
370
371	parcel_data.desc = parcel->getDesc();
372	parcel_data.name = parcel->getName();
373	parcel_data.sim_name = region->getName();
374	parcel_data.snapshot_id = parcel->getSnapshotID();
375	mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
376					  (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
377					  (F32)pos_global.mdV[VZ]);
378	parcel_data.global_x = pos_global.mdV[VX];
379	parcel_data.global_y = pos_global.mdV[VY];
380	parcel_data.global_z = pos_global.mdV[VZ];
381
382	std::string on = getString("on");
383	std::string off = getString("off");
384
385	LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
386
387	// Processing parcel characteristics
388	if (vpm->allowAgentVoice(region, parcel))
389	{
390		mVoiceIcon->setValue(icon_voice);
391		mVoiceText->setText(on);
392	}
393	else
394	{
395		mVoiceIcon->setValue(icon_voice_no);
396		mVoiceText->setText(off);
397	}
398
399	if (vpm->allowAgentFly(region, parcel))
400	{
401		mFlyIcon->setValue(icon_fly);
402		mFlyText->setText(on);
403	}
404	else
405	{
406		mFlyIcon->setValue(icon_fly_no);
407		mFlyText->setText(off);
408	}
409
410	if (vpm->allowAgentPush(region, parcel))
411	{
412		mPushIcon->setValue(icon_push);
413		mPushText->setText(on);
414	}
415	else
416	{
417		mPushIcon->setValue(icon_push_no);
418		mPushText->setText(off);
419	}
420
421	if (vpm->allowAgentBuild(parcel))
422	{
423		mBuildIcon->setValue(icon_build);
424		mBuildText->setText(on);
425	}
426	else
427	{
428		mBuildIcon->setValue(icon_build_no);
429		mBuildText->setText(off);
430	}
431
432	if (vpm->allowAgentScripts(region, parcel))
433	{
434		mScriptsIcon->setValue(icon_scripts);
435		mScriptsText->setText(on);
436	}
437	else
438	{
439		mScriptsIcon->setValue(icon_scripts_no);
440		mScriptsText->setText(off);
441	}
442
443	if (vpm->allowAgentDamage(region, parcel))
444	{
445		mDamageIcon->setValue(icon_damage);
446		mDamageText->setText(on);
447	}
448	else
449	{
450		mDamageIcon->setValue(icon_damage_no);
451		mDamageText->setText(off);
452	}
453
454	if (parcel->getSeeAVs())
455	{
456		mSeeAVsIcon->setValue(icon_see_avs_on);
457		mSeeAVsText->setText(on);
458	}
459	else
460	{
461		mSeeAVsIcon->setValue(icon_see_avs_off);
462		mSeeAVsText->setText(off);
463	}
464
465	mRegionNameText->setText(region->getName());
466	mRegionTypeText->setText(region->getLocalizedSimProductName());
467
468	// Determine parcel owner
469	if (parcel->isPublic())
470	{
471		mParcelOwner->setText(getString("public"));
472		mRegionOwnerText->setText(getString("public"));
473	}
474	else
475	{
476		if (parcel->getIsGroupOwned())
477		{
478			mRegionOwnerText->setText(getString("group_owned_text"));
479
480			if(!parcel->getGroupID().isNull())
481			{
482				// FIXME: Using parcel group as region group.
483				gCacheName->getGroup(parcel->getGroupID(),
484								boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionGroupText, _2));
485
486				gCacheName->getGroup(parcel->getGroupID(),
487								boost::bind(&LLPanelPlaceInfo::onNameCache, mParcelOwner, _2));
488			}
489			else
490			{
491				std::string owner = getString("none_text");
492				mRegionGroupText->setText(owner);
493				mParcelOwner->setText(owner);
494			}
495		}
496		else
497		{
498			// Figure out the owner's name
499			std::string parcel_owner =
500				LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
501			mParcelOwner->setText(parcel_owner);
502			LLAvatarNameCache::get(region->getOwner(),
503								   boost::bind(&LLPanelPlaceInfo::onAvatarNameCache,
504											   _1, _2, mRegionOwnerText));
505		}
506
507		if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
508		{
509			mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text"));
510		}
511	}
512
513	mEstateRatingText->setText(region->getSimAccessString());
514
515	S32 area;
516	S32 claim_price;
517	S32 rent_price;
518	F32 dwell;
519	BOOL for_sale;
520	vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell);
521	if (for_sale)
522	{
523		const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
524		if(auth_buyer_id.notNull())
525		{
526			LLAvatarNameCache::get(auth_buyer_id,
527								   boost::bind(&LLPanelPlaceInfo::onAvatarNameCache,
528											   _1, _2, mSaleToText));
529			
530			// Show sales info to a specific person or a group he belongs to.
531			if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id))
532			{
533				for_sale = FALSE;
534			}
535		}
536		else
537		{
538			mSaleToText->setText(getString("anyone"));
539		}
540
541		mForSalePanel->setVisible(for_sale);
542
543		const U8* sign = (U8*)getString("price_text").c_str();
544		const U8* sqm = (U8*)getString("area_text").c_str();
545
546		mSalesPriceText->setText(llformat("%s%d ", sign, parcel->getSalePrice()));
547		mAreaText->setText(llformat("%d %s", area, sqm));
548		mTrafficText->setText(llformat("%.0f", dwell));
549
550		// Can't have more than region max tasks, regardless of parcel
551		// object bonus factor.
552		S32 primitives = llmin(llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
553							   (S32)region->getMaxTasks());
554
555		const U8* available = (U8*)getString("available").c_str();
556		const U8* allocated = (U8*)getString("allocated").c_str();
557
558		mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available, parcel->getPrimCount(), allocated));
559
560		if (parcel->getAllowOtherScripts())
561		{
562			mParcelScriptsText->setText(getString("all_residents_text"));
563		}
564		else if (parcel->getAllowGroupScripts())
565		{
566			mParcelScriptsText->setText(getString("group_text"));
567		}
568		else
569		{
570			mParcelScriptsText->setText(off);
571		}
572
573		mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off);
574
575		if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
576		{
577			mSubdivideText->setText(getString("can_change"));
578		}
579		else
580		{
581			mSubdivideText->setText(getString("can_not_change"));
582		}
583		if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
584		{
585			mResaleText->setText(getString("can_not_resell"));
586		}
587		else
588		{
589			mResaleText->setText(getString("can_resell"));
590		}
591	}
592
593	mSelectedParcelID = parcel->getLocalID();
594	mLastSelectedRegionID = region->getRegionID();
595	LLPanelPlaceInfo::processParcelInfo(parcel_data);
596
597	mYouAreHerePanel->setVisible(is_current_parcel);
598	getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale);
599}
600
601void LLPanelPlaceProfile::updateEstateName(const std::string& name)
602{
603	mEstateNameText->setText(name);
604}
605
606void LLPanelPlaceProfile::updateEstateOwnerName(const std::string& name)
607{
608	mEstateOwnerText->setText(name);
609}
610
611void LLPanelPlaceProfile::updateCovenantText(const std::string &text)
612{
613	mCovenantText->setText(text);
614}
615
616void LLPanelPlaceProfile::onForSaleBannerClick()
617{
618	LLViewerParcelMgr* mgr = LLViewerParcelMgr::getInstance();
619	LLParcel* parcel = mgr->getFloatingParcelSelection()->getParcel();
620	LLViewerRegion* selected_region =  mgr->getSelectionRegion();
621	if(parcel && selected_region)
622	{
623		if(parcel->getLocalID() == mSelectedParcelID &&
624				mLastSelectedRegionID ==selected_region->getRegionID())
625		{
626			S32 price = parcel->getSalePrice();
627
628			if(price - gStatusBar->getBalance() > 0)
629			{
630				LLStringUtil::format_map_t args;
631				args["AMOUNT"] = llformat("%d", price);
632				LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("buying_selected_land", args), price );
633			}
634			else
635			{
636				LLViewerParcelMgr::getInstance()->startBuyLand();
637			}
638		}
639		else
640		{
641			LL_WARNS("Places") << "User  is trying  to buy remote parcel.Operation is not supported"<< LL_ENDL;
642		}
643
644	}
645}
646
647// static
648void LLPanelPlaceProfile::updateYouAreHereBanner(void* userdata)
649{
650	//YouAreHere Banner should be displayed only for selected places,
651	// If you want to display it for landmark or teleport history item, you should check by mParcelId
652
653	LLPanelPlaceProfile* self = static_cast<LLPanelPlaceProfile*>(userdata);
654	if(!self->getVisible())
655		return;
656
657	if(!gDisconnected && gAgent.getRegion())
658	{
659		static F32 radius = gSavedSettings.getF32("YouAreHereDistance");
660
661		BOOL display_banner = gAgent.getRegion()->getRegionID() == self->mLastSelectedRegionID &&
662										LLAgentUI::checkAgentDistance(self->mPosRegion, radius);
663
664		self->mYouAreHerePanel->setVisible(display_banner);
665	}
666}