Merge viewer-estate-access
commit
ea206fdfd6
|
|
@ -1938,11 +1938,13 @@ struct LLEstateAccessChangeInfo
|
|||
LLSD sd;
|
||||
sd["name"] = mDialogName;
|
||||
sd["operation"] = (S32)mOperationFlag;
|
||||
for (uuid_vec_t::const_iterator it = mAgentOrGroupIDs.begin();
|
||||
it != mAgentOrGroupIDs.end();
|
||||
++it)
|
||||
for (U32 i = 0; i < mAgentOrGroupIDs.size(); ++i)
|
||||
{
|
||||
sd["allowed_ids"].append(*it);
|
||||
sd["allowed_ids"].append(mAgentOrGroupIDs[i]);
|
||||
if (mAgentNames.size() > i)
|
||||
{
|
||||
sd["allowed_names"].append(mAgentNames[i].asLLSD());
|
||||
}
|
||||
}
|
||||
return sd;
|
||||
}
|
||||
|
|
@ -1950,6 +1952,7 @@ struct LLEstateAccessChangeInfo
|
|||
U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc.
|
||||
std::string mDialogName;
|
||||
uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change
|
||||
std::vector<LLAvatarName> mAgentNames; // Optional list of the agent names for notifications
|
||||
};
|
||||
|
||||
// static
|
||||
|
|
@ -3579,34 +3582,41 @@ void LLPanelEstateAccess::updateControls(LLViewerRegion* region)
|
|||
BOOL god = gAgent.isGodlike();
|
||||
BOOL owner = (region && (region->getOwner() == gAgent.getID()));
|
||||
BOOL manager = (region && region->isEstateManager());
|
||||
setCtrlsEnabled(god || owner || manager);
|
||||
BOOL enable_cotrols = god || owner || manager;
|
||||
setCtrlsEnabled(enable_cotrols);
|
||||
|
||||
BOOL has_allowed_avatar = getChild<LLNameListCtrl>("allowed_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
|
||||
BOOL has_allowed_group = getChild<LLNameListCtrl>("allowed_group_name_list")->getFirstSelected() ? TRUE : FALSE;
|
||||
BOOL has_banned_agent = getChild<LLNameListCtrl>("banned_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
|
||||
BOOL has_estate_manager = getChild<LLNameListCtrl>("estate_manager_name_list")->getFirstSelected() ? TRUE : FALSE;
|
||||
|
||||
getChildView("add_allowed_avatar_btn")->setEnabled(god || owner || manager);
|
||||
getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && (god || owner || manager));
|
||||
getChildView("allowed_avatar_name_list")->setEnabled(god || owner || manager);
|
||||
getChildView("add_allowed_avatar_btn")->setEnabled(enable_cotrols);
|
||||
getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && enable_cotrols);
|
||||
getChildView("allowed_avatar_name_list")->setEnabled(enable_cotrols);
|
||||
|
||||
getChildView("add_allowed_group_btn")->setEnabled(god || owner || manager);
|
||||
getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && (god || owner || manager));
|
||||
getChildView("allowed_group_name_list")->setEnabled(god || owner || manager);
|
||||
getChildView("add_allowed_group_btn")->setEnabled(enable_cotrols);
|
||||
getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && enable_cotrols);
|
||||
getChildView("allowed_group_name_list")->setEnabled(enable_cotrols);
|
||||
|
||||
// Can't ban people from mainland, orientation islands, etc. because this
|
||||
// creates much network traffic and server load.
|
||||
// Disable their accounts in CSR tool instead.
|
||||
bool linden_estate = LLPanelEstateInfo::isLindenEstate();
|
||||
bool enable_ban = (god || owner || manager) && !linden_estate;
|
||||
bool enable_ban = enable_cotrols && !linden_estate;
|
||||
getChildView("add_banned_avatar_btn")->setEnabled(enable_ban);
|
||||
getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban);
|
||||
getChildView("banned_avatar_name_list")->setEnabled(god || owner || manager);
|
||||
getChildView("banned_avatar_name_list")->setEnabled(enable_cotrols);
|
||||
|
||||
// estate managers can't add estate managers
|
||||
getChildView("add_estate_manager_btn")->setEnabled(god || owner);
|
||||
getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner));
|
||||
getChildView("estate_manager_name_list")->setEnabled(god || owner);
|
||||
|
||||
if (enable_cotrols != mCtrlsEnabled)
|
||||
{
|
||||
mCtrlsEnabled = enable_cotrols;
|
||||
updateLists(); // update the lists on the agent's access level change
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -3840,7 +3850,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r
|
|||
}
|
||||
|
||||
// avatar picker yes multi-select, yes close-on-select
|
||||
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, (void*)change_info),
|
||||
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, _2, (void*)change_info),
|
||||
TRUE, TRUE, FALSE, parent_floater_name, button);
|
||||
|
||||
//Allows the closed parent floater to close the child floater (avatar picker)
|
||||
|
|
@ -3853,7 +3863,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r
|
|||
}
|
||||
|
||||
// static
|
||||
void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
||||
void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, std::vector<LLAvatarName> names, void* data)
|
||||
{
|
||||
LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data;
|
||||
if (!change_info) return;
|
||||
|
|
@ -3889,11 +3899,12 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
|||
}
|
||||
|
||||
uuid_vec_t ids_allowed;
|
||||
std::vector<LLAvatarName> names_allowed;
|
||||
std::string already_allowed;
|
||||
bool single = true;
|
||||
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
|
||||
for (U32 i = 0; i < ids.size(); ++i)
|
||||
{
|
||||
LLScrollListItem* item = name_list->getNameItemByAgentId(*it);
|
||||
LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
|
||||
if (item)
|
||||
{
|
||||
if (!already_allowed.empty())
|
||||
|
|
@ -3905,7 +3916,8 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
|||
}
|
||||
else
|
||||
{
|
||||
ids_allowed.push_back(*it);
|
||||
ids_allowed.push_back(ids[i]);
|
||||
names_allowed.push_back(names[i]);
|
||||
}
|
||||
}
|
||||
if (!already_allowed.empty())
|
||||
|
|
@ -3921,6 +3933,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
|||
}
|
||||
}
|
||||
change_info->mAgentOrGroupIDs = ids_allowed;
|
||||
change_info->mAgentNames = names_allowed;
|
||||
}
|
||||
if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD)
|
||||
{
|
||||
|
|
@ -3940,13 +3953,14 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
|||
}
|
||||
|
||||
uuid_vec_t ids_allowed;
|
||||
std::vector<LLAvatarName> names_allowed;
|
||||
std::string already_banned;
|
||||
std::string em_ban;
|
||||
bool single = true;
|
||||
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
|
||||
for (U32 i = 0; i < ids.size(); ++i)
|
||||
{
|
||||
bool is_allowed = true;
|
||||
LLScrollListItem* em_item = em_list->getNameItemByAgentId(*it);
|
||||
LLScrollListItem* em_item = em_list->getNameItemByAgentId(ids[i]);
|
||||
if (em_item)
|
||||
{
|
||||
if (!em_ban.empty())
|
||||
|
|
@ -3957,7 +3971,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
|||
is_allowed = false;
|
||||
}
|
||||
|
||||
LLScrollListItem* item = name_list->getNameItemByAgentId(*it);
|
||||
LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
|
||||
if (item)
|
||||
{
|
||||
if (!already_banned.empty())
|
||||
|
|
@ -3971,7 +3985,8 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
|||
|
||||
if (is_allowed)
|
||||
{
|
||||
ids_allowed.push_back(*it);
|
||||
ids_allowed.push_back(ids[i]);
|
||||
names_allowed.push_back(names[i]);
|
||||
}
|
||||
}
|
||||
if (!em_ban.empty())
|
||||
|
|
@ -3998,6 +4013,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
|
|||
}
|
||||
}
|
||||
change_info->mAgentOrGroupIDs = ids_allowed;
|
||||
change_info->mAgentNames = names_allowed;
|
||||
}
|
||||
|
||||
LLSD args;
|
||||
|
|
@ -4120,12 +4136,9 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
|
|||
|
||||
std::string names;
|
||||
U32 listed_names = 0;
|
||||
LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray();
|
||||
for (LLSD::array_const_iterator iter = notification["payload"]["allowed_ids"].beginArray();
|
||||
iter != end_it;
|
||||
iter++)
|
||||
for (U32 i = 0; i < notification["payload"]["allowed_ids"].size(); ++i)
|
||||
{
|
||||
if (iter + 1 != end_it)
|
||||
if (i + 1 != notification["payload"]["allowed_ids"].size())
|
||||
{
|
||||
flags |= ESTATE_ACCESS_NO_REPLY;
|
||||
}
|
||||
|
|
@ -4134,7 +4147,7 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
|
|||
flags &= ~ESTATE_ACCESS_NO_REPLY;
|
||||
}
|
||||
|
||||
const LLUUID id = iter->asUUID();
|
||||
const LLUUID id = notification["payload"]["allowed_ids"][i].asUUID();
|
||||
if (((U32)notification["payload"]["operation"].asInteger() & ESTATE_ACCESS_BANNED_AGENT_ADD)
|
||||
&& region && (region->getOwner() == id))
|
||||
{
|
||||
|
|
@ -4149,15 +4162,23 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
|
|||
// fill the name list for confirmation
|
||||
if (listed_names < MAX_LISTED_NAMES)
|
||||
{
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(id, &av_name))
|
||||
if (!names.empty())
|
||||
{
|
||||
if (!names.empty())
|
||||
names += ", ";
|
||||
}
|
||||
if (!notification["payload"]["allowed_names"][i]["display_name"].asString().empty())
|
||||
{
|
||||
names += notification["payload"]["allowed_names"][i]["display_name"].asString();
|
||||
}
|
||||
else
|
||||
{ //try to get an agent name from cache
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(id, &av_name))
|
||||
{
|
||||
names += ", ";
|
||||
names += av_name.getCompleteName();
|
||||
}
|
||||
names += av_name.getCompleteName();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
listed_names++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ private:
|
|||
// Core methods for all above add/remove button clicks
|
||||
static void accessAddCore(U32 operation_flag, const std::string& dialog_name);
|
||||
static bool accessAddCore2(const LLSD& notification, const LLSD& response);
|
||||
static void accessAddCore3(const uuid_vec_t& ids, void* data);
|
||||
static void accessAddCore3(const uuid_vec_t& ids, std::vector<LLAvatarName> names, void* data);
|
||||
|
||||
static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name);
|
||||
static bool accessRemoveCore2(const LLSD& notification, const LLSD& response);
|
||||
|
|
@ -583,6 +583,7 @@ private:
|
|||
void copyListToClipboard(std::string list_name);
|
||||
|
||||
bool mPendingUpdate;
|
||||
BOOL mCtrlsEnabled;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue