diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterexperienceprofile.cpp | 125 | ||||
-rw-r--r-- | indra/newview/llfloaterexperienceprofile.h | 7 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_experienceprofile.xml | 67 |
4 files changed, 135 insertions, 69 deletions
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 <sstream> +#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<LLFloaterExperienceProfile>& parent):mParent(parent) + { + } + + LLHandle<LLFloaterExperienceProfile> mParent; + + virtual void result(const LLSD& content) + { + LLFloaterExperienceProfile* parent = mParent.get(); + if(!parent) + return; + + parent->getChild<LLButton>(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<LLLayoutPanel>(PNL_IMAGE); @@ -87,12 +110,22 @@ BOOL LLFloaterExperienceProfile::postBuild() { LLExperienceCache::fetch(mExperienceId, true); LLExperienceCache::get(mExperienceId, boost::bind(&LLFloaterExperienceProfile::experienceCallback, - getDerivedHandle<LLFloaterExperienceProfile>(), _1)); + getDerivedHandle<LLFloaterExperienceProfile>(), _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<LLFloaterExperienceProfile>())); + } + } } + + - 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(LLHandle<LLFloaterExperience } } -void LLFloaterExperienceProfile::onClickMap() +void LLFloaterExperienceProfile::onClickEdit() { -// LLFloaterWorldMap::getInstance()->trackLocation(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<LLTextBox>(TF_MATURITY); - child->setText(getMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()))); + setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), child); child = getChild<LLTextBox>(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 diff --git a/indra/newview/llfloaterexperienceprofile.h b/indra/newview/llfloaterexperienceprofile.h index 1d1e4c50cf..e19a63aca7 100644 --- a/indra/newview/llfloaterexperienceprofile.h +++ b/indra/newview/llfloaterexperienceprofile.h @@ -34,6 +34,7 @@ #include "llsd.h" class LLLayoutPanel; +class LLTextBox; class LLFloaterExperienceProfile : public LLFloater { @@ -45,16 +46,14 @@ public: void setExperienceId( const LLUUID& experience_id ); protected: - - void onClickMap(); - void onClickTeleport(); void onClickEdit(); static void experienceCallback(LLHandle<LLFloaterExperienceProfile> handle, const LLSD& experience); + void refreshExperience(const LLSD& experience); BOOL postBuild(); - std::string getMaturityString(U8 maturity); + bool setMaturityString(U8 maturity, LLTextBox* child); LLUUID mExperienceId; LLSD mExperienceDetails; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index adc346529e..e0eb8b5f46 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1597,8 +1597,11 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("GetDisplayNames"); capabilityNames.append("GetExperiences"); - capabilityNames.append("GetExperienceInfo"); + capabilityNames.append("GetExperienceInfo"); + capabilityNames.append("GetAdminExperiences"); capabilityNames.append("GetCreatorExperiences"); + capabilityNames.append("ExperiencePreferences"); + capabilityNames.append("IsExperienceAdmin"); capabilityNames.append("GetMesh"); capabilityNames.append("GetMetadata"); capabilityNames.append("GetObjectCost"); diff --git a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml index d9990f3a59..668a3bcc2e 100644 --- a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml +++ b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml @@ -10,18 +10,33 @@ min_width="300" layout="topleft" name="floater_experience_profile" - save_rect="yes" single_instance="false" reuse_instance="false" title="EXPERIENCE PROFILE" width="358"> + <floater.string + name="maturity_icon_general"> + "Parcel_PG_Light" + </floater.string> + <floater.string + name="maturity_icon_moderate"> + "Parcel_M_Light" + </floater.string> + <floater.string + name="maturity_icon_adult"> + "Parcel_R_Light" + </floater.string> + <floater.string + name="forget_experience"> + "Forget" + </floater.string> <panel background_visible="true" follows="all" height="570" layout="topleft" left="5" - min_height="350" + min_height="250" top="5" width="348" name="panel_experience_info"> @@ -133,7 +148,7 @@ </layout_panel> <layout_panel follows="all" - height="69" + height="46" layout="topleft" left="0" top="5" @@ -165,23 +180,6 @@ width="288"> someplace </text> - <button - follows="bottom|left" - height="23" - label="Teleport" - layout="topleft" - name="teleport_btn" - width="151" - left="10"/> - <button - follows="bottom|left" - height="23" - label="Map" - layout="topleft" - name="map_btn" - top_pad="-23" - width="101" - left_pad="5"/> </layout_panel> <layout_panel follows="all" @@ -246,7 +244,7 @@ left_pad="2" valign="center" name="ContentRatingText" - top_delta="-2" + top_delta="-3" width="188"> Adult </text> @@ -280,9 +278,30 @@ label="Edit" layout="topleft" name="edit_btn" - top_pad="0" - width="151" - left="10"/> + top_pad="3" + width="80" + left="10" + visible="false"/> + <button + follows="bottom|left" + height="23" + label="Allow" + layout="topleft" + name="allow_btn" + width="80" + top_pad="-23" + left_pad="3" + enabled="false"/> + <button + follows="bottom|left" + height="23" + label="Block" + layout="topleft" + name="block_btn" + width="80" + top_pad="-23" + left_pad="3" + enabled="false"/> </layout_panel> </layout_stack> |