From 257110c11e5546f0a5a07b087694cfc9059367b4 Mon Sep 17 00:00:00 2001 From: dolphin Date: Wed, 21 Aug 2013 15:43:09 -0700 Subject: Added new fields to the experience cache. Experience profile moved to it's own floater, will probalby be moving again. XP profile displays most data, though the presentation is not final Fixed a bug with the XP selection combobox in the script editor --- indra/newview/llfloaterexperienceprofile.cpp | 215 +++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 indra/newview/llfloaterexperienceprofile.cpp (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp new file mode 100644 index 0000000000..821a1de6f7 --- /dev/null +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -0,0 +1,215 @@ +/** + * @file llfloaterexperienceprofile.cpp + * @brief llfloaterexperienceprofile and related class definitions + * + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterexperienceprofile.h" +#include "llexperiencecache.h" +#include "llfloaterworldmap.h" +#include "llfloaterreg.h" +#include "lllayoutstack.h" +#include "lltextbox.h" +#include "llsdserialize.h" +#include "llexpandabletextbox.h" +#include "lltexturectrl.h" +#include "lltrans.h" + +#define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" +#define TF_NAME "experience_title" +#define TF_DESC "experience_description" +#define TF_SLURL "LocationTextText" +#define TF_MRKT "marketplace" +#define TF_MATURITY "ContentRatingText" +#define TF_OWNER "OwnerText" + +#define IMG_LOGO "logo" + +#define PNL_IMAGE "image_panel" +#define PNL_DESC "description panel" +#define PNL_LOC "location panel" +#define PNL_MRKT "marketplace panel" + +#define BTN_TP "teleport_btn" +#define BTN_MAP "show_on_map_btn" +#define BTN_EDIT "edit_btn" + + +LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data) + : LLFloater(data) + , mExperienceId(data.asUUID()) + , mImagePanel(NULL) + , mDescriptionPanel(NULL) + , mLocationPanel(NULL) + , mMarketplacePanel(NULL) +{ + +} + +LLFloaterExperienceProfile::~LLFloaterExperienceProfile() +{ + +} + + +BOOL LLFloaterExperienceProfile::postBuild() +{ + mImagePanel = getChild(PNL_IMAGE); + mDescriptionPanel = getChild(PNL_DESC); + mLocationPanel = getChild(PNL_LOC); + mMarketplacePanel = getChild(PNL_MRKT); + + if (mExperienceId.notNull()) + { + LLExperienceCache::fetch(mExperienceId, true); + LLExperienceCache::get(mExperienceId, boost::bind(&LLFloaterExperienceProfile::experienceCallback, + getDerivedHandle(), _1)); + } + + + childSetAction(BTN_TP, boost::bind(&LLFloaterExperienceProfile::onClickTeleport, this)); + childSetAction(BTN_MAP, boost::bind(&LLFloaterExperienceProfile::onClickMap, this)); + childSetAction(BTN_EDIT, boost::bind(&LLFloaterExperienceProfile::onClickEdit, this)); + + return TRUE; +} + +void LLFloaterExperienceProfile::experienceCallback(LLHandle handle, const LLSD& experience ) +{ + LLFloaterExperienceProfile* pllpep = handle.get(); + if(pllpep) + { + pllpep->refreshExperience(experience); + } +} + +void LLFloaterExperienceProfile::onClickMap() +{ +// LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); +// LLFloaterReg::showInstance("world_map", "center"); + +} + +void LLFloaterExperienceProfile::onClickTeleport() +{ +// if (!getPosGlobal().isExactlyZero()) +// { +// gAgent.teleportViaLocation(getPosGlobal()); +// LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); +// } + +} + +void LLFloaterExperienceProfile::onClickEdit() +{ + +} + +std::string LLFloaterExperienceProfile::getMaturityString(U8 maturity) +{ + if(maturity <= SIM_ACCESS_MIN) + return LLTrans::getString("SIM_ACCESS_MIN"); + if(maturity <= SIM_ACCESS_PG) + return LLTrans::getString("SIM_ACCESS_PG"); + if(maturity <= SIM_ACCESS_MATURE) + return LLTrans::getString("SIM_ACCESS_MATURE"); + if(maturity <= SIM_ACCESS_ADULT) + return LLTrans::getString("SIM_ACCESS_ADULT"); + + return LLStringUtil::null; +} + + +void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) +{ + mExperienceDetails = experience; + + if(experience.has(LLExperienceCache::MISSING)) + { + mImagePanel->setVisible(FALSE); + mDescriptionPanel->setVisible(FALSE); + mLocationPanel->setVisible(FALSE); + mMarketplacePanel->setVisible(FALSE); + } + + LLTextBox* child = getChild(TF_NAME); + child->setText(experience[LLExperienceCache::NAME].asString()); + + std::string value = experience[LLExperienceCache::DESCRIPTION].asString(); + LLExpandableTextBox* exchild = getChild(TF_DESC); + exchild->setText(value); + mDescriptionPanel->setVisible(value.length()>0); + + value = experience[LLExperienceCache::SLURL].asString(); + child = getChild(TF_SLURL); + child->setText(value); + mLocationPanel->setVisible(value.length()>0); + + child = getChild(TF_MATURITY); + child->setText(getMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()))); + + child = getChild(TF_OWNER); + child->setText(experience[LLExperienceCache::OWNER_ID].asString()); + + value=experience[LLExperienceCache::METADATA].asString(); + if(value.empty()) + return; + + LLPointer parser = new LLSDXMLParser(); + + LLSD data; + + std::istringstream is = std::istringstream(value); + if(LLSDParser::PARSE_FAILURE != parser->parse(is, data, value.size())) + { + if(data.has(TF_MRKT)) + { + value=data[TF_MRKT].asString(); + + child = getChild(TF_MRKT); + child->setText(value); + mMarketplacePanel->setVisible(TRUE); + } + else + { + mMarketplacePanel->setVisible(FALSE); + } + + if(data.has(IMG_LOGO)) + { + LLTextureCtrl* logo = getChild(IMG_LOGO); + logo->setImageAssetID(data[IMG_LOGO].asUUID()); + mImagePanel->setVisible(TRUE); + } + } + + + + + + + +} -- cgit v1.2.3 From 373d37cd7bd41daa85850280e985a43edcca0a47 Mon Sep 17 00:00:00 2001 From: dolphin Date: Thu, 22 Aug 2013 12:04:07 -0700 Subject: added missing include --- indra/newview/llfloaterexperienceprofile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 821a1de6f7..e074f83baa 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -37,6 +37,7 @@ #include "llexpandabletextbox.h" #include "lltexturectrl.h" #include "lltrans.h" +#include #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" -- cgit v1.2.3 From eaf847e60df3c078d15f8991e9448b06ffa83bf7 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 27 Aug 2013 16:37:08 -0700 Subject: experience profile work in progress --- indra/newview/llfloaterexperienceprofile.cpp | 125 ++++++++++++++++++--------- 1 file changed, 85 insertions(+), 40 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index e074f83baa..8e5a7a7588 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -27,17 +27,19 @@ #include "llviewerprecompiledheaders.h" -#include "llfloaterexperienceprofile.h" +#include "llexpandabletextbox.h" #include "llexperiencecache.h" -#include "llfloaterworldmap.h" +#include "llfloaterexperienceprofile.h" #include "llfloaterreg.h" #include "lllayoutstack.h" -#include "lltextbox.h" #include "llsdserialize.h" -#include "llexpandabletextbox.h" +#include "llslurl.h" +#include "lltextbox.h" #include "lltexturectrl.h" #include "lltrans.h" -#include +#include "llviewerregion.h" +#include "llagent.h" +#include "llhttpclient.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -54,8 +56,6 @@ #define PNL_LOC "location panel" #define PNL_MRKT "marketplace panel" -#define BTN_TP "teleport_btn" -#define BTN_MAP "show_on_map_btn" #define BTN_EDIT "edit_btn" @@ -76,6 +76,29 @@ LLFloaterExperienceProfile::~LLFloaterExperienceProfile() } +class IsAdminResponder : public LLHTTPClient::Responder +{ +public: + IsAdminResponder(const LLHandle& parent):mParent(parent) + { + } + + LLHandle mParent; + + virtual void result(const LLSD& content) + { + LLFloaterExperienceProfile* parent = mParent.get(); + if(!parent) + return; + + parent->getChild(BTN_EDIT)->setVisible(content["status"].asBoolean()); + } + virtual void error(U32 status, const std::string& reason) + { + lldebugs << "IsAdminResponder failed with code: " << status<< ", reason: " << reason << llendl; + } +}; + BOOL LLFloaterExperienceProfile::postBuild() { mImagePanel = getChild(PNL_IMAGE); @@ -87,12 +110,22 @@ BOOL LLFloaterExperienceProfile::postBuild() { LLExperienceCache::fetch(mExperienceId, true); LLExperienceCache::get(mExperienceId, boost::bind(&LLFloaterExperienceProfile::experienceCallback, - getDerivedHandle(), _1)); + getDerivedHandle(), _1)); + + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("IsExperienceAdmin"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url+"/"+mExperienceId.asString(), new IsAdminResponder(getDerivedHandle())); + } + } } + + - childSetAction(BTN_TP, boost::bind(&LLFloaterExperienceProfile::onClickTeleport, this)); - childSetAction(BTN_MAP, boost::bind(&LLFloaterExperienceProfile::onClickMap, this)); childSetAction(BTN_EDIT, boost::bind(&LLFloaterExperienceProfile::onClickEdit, this)); return TRUE; @@ -107,40 +140,42 @@ void LLFloaterExperienceProfile::experienceCallback(LLHandletrackLocation(getPosGlobal()); -// LLFloaterReg::showInstance("world_map", "center"); } -void LLFloaterExperienceProfile::onClickTeleport() +bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child ) { -// if (!getPosGlobal().isExactlyZero()) -// { -// gAgent.teleportViaLocation(getPosGlobal()); -// LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); -// } - -} + LLStyle::Params style; + std::string access; + if(maturity <= SIM_ACCESS_PG) + { + style.image(LLUI::getUIImage(getString("maturity_icon_general"))); + access = LLTrans::getString("SIM_ACCESS_PG"); + } + else if(maturity <= SIM_ACCESS_MATURE) + { + style.image(LLUI::getUIImage(getString("maturity_icon_moderate"))); + access = LLTrans::getString("SIM_ACCESS_MATURE"); + } + else if(maturity <= SIM_ACCESS_ADULT) + { + style.image(LLUI::getUIImage(getString("maturity_icon_adult"))); + access = LLTrans::getString("SIM_ACCESS_ADULT"); + } + else + { + return false; + } -void LLFloaterExperienceProfile::onClickEdit() -{ + child->setText(LLStringUtil::null); -} + child->appendImageSegment(style); -std::string LLFloaterExperienceProfile::getMaturityString(U8 maturity) -{ - if(maturity <= SIM_ACCESS_MIN) - return LLTrans::getString("SIM_ACCESS_MIN"); - if(maturity <= SIM_ACCESS_PG) - return LLTrans::getString("SIM_ACCESS_PG"); - if(maturity <= SIM_ACCESS_MATURE) - return LLTrans::getString("SIM_ACCESS_MATURE"); - if(maturity <= SIM_ACCESS_ADULT) - return LLTrans::getString("SIM_ACCESS_ADULT"); + child->appendText(access, false); - return LLStringUtil::null; + return true; } @@ -170,11 +205,21 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) mLocationPanel->setVisible(value.length()>0); child = getChild(TF_MATURITY); - child->setText(getMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()))); + setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), child); child = getChild(TF_OWNER); - child->setText(experience[LLExperienceCache::OWNER_ID].asString()); - + + LLUUID id = experience[LLExperienceCache::OWNER_ID].asUUID(); + if(experience[LLExperienceCache::GROUP_ID].asUUID() == id) + { + value = LLSLURL("group", id, "inspect").getSLURLString(); + } + else + { + value = LLSLURL("agent", id, "inspect").getSLURLString(); + } + child->setText(value); + value=experience[LLExperienceCache::METADATA].asString(); if(value.empty()) return; @@ -183,7 +228,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLSD data; - std::istringstream is = std::istringstream(value); + std::istringstream is(value); if(LLSDParser::PARSE_FAILURE != parser->parse(is, data, value.size())) { if(data.has(TF_MRKT)) @@ -213,4 +258,4 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) -} +} \ No newline at end of file -- cgit v1.2.3 From df437553ede576df4e6a1c5e4a2e177f7d8275c2 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 3 Sep 2013 10:14:24 -0700 Subject: Updated experience profile floater to have permission buttons --- indra/newview/llfloaterexperienceprofile.cpp | 151 ++++++++++++++++++++++++++- 1 file changed, 147 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 8e5a7a7588..895fd5ee4d 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -57,6 +57,9 @@ #define PNL_MRKT "marketplace panel" #define BTN_EDIT "edit_btn" +#define BTN_ALLOW "allow_btn" +#define BTN_FORGET "forget_btn" +#define BTN_BLOCK "block_btn" LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data) @@ -75,6 +78,29 @@ LLFloaterExperienceProfile::~LLFloaterExperienceProfile() } +class ExperiencePreferencesResponder : public LLHTTPClient::Responder +{ +public: + ExperiencePreferencesResponder(const LLHandle& parent):mParent(parent) + { + } + + LLHandle mParent; + + virtual void result(const LLSD& content) + { + LLFloaterExperienceProfile* parent=mParent.get(); + if(parent) + { + parent->setPreferences(content); + } + } + virtual void error(U32 status, const std::string& reason) + { + lldebugs << "ExperiencePreferencesResponder failed with code: " << status<< ", reason: " << reason << llendl; + } +}; + class IsAdminResponder : public LLHTTPClient::Responder { @@ -90,8 +116,27 @@ public: LLFloaterExperienceProfile* parent = mParent.get(); if(!parent) return; + + LLButton* edit=parent->getChild(BTN_EDIT); - parent->getChild(BTN_EDIT)->setVisible(content["status"].asBoolean()); + if(content.has("experience_ids")) + { + LLUUID id=parent->getKey().asUUID(); + const LLSD& xp_ids = content["experience_ids"]; + LLSD::array_const_iterator it = xp_ids.beginArray(); + while(it != xp_ids.endArray()) + { + if(it->asUUID() == id) + { + edit->setVisible(TRUE); + return; + } + ++it; + } + } + edit->setVisible(FALSE); + + //parent->getChild(BTN_EDIT)->setVisible(content["status"].asBoolean()); } virtual void error(U32 status, const std::string& reason) { @@ -115,10 +160,22 @@ BOOL LLFloaterExperienceProfile::postBuild() LLViewerRegion* region = gAgent.getRegion(); if (region) { - std::string lookup_url=region->getCapability("IsExperienceAdmin"); + // std::string lookup_url=region->getCapability("IsExperienceAdmin"); + // if(!lookup_url.empty()) + // { + // LLHTTPClient::get(lookup_url+"/"+mExperienceId.asString(), new IsAdminResponder(getDerivedHandle())); + // } + + std::string lookup_url=region->getCapability("GetAdminExperiences"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url, new IsAdminResponder(getDerivedHandle())); + } + + lookup_url=region->getCapability("ExperiencePreferences"); if(!lookup_url.empty()) { - LLHTTPClient::get(lookup_url+"/"+mExperienceId.asString(), new IsAdminResponder(getDerivedHandle())); + LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(getDerivedHandle())); } } } @@ -127,6 +184,9 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetAction(BTN_EDIT, boost::bind(&LLFloaterExperienceProfile::onClickEdit, this)); + childSetAction(BTN_ALLOW, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Allow")); + childSetAction(BTN_FORGET, boost::bind(&LLFloaterExperienceProfile::onClickForget, this)); + childSetAction(BTN_BLOCK, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Block")); return TRUE; } @@ -145,6 +205,39 @@ void LLFloaterExperienceProfile::onClickEdit() } + +void LLFloaterExperienceProfile::onClickPermission(const char* perm) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + return; + + std::string lookup_url=region->getCapability("ExperiencePreferences"); + if(lookup_url.empty()) + return; + LLSD permission; + LLSD data; + permission["permission"]=perm; + + data[mExperienceId.asString()]=permission; + LLHTTPClient::put(lookup_url, data, new ExperiencePreferencesResponder(getDerivedHandle())); + +} + + +void LLFloaterExperienceProfile::onClickForget() +{ + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + return; + + std::string lookup_url=region->getCapability("ExperiencePreferences"); + if(lookup_url.empty()) + return; + + LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(getDerivedHandle())); +} + bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child ) { LLStyle::Params style; @@ -258,4 +351,54 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) -} \ No newline at end of file +} + +void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) +{ + const LLSD& experiences = content["experiences"]; + const LLSD& blocked = content["blocked"]; + LLButton* button; + + + for(LLSD::array_const_iterator it = experiences.beginArray(); it != experiences.endArray() ; ++it) + { + if(it->asUUID()==mExperienceId) + { + button=getChild(BTN_ALLOW); + button->setEnabled(FALSE); + + button=getChild(BTN_FORGET); + button->setEnabled(TRUE); + + button=getChild(BTN_BLOCK); + button->setEnabled(TRUE); + return; + } + } + + for(LLSD::array_const_iterator it = blocked.beginArray(); it != blocked.endArray() ; ++it) + { + if(it->asUUID()==mExperienceId) + { + button=getChild(BTN_ALLOW); + button->setEnabled(TRUE); + + button=getChild(BTN_FORGET); + button->setEnabled(TRUE); + + button=getChild(BTN_BLOCK); + button->setEnabled(FALSE); + return; + } + } + + + button=getChild(BTN_ALLOW); + button->setEnabled(TRUE); + + button=getChild(BTN_FORGET); + button->setEnabled(FALSE); + + button=getChild(BTN_BLOCK); + button->setEnabled(TRUE); +} -- cgit v1.2.3 From ece98188a8e5c76adddf884886f44b6fc9c5ae21 Mon Sep 17 00:00:00 2001 From: dolphin Date: Fri, 6 Sep 2013 17:09:50 -0700 Subject: Added profile editing to the experience profile floater. --- indra/newview/llfloaterexperienceprofile.cpp | 353 ++++++++++++++++++++++----- 1 file changed, 297 insertions(+), 56 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 895fd5ee4d..292f6f0952 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -27,19 +27,25 @@ #include "llviewerprecompiledheaders.h" +#include "llagent.h" #include "llexpandabletextbox.h" #include "llexperiencecache.h" #include "llfloaterexperienceprofile.h" #include "llfloaterreg.h" +#include "llhttpclient.h" #include "lllayoutstack.h" #include "llsdserialize.h" #include "llslurl.h" +#include "lltabcontainer.h" #include "lltextbox.h" #include "lltexturectrl.h" #include "lltrans.h" #include "llviewerregion.h" -#include "llagent.h" -#include "llhttpclient.h" +#include "lllineeditor.h" +#include "llcombobox.h" +#include "llcheckboxctrl.h" +#include "llnotificationsutil.h" +#include "llappviewer.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -48,6 +54,7 @@ #define TF_MRKT "marketplace" #define TF_MATURITY "ContentRatingText" #define TF_OWNER "OwnerText" +#define EDIT "edit_" #define IMG_LOGO "logo" @@ -60,6 +67,10 @@ #define BTN_ALLOW "allow_btn" #define BTN_FORGET "forget_btn" #define BTN_BLOCK "block_btn" +#define BTN_CANCEL "cancel_btn" +#define BTN_SAVE "save_btn" +#define BTN_ENABLE "enable_btn" +#define BTN_PRIVATE "private_btn" LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data) @@ -69,78 +80,97 @@ LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data) , mDescriptionPanel(NULL) , mLocationPanel(NULL) , mMarketplacePanel(NULL) + , mSaveCompleteAction(NOTHING) + , mDirty(false) + , mForceClose(false) { } + LLFloaterExperienceProfile::~LLFloaterExperienceProfile() { } -class ExperiencePreferencesResponder : public LLHTTPClient::Responder +template +class HandleResponder : public LLHTTPClient::Responder { public: - ExperiencePreferencesResponder(const LLHandle& parent):mParent(parent) + HandleResponder(const LLHandle& parent):mParent(parent){} + LLHandle mParent; + + virtual void error(U32 status, const std::string& reason) { + llwarns << "HandleResponder failed with code: " << status<< ", reason: " << reason << llendl; } +}; - LLHandle mParent; +class ExperienceUpdateResponder : public HandleResponder +{ +public: + ExperienceUpdateResponder(const LLHandle& parent):HandleResponder(parent) + { + } virtual void result(const LLSD& content) { LLFloaterExperienceProfile* parent=mParent.get(); if(parent) { - parent->setPreferences(content); + parent->onSaveComplete(content); } } - virtual void error(U32 status, const std::string& reason) - { - lldebugs << "ExperiencePreferencesResponder failed with code: " << status<< ", reason: " << reason << llendl; - } }; -class IsAdminResponder : public LLHTTPClient::Responder + +class ExperiencePreferencesResponder : public HandleResponder { public: - IsAdminResponder(const LLHandle& parent):mParent(parent) + ExperiencePreferencesResponder(const LLHandle& parent):HandleResponder(parent) + { + } + + + virtual void result(const LLSD& content) { + LLFloaterExperienceProfile* parent=mParent.get(); + if(parent) + { + parent->setPreferences(content); + } } +}; - LLHandle mParent; +class IsAdminResponder : public HandleResponder +{ +public: + IsAdminResponder(const LLHandle& parent):HandleResponder(parent) + { + } + virtual void result(const LLSD& content) { LLFloaterExperienceProfile* parent = mParent.get(); if(!parent) return; - - LLButton* edit=parent->getChild(BTN_EDIT); - if(content.has("experience_ids")) + bool enabled = true; + LLViewerRegion* region = gAgent.getRegion(); + if (!region) { - LLUUID id=parent->getKey().asUUID(); - const LLSD& xp_ids = content["experience_ids"]; - LLSD::array_const_iterator it = xp_ids.beginArray(); - while(it != xp_ids.endArray()) - { - if(it->asUUID() == id) - { - edit->setVisible(TRUE); - return; - } - ++it; - } + enabled = false; } - edit->setVisible(FALSE); - - //parent->getChild(BTN_EDIT)->setVisible(content["status"].asBoolean()); - } - virtual void error(U32 status, const std::string& reason) - { - lldebugs << "IsAdminResponder failed with code: " << status<< ", reason: " << reason << llendl; + else + { + std::string url=region->getCapability("UpdateExperience"); + if(url.empty()) + enabled = false; + } + + parent->getChild(BTN_EDIT)->setVisible(enabled && content["status"].asBoolean()); } }; @@ -160,16 +190,10 @@ BOOL LLFloaterExperienceProfile::postBuild() LLViewerRegion* region = gAgent.getRegion(); if (region) { - // std::string lookup_url=region->getCapability("IsExperienceAdmin"); - // if(!lookup_url.empty()) - // { - // LLHTTPClient::get(lookup_url+"/"+mExperienceId.asString(), new IsAdminResponder(getDerivedHandle())); - // } - - std::string lookup_url=region->getCapability("GetAdminExperiences"); + std::string lookup_url=region->getCapability("IsExperienceAdmin"); if(!lookup_url.empty()) { - LLHTTPClient::get(lookup_url, new IsAdminResponder(getDerivedHandle())); + LLHTTPClient::get(lookup_url+"?experience_id="+mExperienceId.asString(), new IsAdminResponder(getDerivedHandle())); } lookup_url=region->getCapability("ExperiencePreferences"); @@ -180,14 +204,25 @@ BOOL LLFloaterExperienceProfile::postBuild() } } - - - childSetAction(BTN_EDIT, boost::bind(&LLFloaterExperienceProfile::onClickEdit, this)); childSetAction(BTN_ALLOW, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Allow")); childSetAction(BTN_FORGET, boost::bind(&LLFloaterExperienceProfile::onClickForget, this)); childSetAction(BTN_BLOCK, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Block")); + childSetAction(BTN_CANCEL, boost::bind(&LLFloaterExperienceProfile::onClickCancel, this)); + childSetAction(BTN_SAVE, boost::bind(&LLFloaterExperienceProfile::onClickSave, this)); + + + getChild(EDIT TF_NAME)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_DESC)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_SLURL)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_MATURITY)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_MRKT)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_NAME)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + childSetAction(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + childSetAction(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_DESC)->setCommitOnFocusLost(TRUE); + return TRUE; } @@ -202,7 +237,20 @@ void LLFloaterExperienceProfile::experienceCallback(LLHandle("tab_container"); + + tabs->selectTabByName("edit_panel_experience_info"); +} + + +void LLFloaterExperienceProfile::onClickCancel() +{ + changeToView(); +} +void LLFloaterExperienceProfile::onClickSave() +{ + doSave(NOTHING); } @@ -238,7 +286,7 @@ void LLFloaterExperienceProfile::onClickForget() LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(getDerivedHandle())); } -bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child ) +bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child, LLComboBox* combo ) { LLStyle::Params style; std::string access; @@ -246,16 +294,19 @@ bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* chil { style.image(LLUI::getUIImage(getString("maturity_icon_general"))); access = LLTrans::getString("SIM_ACCESS_PG"); + combo->setCurrentByIndex(2); } else if(maturity <= SIM_ACCESS_MATURE) { style.image(LLUI::getUIImage(getString("maturity_icon_moderate"))); access = LLTrans::getString("SIM_ACCESS_MATURE"); + combo->setCurrentByIndex(1); } else if(maturity <= SIM_ACCESS_ADULT) { style.image(LLUI::getUIImage(getString("maturity_icon_adult"))); access = LLTrans::getString("SIM_ACCESS_ADULT"); + combo->setCurrentByIndex(0); } else { @@ -286,29 +337,38 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLTextBox* child = getChild(TF_NAME); child->setText(experience[LLExperienceCache::NAME].asString()); - + + LLLineEditor* linechild = getChild(EDIT TF_NAME); + linechild->setText(experience[LLExperienceCache::NAME].asString()); + std::string value = experience[LLExperienceCache::DESCRIPTION].asString(); LLExpandableTextBox* exchild = getChild(TF_DESC); exchild->setText(value); mDescriptionPanel->setVisible(value.length()>0); + + LLTextEditor* edit_child = getChild(EDIT TF_DESC); + edit_child->setText(value); value = experience[LLExperienceCache::SLURL].asString(); child = getChild(TF_SLURL); child->setText(value); mLocationPanel->setVisible(value.length()>0); + + linechild = getChild(EDIT TF_SLURL); + linechild->setText(value); - child = getChild(TF_MATURITY); - setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), child); + setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), getChild(TF_MATURITY), getChild(EDIT TF_MATURITY)); child = getChild(TF_OWNER); - LLUUID id = experience[LLExperienceCache::OWNER_ID].asUUID(); - if(experience[LLExperienceCache::GROUP_ID].asUUID() == id) + LLUUID id = experience[LLExperienceCache::GROUP_ID].asUUID(); + if(id.notNull()) { value = LLSLURL("group", id, "inspect").getSLURLString(); } else { + id = experience[LLExperienceCache::AGENT_ID].asUUID(); value = LLSLURL("agent", id, "inspect").getSLURLString(); } child->setText(value); @@ -324,6 +384,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) std::istringstream is(value); if(LLSDParser::PARSE_FAILURE != parser->parse(is, data, value.size())) { + value=""; if(data.has(TF_MRKT)) { value=data[TF_MRKT].asString(); @@ -336,21 +397,31 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) { mMarketplacePanel->setVisible(FALSE); } + + linechild = getChild(EDIT TF_MRKT); + linechild->setText(value); if(data.has(IMG_LOGO)) { LLTextureCtrl* logo = getChild(IMG_LOGO); logo->setImageAssetID(data[IMG_LOGO].asUUID()); mImagePanel->setVisible(TRUE); + + logo = getChild(EDIT IMG_LOGO); + logo->setImageAssetID(data[IMG_LOGO].asUUID()); } } - - - + LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); + enable->set( 0 == (mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_DISABLED)); + enable = getChild(EDIT BTN_PRIVATE); + enable->set( 0 != (mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_PRIVATE)); - + mDirty=false; + setCanClose(!mDirty); + + getChild(BTN_SAVE)->setEnabled(mDirty); } void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) @@ -402,3 +473,173 @@ void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) button=getChild(BTN_BLOCK); button->setEnabled(TRUE); } + +void LLFloaterExperienceProfile::onFieldChanged() +{ + mDirty=true; + setCanClose(!mDirty); + getChild(BTN_SAVE)->setEnabled(mDirty); +} + + +BOOL LLFloaterExperienceProfile::canClose() +{ + if(mForceClose || !mDirty) + { + return TRUE; + } + else + { + // Bring up view-modal dialog: Save changes? Yes, No, Cancel + LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLFloaterExperienceProfile::handleSaveChangesDialog, this, _1, _2, CLOSE)); + return FALSE; + } +} + +bool LLFloaterExperienceProfile::handleSaveChangesDialog( const LLSD& notification, const LLSD& response, int action ) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch( option ) + { + case 0: // "Yes" + // close after saving + doSave( action ); + break; + + case 1: // "No" + if(action != NOTHING) + { + mForceClose = TRUE; + if(action==CLOSE) + { + closeFloater(); + } + else + { + changeToView(); + } + } + break; + + case 2: // "Cancel" + default: + // If we were quitting, we didn't really mean it. + LLAppViewer::instance()->abortQuit(); + break; + } + return false; +} + +void LLFloaterExperienceProfile::doSave( int success_action ) +{ + mSaveCompleteAction=success_action; + + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + return; + + std::string url=region->getCapability("UpdateExperience"); + if(url.empty()) + return; + + LLSD package=mExperienceDetails; + + package[LLExperienceCache::NAME] = getChild(EDIT TF_NAME)->getText(); + package[LLExperienceCache::DESCRIPTION] = getChild(EDIT TF_DESC)->getText(); + package[LLExperienceCache::SLURL] = getChild(EDIT TF_SLURL)->getText(); + + package[LLExperienceCache::MATURITY] = getChild(EDIT TF_MATURITY)->getSelectedValue().asInteger(); + + LLSD metadata; + + metadata[TF_MRKT] = getChild(EDIT TF_MRKT)->getText(); + metadata[IMG_LOGO] = getChild(EDIT IMG_LOGO)->getImageAssetID(); + + LLPointer formatter = new LLSDXMLFormatter(); + + std::ostringstream os; + if(formatter->format(metadata, os)) + { + package[LLExperienceCache::METADATA]=os.str(); + } + + int properties = package[LLExperienceCache::PROPERTIES].asInteger(); + LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); + if(enable->get()) + { + properties &= ~LLExperienceCache::PROPERTY_DISABLED; + } + else + { + properties |= LLExperienceCache::PROPERTY_DISABLED; + } + + enable = getChild(EDIT BTN_PRIVATE); + if(enable->get()) + { + properties |= LLExperienceCache::PROPERTY_PRIVATE; + } + else + { + properties &= ~LLExperienceCache::PROPERTY_PRIVATE; + } + + package[LLExperienceCache::PROPERTIES] = properties; + + LLHTTPClient::post(url, package, new ExperienceUpdateResponder(getDerivedHandle())); +} + +void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content ) +{ + LLUUID id = getExperienceId(); + + if(!content.has("experience_keys")) + { + llwarns << "LLFloaterExperienceProfile::onSaveComplete called with bad content" << llendl; + return; + } + + const LLSD& experiences = content["experience_keys"]; + + LLSD::array_const_iterator it = experiences.beginArray(); + if(it == experiences.endArray()) + { + llwarns << "LLFloaterExperienceProfile::onSaveComplete called with empty content" << llendl; + return; + } + + if(!it->has(LLExperienceCache::EXPERIENCE_ID) || ((*it)[LLExperienceCache::EXPERIENCE_ID].asUUID() != id)) + { + llwarns << "LLFloaterExperienceProfile::onSaveComplete called with unexpected experience id" << llendl; + return; + } + + refreshExperience(*it); + LLExperienceCache::fetch(id, true); + + if(mSaveCompleteAction==VIEW) + { + LLTabContainer* tabs = getChild("tab_container"); + tabs->selectTabByName("panel_experience_info"); + } + else if(mSaveCompleteAction == CLOSE) + { + closeFloater(); + } +} + +void LLFloaterExperienceProfile::changeToView() +{ + if(mForceClose || !mDirty) + { + refreshExperience(mExperienceDetails); + LLTabContainer* tabs = getChild("tab_container"); + + tabs->selectTabByName("panel_experience_info"); + } + else + { + // Bring up view-modal dialog: Save changes? Yes, No, Cancel + LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLFloaterExperienceProfile::handleSaveChangesDialog, this, _1, _2, VIEW)); + } +} -- cgit v1.2.3 From 541e92c3653e112ec54ea322c9c5c54cacb0fd21 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 9 Sep 2013 10:26:18 -0700 Subject: Added some explicitness for the mac build --- indra/newview/llfloaterexperienceprofile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 292f6f0952..e1e4039626 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -109,7 +109,7 @@ public: class ExperienceUpdateResponder : public HandleResponder { public: - ExperienceUpdateResponder(const LLHandle& parent):HandleResponder(parent) + ExperienceUpdateResponder(const LLHandle& parent):HandleResponder(parent) { } @@ -128,7 +128,7 @@ public: class ExperiencePreferencesResponder : public HandleResponder { public: - ExperiencePreferencesResponder(const LLHandle& parent):HandleResponder(parent) + ExperiencePreferencesResponder(const LLHandle& parent):HandleResponder(parent) { } @@ -147,7 +147,7 @@ public: class IsAdminResponder : public HandleResponder { public: - IsAdminResponder(const LLHandle& parent):HandleResponder(parent) + IsAdminResponder(const LLHandle& parent):HandleResponder(parent) { } -- cgit v1.2.3 From 51c01f5294b68b66706685346ecea16246b85cce Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 9 Sep 2013 11:19:41 -0700 Subject: More explicitnexx for the mac build Also update the experience cache when the update returns. --- indra/newview/llfloaterexperienceprofile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index e1e4039626..a565b5c8e7 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -496,7 +496,7 @@ BOOL LLFloaterExperienceProfile::canClose() } } -bool LLFloaterExperienceProfile::handleSaveChangesDialog( const LLSD& notification, const LLSD& response, int action ) +bool LLFloaterExperienceProfile::handleSaveChangesDialog( const LLSD& notification, const LLSD& response, PostSaveAction action ) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); switch( option ) @@ -615,6 +615,7 @@ void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content ) } refreshExperience(*it); + LLExperienceCache::insert(*it); LLExperienceCache::fetch(id, true); if(mSaveCompleteAction==VIEW) -- cgit v1.2.3 From f5b7343238626f52ea45ee74ed06294ae1f22a74 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 17 Sep 2013 19:58:20 -0700 Subject: Updated position of the edit button the experience profile and added the Grid Wide tag. --- indra/newview/llfloaterexperienceprofile.cpp | 74 +++++++++++++++++----------- 1 file changed, 45 insertions(+), 29 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index a565b5c8e7..49dd2a59ac 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -54,10 +54,12 @@ #define TF_MRKT "marketplace" #define TF_MATURITY "ContentRatingText" #define TF_OWNER "OwnerText" +#define TF_GRID_WIDE "grid_wide" #define EDIT "edit_" #define IMG_LOGO "logo" +#define PNL_TOP "top panel" #define PNL_IMAGE "image_panel" #define PNL_DESC "description panel" #define PNL_LOC "location panel" @@ -76,10 +78,6 @@ LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data) : LLFloater(data) , mExperienceId(data.asUUID()) - , mImagePanel(NULL) - , mDescriptionPanel(NULL) - , mLocationPanel(NULL) - , mMarketplacePanel(NULL) , mSaveCompleteAction(NOTHING) , mDirty(false) , mForceClose(false) @@ -169,17 +167,16 @@ public: if(url.empty()) enabled = false; } - - parent->getChild(BTN_EDIT)->setVisible(enabled && content["status"].asBoolean()); + if(enabled && content["status"].asBoolean()) + { + parent->getChild(PNL_TOP)->setVisible(TRUE); + parent->getChild(BTN_EDIT)->setVisible(TRUE); + } } }; BOOL LLFloaterExperienceProfile::postBuild() { - mImagePanel = getChild(PNL_IMAGE); - mDescriptionPanel = getChild(PNL_DESC); - mLocationPanel = getChild(PNL_LOC); - mMarketplacePanel = getChild(PNL_MRKT); if (mExperienceId.notNull()) { @@ -327,13 +324,20 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) { mExperienceDetails = experience; - if(experience.has(LLExperienceCache::MISSING)) - { - mImagePanel->setVisible(FALSE); - mDescriptionPanel->setVisible(FALSE); - mLocationPanel->setVisible(FALSE); - mMarketplacePanel->setVisible(FALSE); - } + + LLLayoutPanel* imagePanel = getChild(PNL_IMAGE); + LLLayoutPanel* descriptionPanel = getChild(PNL_DESC); + LLLayoutPanel* locationPanel = getChild(PNL_LOC); + LLLayoutPanel* marketplacePanel = getChild(PNL_MRKT); + LLLayoutPanel* topPanel = getChild(PNL_TOP); + + + imagePanel->setVisible(FALSE); + descriptionPanel->setVisible(FALSE); + locationPanel->setVisible(FALSE); + marketplacePanel->setVisible(FALSE); + topPanel->setVisible(FALSE); + LLTextBox* child = getChild(TF_NAME); child->setText(experience[LLExperienceCache::NAME].asString()); @@ -344,7 +348,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) std::string value = experience[LLExperienceCache::DESCRIPTION].asString(); LLExpandableTextBox* exchild = getChild(TF_DESC); exchild->setText(value); - mDescriptionPanel->setVisible(value.length()>0); + descriptionPanel->setVisible(value.length()>0); LLTextEditor* edit_child = getChild(EDIT TF_DESC); edit_child->setText(value); @@ -352,7 +356,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) value = experience[LLExperienceCache::SLURL].asString(); child = getChild(TF_SLURL); child->setText(value); - mLocationPanel->setVisible(value.length()>0); + locationPanel->setVisible(value.length()>0); linechild = getChild(EDIT TF_SLURL); linechild->setText(value); @@ -372,7 +376,20 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) value = LLSLURL("agent", id, "inspect").getSLURLString(); } child->setText(value); - + + LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); + S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger(); + enable->set(properties & LLExperienceCache::PROPERTY_DISABLED); + + enable = getChild(EDIT BTN_PRIVATE); + enable->set(properties & LLExperienceCache::PROPERTY_PRIVATE); + + if(properties & LLExperienceCache::PROPERTY_GRID) + { + topPanel->setVisible(TRUE); + getChild(TF_GRID_WIDE)->setVisible(TRUE); + } + value=experience[LLExperienceCache::METADATA].asString(); if(value.empty()) return; @@ -391,11 +408,11 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) child = getChild(TF_MRKT); child->setText(value); - mMarketplacePanel->setVisible(TRUE); + marketplacePanel->setVisible(TRUE); } else { - mMarketplacePanel->setVisible(FALSE); + marketplacePanel->setVisible(FALSE); } linechild = getChild(EDIT TF_MRKT); @@ -405,18 +422,17 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) { LLTextureCtrl* logo = getChild(IMG_LOGO); logo->setImageAssetID(data[IMG_LOGO].asUUID()); - mImagePanel->setVisible(TRUE); + imagePanel->setVisible(TRUE); logo = getChild(EDIT IMG_LOGO); logo->setImageAssetID(data[IMG_LOGO].asUUID()); } } - - LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); - enable->set( 0 == (mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_DISABLED)); - - enable = getChild(EDIT BTN_PRIVATE); - enable->set( 0 != (mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_PRIVATE)); + else + { + marketplacePanel->setVisible(FALSE); + imagePanel->setVisible(FALSE); + } mDirty=false; setCanClose(!mDirty); -- cgit v1.2.3 From c8144f7405178621f779b814fd4cb3e632786e0a Mon Sep 17 00:00:00 2001 From: dolphin Date: Wed, 18 Sep 2013 15:55:42 -0700 Subject: Fixed enabled checkbox in the edit experience profile floater --- indra/newview/llfloaterexperienceprofile.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 49dd2a59ac..ec2e7f0f10 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -379,7 +379,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger(); - enable->set(properties & LLExperienceCache::PROPERTY_DISABLED); + enable->set(!(properties & LLExperienceCache::PROPERTY_DISABLED)); enable = getChild(EDIT BTN_PRIVATE); enable->set(properties & LLExperienceCache::PROPERTY_PRIVATE); @@ -408,7 +408,14 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) child = getChild(TF_MRKT); child->setText(value); - marketplacePanel->setVisible(TRUE); + if(value.size()) + { + marketplacePanel->setVisible(TRUE); + } + else + { + marketplacePanel->setVisible(FALSE); + } } else { @@ -421,11 +428,15 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) if(data.has(IMG_LOGO)) { LLTextureCtrl* logo = getChild(IMG_LOGO); - logo->setImageAssetID(data[IMG_LOGO].asUUID()); + + LLUUID id = data[IMG_LOGO].asUUID(); + logo->setImageAssetID(id); imagePanel->setVisible(TRUE); logo = getChild(EDIT IMG_LOGO); logo->setImageAssetID(data[IMG_LOGO].asUUID()); + + imagePanel->setVisible(id.notNull()); } } else -- cgit v1.2.3 From 48e1e10fd69aaea6ef22feb2518e80a120e9f999 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 23 Sep 2013 11:44:21 -0700 Subject: Added LLUrlEntryExperienceProfile to link to experience profiles Added LLExperienceHandler to handle experience links Updated LLSidepanelItemInfo to use profile links --- indra/newview/llfloaterexperienceprofile.cpp | 42 ++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index ec2e7f0f10..01af6b1cab 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -26,14 +26,20 @@ #include "llviewerprecompiledheaders.h" +#include "llfloaterexperienceprofile.h" #include "llagent.h" +#include "llappviewer.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llcommandhandler.h" #include "llexpandabletextbox.h" #include "llexperiencecache.h" -#include "llfloaterexperienceprofile.h" #include "llfloaterreg.h" #include "llhttpclient.h" #include "lllayoutstack.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" #include "llsdserialize.h" #include "llslurl.h" #include "lltabcontainer.h" @@ -41,11 +47,6 @@ #include "lltexturectrl.h" #include "lltrans.h" #include "llviewerregion.h" -#include "lllineeditor.h" -#include "llcombobox.h" -#include "llcheckboxctrl.h" -#include "llnotificationsutil.h" -#include "llappviewer.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -75,6 +76,34 @@ #define BTN_PRIVATE "private_btn" + +class LLExperienceHandler : public LLCommandHandler +{ +public: + LLExperienceHandler() : LLCommandHandler("experience", UNTRUSTED_THROTTLE) { } + + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if(params.size() != 2 || params[1].asString() != "profile") + return false; + + LLExperienceCache::get(params[0].asUUID(), boost::bind(&LLExperienceHandler::experienceCallback, this, _1)); + return true; + } + + void experienceCallback(const LLSD& experienceDetails) + { + if(!experienceDetails.has(LLExperienceCache::MISSING)) + { + LLFloaterReg::showInstance("experience_profile", experienceDetails[LLExperienceCache::EXPERIENCE_ID].asUUID(), true); + } + } +}; + +LLExperienceHandler gExperienceHandler; + + LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data) : LLFloater(data) , mExperienceId(data.asUUID()) @@ -355,6 +384,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) value = experience[LLExperienceCache::SLURL].asString(); child = getChild(TF_SLURL); + value = LLSLURL(value).getSLURLString(); child->setText(value); locationPanel->setVisible(value.length()>0); -- cgit v1.2.3 From 09964ec6ede2c9dba5954448bff6b2da2dc179af Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 24 Sep 2013 19:10:43 -0700 Subject: Created an experience specific permissions dialog. --- indra/newview/llfloaterexperienceprofile.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 01af6b1cab..f99e20f7e0 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -417,7 +417,9 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) if(properties & LLExperienceCache::PROPERTY_GRID) { topPanel->setVisible(TRUE); - getChild(TF_GRID_WIDE)->setVisible(TRUE); + child=getChild(TF_GRID_WIDE); + child->setVisible(TRUE); + child->setText(LLTrans::getString("GRID_WIDE")); } value=experience[LLExperienceCache::METADATA].asString(); -- cgit v1.2.3 From 1aed2f848c4f2a86d6c2ea6385ebb920e7658aa8 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 15 Oct 2013 16:42:55 -0700 Subject: Added LLTabContainer::getTotalTabWidth Cleaned up experience profile floater --- indra/newview/llfloaterexperienceprofile.cpp | 66 ++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 18 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index f99e20f7e0..e1667a39b7 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -55,6 +55,7 @@ #define TF_MRKT "marketplace" #define TF_MATURITY "ContentRatingText" #define TF_OWNER "OwnerText" +#define TF_GROUP "GroupText" #define TF_GRID_WIDE "grid_wide" #define EDIT "edit_" @@ -65,6 +66,7 @@ #define PNL_DESC "description panel" #define PNL_LOC "location panel" #define PNL_MRKT "marketplace panel" +#define PNL_GROUP "group_panel" #define BTN_EDIT "edit_btn" #define BTN_ALLOW "allow_btn" @@ -74,6 +76,8 @@ #define BTN_SAVE "save_btn" #define BTN_ENABLE "enable_btn" #define BTN_PRIVATE "private_btn" +#define BTN_SET_LOCATION "location_btn" +#define BTN_CLEAR_LOCATION "clear_btn" @@ -236,14 +240,15 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetAction(BTN_BLOCK, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Block")); childSetAction(BTN_CANCEL, boost::bind(&LLFloaterExperienceProfile::onClickCancel, this)); childSetAction(BTN_SAVE, boost::bind(&LLFloaterExperienceProfile::onClickSave, this)); + childSetAction(BTN_SET_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickLocation, this)); + childSetAction(BTN_CLEAR_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickClear, this)); - getChild(EDIT TF_NAME)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_DESC)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_SLURL)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_DESC)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); getChild(EDIT TF_MATURITY)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_MRKT)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_NAME)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_MRKT)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + getChild(EDIT TF_NAME)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + childSetAction(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); childSetAction(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); @@ -384,28 +389,35 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) value = experience[LLExperienceCache::SLURL].asString(); child = getChild(TF_SLURL); + bool has_value = value.length()>0; + locationPanel->setVisible(has_value); value = LLSLURL(value).getSLURLString(); child->setText(value); - locationPanel->setVisible(value.length()>0); - - linechild = getChild(EDIT TF_SLURL); - linechild->setText(value); - - setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), getChild(TF_MATURITY), getChild(EDIT TF_MATURITY)); - child = getChild(TF_OWNER); - LLUUID id = experience[LLExperienceCache::GROUP_ID].asUUID(); - if(id.notNull()) + child = getChild(EDIT TF_SLURL); + if(has_value) { - value = LLSLURL("group", id, "inspect").getSLURLString(); + child->setText(value); } else { - id = experience[LLExperienceCache::AGENT_ID].asUUID(); - value = LLSLURL("agent", id, "inspect").getSLURLString(); + child->setText(getString("empty_slurl")); } + + setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), getChild(TF_MATURITY), getChild(EDIT TF_MATURITY)); + + LLUUID id = experience[LLExperienceCache::AGENT_ID].asUUID(); + child = getChild(TF_OWNER); + value = LLSLURL("agent", id, "inspect").getSLURLString(); + child->setText(value); + + + id = experience[LLExperienceCache::GROUP_ID].asUUID(); + child = getChild(TF_GROUP); + value = LLSLURL("group", id, "inspect").getSLURLString(); child->setText(value); + getChild(PNL_GROUP)->setVisible(id.notNull()); LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger(); @@ -479,7 +491,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) mDirty=false; setCanClose(!mDirty); - + mForceClose = false; getChild(BTN_SAVE)->setEnabled(mDirty); } @@ -703,3 +715,21 @@ void LLFloaterExperienceProfile::changeToView() LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLFloaterExperienceProfile::handleSaveChangesDialog, this, _1, _2, VIEW)); } } + +void LLFloaterExperienceProfile::onClickLocation() +{ + LLViewerRegion* region = gAgent.getRegion(); + if(region) + { + LLTextBox* child = getChild(EDIT TF_SLURL); + child->setText(LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString()); + onFieldChanged(); + } +} + +void LLFloaterExperienceProfile::onClickClear() +{ + LLTextBox* child = getChild(EDIT TF_SLURL); + child->setText(getString("empty_slurl")); + onFieldChanged(); +} -- cgit v1.2.3 From fa344fdcd987ec66fa08f6286b504cb126c9a45c Mon Sep 17 00:00:00 2001 From: dolphin Date: Thu, 17 Oct 2013 13:58:52 -0700 Subject: Updated experience profile to remove the permission buttons on privileged experiences and fix the enabling of the save button with the checkbox controls. --- indra/newview/llfloaterexperienceprofile.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index e1667a39b7..740e800a07 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -67,6 +67,7 @@ #define PNL_LOC "location panel" #define PNL_MRKT "marketplace panel" #define PNL_GROUP "group_panel" +#define PNL_PERMS "perm panel" #define BTN_EDIT "edit_btn" #define BTN_ALLOW "allow_btn" @@ -249,8 +250,8 @@ BOOL LLFloaterExperienceProfile::postBuild() getChild(EDIT TF_MRKT)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); getChild(EDIT TF_NAME)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); - childSetAction(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - childSetAction(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + childSetCommitCallback(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + childSetCommitCallback(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); getChild(EDIT TF_DESC)->setCommitOnFocusLost(TRUE); @@ -364,6 +365,7 @@ 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); @@ -433,6 +435,9 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) child->setVisible(TRUE); child->setText(LLTrans::getString("GRID_WIDE")); } + + + permPanel->setVisible((properties & LLExperienceCache::PROPERTY_PRIVILEGED) == 0); value=experience[LLExperienceCache::METADATA].asString(); if(value.empty()) @@ -490,7 +495,6 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) } mDirty=false; - setCanClose(!mDirty); mForceClose = false; getChild(BTN_SAVE)->setEnabled(mDirty); } @@ -548,7 +552,6 @@ void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) void LLFloaterExperienceProfile::onFieldChanged() { mDirty=true; - setCanClose(!mDirty); getChild(BTN_SAVE)->setEnabled(mDirty); } -- cgit v1.2.3 From 035eafb0c69c434c709862c816663f2b4ca2ab2b Mon Sep 17 00:00:00 2001 From: dolphin Date: Thu, 17 Oct 2013 14:36:54 -0700 Subject: Fixed slurl saving for the experience profile floater --- indra/newview/llfloaterexperienceprofile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 740e800a07..0e868e199d 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -620,7 +620,7 @@ void LLFloaterExperienceProfile::doSave( int success_action ) package[LLExperienceCache::NAME] = getChild(EDIT TF_NAME)->getText(); package[LLExperienceCache::DESCRIPTION] = getChild(EDIT TF_DESC)->getText(); - package[LLExperienceCache::SLURL] = getChild(EDIT TF_SLURL)->getText(); + package[LLExperienceCache::SLURL] = getChild(EDIT TF_SLURL)->getText(); package[LLExperienceCache::MATURITY] = getChild(EDIT TF_MATURITY)->getSelectedValue().asInteger(); -- cgit v1.2.3 From 309ffd57fade231c3d14eedfe1171788e250f088 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 22 Oct 2013 10:51:53 -0700 Subject: Post events on experience permission changes to refresh uis --- indra/newview/llfloaterexperienceprofile.cpp | 140 +++++++++++++++++++-------- 1 file changed, 102 insertions(+), 38 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 0e868e199d..25dde49b8e 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -47,6 +47,7 @@ #include "lltexturectrl.h" #include "lltrans.h" #include "llviewerregion.h" +#include "llevents.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -157,21 +158,16 @@ public: -class ExperiencePreferencesResponder : public HandleResponder +class ExperiencePreferencesResponder : public LLHTTPClient::Responder { public: - ExperiencePreferencesResponder(const LLHandle& parent):HandleResponder(parent) + ExperiencePreferencesResponder() { } - virtual void result(const LLSD& content) { - LLFloaterExperienceProfile* parent=mParent.get(); - if(parent) - { - parent->setPreferences(content); - } + LLEventPumps::instance().obtain("experience_permission").post(content); } }; @@ -230,7 +226,7 @@ BOOL LLFloaterExperienceProfile::postBuild() lookup_url=region->getCapability("ExperiencePreferences"); if(!lookup_url.empty()) { - LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(getDerivedHandle())); + LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder()); } } } @@ -254,6 +250,10 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetCommitCallback(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); getChild(EDIT TF_DESC)->setCommitOnFocusLost(TRUE); + + + LLEventPumps::instance().obtain("experience_permission").listen(mExperienceId.asString()+"-profile", + boost::bind(&LLFloaterExperienceProfile::experiencePermission, getDerivedHandle(this), _1)); return TRUE; } @@ -267,6 +267,18 @@ void LLFloaterExperienceProfile::experienceCallback(LLHandle handle, const LLSD& permission ) +{ + LLFloaterExperienceProfile* pllpep = handle.get(); + if(pllpep) + { + pllpep->updatePermission(permission); + } + return false; +} + + void LLFloaterExperienceProfile::onClickEdit() { LLTabContainer* tabs = getChild("tab_container"); @@ -300,7 +312,7 @@ void LLFloaterExperienceProfile::onClickPermission(const char* perm) permission["permission"]=perm; data[mExperienceId.asString()]=permission; - LLHTTPClient::put(lookup_url, data, new ExperiencePreferencesResponder(getDerivedHandle())); + LLHTTPClient::put(lookup_url, data, new ExperiencePreferencesResponder()); } @@ -315,7 +327,7 @@ void LLFloaterExperienceProfile::onClickForget() if(lookup_url.empty()) return; - LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(getDerivedHandle())); + LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder()); } bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child, LLComboBox* combo ) @@ -503,21 +515,13 @@ void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) { const LLSD& experiences = content["experiences"]; const LLSD& blocked = content["blocked"]; - LLButton* button; for(LLSD::array_const_iterator it = experiences.beginArray(); it != experiences.endArray() ; ++it) { if(it->asUUID()==mExperienceId) { - button=getChild(BTN_ALLOW); - button->setEnabled(FALSE); - - button=getChild(BTN_FORGET); - button->setEnabled(TRUE); - - button=getChild(BTN_BLOCK); - button->setEnabled(TRUE); + experienceAllowed(); return; } } @@ -526,27 +530,12 @@ void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) { if(it->asUUID()==mExperienceId) { - button=getChild(BTN_ALLOW); - button->setEnabled(TRUE); - - button=getChild(BTN_FORGET); - button->setEnabled(TRUE); - - button=getChild(BTN_BLOCK); - button->setEnabled(FALSE); + experienceBlocked(); return; } } - - button=getChild(BTN_ALLOW); - button->setEnabled(TRUE); - - button=getChild(BTN_FORGET); - button->setEnabled(FALSE); - - button=getChild(BTN_BLOCK); - button->setEnabled(TRUE); + experienceForgotten(); } void LLFloaterExperienceProfile::onFieldChanged() @@ -620,7 +609,15 @@ void LLFloaterExperienceProfile::doSave( int success_action ) package[LLExperienceCache::NAME] = getChild(EDIT TF_NAME)->getText(); package[LLExperienceCache::DESCRIPTION] = getChild(EDIT TF_DESC)->getText(); - package[LLExperienceCache::SLURL] = getChild(EDIT TF_SLURL)->getText(); + std::string slurl = getChild(EDIT TF_SLURL)->getText(); + if(slurl == getString("empty_slurl")) + { + package[LLExperienceCache::SLURL] = LLStringUtil::null; + } + else + { + package[LLExperienceCache::SLURL] = slurl; + } package[LLExperienceCache::MATURITY] = getChild(EDIT TF_MATURITY)->getSelectedValue().asInteger(); @@ -736,3 +733,70 @@ void LLFloaterExperienceProfile::onClickClear() child->setText(getString("empty_slurl")); onFieldChanged(); } + +void LLFloaterExperienceProfile::updatePermission( const LLSD& permission ) +{ + std::string xp = mExperienceId.asString(); + if(permission.has(xp)) + { + std::string str = permission[xp]["permission"].asString(); + if(str == "Allow") + { + experienceAllowed(); + } + else if(str == "Block") + { + experienceBlocked(); + } + else if(str == "Forget") + { + experienceForgotten(); + } + } + else + { + setPreferences(permission); + } +} + +void LLFloaterExperienceProfile::experienceAllowed() +{ + LLButton* button=getChild(BTN_ALLOW); + button->setEnabled(FALSE); + + button=getChild(BTN_FORGET); + button->setEnabled(TRUE); + + button=getChild(BTN_BLOCK); + button->setEnabled(TRUE); +} + +void LLFloaterExperienceProfile::experienceForgotten() +{ + LLButton* button=getChild(BTN_ALLOW); + button->setEnabled(TRUE); + + button=getChild(BTN_FORGET); + button->setEnabled(FALSE); + + button=getChild(BTN_BLOCK); + button->setEnabled(TRUE); +} + +void LLFloaterExperienceProfile::experienceBlocked() +{ + LLButton* button=getChild(BTN_ALLOW); + button->setEnabled(TRUE); + + button=getChild(BTN_FORGET); + button->setEnabled(TRUE); + + button=getChild(BTN_BLOCK); + button->setEnabled(FALSE); +} + +void LLFloaterExperienceProfile::onClose( bool app_quitting ) +{ + LLEventPumps::instance().obtain("experience_permission").stopListening(mExperienceId.asString()+"-profile"); + LLFloater::onClose(app_quitting); +} -- cgit v1.2.3 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 +++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 11 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') 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()) -- cgit v1.2.3 From 1d8066890df4d8de9e60970037282beb9818788c Mon Sep 17 00:00:00 2001 From: dolphin Date: Fri, 25 Oct 2013 14:04:24 -0700 Subject: Make the experience profile save button enable and disable as changes are made/reverted. Added some explanation text. --- indra/newview/llfloaterexperienceprofile.cpp | 130 +++++++++++++++------------ 1 file changed, 75 insertions(+), 55 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 2a81c6cdec..83b4f1609e 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -275,6 +275,8 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetCommitCallback(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); childSetCommitCallback(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + childSetCommitCallback(EDIT IMG_LOGO, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + getChild(EDIT TF_DESC)->setCommitOnFocusLost(TRUE); @@ -396,6 +398,7 @@ bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* chil void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) { mExperienceDetails = experience; + mPackage = experience; LLLayoutPanel* imagePanel = getChild(PNL_IMAGE); @@ -581,7 +584,23 @@ void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) void LLFloaterExperienceProfile::onFieldChanged() { - mDirty=true; + updatePackage(); + + LLSD::map_const_iterator st = mExperienceDetails.beginMap(); + LLSD::map_const_iterator dt = mPackage.beginMap(); + + mDirty = false; + while( !mDirty && st != mExperienceDetails.endMap() && dt != mPackage.endMap()) + { + mDirty = st->first != dt->first || st->second.asString() != dt->second.asString(); + ++st;++dt; + } + + if(!mDirty && (st != mExperienceDetails.endMap() || dt != mPackage.endMap())) + { + mDirty = true; + } + getChild(BTN_SAVE)->setEnabled(mDirty); } @@ -645,60 +664,8 @@ void LLFloaterExperienceProfile::doSave( int success_action ) std::string url=region->getCapability("UpdateExperience"); if(url.empty()) return; - - LLSD package=mExperienceDetails; - - package[LLExperienceCache::NAME] = getChild(EDIT TF_NAME)->getText(); - package[LLExperienceCache::DESCRIPTION] = getChild(EDIT TF_DESC)->getText(); - std::string slurl = getChild(EDIT TF_SLURL)->getText(); - if(slurl == getString("empty_slurl")) - { - package[LLExperienceCache::SLURL] = LLStringUtil::null; - } - else - { - package[LLExperienceCache::SLURL] = slurl; - } - - package[LLExperienceCache::MATURITY] = getChild(EDIT TF_MATURITY)->getSelectedValue().asInteger(); - - LLSD metadata; - - metadata[TF_MRKT] = getChild(EDIT TF_MRKT)->getText(); - metadata[IMG_LOGO] = getChild(EDIT IMG_LOGO)->getImageAssetID(); - - LLPointer formatter = new LLSDXMLFormatter(); - - std::ostringstream os; - if(formatter->format(metadata, os)) - { - package[LLExperienceCache::METADATA]=os.str(); - } - - int properties = package[LLExperienceCache::PROPERTIES].asInteger(); - LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); - if(enable->get()) - { - properties &= ~LLExperienceCache::PROPERTY_DISABLED; - } - else - { - properties |= LLExperienceCache::PROPERTY_DISABLED; - } - - enable = getChild(EDIT BTN_PRIVATE); - if(enable->get()) - { - properties |= LLExperienceCache::PROPERTY_PRIVATE; - } - else - { - properties &= ~LLExperienceCache::PROPERTY_PRIVATE; - } - - package[LLExperienceCache::PROPERTIES] = properties; - - LLHTTPClient::post(url, package, new ExperienceUpdateResponder(getDerivedHandle())); + + LLHTTPClient::post(url, mPackage, new ExperienceUpdateResponder(getDerivedHandle())); } void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content ) @@ -841,3 +808,56 @@ void LLFloaterExperienceProfile::onClose( bool app_quitting ) LLEventPumps::instance().obtain("experience_permission").stopListening(mExperienceId.asString()+"-profile"); LLFloater::onClose(app_quitting); } + +void LLFloaterExperienceProfile::updatePackage() +{ + mPackage[LLExperienceCache::NAME] = getChild(EDIT TF_NAME)->getText(); + mPackage[LLExperienceCache::DESCRIPTION] = getChild(EDIT TF_DESC)->getText(); + std::string slurl = getChild(EDIT TF_SLURL)->getText(); + if(slurl == getString("empty_slurl")) + { + mPackage[LLExperienceCache::SLURL] = LLStringUtil::null; + } + else + { + mPackage[LLExperienceCache::SLURL] = slurl; + } + + mPackage[LLExperienceCache::MATURITY] = getChild(EDIT TF_MATURITY)->getSelectedValue().asInteger(); + + LLSD metadata; + + metadata[TF_MRKT] = getChild(EDIT TF_MRKT)->getText(); + metadata[IMG_LOGO] = getChild(EDIT IMG_LOGO)->getImageAssetID(); + + LLPointer formatter = new LLSDXMLFormatter(); + + std::ostringstream os; + if(formatter->format(metadata, os)) + { + mPackage[LLExperienceCache::METADATA]=os.str(); + } + + int properties = mPackage[LLExperienceCache::PROPERTIES].asInteger(); + LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); + if(enable->get()) + { + properties &= ~LLExperienceCache::PROPERTY_DISABLED; + } + else + { + properties |= LLExperienceCache::PROPERTY_DISABLED; + } + + enable = getChild(EDIT BTN_PRIVATE); + if(enable->get()) + { + properties |= LLExperienceCache::PROPERTY_PRIVATE; + } + else + { + properties &= ~LLExperienceCache::PROPERTY_PRIVATE; + } + + mPackage[LLExperienceCache::PROPERTIES] = properties; +} -- cgit v1.2.3 From 1e770cb8f972fc3ad475e54dc07a5a7431b968c0 Mon Sep 17 00:00:00 2001 From: dolphin Date: Fri, 25 Oct 2013 15:51:37 -0700 Subject: Fixed experience profile permission messages --- indra/newview/llfloaterexperienceprofile.cpp | 92 ++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 20 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 83b4f1609e..4b6ed393b5 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -162,45 +162,87 @@ public: class ExperiencePreferencesResponder : public LLHTTPClient::Responder { public: - ExperiencePreferencesResponder(bool single):mSingle(single) + ExperiencePreferencesResponder(const LLUUID& single = LLUUID::null):mId(single) { } - void sendSingle(const LLSD& content, const LLSD& permission, const char* name) + bool sendSingle(const LLSD& content, const LLSD& permission, const char* name) { if(!content.has(name)) - return; + return false; 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); + if(it->asUUID() == mId) + { + LLSD message; + message[it->asString()] = permission; + message["experience"] = mId; + pump.post(message); + return true; + } ++it; } + return false; } - virtual void result(const LLSD& content) + bool hasPermission(const LLSD& content, const char* name) { - if(mSingle) + if(!content.has(name)) + return false; + + const LLSD& list = content[name]; + LLSD::array_const_iterator it = list.beginArray(); + while(it != list.endArray()) { - LLSD experience; - experience["permission"]="Allow"; + if(it->asUUID() == mId) + { + return true; + } + ++it; + } + return false; + } - sendSingle(content, experience, "experiences"); + const char* getPermission(const LLSD& content) + { + if(hasPermission(content, "experiences")) + { + return "Allow"; + } + else if(hasPermission(content, "blocked")) + { + return "Block"; + } + return "Forget"; + } - experience["permission"]="Block"; - sendSingle(content, experience, "blocked"); + virtual void result(const LLSD& content) + { + if(mId.notNull()) + { + post(getPermission(content)); return; } LLEventPumps::instance().obtain("experience_permission").post(content); } + + void post( const char* perm ) + { + LLSD experience; + LLSD message; + experience["permission"]=perm; + message["experience"] = mId; + message[mId.asString()] = experience; + LLEventPumps::instance().obtain("experience_permission").post(message); + } + private: - bool mSingle; + LLUUID mId; }; @@ -340,7 +382,7 @@ void LLFloaterExperienceProfile::onClickPermission(const char* perm) permission["permission"]=perm; data[mExperienceId.asString()]=permission; - LLHTTPClient::put(lookup_url, data, new ExperiencePreferencesResponder(false)); + LLHTTPClient::put(lookup_url, data, new ExperiencePreferencesResponder(mExperienceId)); } @@ -355,7 +397,7 @@ void LLFloaterExperienceProfile::onClickForget() if(lookup_url.empty()) return; - LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(false)); + LLHTTPClient::del(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(mExperienceId)); } bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child, LLComboBox* combo ) @@ -490,7 +532,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) std::string lookup_url=region->getCapability("ExperiencePreferences"); if(!lookup_url.empty()) { - LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(true)); + LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(mExperienceId)); } } } @@ -557,6 +599,12 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) { + S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger(); + if(properties & LLExperienceCache::PROPERTY_PRIVILEGED) + { + return; + } + const LLSD& experiences = content["experiences"]; const LLSD& blocked = content["blocked"]; @@ -744,10 +792,14 @@ void LLFloaterExperienceProfile::onClickClear() void LLFloaterExperienceProfile::updatePermission( const LLSD& permission ) { - std::string xp = mExperienceId.asString(); - if(permission.has(xp)) + if(permission.has("experience")) { - std::string str = permission[xp]["permission"].asString(); + if(permission["experience"].asUUID() != mExperienceId) + { + return; + } + + std::string str = permission[mExperienceId.asString()]["permission"].asString(); if(str == "Allow") { experienceAllowed(); -- cgit v1.2.3 From 9f633d9f084dff6af5b3129f19254bb730398250 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 10 Feb 2014 12:11:50 -0800 Subject: Fix hiding of the edit button on non grid-wide experiences. --- indra/newview/llfloaterexperienceprofile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 4b6ed393b5..1843d2eb8b 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -509,7 +509,6 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) enable = getChild(EDIT BTN_PRIVATE); enable->set(properties & LLExperienceCache::PROPERTY_PRIVATE); - if(properties & LLExperienceCache::PROPERTY_GRID) { topPanel->setVisible(TRUE); @@ -518,6 +517,10 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) child->setText(LLTrans::getString("GRID_WIDE")); } + if(getChild(BTN_EDIT)->getVisible()) + { + topPanel->setVisible(TRUE); + } if(properties & LLExperienceCache::PROPERTY_PRIVILEGED) { -- cgit v1.2.3 From 49f08d775d3644bb47d342f8e37dd15051aeaa62 Mon Sep 17 00:00:00 2001 From: dolphin Date: Fri, 28 Feb 2014 16:21:42 -0800 Subject: Add group editing for experiences --- indra/newview/llfloaterexperienceprofile.cpp | 42 ++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 1843d2eb8b..fd0f7aee1d 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -48,6 +48,7 @@ #include "lltrans.h" #include "llviewerregion.h" #include "llevents.h" +#include "llfloatergroups.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -81,6 +82,7 @@ #define BTN_PRIVATE "private_btn" #define BTN_SET_LOCATION "location_btn" #define BTN_CLEAR_LOCATION "clear_btn" +#define BTN_SET_GROUP "Group_btn" @@ -304,10 +306,10 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetAction(BTN_FORGET, boost::bind(&LLFloaterExperienceProfile::onClickForget, this)); childSetAction(BTN_BLOCK, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Block")); childSetAction(BTN_CANCEL, boost::bind(&LLFloaterExperienceProfile::onClickCancel, this)); - childSetAction(BTN_SAVE, boost::bind(&LLFloaterExperienceProfile::onClickSave, this)); - childSetAction(BTN_SET_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickLocation, this)); - childSetAction(BTN_CLEAR_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickClear, this)); - + childSetAction(BTN_SAVE, boost::bind(&LLFloaterExperienceProfile::onClickSave, this)); + childSetAction(BTN_SET_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickLocation, this)); + childSetAction(BTN_CLEAR_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickClear, this)); + childSetAction(BTN_SET_GROUP, boost::bind(&LLFloaterExperienceProfile::onPickGroup, this)); getChild(EDIT TF_DESC)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); getChild(EDIT TF_MATURITY)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); @@ -498,10 +500,15 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) id = experience[LLExperienceCache::GROUP_ID].asUUID(); + bool id_null = id.isNull(); child = getChild(TF_GROUP); value = LLSLURL("group", id, "inspect").getSLURLString(); child->setText(value); - getChild(PNL_GROUP)->setVisible(id.notNull()); + getChild(PNL_GROUP)->setVisible(!id_null); + + setEditGroup(id); + + getChild(BTN_SET_GROUP)->setEnabled(experience[LLExperienceCache::AGENT_ID].asUUID() == gAgent->getID()); LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger(); @@ -916,3 +923,28 @@ void LLFloaterExperienceProfile::updatePackage() mPackage[LLExperienceCache::PROPERTIES] = properties; } + +void LLFloaterExperienceProfile::onPickGroup() +{ + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + + LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance("group_picker", LLSD(gAgent.getID())); + if (widget) + { + widget->setSelectGroupCallback(boost::bind(&LLFloaterExperienceProfile::setEditGroup, this, _1)); + if (parent_floater) + { + LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget); + widget->setOrigin(new_rect.mLeft, new_rect.mBottom); + parent_floater->addDependentFloater(widget); + } + } +} + +void LLFloaterExperienceProfile::setEditGroup( LLUUID group_id ) +{ + LLTextBox* child = getChild(EDIT TF_GROUP); + std::string value = LLSLURL("group", group_id, "inspect").getSLURLString(); + child->setText(value); + mPackage[LLExperienceCache::GROUP_ID] = group_id; +} -- cgit v1.2.3 From 96457e1affe33d75208cabf7529b53eee8e8105b Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 3 Mar 2014 11:28:34 -0800 Subject: Disable the acquire xp button by default. Mark the xp profile dirty when changing the group --- indra/newview/llfloaterexperienceprofile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index fd0f7aee1d..e5574be4f0 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -508,7 +508,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) setEditGroup(id); - getChild(BTN_SET_GROUP)->setEnabled(experience[LLExperienceCache::AGENT_ID].asUUID() == gAgent->getID()); + getChild(BTN_SET_GROUP)->setEnabled(experience[LLExperienceCache::AGENT_ID].asUUID() == gAgent.getID()); LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger(); @@ -947,4 +947,5 @@ void LLFloaterExperienceProfile::setEditGroup( LLUUID group_id ) std::string value = LLSLURL("group", group_id, "inspect").getSLURLString(); child->setText(value); mPackage[LLExperienceCache::GROUP_ID] = group_id; + onFieldChanged(); } -- cgit v1.2.3 From 9fe5728b4385ead4a4c74eed7917d93060510cdb Mon Sep 17 00:00:00 2001 From: dolphin Date: Wed, 12 Mar 2014 09:50:08 -0700 Subject: Show ignored items when updating an experience profile --- indra/newview/llfloaterexperienceprofile.cpp | 35 +++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index e5574be4f0..1c01a4bb9f 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -49,6 +49,7 @@ #include "llviewerregion.h" #include "llevents.h" #include "llfloatergroups.h" +#include "llnotifications.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -85,7 +86,6 @@ #define BTN_SET_GROUP "Group_btn" - class LLExperienceHandler : public LLCommandHandler { public: @@ -722,6 +722,10 @@ void LLFloaterExperienceProfile::doSave( int success_action ) std::string url=region->getCapability("UpdateExperience"); if(url.empty()) return; + + mPackage.erase(LLExperienceCache::QUOTA); + mPackage.erase(LLExperienceCache::EXPIRES); + mPackage.erase(LLExperienceCache::AGENT_ID); LLHTTPClient::post(url, mPackage, new ExperienceUpdateResponder(getDerivedHandle())); } @@ -730,6 +734,35 @@ void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content ) { LLUUID id = getExperienceId(); + if(content.has("removed")) + { + const LLSD& removed = content["removed"]; + LLSD::map_const_iterator it = removed.beginMap(); + for(/**/; it != removed.endMap(); ++it) + { + const std::string& field = it->first; + if(field == LLExperienceCache::EXPERIENCE_ID) + { + //this message should be removed by the experience api + continue; + } + const LLSD& data = it->second; + std::string error_tag = data["error_tag"].asString()+ "ExperienceProfileMessage"; + LLSD fields; + if( LLNotifications::instance().getTemplate(error_tag)) + { + fields["field"] = field; + fields["extra_info"] = data["extra_info"]; + LLNotificationsUtil::add(error_tag, fields); + } + else + { + fields["MESSAGE"]=data["en"]; + LLNotificationsUtil::add("GenericAlert", fields); + } + } + } + if(!content.has("experience_keys")) { llwarns << "LLFloaterExperienceProfile::onSaveComplete called with bad content" << llendl; -- cgit v1.2.3 From e10ae3ba960cf030582378c454937dd326fcd436 Mon Sep 17 00:00:00 2001 From: dolphin Date: Thu, 13 Mar 2014 15:10:51 -0700 Subject: Added a Report Abuse button to the experience profile --- indra/newview/llfloaterexperienceprofile.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 1c01a4bb9f..f8b4978a3d 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -50,6 +50,7 @@ #include "llevents.h" #include "llfloatergroups.h" #include "llnotifications.h" +#include "llfloaterreporter.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -73,17 +74,18 @@ #define PNL_GROUP "group_panel" #define PNL_PERMS "perm panel" -#define BTN_EDIT "edit_btn" #define BTN_ALLOW "allow_btn" -#define BTN_FORGET "forget_btn" #define BTN_BLOCK "block_btn" #define BTN_CANCEL "cancel_btn" -#define BTN_SAVE "save_btn" +#define BTN_CLEAR_LOCATION "clear_btn" +#define BTN_EDIT "edit_btn" #define BTN_ENABLE "enable_btn" +#define BTN_FORGET "forget_btn" #define BTN_PRIVATE "private_btn" -#define BTN_SET_LOCATION "location_btn" -#define BTN_CLEAR_LOCATION "clear_btn" +#define BTN_REPORT "report_btn" +#define BTN_SAVE "save_btn" #define BTN_SET_GROUP "Group_btn" +#define BTN_SET_LOCATION "location_btn" class LLExperienceHandler : public LLCommandHandler @@ -310,6 +312,7 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetAction(BTN_SET_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickLocation, this)); childSetAction(BTN_CLEAR_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickClear, this)); childSetAction(BTN_SET_GROUP, boost::bind(&LLFloaterExperienceProfile::onPickGroup, this)); + childSetAction(BTN_REPORT, boost::bind(&LLFloaterExperienceProfile::onReportExperience, this)); getChild(EDIT TF_DESC)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); getChild(EDIT TF_MATURITY)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); @@ -982,3 +985,8 @@ void LLFloaterExperienceProfile::setEditGroup( LLUUID group_id ) mPackage[LLExperienceCache::GROUP_ID] = group_id; onFieldChanged(); } + +void LLFloaterExperienceProfile::onReportExperience() +{ + LLFloaterReporter::showFromExperience(mExperienceId); +} -- cgit v1.2.3 From d14673988d0d26e5029f8f921bf00cce63e4f767 Mon Sep 17 00:00:00 2001 From: dolphin Date: Wed, 7 May 2014 13:40:34 -0700 Subject: removed deprecated logging macros --- indra/newview/llfloaterexperienceprofile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index f8b4978a3d..25433f814c 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -140,7 +140,7 @@ public: virtual void error(U32 status, const std::string& reason) { - llwarns << "HandleResponder failed with code: " << status<< ", reason: " << reason << llendl; + LL_WARNS() << "HandleResponder failed with code: " << status<< ", reason: " << reason << LL_ENDL; } }; @@ -768,7 +768,7 @@ void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content ) if(!content.has("experience_keys")) { - llwarns << "LLFloaterExperienceProfile::onSaveComplete called with bad content" << llendl; + LL_WARNS() << "LLFloaterExperienceProfile::onSaveComplete called with bad content" << LL_ENDL; return; } @@ -777,13 +777,13 @@ void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content ) LLSD::array_const_iterator it = experiences.beginArray(); if(it == experiences.endArray()) { - llwarns << "LLFloaterExperienceProfile::onSaveComplete called with empty content" << llendl; + LL_WARNS() << "LLFloaterExperienceProfile::onSaveComplete called with empty content" << LL_ENDL; return; } if(!it->has(LLExperienceCache::EXPERIENCE_ID) || ((*it)[LLExperienceCache::EXPERIENCE_ID].asUUID() != id)) { - llwarns << "LLFloaterExperienceProfile::onSaveComplete called with unexpected experience id" << llendl; + LL_WARNS() << "LLFloaterExperienceProfile::onSaveComplete called with unexpected experience id" << LL_ENDL; return; } -- cgit v1.2.3 From 1b704efb17a2278588146760d189daaffe56d35d Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 12 May 2014 17:03:10 -0700 Subject: Don't bother updating the dirty flag if the profile is not editable. --- indra/newview/llfloaterexperienceprofile.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 25433f814c..c14d77a944 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -647,6 +647,10 @@ void LLFloaterExperienceProfile::onFieldChanged() { updatePackage(); + if(!getChild(BTN_EDIT)->getVisible()) + { + return; + } LLSD::map_const_iterator st = mExperienceDetails.beginMap(); LLSD::map_const_iterator dt = mPackage.beginMap(); -- cgit v1.2.3 From f10f3d2fdec90b0ca4d34e6b90642e7c45896d9e Mon Sep 17 00:00:00 2001 From: Cho Date: Mon, 2 Jun 2014 21:16:28 +0100 Subject: Added URL menu for experience profile links for ACME-1469 --- indra/newview/llfloaterexperienceprofile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index c14d77a944..f80fdd9cfe 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -463,7 +463,8 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLTextBox* child = getChild(TF_NAME); - child->setText(experience[LLExperienceCache::NAME].asString()); + //child->setText(experience[LLExperienceCache::NAME].asString()); + child->setText(LLSLURL("experience", experience[LLExperienceCache::EXPERIENCE_ID], "profile").getSLURLString()); LLLineEditor* linechild = getChild(EDIT TF_NAME); linechild->setText(experience[LLExperienceCache::NAME].asString()); -- cgit v1.2.3 From 200788c344f5449f99eacc9167ac15c7e6262b69 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 24 Jun 2014 22:43:23 +0100 Subject: Updated all experience responders for LLCurl::Responder interface changes for ACME-1535 and ACME-1536 --- indra/newview/llfloaterexperienceprofile.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index f80fdd9cfe..764d9088a1 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -138,9 +138,9 @@ public: HandleResponder(const LLHandle& parent):mParent(parent){} LLHandle mParent; - virtual void error(U32 status, const std::string& reason) + virtual void httpFailure() { - LL_WARNS() << "HandleResponder failed with code: " << status<< ", reason: " << reason << LL_ENDL; + LL_WARNS() << "HandleResponder failed with code: " << getStatus() << ", reason: " << getReason() << LL_ENDL; } }; @@ -151,12 +151,12 @@ public: { } - virtual void result(const LLSD& content) + virtual void httpSuccess() { LLFloaterExperienceProfile* parent=mParent.get(); if(parent) { - parent->onSaveComplete(content); + parent->onSaveComplete(getContent()); } } }; @@ -225,14 +225,14 @@ public: } - virtual void result(const LLSD& content) + virtual void httpSuccess() { if(mId.notNull()) { - post(getPermission(content)); + post(getPermission(getContent())); return; } - LLEventPumps::instance().obtain("experience_permission").post(content); + LLEventPumps::instance().obtain("experience_permission").post(getContent()); } void post( const char* perm ) @@ -257,7 +257,7 @@ public: { } - virtual void result(const LLSD& content) + virtual void httpSuccess() { LLFloaterExperienceProfile* parent = mParent.get(); if(!parent) @@ -275,7 +275,7 @@ public: if(url.empty()) enabled = false; } - if(enabled && content["status"].asBoolean()) + if(enabled && getContent()["status"].asBoolean()) { parent->getChild(PNL_TOP)->setVisible(TRUE); parent->getChild(BTN_EDIT)->setVisible(TRUE); -- cgit v1.2.3 From 3b2f456416d29534cb41fc9d4ad3bf195dcfc847 Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 18 Jul 2014 01:45:48 +0100 Subject: Added mLocationSLURL to fix ACME-1560 --- indra/newview/llfloaterexperienceprofile.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 764d9088a1..4ee31f5df1 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -477,18 +477,18 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLTextEditor* edit_child = getChild(EDIT TF_DESC); edit_child->setText(value); - value = experience[LLExperienceCache::SLURL].asString(); + mLocationSLURL = experience[LLExperienceCache::SLURL].asString(); child = getChild(TF_SLURL); - bool has_value = value.length()>0; - locationPanel->setVisible(has_value); - value = LLSLURL(value).getSLURLString(); - child->setText(value); + bool has_slurl = mLocationSLURL.length()>0; + locationPanel->setVisible(has_slurl); + mLocationSLURL = LLSLURL(mLocationSLURL).getSLURLString(); + child->setText(mLocationSLURL); child = getChild(EDIT TF_SLURL); - if(has_value) + if(has_slurl) { - child->setText(value); + child->setText(mLocationSLURL); } else { @@ -829,7 +829,8 @@ void LLFloaterExperienceProfile::onClickLocation() if(region) { LLTextBox* child = getChild(EDIT TF_SLURL); - child->setText(LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString()); + mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString(); + child->setText(mLocationSLURL); onFieldChanged(); } } @@ -837,6 +838,7 @@ void LLFloaterExperienceProfile::onClickLocation() void LLFloaterExperienceProfile::onClickClear() { LLTextBox* child = getChild(EDIT TF_SLURL); + mLocationSLURL = ""; child->setText(getString("empty_slurl")); onFieldChanged(); } @@ -916,14 +918,13 @@ void LLFloaterExperienceProfile::updatePackage() { mPackage[LLExperienceCache::NAME] = getChild(EDIT TF_NAME)->getText(); mPackage[LLExperienceCache::DESCRIPTION] = getChild(EDIT TF_DESC)->getText(); - std::string slurl = getChild(EDIT TF_SLURL)->getText(); - if(slurl == getString("empty_slurl")) + if(mLocationSLURL.empty()) { mPackage[LLExperienceCache::SLURL] = LLStringUtil::null; } else { - mPackage[LLExperienceCache::SLURL] = slurl; + mPackage[LLExperienceCache::SLURL] = mLocationSLURL; } mPackage[LLExperienceCache::MATURITY] = getChild(EDIT TF_MATURITY)->getSelectedValue().asInteger(); -- cgit v1.2.3 From 8cc8e7dc77c7aff6d4698632d6a3bebe76698ff7 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 28 Oct 2014 11:43:45 -0700 Subject: ACME-1601: Updated message to match behavior ACME-1616: Change references of "Grid-Wide" to "Grid-Scope" and "non Grid-Wide" to "Land-Scope" --- indra/newview/llfloaterexperienceprofile.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterexperienceprofile.cpp') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 4ee31f5df1..197162487d 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -520,13 +520,19 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) enable = getChild(EDIT BTN_PRIVATE); enable->set(properties & LLExperienceCache::PROPERTY_PRIVATE); + + topPanel->setVisible(TRUE); + child=getChild(TF_GRID_WIDE); + child->setVisible(TRUE); + if(properties & LLExperienceCache::PROPERTY_GRID) { - topPanel->setVisible(TRUE); - child=getChild(TF_GRID_WIDE); - child->setVisible(TRUE); - child->setText(LLTrans::getString("GRID_WIDE")); + child->setText(LLTrans::getString("Grid-Scope")); } + else + { + child->setText(LLTrans::getString("Land-Scope")); + } if(getChild(BTN_EDIT)->getVisible()) { -- cgit v1.2.3