diff options
Diffstat (limited to 'indra/newview/llfloaterexperiences.cpp')
-rw-r--r-- | indra/newview/llfloaterexperiences.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index d973fe5b33..777dc382cd 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -26,6 +26,7 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterexperiences.h" +#include "llfloaterreg.h" #include "llagent.h" #include "llevents.h" @@ -206,19 +207,8 @@ void LLFloaterExperiences::refreshContents() LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); } - lookup_url = region->getCapability("GetAdminExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Admin_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); - } - - lookup_url = region->getCapability("GetCreatorExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Contrib_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); - } + updateInfo("GetAdminExperiences","Admin_Experiences_Tab"); + updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab"); lookup_url = region->getCapability("AgentExperiences"); if(!lookup_url.empty()) @@ -308,6 +298,24 @@ void LLFloaterExperiences::onClose( bool app_quitting ) void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content) const { panel->enableButton(content.has("purchase")); + + LLFloaterExperiences::findInstance()->updateInfo("GetAdminExperiences","Admin_Experiences_Tab"); + LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab"); +} + +void LLFloaterExperiences::updateInfo(std::string experiences, std::string tab) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + LLExperienceListResponder::NameMap nameMap; + std::string lookup_url = region->getCapability(experiences); + if(!lookup_url.empty()) + { + nameMap["experience_ids"]=tab; + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); + } + } } void LLFloaterExperiences::sendPurchaseRequest() const @@ -325,3 +333,8 @@ void LLFloaterExperiences::sendPurchaseRequest() const LLHTTPClient::post(url, content, responder); } } + +LLFloaterExperiences* LLFloaterExperiences::findInstance() +{ + return LLFloaterReg::findTypedInstance<LLFloaterExperiences>("experiences"); +} |