summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterland.cpp
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2019-04-17 16:45:28 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2019-04-17 16:45:28 +0300
commit459601625d0f2a7b8f5454261fc69e55ce7419e3 (patch)
treeb0502d9722dad46dfac35858b62858150942866c /indra/newview/llfloaterland.cpp
parent19cae5d2ccbefee3741a80b8bc8e486dccf26873 (diff)
parent81dbd3663bdaff741e68de0ec4d4d35bedf6649d (diff)
Merged in lindenlab/viewer-release
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r--indra/newview/llfloaterland.cpp75
1 files changed, 55 insertions, 20 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 88b3fb7b96..5d97eebd9d 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -46,6 +46,7 @@
#include "llfloaterreg.h"
#include "llfloateravatarpicker.h"
#include "llfloaterauction.h"
+#include "llfloaterbanduration.h"
#include "llfloatergroups.h"
#include "llfloaterscriptlimits.h"
#include "llavataractions.h"
@@ -2502,33 +2503,49 @@ void LLPanelLandAccess::refresh()
cit != parcel->mBanList.end(); ++cit)
{
const LLAccessEntry& entry = (*cit).second;
- std::string prefix;
+ std::string duration;
if (entry.mTime != 0)
{
LLStringUtil::format_map_t args;
S32 now = time(NULL);
- S32 seconds = entry.mTime - now;
+ S32 seconds = entry.mTime - now;
if (seconds < 0) seconds = 0;
- prefix.assign(" (");
- if (seconds >= 120)
+
+ if (seconds >= 7200)
{
- args["[MINUTES]"] = llformat("%d", (seconds/60));
- std::string buf = parent_floater->getString ("Minutes", args);
- prefix.append(buf);
+ args["[HOURS]"] = llformat("%d", (seconds / 3600));
+ duration = parent_floater->getString("Hours", args);
+ }
+ else if (seconds >= 3600)
+ {
+ duration = "1 " + parent_floater->getString("Hour");
+ }
+ else if (seconds >= 120)
+ {
+ args["[MINUTES]"] = llformat("%d", (seconds / 60));
+ duration = parent_floater->getString("Minutes", args);
}
else if (seconds >= 60)
{
- prefix.append("1 " + parent_floater->getString("Minute"));
+ duration = "1 " + parent_floater->getString("Minute");
}
else
{
args["[SECONDS]"] = llformat("%d", seconds);
- std::string buf = parent_floater->getString ("Seconds", args);
- prefix.append(buf);
+ duration = parent_floater->getString("Seconds", args);
}
- prefix.append(" " + parent_floater->getString("Remaining") + ") ");
}
- mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix);
+ else
+ {
+ duration = parent_floater->getString("Always");
+ }
+ LLSD item;
+ item["id"] = entry.mID;
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "name"; // to be populated later
+ columns[1]["column"] = "duration";
+ columns[1]["value"] = duration;
+ mListBanned->addElement(item);
}
mListBanned->sortByName(TRUE);
}
@@ -2880,7 +2897,7 @@ void LLPanelLandAccess::onClickAddBanned()
LLView * button = findChild<LLButton>("add_banned");
LLFloater * root_floater = gFloaterView->getParentFloater(this);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button);
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), TRUE, FALSE, FALSE, root_floater->getName(), button);
if (picker)
{
root_floater->addDependentFloater(picker);
@@ -2890,23 +2907,41 @@ void LLPanelLandAccess::onClickAddBanned()
// static
void LLPanelLandAccess::callbackAvatarCBBanned(const uuid_vec_t& ids)
{
- if (!ids.empty())
+ LLFloater * root_floater = gFloaterView->getParentFloater(this);
+ LLFloaterBanDuration* duration_floater = LLFloaterBanDuration::show(
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned2, this, _1, _2), ids);
+ if (duration_floater)
{
- LLUUID id = ids[0];
- LLParcel* parcel = mParcel->getParcel();
- if (parcel && parcel->addToBanList(id, 0))
+ root_floater->addDependentFloater(duration_floater);
+ }
+}
+
+void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration)
+{
+ LLParcel* parcel = mParcel->getParcel();
+ if (!parcel) return;
+
+ U32 lists_to_update = 0;
+
+ for (uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); it++)
+ {
+ LLUUID id = *it;
+ if (parcel->addToBanList(id, duration))
{
- U32 lists_to_update = AL_BAN;
+ lists_to_update |= AL_BAN;
// agent was successfully added to ban list
// but we also need to check access list to ensure that agent will not be in two lists simultaneously
if (parcel->removeFromAccessList(id))
{
lists_to_update |= AL_ACCESS;
}
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
- refresh();
}
}
+ if (lists_to_update > 0)
+ {
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
+ refresh();
+ }
}
// static