summaryrefslogtreecommitdiff
path: root/indra
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
parent2f6bea5ca4275deb4406e20b8a02aec63f2d2894 (diff)
MAINT-8441 Generate Confirmation message when adding a person to a estate list
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp155
-rw-r--r--indra/newview/llnamelistctrl.cpp14
-rw-r--r--indra/newview/llnamelistctrl.h2
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml42
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml3
5 files changed, 187 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;
}
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index fe75ab8e50..949f70d8dc 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -415,6 +415,20 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
}
}
+// public
+LLScrollListItem* LLNameListCtrl::getNameItemByAgentId(const LLUUID& agent_id)
+{
+ for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
+ {
+ LLScrollListItem* item = *it;
+ if (item && item->getUUID() == agent_id)
+ {
+ return item;
+ }
+ }
+ return NULL;
+}
+
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
const LLAvatarName& av_name,
std::string suffix,
diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h
index 677b49e667..50b4d80302 100644
--- a/indra/newview/llnamelistctrl.h
+++ b/indra/newview/llnamelistctrl.h
@@ -154,6 +154,8 @@ public:
void removeNameItem(const LLUUID& agent_id);
+ LLScrollListItem* getNameItemByAgentId(const LLUUID& agent_id);
+
// LLView interface
/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6aa6653f42..d139534328 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3805,6 +3805,48 @@ Can&apos;t add estate owner to estate &apos;Banned Resident&apos; list.
type="alertmodal">
Unable to add banned resident to estate manager list.
</notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="AgentIsAlreadyInList"
+ type="alertmodal">
+[AGENT] is already in your [LIST_TYPE] list.
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="AgentsAreAlreadyInList"
+ type="alertmodal">
+[AGENT] are already in your [LIST_TYPE] list.
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="AgentWasAddedToList"
+ type="alertmodal">
+[AGENT] was added to [LIST_TYPE] list of [ESTATE].
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="AgentsWereAddedToList"
+ type="alertmodal">
+[AGENT] were added to [LIST_TYPE] list of [ESTATE].
+
+ </notification>
+ <notification
+ icon="alertmodal.tga"
+ name="AgentWasRemovedFromList"
+ type="alertmodal">
+[AGENT] was removed from [LIST_TYPE] list of [ESTATE].
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="AgentsWereRemovedFromList"
+ type="alertmodal">
+[AGENT] were removed from [LIST_TYPE] list of [ESTATE].
+ </notification>
<notification
icon="alertmodal.tga"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 5f30a7e87d..17ce94d2d7 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2659,6 +2659,9 @@ If you continue to receive this message, please contact Second Life support for
<string name="RegionInfoBannedResidents">Always banned: ([BANNEDAGENTS], max [MAXBANNED])</string>
<string name="RegionInfoListTypeAllowedAgents">Always allowed</string>
<string name="RegionInfoListTypeBannedAgents">Always banned</string>
+ <string name="RegionInfoAllEstates">all estates</string>
+ <string name="RegionInfoManagedEstates">managed estates</string>
+ <string name="RegionInfoThisEstate">this estate</string>
<!-- script limits floater -->
<string name="ScriptLimitsParcelScriptMemory">Parcel Script Memory</string>