From a6faeac94530e59d2c2a56df63a1d78e00fb0247 Mon Sep 17 00:00:00 2001 From: dolphin Date: Fri, 25 Oct 2013 09:48:41 -0700 Subject: Fixed the unintentional removal of experiences from teh list floater. Added a message to the UI for privileged experiences. --- indra/newview/llfloaterexperienceprofile.cpp | 63 ++++++++++++++++++---- .../default/xui/en/floater_experienceprofile.xml | 18 +++++-- 2 files changed, 67 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 25dde49b8e..2a81c6cdec 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -58,6 +58,7 @@ #define TF_OWNER "OwnerText" #define TF_GROUP "GroupText" #define TF_GRID_WIDE "grid_wide" +#define TF_PRIVILEGED "privileged" #define EDIT "edit_" #define IMG_LOGO "logo" @@ -161,14 +162,45 @@ public: class ExperiencePreferencesResponder : public LLHTTPClient::Responder { public: - ExperiencePreferencesResponder() + ExperiencePreferencesResponder(bool single):mSingle(single) { } + void sendSingle(const LLSD& content, const LLSD& permission, const char* name) + { + if(!content.has(name)) + return; + + LLEventPump& pump = LLEventPumps::instance().obtain("experience_permission"); + const LLSD& list = content[name]; + LLSD::array_const_iterator it = list.beginArray(); + while(it != list.endArray()) + { + LLSD message; + message[it->asString()] = permission; + pump.post(message); + ++it; + } + } + virtual void result(const LLSD& content) { + if(mSingle) + { + LLSD experience; + experience["permission"]="Allow"; + + sendSingle(content, experience, "experiences"); + + experience["permission"]="Block"; + sendSingle(content, experience, "blocked"); + + return; + } LLEventPumps::instance().obtain("experience_permission").post(content); } +private: + bool mSingle; }; @@ -222,12 +254,6 @@ BOOL LLFloaterExperienceProfile::postBuild() { LLHTTPClient::get(lookup_url+"?experience_id="+mExperienceId.asString(), new IsAdminResponder(getDerivedHandle())); } - - lookup_url=region->getCapability("ExperiencePreferences"); - if(!lookup_url.empty()) - { - LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder()); - } } } @@ -312,7 +338,7 @@ void LLFloaterExperienceProfile::onClickPermission(const char* perm) permission["permission"]=perm; data[mExperienceId.asString()]=permission; - LLHTTPClient::put(lookup_url, data, new ExperiencePreferencesResponder()); + LLHTTPClient::put(lookup_url, data, new ExperiencePreferencesResponder(false)); } @@ -327,7 +353,7 @@ void LLFloaterExperienceProfile::onClickForget() if(lookup_url.empty()) return; - LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder()); + LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(false)); } bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child, LLComboBox* combo ) @@ -377,7 +403,6 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLLayoutPanel* locationPanel = getChild(PNL_LOC); LLLayoutPanel* marketplacePanel = getChild(PNL_MRKT); LLLayoutPanel* topPanel = getChild(PNL_TOP); - LLLayoutPanel* permPanel = getChild(PNL_PERMS); imagePanel->setVisible(FALSE); @@ -449,7 +474,23 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) } - permPanel->setVisible((properties & LLExperienceCache::PROPERTY_PRIVILEGED) == 0); + if(properties & LLExperienceCache::PROPERTY_PRIVILEGED) + { + child = getChild(TF_PRIVILEGED); + child->setVisible(TRUE); + } + else + { + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("ExperiencePreferences"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(true)); + } + } + } value=experience[LLExperienceCache::METADATA].asString(); if(value.empty()) diff --git a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml index 2b936b79c9..b823b338ad 100644 --- a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml +++ b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml @@ -353,13 +353,13 @@