Updated experience profile floater to have permission buttons
parent
d29268f331
commit
df437553ed
|
|
@ -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<LLFloaterExperienceProfile>& parent):mParent(parent)
|
||||
{
|
||||
}
|
||||
|
||||
LLHandle<LLFloaterExperienceProfile> 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<LLButton>(BTN_EDIT);
|
||||
|
||||
parent->getChild<LLButton>(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<LLButton>(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<LLFloaterExperienceProfile>()));
|
||||
// }
|
||||
|
||||
std::string lookup_url=region->getCapability("GetAdminExperiences");
|
||||
if(!lookup_url.empty())
|
||||
{
|
||||
LLHTTPClient::get(lookup_url+"/"+mExperienceId.asString(), new IsAdminResponder(getDerivedHandle<LLFloaterExperienceProfile>()));
|
||||
LLHTTPClient::get(lookup_url, new IsAdminResponder(getDerivedHandle<LLFloaterExperienceProfile>()));
|
||||
}
|
||||
|
||||
lookup_url=region->getCapability("ExperiencePreferences");
|
||||
if(!lookup_url.empty())
|
||||
{
|
||||
LLHTTPClient::get(lookup_url+"?"+mExperienceId.asString(), new ExperiencePreferencesResponder(getDerivedHandle<LLFloaterExperienceProfile>()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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<LLFloaterExperienceProfile>()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
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<LLFloaterExperienceProfile>()));
|
||||
}
|
||||
|
||||
bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* child )
|
||||
{
|
||||
LLStyle::Params style;
|
||||
|
|
@ -258,4 +351,54 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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<LLButton>(BTN_ALLOW);
|
||||
button->setEnabled(FALSE);
|
||||
|
||||
button=getChild<LLButton>(BTN_FORGET);
|
||||
button->setEnabled(TRUE);
|
||||
|
||||
button=getChild<LLButton>(BTN_BLOCK);
|
||||
button->setEnabled(TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for(LLSD::array_const_iterator it = blocked.beginArray(); it != blocked.endArray() ; ++it)
|
||||
{
|
||||
if(it->asUUID()==mExperienceId)
|
||||
{
|
||||
button=getChild<LLButton>(BTN_ALLOW);
|
||||
button->setEnabled(TRUE);
|
||||
|
||||
button=getChild<LLButton>(BTN_FORGET);
|
||||
button->setEnabled(TRUE);
|
||||
|
||||
button=getChild<LLButton>(BTN_BLOCK);
|
||||
button->setEnabled(FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
button=getChild<LLButton>(BTN_ALLOW);
|
||||
button->setEnabled(TRUE);
|
||||
|
||||
button=getChild<LLButton>(BTN_FORGET);
|
||||
button->setEnabled(FALSE);
|
||||
|
||||
button=getChild<LLButton>(BTN_BLOCK);
|
||||
button->setEnabled(TRUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,12 @@ public:
|
|||
virtual ~LLFloaterExperienceProfile();
|
||||
|
||||
void setExperienceId( const LLUUID& experience_id );
|
||||
void setPreferences( const LLSD& content );
|
||||
|
||||
protected:
|
||||
void onClickEdit();
|
||||
void onClickEdit();
|
||||
void onClickPermission(const char* permission);
|
||||
void onClickForget();
|
||||
|
||||
|
||||
static void experienceCallback(LLHandle<LLFloaterExperienceProfile> handle, const LLSD& experience);
|
||||
|
|
|
|||
|
|
@ -1601,7 +1601,11 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
|
|||
capabilityNames.append("GetAdminExperiences");
|
||||
capabilityNames.append("GetCreatorExperiences");
|
||||
capabilityNames.append("ExperiencePreferences");
|
||||
/*
|
||||
DMH - Does not work, needs a modified people api to take the experience UUID
|
||||
capabilityNames.append("IsExperienceAdmin");
|
||||
capabilityNames.append("IsExperienceContributor");
|
||||
*/
|
||||
capabilityNames.append("GetMesh");
|
||||
capabilityNames.append("GetMetadata");
|
||||
capabilityNames.append("GetObjectCost");
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@
|
|||
name="maturity_icon_adult">
|
||||
"Parcel_R_Light"
|
||||
</floater.string>
|
||||
<floater.string
|
||||
name="forget_experience">
|
||||
"Forget"
|
||||
</floater.string>
|
||||
<panel
|
||||
background_visible="true"
|
||||
follows="all"
|
||||
|
|
@ -218,7 +214,7 @@
|
|||
</layout_panel>
|
||||
<layout_panel
|
||||
follows="left|top|right"
|
||||
height="69"
|
||||
height="92"
|
||||
left="0"
|
||||
top="0"
|
||||
auto_resize="false"
|
||||
|
|
@ -279,9 +275,9 @@
|
|||
layout="topleft"
|
||||
name="edit_btn"
|
||||
top_pad="3"
|
||||
width="80"
|
||||
left="10"
|
||||
visible="false"/>
|
||||
width="120"
|
||||
left="73"
|
||||
visible="true"/>
|
||||
<button
|
||||
follows="bottom|left"
|
||||
height="23"
|
||||
|
|
@ -289,6 +285,16 @@
|
|||
layout="topleft"
|
||||
name="allow_btn"
|
||||
width="80"
|
||||
top_pad="3"
|
||||
left="10"
|
||||
enabled="false"/>
|
||||
<button
|
||||
follows="bottom|left"
|
||||
height="23"
|
||||
label="Forget"
|
||||
layout="topleft"
|
||||
name="forget_btn"
|
||||
width="80"
|
||||
top_pad="-23"
|
||||
left_pad="3"
|
||||
enabled="false"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue