diff options
author | dolphin <dolphin@lindenlab.com> | 2014-02-26 13:55:32 -0800 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2014-02-26 13:55:32 -0800 |
commit | 95523616b89dadd697eb6cfa3a466feadc1e1208 (patch) | |
tree | 697ec3821aeea713147375e12fbf4ddedc8a5281 /indra/newview/llfloaterregioninfo.cpp | |
parent | 7c3e51b05cfe8757bc72a8b5c19eff307b1e501f (diff) |
Updated purchase UI for experiences.
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 58 |
1 files changed, 56 insertions, 2 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))); + } +} |