summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2018-04-23 20:54:08 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2018-04-23 20:54:08 +0300
commit8c1d51caf31c7d34c0c6c347576eed141577de2f (patch)
tree1f395ba3840581ff30545e25b5a7b80c56c88765 /indra/newview/llfloaterregioninfo.cpp
parent2f6bea5ca4275deb4406e20b8a02aec63f2d2894 (diff)
MAINT-8441 Generate Confirmation message when adding a person to a estate list
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp155
1 files changed, 126 insertions, 29 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 3ce9e09324..3ada644482 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -98,6 +98,7 @@
#include "llexperiencecache.h"
#include "llpanelexperiences.h"
#include "llcorehttputil.h"
+#include "llavatarnamecache.h"
const S32 TERRAIN_TEXTURE_COUNT = 4;
const S32 CORNER_COUNT = 4;
@@ -3744,8 +3745,8 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
if (change_info->mOperationFlag & ESTATE_ACCESS_ALLOWED_AGENT_ADD)
{
- LLCtrlListInterface *list = panel->childGetListInterface("allowed_avatar_name_list");
- int currentCount = (list ? list->getItemCount() : 0);
+ LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
+ int currentCount = (name_list ? name_list->getItemCount() : 0);
if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS)
{
LLSD args;
@@ -3757,11 +3758,36 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
delete change_info;
return;
}
+
+ std::string already_allowed;
+ bool single = true;
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ LLScrollListItem* item = name_list->getNameItemByAgentId(*it);
+ if (item)
+ {
+ if (!already_allowed.empty())
+ {
+ already_allowed += ", ";
+ single = false;
+ }
+ already_allowed += item->getColumn(0)->getValue().asString();
+ }
+ }
+ if (!already_allowed.empty())
+ {
+ LLSD args;
+ args["AGENT"] = already_allowed;
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
+ LLNotificationsUtil::add(single ? "AgentIsAlreadyInList" : "AgentsAreAlreadyInList", args);
+ delete change_info;
+ return;
+ }
}
if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD)
{
- LLCtrlListInterface *list = panel->childGetListInterface("banned_avatar_name_list");
- int currentCount = (list ? list->getItemCount() : 0);
+ LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
+ int currentCount = (name_list ? name_list->getItemCount() : 0);
if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS)
{
LLSD args;
@@ -3773,6 +3799,31 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
delete change_info;
return;
}
+
+ std::string already_banned;
+ bool single = true;
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ LLScrollListItem* item = name_list->getNameItemByAgentId(*it);
+ if (item)
+ {
+ if (!already_banned.empty())
+ {
+ already_banned += ", ";
+ single = false;
+ }
+ already_banned += item->getColumn(0)->getValue().asString();
+ }
+ }
+ if (!already_banned.empty())
+ {
+ LLSD args;
+ args["AGENT"] = already_banned;
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
+ LLNotificationsUtil::add(single ? "AgentIsAlreadyInList" : "AgentsAreAlreadyInList", args);
+ delete change_info;
+ return;
+ }
}
LLSD args;
@@ -3870,16 +3921,38 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
const U32 originalFlags = (U32)notification["payload"]["operation"].asInteger();
+ U32 flags = originalFlags;
LLViewerRegion* region = gAgent.getRegion();
- LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray();
+ if (option == 2) // cancel
+ {
+ return false;
+ }
+ else if (option == 1)
+ {
+ // All estates, either than I own or manage for this owner.
+ // This will be verified on simulator. JC
+ if (!region) return false;
+ if (region->getOwner() == gAgent.getID()
+ || gAgent.isGodlike())
+ {
+ flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES;
+ }
+ else if (region->isEstateManager())
+ {
+ flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES;
+ }
+ }
+ std::string names;
+ bool single = true;
+
+ 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++)
{
- U32 flags = originalFlags;
if (iter + 1 != end_it)
flags |= ESTATE_ACCESS_NO_REPLY;
@@ -3890,35 +3963,59 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
LLNotificationsUtil::add("OwnerCanNotBeDenied");
break;
}
- switch (option)
- {
- case 0:
- // This estate
- sendEstateAccessDelta(flags, id);
- break;
- case 1:
+
+ sendEstateAccessDelta(flags, id);
+
+ // fill the name list for confirmation
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(id, &av_name))
{
- // All estates, either than I own or manage for this owner.
- // This will be verified on simulator. JC
- if (!region) break;
- if (region->getOwner() == gAgent.getID()
- || gAgent.isGodlike())
- {
- flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES;
- sendEstateAccessDelta(flags, id);
- }
- else if (region->isEstateManager())
+ if (!names.empty())
{
- flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES;
- sendEstateAccessDelta(flags, id);
+ names += ", ";
+ single = false;
}
- break;
+ names += av_name.getCompleteName();
}
- case 2:
- default:
- break;
+ }
+
+ if (!names.empty()) // show the conirmation
+ {
+ LLSD args;
+ args["AGENT"] = names;
+
+ if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE))
+ {
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
+ }
+ else if (flags & (ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_REMOVE))
+ {
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
+ }
+
+ if (flags & ESTATE_ACCESS_APPLY_TO_ALL_ESTATES)
+ {
+ args["ESTATE"] = LLTrans::getString("RegionInfoAllEstates");
+ }
+ else if (flags & ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES)
+ {
+ args["ESTATE"] = LLTrans::getString("RegionInfoManagedEstates");
}
+ else
+ {
+ args["ESTATE"] = LLTrans::getString("RegionInfoThisEstate");
+ }
+
+ if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_ADD))
+ {
+ LLNotificationsUtil::add(single ? "AgentWasAddedToList" : "AgentsWereAddedToList", args);
+ }
+ else if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_BANNED_AGENT_REMOVE))
+ {
+ LLNotificationsUtil::add(single ? "AgentWasRemovedFromList" : "AgentsWereRemovedFromList", args);
+ }
}
+
return false;
}