diff options
| -rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 58 | ||||
| -rwxr-xr-x | indra/newview/llfloaterregioninfo.h | 7 | ||||
| -rwxr-xr-x | indra/newview/llviewerregion.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_experiences.xml | 39 | 
4 files changed, 99 insertions, 6 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index b7f66a2c0b..43f0ba10a1 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -96,6 +96,7 @@  #include <boost/function.hpp>  #include "llfloaterexperiencepicker.h"  #include "llexperiencecache.h" +#include "llpanelexperiences.h"  const S32 TERRAIN_TEXTURE_COUNT = 4;  const S32 CORNER_COUNT = 4; @@ -3482,13 +3483,20 @@ BOOL LLPanelRegionExperiences::postBuild()  	mAllowed = setupList("panel_allowed");  	mTrusted = setupList("panel_trusted");  	mBlocked = setupList("panel_blocked"); +	mOwned = LLPanelExperiences::create("owned"); +	LLPanel* pOwned = findChild<LLPanel>("panel_owned"); +	pOwned->addChild(mOwned); +	mOwned->setShape(pOwned->getRect());  	return LLPanelRegionInfo::postBuild();  }  LLPanelExperienceListEditor* LLPanelRegionExperiences::setupList( const char* control_name )  {  	LLPanelExperienceListEditor* child = findChild<LLPanelExperienceListEditor>(control_name); -	child->getChild<LLTextBox>("text_name")->setText(getString(control_name)); +	if(child) +	{ +		child->getChild<LLTextBox>("text_name")->setText(getString(control_name)); +	}  	return child;  } @@ -3552,6 +3560,23 @@ void LLPanelRegionExperiences::infoCallback(LLHandle<LLPanelRegionExperiences> h  	{  		floater->processResponse(content);  	} + +} + + +void LLPanelRegionExperiences::ownedCallback( LLHandle<LLPanelRegionExperiences> handle, const LLSD& content ) +{ +	if(handle.isDead()) +		return; + +	LLPanelRegionExperiences* floater = handle.get(); +	if (floater && content.has("experience_ids")) +	{ +		const LLSD& ids = content["experience_ids"]; +		floater->getChild<LLButton>("btn_buy")->setEnabled(ids.beginArray() == ids.endArray()); + +		floater->setOwnedExperiences(content["experience_ids"]); +	}  } @@ -3587,7 +3612,18 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region)  	mTrusted->setReadonly(!allow_modify);  	mTrusted->addFilter(boost::bind(&LLPanelRegionExperiences::FilterExisting, this, _1)); -	std::string url = region->getCapability("RegionExperiences"); +	std::string url = region->getCapability("AgentExperiences"); +	mOwned->getParent()->setVisible(!url.empty() && region && region->canManageEstate()); + +	if(!url.empty()) +	{ +		LLHTTPClient::get(url, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::ownedCallback,  +			getDerivedHandle<LLPanelRegionExperiences>(), _1))); + +		getChild<LLButton>("btn_buy")->setCommitCallback(boost::bind(&LLPanelRegionExperiences::sendPurchaseRequest, this)); +	} + +	url = region->getCapability("RegionExperiences");  	if (!url.empty())  	{  		LLHTTPClient::get(url, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::infoCallback,  @@ -3631,3 +3667,21 @@ void LLPanelRegionExperiences::listChanged()  {  	onChangeAnything();  } + +void LLPanelRegionExperiences::setOwnedExperiences( const LLSD& experiences ) +{ +	mOwned->setExperienceList(experiences); +} + +void LLPanelRegionExperiences::sendPurchaseRequest() const +{ +	LLViewerRegion* region = gAgent.getRegion(); +	std::string url = region->getCapability("AgentExperiences"); +	if(!url.empty()) +	{ +		LLSD content; + +		LLHTTPClient::post(url, content, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::ownedCallback,  +			getDerivedHandle<LLPanelRegionExperiences>(), _1))); +	} +} diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index ccd42f9764..066a5c5da9 100755 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -61,6 +61,7 @@ class LLPanelRegionTerrainInfo;  class LLPanelEstateInfo;  class LLPanelEstateCovenant;  class LLPanelExperienceListEditor; +class LLPanelExperiences;  class LLEventTimer;  class LLEnvironmentSettings; @@ -461,10 +462,12 @@ public:  	virtual BOOL sendUpdate();  	static void infoCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content); -  	void listChanged();  	bool refreshFromRegion(LLViewerRegion* region); +	void sendPurchaseRequest()const;  private: +	static void ownedCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content); +	void setOwnedExperiences(const LLSD& experiences);  	void processResponse( const LLSD& content );  	boost::signals2::connection processResponse( LLPanelExperienceListEditor* panel, boost::signals2::connection& connection, const LLSD& content);  	void refreshRegionExperiences(); @@ -473,6 +476,8 @@ private:  	static LLSD addIds( LLPanelExperienceListEditor* panel );  	bool FilterExisting(const LLSD& experience ); + +	LLPanelExperiences*		     mOwned;  	LLPanelExperienceListEditor* mTrusted;  	boost::signals2::connection  mTrustedConnection;  	LLPanelExperienceListEditor* mAllowed; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 454f83f713..28fa93c442 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1601,6 +1601,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)  	capabilityNames.append("GetDisplayNames");  	capabilityNames.append("GetExperiences"); +	capabilityNames.append("AgentExperiences");  	capabilityNames.append("FindExperienceByName");  	capabilityNames.append("GetExperienceInfo");  	capabilityNames.append("GetAdminExperiences"); diff --git a/indra/newview/skins/default/xui/en/panel_region_experiences.xml b/indra/newview/skins/default/xui/en/panel_region_experiences.xml index f4d38c0e08..ee908348a3 100644 --- a/indra/newview/skins/default/xui/en/panel_region_experiences.xml +++ b/indra/newview/skins/default/xui/en/panel_region_experiences.xml @@ -1,7 +1,7 @@  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>  <panel    border="true" -  follows="top|left" +  follows="all"    height="320"    help_topic="panel_region_experience_tab"    label="Experiences" @@ -27,12 +27,45 @@      left="5"      layout="topleft"      follows="all" -    top="100" +    top="0"      right="-5" -    height="140" +    height="320"      min_height="140"      orientation="vertical">      <layout_panel +      layout="topleft" +      height="100" +      min_height="100" +      width="530"> +      <text +        layout="topleft" +        follows="left|top" +        height="18" +        left="0" +        top="4" +        value="Your Experiences" +        width="460"/> +      <button +        layout="topleft" +        left="464" +        top="4" +        follows="top|right" +        width="64" +        name="btn_buy" +        label="Buy" +        enabled="false"/> +      <panel +        layout="topleft" +        border="true" +        left="0" +        top="22" +        height="74" +        follows="all" +        width="460" +        name="panel_owned">         +      </panel>       +    </layout_panel> +    <layout_panel        height="100"        min_height="100"        width="530">  | 
